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(allow-block-list): add getters and return results #5572

Merged

Conversation

stormshield-frb
Copy link
Contributor

Description

Small changes to improve usability of the allow-block-list Behaviour. When trying to use it, we found ourselves wanting to known:

  • which were the current allowed or blocked peers: hence the new methods allowed_peers and blocked_peers
  • if the peer was already present in the set when adding or removing it from the set: that is why allow/disallow_peer and block/unblock_peer methods now return a boolean, allowing the end user the know if there was a change or not (in our case, we needed it in order to log something).

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@stormshield-frb stormshield-frb force-pushed the feat/improve-allow-block-list-api branch 2 times, most recently from 23bcdb9 to 84d2fbc Compare August 28, 2024 10:08
@dariusc93
Copy link
Member

Thanks! Can you please update the workspace Cargo.toml to reflect the version change?

@stormshield-frb stormshield-frb force-pushed the feat/improve-allow-block-list-api branch from 84d2fbc to fead401 Compare August 28, 2024 12:10
@stormshield-frb stormshield-frb force-pushed the feat/improve-allow-block-list-api branch from fead401 to aab30dc Compare August 28, 2024 12:36
@mergify mergify bot merged commit e63975d into libp2p:master Aug 28, 2024
72 checks passed
@stormshield-frb stormshield-frb deleted the feat/improve-allow-block-list-api branch August 29, 2024 15:26
TimTinkers pushed a commit to unattended-backpack/rust-libp2p that referenced this pull request Sep 14, 2024
## Description

Small changes to improve usability of the `allow-block-list` Behaviour.
When trying to use it, we found ourselves wanting to known:
- which were the current allowed or blocked peers: hence the new methods
`allowed_peers` and `blocked_peers`
- if the peer was already present in the set when adding or removing it
from the set: that is why `allow/disallow_peer` and `block/unblock_peer`
methods now return a boolean, allowing the end user the know if there
was a change or not (in our case, we needed it in order to log
something).

## Notes & open questions

<!--
Any notes, remarks or open questions you have to make about the PR which
don't need to go into the final commit message.
-->

## Change checklist

<!-- Please add a Changelog entry in the appropriate crates and bump the
crate versions if needed. See
<https://github.com/libp2p/rust-libp2p/blob/master/docs/release.md#development-between-releases>-->

- [x] I have performed a self-review of my own code
- [x] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] A changelog entry has been made in the appropriate crates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants