Struct discv5::socket::RateLimiterBuilder
source · pub struct RateLimiterBuilder { /* private fields */ }
Expand description
User-friendly builder of a RateLimiter
. The user can specify three kinds of rate limits but
must at least set the total quota. The three types are:
- Total Quota - Specifies the total number of inbound requests. This must be set.
- Node Quota - Specifies the number of requests per node id.
- IP Quota - Specifies the number of requests per IP.
Quotas can be set via the X_one_every() functions to set hard limits as described above. Using
the X_n_every()
functions allow for bursts.
Implementations§
source§impl RateLimiterBuilder
impl RateLimiterBuilder
sourcepub fn total_one_every(self, time_period: Duration) -> Self
pub fn total_one_every(self, time_period: Duration) -> Self
Allow one token every time_period
to be used for the total RPC limit.
This produces a hard limit.
sourcepub fn node_one_every(self, time_period: Duration) -> Self
pub fn node_one_every(self, time_period: Duration) -> Self
Allow one token every time_period
to be used for the node RPC limit.
This produces a hard limit.
sourcepub fn ip_one_every(self, time_period: Duration) -> Self
pub fn ip_one_every(self, time_period: Duration) -> Self
Allow one token every time_period
to be used for the total RPC limit per IP.
This produces a hard limit.
sourcepub fn total_n_every(self, n: u64, time_period: Duration) -> Self
pub fn total_n_every(self, n: u64, time_period: Duration) -> Self
Allow n
tokens to be use used every time_period
for the total.
sourcepub fn node_n_every(self, n: u64, time_period: Duration) -> Self
pub fn node_n_every(self, n: u64, time_period: Duration) -> Self
Allow n
tokens to be use used every time_period
for the total.
sourcepub fn ip_n_every(self, n: u64, time_period: Duration) -> Self
pub fn ip_n_every(self, n: u64, time_period: Duration) -> Self
Allow n
tokens to be use used every time_period
for the total.