Skip to main content

SqliteSystemDatabase

Struct SqliteSystemDatabase 

Source
pub struct SqliteSystemDatabase { /* private fields */ }

Implementations§

Source§

impl SqliteSystemDatabase

Source

pub async fn connect(database_url: &str) -> Result<Self, JournioError>

Source

pub fn pool(&self) -> &SqlitePool

Trait Implementations§

Source§

impl SystemDatabase for SqliteSystemDatabase

Source§

fn dialect(&self) -> &dyn Dialect

Which dialect this backend speaks.
Source§

fn migrate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create schema + run any pending migrations (mirrors runMigrations).
Source§

fn launch<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Boot the background loops: notification listener (LISTEN/NOTIFY or polling), queue pollers, etc. Mirrors systemDB.launch.
Source§

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Graceful shutdown of background loops.
Source§

fn init_workflow<'life0, 'async_trait>( &'life0 self, init: InitWorkflow, ) -> Pin<Box<dyn Future<Output = JournioResult<InitWorkflowResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Insert a workflow_status row (or upsert on ID conflict). Returns the actual status after upsert — ported from insertWorkflowStatus (system_database.go:936). Surfaces QueueDeduplicated on unique constraint violation of (queue_name, deduplication_id) and ConflictingWorkflow if name/queue mismatch an existing row.
Source§

fn record_workflow_result<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, workflow_id: &'life1 str, status: WorkflowStatusType, output: Option<&'life2 Interchange>, error: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persist terminal result/error — ported from recordWorkflowResult.
Source§

fn get_workflow_status<'life0, 'life1, 'async_trait>( &'life0 self, workflow_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read full status — ported from getWorkflowStatus-style single-row selects scattered through system_database.go.
Source§

fn list_workflows<'life0, 'async_trait>( &'life0 self, limit: i64, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List workflows (filters optional) — ported from listWorkflows (system_database.go:1184). The limit/offset filtering grows as the port progresses; for now a simple cap.
Source§

fn cancel_workflows<'life0, 'life1, 'async_trait>( &'life0 self, workflow_ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel the provided workflows, leaving terminal rows untouched. Returns the subset of IDs that already existed.
Source§

fn resume_workflows<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workflow_ids: &'life1 [String], queue_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resume the provided workflows onto queue_name, or the internal queue if None. Returns the subset of IDs that already existed.
Source§

fn get_workflow_children<'life0, 'life1, 'async_trait>( &'life0 self, workflow_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Recursively list all descendant workflows of workflow_id.
Source§

fn fork_workflow<'life0, 'async_trait>( &'life0 self, input: ForkWorkflow, ) -> Pin<Box<dyn Future<Output = JournioResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fork a workflow by cloning its durable state and enqueueing a new run.
Source§

fn get_queue<'life0, 'life1, 'async_trait>( &'life0 self, queue_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<QueueConfig>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve persisted queue configuration by name.
Source§

fn upsert_queue<'life0, 'life1, 'async_trait>( &'life0 self, queue: &'life1 QueueConfig, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create or replace persisted queue configuration.
Source§

fn record_step_output<'life0, 'life1, 'async_trait>( &'life0 self, step: &'life1 StepRecord, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert or read-back a completed step — ported from recordStepResult / checkStepExecution.
Source§

fn get_steps<'life0, 'life1, 'async_trait>( &'life0 self, workflow_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<StepRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch all recorded steps for replay — ported from the recovery path in workflow.go + system_database.go.
Source§

fn dequeue_workflow<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, queue_name: &'life1 str, executor_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically dequeue the next runnable workflow for queue_name (Postgres: FOR UPDATE SKIP LOCKED). Ported from workflowQueue.loop.
Source§

fn list_runnable_queues<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List queue names that currently have runnable or future queued work.
Source§

fn list_queues<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<QueueConfig>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all registered queues from the queues table — ported from listQueues (system_database.go:4434). Used by the admin server’s queue-metadata endpoint.
Source§

fn send<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, destination_id: &'life1 str, topic: &'life2 str, message: &'life3 Interchange, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Send a message — ported from send (system_database.go:3346). Inserts a row into notifications. An empty topic is stored as the null topic. Returns NonExistentWorkflowError when the destination workflow does not exist (FK violation).
Source§

fn consume_notification<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workflow_id: &'life1 str, topic: &'life2 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<Notification>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically consume the oldest unconsumed message on topic destined for workflow_id — ported from the consume half of recv (system_database.go:3378). Non-blocking: returns None when no message is available. The polling/timeout loop lives in crate::context::WorkflowContext::recv.
Source§

fn set_event<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, workflow_id: &'life1 str, key: &'life2 str, value: &'life3 Interchange, function_id: i32, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

SetEvent — ported from setEvent (system_database.go:3573). Upserts workflow_events and appends workflow_events_history (keyed by function_id, the calling step id).
Source§

fn get_event_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workflow_id: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<Interchange>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read the current value of event key for workflow_id — ported from the query half of getEvent (system_database.go:3615). Non-blocking: returns None when the key is unset. The polling/timeout loop lives in crate::context::WorkflowContext::get_event.
Source§

fn write_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, workflow_id: &'life1 str, key: &'life2 str, value: &'life3 str, function_id: i32, serialization: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Append one serialized value to a durable stream within a workflow.
Source§

fn read_stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workflow_id: &'life1 str, key: &'life2 str, from_offset: i64, ) -> Pin<Box<dyn Future<Output = JournioResult<(Vec<StreamEntry>, bool)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read stream entries from from_offset, ordered by offset. Returns the drained entries plus whether the stream has been closed.
Source§

fn get_workflows_for_recovery<'life0, 'life1, 'async_trait>( &'life0 self, executor_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Workflows left PENDING for this executor at startup — ported from workflowRecovery in recovery.go + system_database.go.
Source§

fn delete_workflows_before<'life0, 'async_trait>( &'life0 self, before: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = JournioResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete completed workflows older than before — ported from permanentDeleteWorkflows.
Source§

fn upsert_schedule<'life0, 'life1, 'async_trait>( &'life0 self, schedule: &'life1 WorkflowSchedule, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create or replace a workflow schedule definition.
Source§

fn list_schedules<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<WorkflowSchedule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all persisted schedule definitions.
Source§

fn update_schedule_last_fired_at<'life0, 'life1, 'async_trait>( &'life0 self, schedule_name: &'life1 str, fired_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the last-fired timestamp after a successful trigger/backfill pass.
Source§

fn get_schedule<'life0, 'life1, 'async_trait>( &'life0 self, schedule_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<WorkflowSchedule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a single schedule by name — ported from the ScheduleNamePrefixes branch of listSchedules (system_database.go:4766). Returns None if no schedule matches.
Source§

fn delete_schedule<'life0, 'life1, 'async_trait>( &'life0 self, schedule_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a schedule by name — ported from deleteSchedule (system_database.go:4928).
Source§

fn update_schedule_status<'life0, 'life1, 'async_trait>( &'life0 self, schedule_name: &'life1 str, status: ScheduleStatus, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update only a schedule’s status — ported from updateSchedule (system_database.go). Used by pause/resume.
Source§

fn create_application_version<'life0, 'life1, 'async_trait>( &'life0 self, version_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register a new application version (no-op if the name already exists). Ported from createApplicationVersion.
Source§

fn update_application_version_timestamp<'life0, 'life1, 'async_trait>( &'life0 self, version_name: &'life1 str, timestamp_ms: i64, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Bump a version’s timestamp, marking it as latest. Ported from updateApplicationVersionTimestamp.
Source§

fn list_application_versions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<VersionInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All registered versions, newest first — ported from listApplicationVersions (system_database.go:5174).
Source§

fn get_latest_application_version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JournioResult<Option<VersionInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The version with the greatest timestamp — ported from getLatestApplicationVersion. Returns None when none are registered.
Source§

fn set_workflow_delay<'life0, 'life1, 'async_trait>( &'life0 self, workflow_id: &'life1 str, delay_until: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set or update the delay on a DELAYED workflow — ported from setWorkflowDelay (system_database.go). No-op for workflows not in the DELAYED status.
Source§

fn delete_workflows<'life0, 'life1, 'async_trait>( &'life0 self, workflow_ids: &'life1 [String], delete_children: bool, ) -> Pin<Box<dyn Future<Output = JournioResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently delete the given workflows and all their associated data (operation outputs, events, event history, streams) — ported from deleteWorkflows (system_database.go). When delete_children is true, descendant workflows are deleted recursively first.
Source§

fn list_workflows_filtered<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 ListWorkflowsFilter, ) -> Pin<Box<dyn Future<Output = JournioResult<Vec<WorkflowStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List workflows with rich filtering and paging — ported from the listWorkflowsOptions branch of listWorkflows (system_database.go:1184). Backends translate the filter into their native parameterization (Postgres ANY($n) arrays vs. SQLite QueryBuilder separated lists).
Source§

fn wait_for_notification<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _workflow_id: &'life1 str, _topic: &'life2 str, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), JournioError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Optional LISTEN/NOTIFY-backed wait hint for recv. Backends without a wakeup path can ignore it; the caller will re-poll after the timeout.
Source§

fn wait_for_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _workflow_id: &'life1 str, _key: &'life2 str, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), JournioError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Optional LISTEN/NOTIFY-backed wait hint for get_event.
Source§

fn wait_for_stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _workflow_id: &'life1 str, _key: &'life2 str, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), JournioError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Optional LISTEN/NOTIFY-backed wait hint for read_stream.

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