pub struct GatewayRouteState { /* private fields */ }Expand description
Shared, cloneable state threaded into every route handler.
Bundles the run store, plan cache, model runner registry, federation registry, and API key table; clones share the same underlying store and cache through interior mutability.
Implementations§
Source§impl GatewayRouteState
impl GatewayRouteState
Sourcepub fn new(store: MemoryGatewayStore) -> Self
pub fn new(store: MemoryGatewayStore) -> Self
Returns route state wrapping store with a fresh cache, runners, and federation.
Sourcepub fn with_cache(store: MemoryGatewayStore, cache: OpenAiPlanCache) -> Self
pub fn with_cache(store: MemoryGatewayStore, cache: OpenAiPlanCache) -> Self
Returns route state wrapping store and a preseeded plan cache.
Sourcepub fn with_runners(self, runners: OpenAiRunnerRegistry) -> Self
pub fn with_runners(self, runners: OpenAiRunnerRegistry) -> Self
Returns the state with its model runner registry replaced by runners.
Sourcepub fn with_federation(self, federation: OpenAiFederation) -> Self
pub fn with_federation(self, federation: OpenAiFederation) -> Self
Returns the state with its federation registry replaced by federation.
Sourcepub fn with_keys(self, keys: OpenAiKeyTable) -> Self
pub fn with_keys(self, keys: OpenAiKeyTable) -> Self
Returns the state with its API key table replaced by keys.
Sourcepub fn store(&self) -> &Arc<Mutex<MemoryGatewayStore>>
pub fn store(&self) -> &Arc<Mutex<MemoryGatewayStore>>
Returns the shared run store.
Sourcepub fn cache(&self) -> &Arc<Mutex<OpenAiPlanCache>>
pub fn cache(&self) -> &Arc<Mutex<OpenAiPlanCache>>
Returns the shared plan cache.
Sourcepub fn runners(&self) -> &OpenAiRunnerRegistry
pub fn runners(&self) -> &OpenAiRunnerRegistry
Returns the model runner registry.
Sourcepub fn federation(&self) -> &OpenAiFederation
pub fn federation(&self) -> &OpenAiFederation
Returns the federation registry.
Sourcepub fn keys(&self) -> &OpenAiKeyTable
pub fn keys(&self) -> &OpenAiKeyTable
Returns the API key table.
Trait Implementations§
Source§impl Clone for GatewayRouteState
impl Clone for GatewayRouteState
Source§fn clone(&self) -> GatewayRouteState
fn clone(&self) -> GatewayRouteState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GatewayRouteState
impl !UnwindSafe for GatewayRouteState
impl Freeze for GatewayRouteState
impl Send for GatewayRouteState
impl Sync for GatewayRouteState
impl Unpin for GatewayRouteState
impl UnsafeUnpin for GatewayRouteState
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