pub enum Store {
Sqlite(SqliteStore),
Postgres(PgStore),
}Expand description
The storage backend used by the engine.
Variants§
Sqlite(SqliteStore)
Postgres(PgStore)
Implementations§
Source§impl Store
impl Store
Sourcepub fn connect(location: &str) -> Result<Store>
pub fn connect(location: &str) -> Result<Store>
Open a backend from a location: a postgres:// / postgresql:// URL,
or a SQLite file path.
pub fn in_memory() -> Result<Store>
pub fn backend(&self) -> &'static str
pub fn put_definition(&self, ir: &WorkflowIr, now: u64) -> Result<PutDefinition>
pub fn definitions(&self) -> Result<Vec<WorkflowIr>>
pub fn execution_exists(&self, id: &str) -> Result<bool>
Sourcepub fn append(
&mut self,
state: &ExecutionState,
events: &[HistoryEvent],
) -> Result<()>
pub fn append( &mut self, state: &ExecutionState, events: &[HistoryEvent], ) -> Result<()>
Atomically append events and update the execution projection.
pub fn history(&self, id: &str) -> Result<Vec<HistoryEvent>>
Sourcepub fn append_rollover(
&mut self,
state: &ExecutionState,
events: &[HistoryEvent],
rollover: Rollover<'_>,
) -> Result<()>
pub fn append_rollover( &mut self, state: &ExecutionState, events: &[HistoryEvent], rollover: Rollover<'_>, ) -> Result<()>
Continue-as-new in one transaction: archive the finished run (its
stored history plus rollover.events) under its run number, then
write the next run’s first events and point the projection at it.
Sourcepub fn run_history(&self, id: &str, run: u32) -> Result<Vec<HistoryEvent>>
pub fn run_history(&self, id: &str, run: u32) -> Result<Vec<HistoryEvent>>
The history of an earlier (archived) run; empty if there is none.
Sourcepub fn execution_status(&self, id: &str) -> Result<Option<String>>
pub fn execution_status(&self, id: &str) -> Result<Option<String>>
The projected status of an execution (its latest run), if it exists.
True for a shared-mode store (several servers write).
Sourcepub fn release_schedule_claims(&self) -> Result<u64>
pub fn release_schedule_claims(&self) -> Result<u64>
Drop every claim on a schedule occurrence. Only for a server that is the only writer (single server, cluster leader): claims left behind are from a process that is gone.
Sourcepub fn insert_schedule(&self, row: &ScheduleRow) -> Result<bool>
pub fn insert_schedule(&self, row: &ScheduleRow) -> Result<bool>
Insert a new schedule; false if the id is taken.
Sourcepub fn update_schedule(&self, row: &ScheduleRow) -> Result<bool>
pub fn update_schedule(&self, row: &ScheduleRow) -> Result<bool>
Overwrite a schedule’s spec, paused flag and next occurrence, and drop any claim on it; false if it does not exist.
pub fn schedule(&self, id: &str) -> Result<Option<ScheduleRow>>
pub fn schedules(&self) -> Result<Vec<ScheduleRow>>
pub fn delete_schedule(&self, id: &str) -> Result<bool>
Sourcepub fn due_schedules(&self, now: u64) -> Result<Vec<ScheduleRow>>
pub fn due_schedules(&self, now: u64) -> Result<Vec<ScheduleRow>>
Unpaused schedules whose next occurrence is due at now and that no
server holds a live claim on.
Sourcepub fn claim_schedule(
&self,
id: &str,
next_fire_ms: u64,
node: &str,
now: u64,
until: u64,
) -> Result<bool>
pub fn claim_schedule( &self, id: &str, next_fire_ms: u64, node: &str, now: u64, until: u64, ) -> Result<bool>
Claim the occurrence next_fire_ms of a schedule for node until
until: a compare-and-set on the row, so of several servers that
find the same occurrence due exactly one gets it.
Sourcepub fn finish_schedule_fire(
&self,
id: &str,
next_fire_ms: u64,
node: &str,
now: u64,
record: &FireRecord,
) -> Result<bool>
pub fn finish_schedule_fire( &self, id: &str, next_fire_ms: u64, node: &str, now: u64, record: &FireRecord, ) -> Result<bool>
Record a handled occurrence and release the claim, if node still
holds it on occurrence next_fire_ms. False when the row changed
meanwhile (updated, paused, deleted or claimed by another server).
Sourcepub fn release_schedule_claim(
&self,
id: &str,
node: &str,
retry_at: u64,
error: &str,
now: u64,
) -> Result<()>
pub fn release_schedule_claim( &self, id: &str, node: &str, retry_at: u64, error: &str, now: u64, ) -> Result<()>
Give up a claim without advancing the schedule: the occurrence is
tried again from retry_at by any server.
Sourcepub fn record_schedule_trigger(
&self,
id: &str,
execution_id: &str,
now: u64,
) -> Result<()>
pub fn record_schedule_trigger( &self, id: &str, execution_id: &str, now: u64, ) -> Result<()>
Note an execution started by POST /v1/schedules/{id}/trigger.
Sourcepub fn active_execution_ids(&self) -> Result<Vec<String>>
pub fn active_execution_ids(&self) -> Result<Vec<String>>
Ids of executions that have not reached a terminal status.
pub fn list_executions( &self, status: Option<&str>, workflow: Option<&str>, limit: u32, ) -> Result<Vec<ExecutionSummary>>
pub fn count_by_status(&self) -> Result<Vec<(String, u64)>>
pub fn upsert_worker(&self, w: &WorkerRecord) -> Result<()>
pub fn touch_worker(&self, worker_id: &str, now: u64) -> Result<()>
pub fn workers(&self) -> Result<Vec<WorkerRecord>>
Auto Trait Implementations§
impl !Freeze for Store
impl !RefUnwindSafe for Store
impl !Sync for Store
impl !UnwindSafe for Store
impl Forget for Store
impl Move for Store
impl Send for Store
impl Unpin for Store
impl UnsafeUnpin for Store
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request