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

method to enable/disable downloading #305

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

method to enable/disable downloading #305

sethvincent opened this issue Aug 22, 2022 · 3 comments

Comments

@sethvincent
Copy link

It would be useful to be able to send/receive the updated length/bitfield of a core among peers with the ability to block downloading of data.

Our use cases for this I think are mostly around authorization as well as limiting & being very targeted with bandwidth use.

This might include an option that's passed to the Hypercore constructor and a method to call to enable/disable downloading.

@mafintosh
Copy link
Contributor

Should be

core.setUploading(bool)
core.setDownloading(bool)

and we should "ref" count these per session I guess

@gmaclennan
Copy link
Contributor

gmaclennan commented Jan 16, 2023

Thinking about this more, this might be more useful to set per peer when replicating.

Use case: To save bandwidth only want to upload data to a subset of peers, e.g. a peers on a local network, or a device on a low-bandwidth internet connection might choose to only upload to a single peer.

Not sure about the API for this. It looks like the peer-add and peer-remove events are not documented right now. But if there was an option to set the initial state of a peer to uploading=false then the peer object returned via peer-add could have a setUploading(true) method attached.

@gmaclennan
Copy link
Contributor

This might be tricky because would you not have to queue "wants" from a peer with uploading=false, so that when you call setUploading(true) on the peer, then the data is actually sent? Or is this logic already there?

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