pub enum PermitGranularity {
Kilobyte,
Megabyte,
}Expand description
Memory permit granularity for different use cases.
Variants§
Kilobyte
1 KB per permit
Use for:
- HTTP/gRPC request limiting (small, high-concurrency operations)
- Small batch operations
- Scenarios requiring fine-grained fairness
Megabyte
1 MB per permit (default)
Use for:
- Query execution memory management
- Compaction memory control
- Large, long-running operations
Implementations§
Source§impl PermitGranularity
impl PermitGranularity
Sourcepub fn bytes_to_permits(self, bytes: u64) -> u32
pub fn bytes_to_permits(self, bytes: u64) -> u32
Converts bytes to permits based on this granularity.
Rounds up to ensure the requested bytes are fully covered. Clamped to Semaphore::MAX_PERMITS.
Sourcepub fn permits_to_bytes(self, permits: u32) -> u64
pub fn permits_to_bytes(self, permits: u32) -> u64
Converts permits to bytes based on this granularity.
Trait Implementations§
Source§impl Clone for PermitGranularity
impl Clone for PermitGranularity
Source§fn clone(&self) -> PermitGranularity
fn clone(&self) -> PermitGranularity
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PermitGranularity
impl Debug for PermitGranularity
Source§impl Default for PermitGranularity
impl Default for PermitGranularity
Source§fn default() -> PermitGranularity
fn default() -> PermitGranularity
Returns the “default value” for a type. Read more
Source§impl Display for PermitGranularity
impl Display for PermitGranularity
Source§impl PartialEq for PermitGranularity
impl PartialEq for PermitGranularity
impl Copy for PermitGranularity
impl Eq for PermitGranularity
impl StructuralPartialEq for PermitGranularity
Auto Trait Implementations§
impl Freeze for PermitGranularity
impl RefUnwindSafe for PermitGranularity
impl Send for PermitGranularity
impl Sync for PermitGranularity
impl Unpin for PermitGranularity
impl UnsafeUnpin for PermitGranularity
impl UnwindSafe for PermitGranularity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].