pub struct VifuRuntime { /* private fields */ }Expand description
A self-contained runtime for one application or project.
One runtime may register multiple providers, agents, and stable named endpoints. It can run directly inside a Rust host; Vifu Server and Agent Gateway are optional deployment components.
Implementations§
Source§impl VifuRuntime
impl VifuRuntime
pub fn new(project_id: impl Into<String>) -> Result<Self, RuntimeError>
pub fn with_store( project_id: impl Into<String>, store: Arc<dyn RuntimeStore>, ) -> Result<Self, RuntimeError>
pub fn project_id(&self) -> &str
pub fn register_provider( &self, name: impl Into<String>, provider: Arc<dyn AgentProvider>, ) -> Result<(), RuntimeError>
pub fn register_agent(&self, agent: AgentDefinition) -> Result<(), RuntimeError>
pub fn register_endpoint( &self, endpoint: EndpointDefinition, ) -> Result<(), RuntimeError>
pub fn session( &self, session_id: impl Into<String>, ) -> Result<RuntimeSession, RuntimeError>
pub async fn invoke( &self, input: InvocationInput, ) -> Result<InvocationOutput, RuntimeError>
pub fn start_invoke( &self, input: InvocationInput, ) -> Result<InvocationHandle, RuntimeError>
pub fn poll_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>
Sourcepub fn take_invocation(
&self,
handle: &InvocationHandle,
) -> Result<InvocationPoll, RuntimeError>
pub fn take_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>
Returns the current poll state and removes it once it is terminal.
Pending and running invocations remain registered so callers can keep polling the same handle.
pub fn cancel_invocation( &self, handle: &InvocationHandle, ) -> Result<(), RuntimeError>
pub async fn execute_effects( &self, effects: Vec<EffectRequest>, ) -> Result<EffectExecution, RuntimeError>
pub async fn execute_effects_with_limit( &self, effects: Vec<EffectRequest>, limit: usize, ) -> Result<EffectExecution, RuntimeError>
pub fn export_snapshot(&self) -> Result<Vec<u8>, RuntimeError>
pub fn restore_snapshot(&self, bytes: &[u8]) -> Result<(), RuntimeError>
Trait Implementations§
Source§impl Clone for VifuRuntime
impl Clone for VifuRuntime
Source§fn clone(&self) -> VifuRuntime
fn clone(&self) -> VifuRuntime
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 VifuRuntime
impl !UnwindSafe for VifuRuntime
impl Freeze for VifuRuntime
impl Send for VifuRuntime
impl Sync for VifuRuntime
impl Unpin for VifuRuntime
impl UnsafeUnpin for VifuRuntime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.