Skip to main content

Store

Enum Store 

Source
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

Source

pub fn connect(location: &str) -> Result<Store>

Open a backend from a location: a postgres:// / postgresql:// URL, or a SQLite file path.

Source

pub fn open(path: &Path) -> Result<Store>

Open (or create) a SQLite database file.

Source

pub fn in_memory() -> Result<Store>

Source

pub fn backend(&self) -> &'static str

Source

pub fn put_definition(&self, ir: &WorkflowIr, now: u64) -> Result<PutDefinition>

Source

pub fn definitions(&self) -> Result<Vec<WorkflowIr>>

Source

pub fn execution_exists(&self, id: &str) -> Result<bool>

Source

pub fn append( &mut self, state: &ExecutionState, events: &[HistoryEvent], ) -> Result<()>

Atomically append events and update the execution projection.

Source

pub fn history(&self, id: &str) -> Result<Vec<HistoryEvent>>

Source

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.

Source

pub fn run_history(&self, id: &str, run: u32) -> Result<Vec<HistoryEvent>>

The history of an earlier (archived) run; empty if there is none.

Source

pub fn execution_status(&self, id: &str) -> Result<Option<String>>

The projected status of an execution (its latest run), if it exists.

Source

pub fn read_only(&self) -> bool

True when this store cannot write (a cluster standby).

Source

pub fn shared(&self) -> bool

True for a shared-mode store (several servers write).

Source

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.

Source

pub fn insert_schedule(&self, row: &ScheduleRow) -> Result<bool>

Insert a new schedule; false if the id is taken.

Source

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.

Source

pub fn schedule(&self, id: &str) -> Result<Option<ScheduleRow>>

Source

pub fn schedules(&self) -> Result<Vec<ScheduleRow>>

Source

pub fn delete_schedule(&self, id: &str) -> Result<bool>

Source

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.

Source

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.

Source

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

Source

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.

Source

pub fn record_schedule_trigger( &self, id: &str, execution_id: &str, now: u64, ) -> Result<()>

Note an execution started by POST /v1/schedules/{id}/trigger.

Source

pub fn active_execution_ids(&self) -> Result<Vec<String>>

Ids of executions that have not reached a terminal status.

Source

pub fn list_executions( &self, status: Option<&str>, workflow: Option<&str>, limit: u32, ) -> Result<Vec<ExecutionSummary>>

Source

pub fn count_by_status(&self) -> Result<Vec<(String, u64)>>

Source

pub fn upsert_worker(&self, w: &WorkerRecord) -> Result<()>

Source

pub fn touch_worker(&self, worker_id: &str, now: u64) -> Result<()>

Source

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<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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