pub struct Envelope { /* private fields */ }Expand description
The process-wide envelope state: the global query semaphore and one index-operation semaphore per key.
The per-key semaphores are created on first use with the key’s plan cap and kept for the process lifetime. The map grows by one entry per key that ever indexes — bounded by the number of keys the operator has issued, which is the same order as the key store itself.
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn with_query_permits(permits: usize) -> Self
pub fn with_query_permits(permits: usize) -> Self
An envelope with a chosen global query cap — the seam tests use to exercise exhaustion without four real graph loads.
Sourcepub async fn acquire_query(&self) -> OwnedSemaphorePermit
pub async fn acquire_query(&self) -> OwnedSemaphorePermit
Waits for a global query slot. The semaphore is never closed, so acquisition cannot fail.
Sourcepub fn try_acquire_query(&self) -> Option<OwnedSemaphorePermit>
pub fn try_acquire_query(&self) -> Option<OwnedSemaphorePermit>
Takes a global query slot without waiting, if one is free.
Sourcepub fn try_acquire_index_op(
&self,
key_id: &str,
max_concurrent: usize,
) -> Option<OwnedSemaphorePermit>
pub fn try_acquire_index_op( &self, key_id: &str, max_concurrent: usize, ) -> Option<OwnedSemaphorePermit>
Takes this key’s index-operation slot without waiting.
None means the key already runs max_concurrent index
operations (or the permit map’s lock was poisoned, in which
case refusing is again the safe direction). Index operations
refuse rather than queue: a queued creation would hold a
connection open for the length of someone else’s clone, and a
client can retry a 429 the moment its own first build ends.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnsafeUnpin for Envelope
impl UnwindSafe for Envelope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more