pub struct AppState { /* private fields */ }Expand description
Server state.
Holds a pool of inference-engine replicas behind a semaphore rather than a
single mutex, so up to pool.size() requests can generate concurrently. The
default path (a 1-element pool) is byte-identical to the previous
single-mutex design.
Implementations§
Source§impl AppState
impl AppState
Sourcepub async fn acquire_engine(&self) -> Result<EngineLease, PoolError>
pub async fn acquire_engine(&self) -> Result<EngineLease, PoolError>
Acquire an exclusive lease on one engine replica from the pool, waiting asynchronously if every replica is currently busy.
The returned EngineLease derefs to the engine (so callers invoke the
usual generate* methods) and returns it to the pool on drop.
Sourcepub fn engines(&self) -> &Arc<EnginePool>
pub fn engines(&self) -> &Arc<EnginePool>
Access the underlying engine pool.
Sourcepub fn tokenizer(&self) -> Option<&TokenizerBridge>
pub fn tokenizer(&self) -> Option<&TokenizerBridge>
Access the optional tokenizer.
Sourcepub fn metrics(&self) -> &Arc<InferenceMetrics>
pub fn metrics(&self) -> &Arc<InferenceMetrics>
Access the shared metrics instance.
Auto Trait Implementations§
impl !Freeze for AppState
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
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
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>
Converts
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>
Converts
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