pub trait HiveTokenSource: Send + Sync {
// Required methods
fn admit_route(
&self,
fresh_token: bool,
) -> Result<ModelsAdmission, ModelsRefusal>;
fn note_answer(&self, status: u16, retry_after: Option<&str>, body: &[u8]);
fn note_passed(&self);
}Expand description
Where the subscription-model access comes from (the Hive connector). Every method may block (file reads, a token mint); the proxy calls them off the async runtime and bounds the wait.
Required Methods§
Sourcefn admit_route(
&self,
fresh_token: bool,
) -> Result<ModelsAdmission, ModelsRefusal>
fn admit_route( &self, fresh_token: bool, ) -> Result<ModelsAdmission, ModelsRefusal>
Lease right, origin pin, holds, then the token; fresh_token mints
a new one (the gateway answered 401 to the cached one).
Sourcefn note_answer(&self, status: u16, retry_after: Option<&str>, body: &[u8])
fn note_answer(&self, status: u16, retry_after: Option<&str>, body: &[u8])
The gateway answered status (non-2xx) with body: record the hold
it sets, if any.
Sourcefn note_passed(&self)
fn note_passed(&self)
A probe passed: the holds of the leanctx routes end.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".