Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

extend peer.Set with the Remove method #260

Closed
vgonkivs opened this issue Jun 20, 2022 · 4 comments · Fixed by #261
Closed

extend peer.Set with the Remove method #260

vgonkivs opened this issue Jun 20, 2022 · 4 comments · Fixed by #261

Comments

@vgonkivs
Copy link

Currently peer.Set allows only to add peers but it would be nice to have a remove functionality.

@marten-seemann
Copy link
Contributor

Actually, I'd be in favor of removing the peer.Set altogether. The only consumer I can find is kad-dht (here and here) and the peerstore, where the peerstore isn't even using it in an efficient way.

Therefore, this code should probably live (unexported) inside kad.

@vgonkivs
Copy link
Author

Hi @marten-seemann. Thanks for the explanation. Is it possible to temporary add this functionality(I can open a PR) as it's pretty logic that if there is a possibility to add a peer, then it might have possibility to delete a peer or could suggest what can I use instead of peer.Set(with add/remove peer functionality) if it will be deleted at all? I want to avoid copy pasting in my code

@marten-seemann
Copy link
Contributor

This seems to be a trivial piece of code, so I'd argue that copy-pasting the parts that you need would actually be the right thing to do.

Also note that the API here is kind of confusing: You can set a size, but that size is not enforced by Add (only by TryAdd).

@vgonkivs
Copy link
Author

ok, thank you.

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

Successfully merging a pull request may close this issue.

2 participants