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

Add a contains_key method #172

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add a contains_key method #172

wants to merge 3 commits into from

Conversation

antifuchs
Copy link
Collaborator

This should fix #171 - currently, we have no good way of letting people control the memory usage of keyed rate limiter states. This at least allows them to tell whether a test would add a new key (consuming memory) - and then rate-limit that.

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (8577d05) 97.52% compared to head (dbfb73a) 97.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #172      +/-   ##
==========================================
+ Coverage   97.52%   97.55%   +0.02%     
==========================================
  Files          31       31              
  Lines        2220     2247      +27     
==========================================
+ Hits         2165     2192      +27     
  Misses         55       55              
Impacted Files Coverage Δ
governor/src/state.rs 100.00% <ø> (ø)
governor/src/state/direct.rs 100.00% <100.00%> (ø)
governor/src/state/in_memory.rs 100.00% <100.00%> (ø)
governor/src/state/keyed.rs 100.00% <100.00%> (ø)
governor/src/state/keyed/dashmap.rs 100.00% <100.00%> (ø)
governor/src/state/keyed/hashmap.rs 100.00% <100.00%> (ø)
governor/tests/keyed_dashmap.rs 100.00% <100.00%> (ø)
governor/tests/keyed_hashmap.rs 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

This allows systems to check whether they have already added a given
key to a state store, which might help fight off DDoS attacks that
vary the key (e.g. the origin IP address).
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

Successfully merging this pull request may close these issues.

Characterize Memory Usage for Keyed Variants
1 participant