Skip to main content

LocalDurableContext

Struct LocalDurableContext 

Source
pub struct LocalDurableContext<P: Provider> { /* private fields */ }
Expand description

A passthrough durable context for local development and testing.

Executes LLM calls and tool calls directly without journaling. No crash recovery, no replay — just direct passthrough.

This is the default when you do not need durable execution but want a concrete DurableContext implementation.

Implementations§

Source§

impl<P: Provider> LocalDurableContext<P>

Source

pub fn new(provider: Arc<P>, tools: Arc<ToolRegistry>) -> Self

Create a new local durable context.

Trait Implementations§

Source§

impl<P: Provider> DurableContext for LocalDurableContext<P>

Source§

async fn execute_llm_call( &self, request: CompletionRequest, _options: ActivityOptions, ) -> Result<CompletionResponse, DurableError>

Execute an LLM call as a durable activity.
Source§

async fn execute_tool( &self, tool_name: &str, input: Value, ctx: &ToolContext, _options: ActivityOptions, ) -> Result<ToolOutput, DurableError>

Execute a tool call as a durable activity.
Source§

async fn wait_for_signal<T: DeserializeOwned + WasmCompatSend>( &self, _signal_name: &str, timeout: Duration, ) -> Result<Option<T>, DurableError>

Wait for an external signal with a timeout.
Source§

fn should_continue_as_new(&self) -> bool

Whether the workflow should continue-as-new to avoid history bloat.
Source§

async fn continue_as_new(&self, _state: Value) -> Result<(), DurableError>

Continue the workflow as a new execution with the given state.
Source§

async fn sleep(&self, duration: Duration)

Sleep for a duration (durable — survives replay).
Source§

fn now(&self) -> DateTime<Utc>

Current time (deterministic during replay).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,