Skip to main content

RunStore

Struct RunStore 

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

A connection to one run store file.

Implementations§

Source§

impl RunStore

Source

pub fn heads_blocking(&self) -> Result<RunFeedHeads, RunStoreError>

Where the feeds and the link count stand and the epoch they belong to, in one read transaction.

Source

pub fn snapshot_blocking( &self, id: RunId, ) -> Result<Option<RunSnapshot>, RunStoreError>

Everything recorded about one run, or None for an unknown identity.

Source

pub fn snapshots_blocking( &self, work: Option<WorkItemId>, limit: u16, ) -> Result<Vec<RunSnapshot>, RunStoreError>

Runs, newest first, optionally only those executing one task; at most 1000.

Source

pub fn lifecycle_page_blocking( &self, after_sequence: u64, limit: u16, run: Option<RunId>, ) -> Result<LifecyclePage, RunStoreError>

Lifecycle facts after a feed cursor, optionally only one run’s; at most 1000. Lifecycle is never pruned, so a cursor is always continuous.

Source

pub fn activity_page_blocking( &self, after_sequence: u64, limit: u16, run: Option<RunId>, ) -> Result<ActivityPage, RunStoreError>

Activity after a feed cursor, optionally only one run’s; at most 1000.

A cursor older than what retention kept returns a ActivityGap and resumes from the oldest record still held, so a client is told the feed is discontinuous rather than served a silent hole.

Source§

impl RunStore

Source

pub fn start_blocking( &mut self, record: &RunRecord, expected: LineageId, ) -> Result<Written<LifecycleEntry>, RunStoreError>

Record a run’s start as its first lifecycle fact, in the history expected.

The run identity is the idempotency key: a resent start that matches the recorded one returns it unchanged, and any other content under that identity is refused.

Source

pub fn transition_blocking( &mut self, transition: &RunTransition, writer: &ActorId, now: DateTime<Utc>, expected: LineageId, ) -> Result<Written<LifecycleEntry>, RunStoreError>

Record a lifecycle transition as writer, at DPM’s own time now.

The transition identity is the idempotency key. The state machine is checked inside the write transaction against the run’s latest recorded state, so two racing reporters cannot both end a run.

Source

pub fn append_activity_blocking( &mut self, inputs: &[ActivityInput], writer: &ActorId, now: DateTime<Utc>, expected: LineageId, ) -> Result<Vec<Written<ActivityEntry>>, RunStoreError>

Record a batch of activity as writer, at DPM’s own time now, and apply retention.

All of the batch is recorded or none of it. A record is identified by its run and source_sequence. One still held with the same content, including the whole of its text, is a duplicate delivery and is answered with the recorded record; with other content it is refused. A sequence at or below the run’s high-water mark that is no longer held is refused as expired, so a retry that outlived retention can never become a new receipt. Activity changes no lifecycle state, whatever it reports.

Record that a committed project operation was performed by a run, as writer.

operation carries what the project store recorded about the operation; the engine checks it inside the write transaction against the run, so a link can never attribute someone else’s operation, another task’s, or one outside the run’s lifetime. An operation links to at most one run; repeating the same link answers with the recorded one.

Source§

impl RunStore

Source

pub fn sidecar_path(project: &Path) -> PathBuf

The run store that belongs beside the project store at project.

Source

pub fn open_existing_blocking( path: &Path, workspace: WorkspaceId, ) -> Result<Option<Self>, RunStoreError>

Open an existing run store for the project store of workspace, or None when none was ever created. Nothing is created or written; a store that is corrupt, of another version or bound to another workspace is refused before it is opened for writing.

Source

pub fn open_or_create_blocking( path: &Path, workspace: WorkspaceId, lineage: LineageId, ) -> Result<Self, RunStoreError>

Open the run store beside a project store, creating it bound to workspace and lineage when it does not exist yet.

Source

pub fn in_memory_blocking( workspace: WorkspaceId, lineage: LineageId, ) -> Result<Self, RunStoreError>

A disposable run store for an in-memory project store.

Source

pub fn set_activity_limit(&mut self, limit: u64)

Keep at most limit activity records from now on; older ones are pruned by the next write.

Source

pub fn path(&self) -> &Path

Location of the run store, or the in-memory label.

Source

pub fn binding_blocking(&self) -> Result<RunBinding, RunStoreError>

The workspace and history this run store is bound to.

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> 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.
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