pub struct RunStore { /* private fields */ }Expand description
A connection to one run store file.
Implementations§
Source§impl RunStore
impl RunStore
Sourcepub fn heads_blocking(&self) -> Result<RunFeedHeads, RunStoreError>
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.
Sourcepub fn snapshot_blocking(
&self,
id: RunId,
) -> Result<Option<RunSnapshot>, RunStoreError>
pub fn snapshot_blocking( &self, id: RunId, ) -> Result<Option<RunSnapshot>, RunStoreError>
Everything recorded about one run, or None for an unknown identity.
Sourcepub fn snapshots_blocking(
&self,
work: Option<WorkItemId>,
limit: u16,
) -> Result<Vec<RunSnapshot>, RunStoreError>
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.
Sourcepub fn lifecycle_page_blocking(
&self,
after_sequence: u64,
limit: u16,
run: Option<RunId>,
) -> Result<LifecyclePage, RunStoreError>
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.
Sourcepub fn activity_page_blocking(
&self,
after_sequence: u64,
limit: u16,
run: Option<RunId>,
) -> Result<ActivityPage, RunStoreError>
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
impl RunStore
Sourcepub fn start_blocking(
&mut self,
record: &RunRecord,
expected: LineageId,
) -> Result<Written<LifecycleEntry>, RunStoreError>
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.
Sourcepub fn transition_blocking(
&mut self,
transition: &RunTransition,
writer: &ActorId,
now: DateTime<Utc>,
expected: LineageId,
) -> Result<Written<LifecycleEntry>, RunStoreError>
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.
Sourcepub fn append_activity_blocking(
&mut self,
inputs: &[ActivityInput],
writer: &ActorId,
now: DateTime<Utc>,
expected: LineageId,
) -> Result<Vec<Written<ActivityEntry>>, RunStoreError>
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.
Sourcepub fn link_blocking(
&mut self,
run: RunId,
operation: &OperationFacts,
writer: &ActorId,
now: DateTime<Utc>,
expected: LineageId,
) -> Result<Written<RunLink>, RunStoreError>
pub fn link_blocking( &mut self, run: RunId, operation: &OperationFacts, writer: &ActorId, now: DateTime<Utc>, expected: LineageId, ) -> Result<Written<RunLink>, RunStoreError>
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
impl RunStore
Sourcepub fn sidecar_path(project: &Path) -> PathBuf
pub fn sidecar_path(project: &Path) -> PathBuf
The run store that belongs beside the project store at project.
Sourcepub fn open_existing_blocking(
path: &Path,
workspace: WorkspaceId,
) -> Result<Option<Self>, RunStoreError>
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.
Sourcepub fn open_or_create_blocking(
path: &Path,
workspace: WorkspaceId,
lineage: LineageId,
) -> Result<Self, RunStoreError>
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.
Sourcepub fn in_memory_blocking(
workspace: WorkspaceId,
lineage: LineageId,
) -> Result<Self, RunStoreError>
pub fn in_memory_blocking( workspace: WorkspaceId, lineage: LineageId, ) -> Result<Self, RunStoreError>
A disposable run store for an in-memory project store.
Sourcepub fn set_activity_limit(&mut self, limit: u64)
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.
Sourcepub fn binding_blocking(&self) -> Result<RunBinding, RunStoreError>
pub fn binding_blocking(&self) -> Result<RunBinding, RunStoreError>
The workspace and history this run store is bound to.