Skip to main content

Tx

Struct Tx 

Source
pub struct Tx<'a> { /* private fields */ }
Expand description

The transaction of one Session commit callback. Table reads fail with SessionError::ReadAfterWrite after the first table write; document access stays available.

Implementations§

Source§

impl<'a> Tx<'a>

Source

pub fn committed<T>( &mut self, read: impl FnOnce(&dyn Storage) -> Result<T>, ) -> Result<T, SessionError>

A read of committed Storage that ignores the read-after-write rule: the conversation runtime and the task scheduler (crates/harness) read inside their own commit callbacks, as upstream’s read Storage directly.

Source

pub fn staged_tasks(&self) -> Vec<TaskRecord>

Latest candidate of every task this transaction created or replaced, in first-write order.

Source

pub fn staged_conversations(&self) -> Vec<ConversationRecord>

Every conversation this transaction created or forked, in order.

Source

pub fn create_root_conversation( &mut self, ) -> Result<ConversationRecord, SessionError>

Create the ownerless root conversation at its reserved ID.

Source

pub fn conversation( &mut self, id: ConversationId, ) -> Result<Option<ConversationRecord>, SessionError>

Source

pub fn entry( &mut self, id: EntryId, ) -> Result<Option<EntryRecord>, SessionError>

Source

pub fn entry_of( &mut self, kind: &str, id: EntryId, ) -> Result<Option<EntryRecord>, SessionError>

None when the entry is absent or has another kind.

Source

pub fn task(&mut self, id: TaskId) -> Result<Option<TaskRecord>, SessionError>

Source

pub fn scan_conversations( &mut self, query: &ConversationQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<ConversationRecord>, SessionError>

Source

pub fn scan_entries( &mut self, query: &EntryQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<EntryRecord>, SessionError>

Source

pub fn latest_head_marker( &mut self, conversation_id: ConversationId, ) -> Result<Option<EntryRecord>, SessionError>

Newest visible entry of the conversation that carries a head.

Source

pub fn scan_tasks( &mut self, query: &TaskQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<TaskRecord>, SessionError>

Source

pub fn submission( &mut self, id: SubmissionId, ) -> Result<Option<SubmissionRecord>, SessionError>

Source

pub fn submission_by_request( &mut self, conversation_id: ConversationId, request_id: &str, ) -> Result<Option<SubmissionRecord>, SessionError>

Committed submission with a conversation-scoped request ID, for host deduplication.

Source

pub fn create_conversation( &mut self, ownership: ConversationOwnership, ) -> Result<ConversationRecord, SessionError>

Source

pub fn fork_conversation( &mut self, parent: ConversationId, at: EntryId, ownership: ConversationOwnership, ) -> Result<ConversationRecord, SessionError>

Fork history at one visible entry; conversation documents are copied by their fork policy.

Source

pub fn append_entry( &mut self, conversation_id: ConversationId, draft: EntryDraft, ) -> Result<EntryRecord, SessionError>

Append an entry; head: SelfId starts the active context at the new entry.

Source

pub fn create_task( &mut self, task: &TaskDefinition, input: Value, options: TaskOptions, ) -> Result<TaskId, SessionError>

Source

pub fn create_submission( &mut self, create: SubmissionCreate, ) -> Result<SubmissionRecord, SessionError>

Create a raw submission record with a fresh ID. No admission rules apply.

Source

pub fn settle_submission( &mut self, id: SubmissionId, settlement: SubmissionSettlement, )

Settle a queued or placed submission; resolved during assembly against this transaction’s latest record.

Source

pub fn place_submission(&mut self, id: SubmissionId, entry: EntryId)

Place a queued submission at entry: an input becomes placed, a write done.

Source

pub fn set_task(&mut self, value: TaskRecord) -> Result<(), SessionError>

Replace one task record completely, stamping startedAt on its first change to running and endedAt on the change to terminal.

Source

pub fn doc(&mut self, doc: &Doc, owner: Owner) -> Result<Draft, SessionError>

Acquire a draft of a singleton document, creating it from initial when absent.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Tx<'a>

§

impl<'a> !Send for Tx<'a>

§

impl<'a> !Sync for Tx<'a>

§

impl<'a> !UnwindSafe for Tx<'a>

§

impl<'a> Forget for Tx<'a>

§

impl<'a> Freeze for Tx<'a>

§

impl<'a> Move for Tx<'a>

§

impl<'a> Unpin for Tx<'a>

§

impl<'a> UnsafeUnpin for Tx<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.