pub struct EngineHandle { /* private fields */ }Expand description
Shared, hot-swappable reference to the active OxiosEngine.
Wraps RwLock<Arc<OxiosEngine>> so that:
- Writers (
EngineApi) can atomically replace the engine on config change - Readers (
AgentRuntime) always get the current engine at execution time
§Cost
Rebuilding OxiosEngine is cheap: OxiBuilder::new().with_builtins().build()
populates registries from static model_db data (~1μs, no I/O, no network).
§Concurrency
parking_lot::RwLockis not async-aware, but engine swap only occurs on explicit user action (Web UI / CLI config change) — never in a hot path.- Agent execution reads the engine once at the start of
execute()and uses the sameArc<OxiosEngine>for the entire run (consistent within one execution).
Implementations§
Source§impl EngineHandle
impl EngineHandle
Sourcepub fn new(engine: Arc<OxiosEngine>) -> Self
pub fn new(engine: Arc<OxiosEngine>) -> Self
Create a new handle wrapping the given engine.
Sourcepub fn get(&self) -> Arc<OxiosEngine> ⓘ
pub fn get(&self) -> Arc<OxiosEngine> ⓘ
Get a snapshot of the current engine.
The returned Arc is stable — it won’t change even if another thread
calls swap() concurrently.
Sourcepub fn swap(&self, new_engine: OxiosEngine)
pub fn swap(&self, new_engine: OxiosEngine)
Atomically replace the engine with a new one.
Callers should rebuild OxiosEngine with updated credentials/model
before calling this.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EngineHandle
impl !RefUnwindSafe for EngineHandle
impl !UnwindSafe for EngineHandle
impl Send for EngineHandle
impl Sync for EngineHandle
impl Unpin for EngineHandle
impl UnsafeUnpin for EngineHandle
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