Trait rama::layer::limit::policy::ConcurrentTracker
pub trait ConcurrentTracker:
Send
+ Sync
+ 'static {
type Guard: Send + 'static;
type Error: Send + Sync + 'static;
// Required method
fn try_access(&self) -> Result<Self::Guard, Self::Error>;
}
Expand description
The tracker trait that can be implemented to provide custom concurrent request tracking.
By default ConcurrentCounter
is provided, but in case you need multi-instance tracking,
you can support that by implementing the ConcurrentTracker
trait.
Required Associated Types§
Required Methods§
fn try_access(&self) -> Result<Self::Guard, Self::Error>
fn try_access(&self) -> Result<Self::Guard, Self::Error>
Try to access the resource, returning a guard if successful, or an error if the limit is reached.
When the limit is reached and a backoff is used in the parent structure, the backoff should tried to be used before returning the error.