obeli_sk_concepts::storage

Trait DbConnection

Source
pub trait DbConnection: Send + Sync {
Show 19 methods // Required methods fn lock_pending<'life0, 'async_trait>( &'life0 self, batch_size: usize, pending_at_or_sooner: DateTime<Utc>, ffqns: Arc<[FunctionFqn]>, created_at: DateTime<Utc>, component_id: ComponentId, executor_id: ExecutorId, lock_expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<LockPendingResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn lock<'life0, 'life1, 'async_trait>( &'life0 self, created_at: DateTime<Utc>, component_id: ComponentId, execution_id: &'life1 ExecutionId, run_id: RunId, version: Version, executor_id: ExecutorId, lock_expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<LockResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn append<'life0, 'async_trait>( &'life0 self, execution_id: ExecutionId, version: Version, req: AppendRequest, ) -> Pin<Box<dyn Future<Output = Result<AppendResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_response<'life0, 'async_trait>( &'life0 self, created_at: DateTime<Utc>, execution_id: ExecutionId, response_event: JoinSetResponseEvent, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_batch<'life0, 'async_trait>( &'life0 self, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, execution_id: ExecutionId, version: Version, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_batch_create_new_execution<'life0, 'async_trait>( &'life0 self, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, execution_id: ExecutionId, version: Version, child_req: Vec<CreateRequest>, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_batch_respond_to_parent<'life0, 'async_trait>( &'life0 self, execution_id: ExecutionId, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, version: Version, parent_execution_id: ExecutionId, parent_response_event: JoinSetResponseEventOuter, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_execution_events<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, since: &'life2 Version, max_length: VersionType, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionEvent>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_execution_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, version: &'life2 Version, ) -> Pin<Box<dyn Future<Output = Result<ExecutionEvent, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_pending_state<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<PendingState, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_expired_timers<'life0, 'async_trait>( &'life0 self, at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExpiredTimer>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn create<'life0, 'async_trait>( &'life0 self, req: CreateRequest, ) -> Pin<Box<dyn Future<Output = Result<AppendResponse, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_to_next_responses<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, start_idx: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<JoinSetResponseEventOuter>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn wait_for_finished_result<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, timeout: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<FinishedExecutionResult, ClientError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn wait_for_pending<'life0, 'async_trait>( &'life0 self, pending_at_or_sooner: DateTime<Utc>, ffqns: Arc<[FunctionFqn]>, max_wait: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_executions<'life0, 'async_trait>( &'life0 self, ffqn: Option<FunctionFqn>, pagination: ExecutionListPagination, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionWithState>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_responses<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, pagination: Pagination<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResponseWithCursor>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn get_create_request<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<CreateRequest, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_finished_result<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, finished: PendingStateFinished, ) -> Pin<Box<dyn Future<Output = Result<Option<FinishedExecutionResult>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}

Required Methods§

Source

fn lock_pending<'life0, 'async_trait>( &'life0 self, batch_size: usize, pending_at_or_sooner: DateTime<Utc>, ffqns: Arc<[FunctionFqn]>, created_at: DateTime<Utc>, component_id: ComponentId, executor_id: ExecutorId, lock_expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<LockPendingResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn lock<'life0, 'life1, 'async_trait>( &'life0 self, created_at: DateTime<Utc>, component_id: ComponentId, execution_id: &'life1 ExecutionId, run_id: RunId, version: Version, executor_id: ExecutorId, lock_expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<LockResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Specialized append which returns the event history.

Source

fn append<'life0, 'async_trait>( &'life0 self, execution_id: ExecutionId, version: Version, req: AppendRequest, ) -> Pin<Box<dyn Future<Output = Result<AppendResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append a single event to an existing execution log

Source

fn append_response<'life0, 'async_trait>( &'life0 self, created_at: DateTime<Utc>, execution_id: ExecutionId, response_event: JoinSetResponseEvent, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn append_batch<'life0, 'async_trait>( &'life0 self, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, execution_id: ExecutionId, version: Version, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append one or more events to an existing execution log

Source

fn append_batch_create_new_execution<'life0, 'async_trait>( &'life0 self, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, execution_id: ExecutionId, version: Version, child_req: Vec<CreateRequest>, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append one or more events to the parent execution log, and create zero or more child execution logs.

Source

fn append_batch_respond_to_parent<'life0, 'async_trait>( &'life0 self, execution_id: ExecutionId, current_time: DateTime<Utc>, batch: Vec<AppendRequest>, version: Version, parent_execution_id: ExecutionId, parent_response_event: JoinSetResponseEventOuter, ) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn list_execution_events<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, since: &'life2 Version, max_length: VersionType, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionEvent>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_execution_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, version: &'life2 Version, ) -> Pin<Box<dyn Future<Output = Result<ExecutionEvent, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_pending_state<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<PendingState, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_expired_timers<'life0, 'async_trait>( &'life0 self, at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExpiredTimer>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get currently expired locks and async timers (delay requests)

Source

fn create<'life0, 'async_trait>( &'life0 self, req: CreateRequest, ) -> Pin<Box<dyn Future<Output = Result<AppendResponse, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new execution log

Source

fn subscribe_to_next_responses<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, start_idx: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<JoinSetResponseEventOuter>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get notified when a new response arrives. Parameter start_idx must be at most be equal to current size of responses in the execution log.

Source

fn wait_for_finished_result<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, timeout: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<FinishedExecutionResult, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn wait_for_pending<'life0, 'async_trait>( &'life0 self, pending_at_or_sooner: DateTime<Utc>, ffqns: Arc<[FunctionFqn]>, max_wait: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Best effort for blocking while there are no pending executions. Return immediately if there are pending notifications at pending_at_or_sooner. Implementation must return not later than at expiry date, which is: pending_at_or_sooner + max_wait. Timers that expire until the expiry date can be disregarded. Databases that do not support subscriptions should wait for max_wait.

Source

fn list_executions<'life0, 'async_trait>( &'life0 self, ffqn: Option<FunctionFqn>, pagination: ExecutionListPagination, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionWithState>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns executions sorted in descending order. Used by gRPC only.

Source

fn list_responses<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, pagination: Pagination<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResponseWithCursor>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns responses of an execution ordered as they arrived, enabling matching each JoinNext to its corresponding response. Used by gRPC only.

Provided Methods§

Source

fn get_create_request<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, ) -> Pin<Box<dyn Future<Output = Result<CreateRequest, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_finished_result<'life0, 'life1, 'async_trait>( &'life0 self, execution_id: &'life1 ExecutionId, finished: PendingStateFinished, ) -> Pin<Box<dyn Future<Output = Result<Option<FinishedExecutionResult>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§