Skip to main content

MemoryExecutionJournal

Struct MemoryExecutionJournal 

Source
pub struct MemoryExecutionJournal { /* private fields */ }
Expand description

Deterministic bounded journal for local development and contract tests.

Implementations§

Source§

impl MemoryExecutionJournal

Source

pub fn new(max_events_per_execution: usize) -> Self

Trait Implementations§

Source§

impl ExecutionJournal for MemoryExecutionJournal

Source§

fn reserve<'life0, 'async_trait>( &'life0 self, execution: NewJournalExecution, ) -> Pin<Box<dyn Future<Output = Result<JournalReservation, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn claim<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, worker_id: &'life2 str, now_ms: i64, expires_at_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn recoverable<'life0, 'async_trait>( &'life0 self, now_ms: i64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<JournalExecution>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn transition<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, expected: &'life2 [ExecutionState], next: ExecutionState, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn attach_delegation<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, delegation: JournalDelegation, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist the opaque delegation reference before any Infra-backed Kernel operation. Replays with the same lease are idempotent.
Source§

fn complete_delegation_cleanup<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, lease_ref: &'life2 DelegationLeaseRef, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark terminal delegation cleanup after broker revoke succeeds.
Source§

fn finish<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, expected: &'life2 [ExecutionState], next: ExecutionState, outcome: Option<ExecutionOutcome>, failure: Option<ExecutionFailure>, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn transition_with_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, expected: &'life2 [ExecutionState], next: ExecutionState, outcome: Option<ExecutionOutcome>, failure: Option<ExecutionFailure>, payload: EventPayload, ) -> Pin<Box<dyn Future<Output = Result<JournalMutation, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically commit a state transition and its corresponding event so replay and SSE cannot observe one without the other. Terminal outcome and failure payloads are supplied only for terminal transitions.
Source§

fn append_event<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, payload: EventPayload, ) -> Pin<Box<dyn Future<Output = Result<ExecutionEvent, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn begin_interaction<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, request_id: &'life2 str, prompt: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<JournalMutation, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Atomically publish a pending interaction and its committed event.
Source§

fn commit_interaction_input<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, operation_id: &'life2 OperationId, request_id: &'life3 str, response_text: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<JournalMutation, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Atomically deduplicate input, transition back to running, and commit the interaction-received event before any in-process waiter is woken.
Source§

fn complete_interaction<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, request_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<JournalExecution, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark a journal-committed response as consumed by the running tool.
Source§

fn events<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExecutionId, after: Option<u64>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionEvent>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.