#[non_exhaustive]pub struct RequestPools { /* private fields */ }Expand description
How a module’s data requests share handler slots, returned from
ModuleHandler::request_pools.
RequestPools::new is the behaviour a module gets when it declares
nothing: one pool of 64 slots for every data request.
RequestPools::with_long_held adds a second pool and the classifier
that decides which requests use it.
Implementations§
Source§impl RequestPools
impl RequestPools
Sourcepub fn with_long_held<F>(self, limit: usize, classifier: F) -> Self
pub fn with_long_held<F>(self, limit: usize, classifier: F) -> Self
Add a long-held pool of limit slots, and the classifier that puts
each data request in a pool.
The SDK calls classifier with the request’s raw body, before the
request takes a slot; the SDK itself never interprets a body. A
request the classifier puts in RequestPool::LongHeld waits only
for a long-held slot, and every other request waits only for a
default slot, so a full pool never delays requests of the other one.
The classifier runs on the task that reads the connection’s frames,
so it must be cheap and must not block: peek at the operation name,
do not decode the whole body. If it panics, the request uses the
default pool. A limit of 0 is raised to 1, so long-held requests
are delayed, never stranded.
Sourcepub fn long_held_limit(&self) -> Option<usize>
pub fn long_held_limit(&self) -> Option<usize>
The long-held pool’s slot limit, or None when there is no long-held
pool.