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

event for listening to bitfield updates #310

Open
sethvincent opened this issue Aug 25, 2022 · 3 comments
Open

event for listening to bitfield updates #310

sethvincent opened this issue Aug 25, 2022 · 3 comments

Comments

@sethvincent
Copy link

It would be useful to be able to listen to an event on the core and for each peer in core.peers to find out when a bitfield is updated. The end goal for this would be to create diffs of the bitfield changes. For example, this event might provide something like the values used in Peer.onbitfield & Peer.onrange.

@mafintosh
Copy link
Contributor

Maybe something like:

core.on('peer-update', function (peer) {
  ...
})

@mafintosh
Copy link
Contributor

Obvs that requires queries on the remoteBitfield to be practical (ie, fast has(start, end))

@gmaclennan
Copy link
Contributor

@mafintosh any further thoughts on whether this is possible / practical?

Use case: know what data / size of data that needs to be uploaded to / downloaded from a particular peer, ultimately to know whether replication has "finished" e.g. all data that can be sent has been sent, and all data that can be received can be received. But also to provide a user feedback on progress of replication and an estimation of time to completion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants