Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: emit PendingContentReady event #2302

Merged
merged 9 commits into from
May 17, 2024

Conversation

Frando
Copy link
Member

@Frando Frando commented May 16, 2024

Description

This adds a new LiveEvent variant: PendingContentReady.

It is emitted once, after sync was started, the list of pending content blobs becomes empty. This is the case if either all blobs from this sesion have been downloaded, or failed.

I think this could help with simple examples like https://gist.github.com/dignifiedquire/efbd1a7a1da729494adb088d72f1ceaa#file-main-sync-rs-L84

It should not be used as a guarantee that all content is now available locally, and it should be used with a timeout usually, because it may very legally never be emitted (e.g. if the remote does not have all blobs themselves, or closes the connections, etc).

Breaking Changes

  • LiveEvent now has a new variant PendingContentReady. This event is emitted after a sync completed and Self::SyncFinished was emitted. It signals that all currently pending downloads have been completed. Receiving this event does not guarantee that all content in the document is available. If blobs failed to download, this event will still be emitted after all operations completed.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.
  • All breaking changes documented.

@Frando Frando marked this pull request as draft May 16, 2024 14:40
@Frando Frando marked this pull request as ready for review May 17, 2024 12:35
@Frando Frando enabled auto-merge May 17, 2024 12:35
@dignifiedquire
Copy link
Contributor

2024-05-17T10:38:10.257646Z DEBUG gossip{me=icdmm64o2lmqfyxw}: iroh_gossip::net: handle out_event SendMessage(PublicKey(4dxirwpnfj5gb3av), Message { topic: TopicId(lofyckr47fnbhjaq), message: Gossip(Gossip(Gossip { id: MessageId(nazywnpxm4nuce77), content: <239b>, scope: Swarm(Round(0)) })) })
thread 'sync_restart_node' panicked at iroh\tests\sync.rs:1316:9:
Failed to receive or match all events: Event didn't match any matcher: PendingContentReady

this looks like a real failure?

@Frando Frando added this pull request to the merge queue May 17, 2024
Merged via the queue into main with commit fc73502 May 17, 2024
21 of 22 checks passed
@dignifiedquire dignifiedquire deleted the feat/docs-pending-content-ready-event branch May 24, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants