pub struct SqlitePool<S: Sleep>(/* private fields */);
Implementations§
Source§impl<S: Sleep> SqlitePool<S>
impl<S: Sleep> SqlitePool<S>
pub async fn new<P: AsRef<Path>>( path: P, config: SqliteConfig, sleep: S, ) -> Result<Self, DbError>
pub async fn transaction_write<F, T>( &self, func: F, name: &'static str, ) -> Result<T, DbError>
pub async fn transaction_read<F, T>( &self, func: F, name: &'static str, ) -> Result<T, DbError>
pub async fn conn_low_prio<F, T>( &self, func: F, name: &'static str, ) -> Result<T, DbError>
Trait Implementations§
Source§impl<S: Clone + Sleep> Clone for SqlitePool<S>
impl<S: Clone + Sleep> Clone for SqlitePool<S>
Source§fn clone(&self) -> SqlitePool<S>
fn clone(&self) -> SqlitePool<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S: Sleep> DbConnection for SqlitePool<S>
impl<S: Sleep> DbConnection for SqlitePool<S>
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,
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 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 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 delays and locks.
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,
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
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>,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<LockPendingResponse, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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_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<'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,
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.
fn append_batch_respond_to_parent<'life0, 'async_trait>(
&'life0 self,
execution_id: ExecutionIdDerived,
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,
include_backtrace_id: bool,
) -> 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 subscribe_to_next_responses<'life0, 'life1, 'async_trait>(
&'life0 self,
execution_id: &'life1 ExecutionId,
start_idx: usize,
interrupt_after: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JoinSetResponseEventOuter>, SubscribeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe_to_next_responses<'life0, 'life1, 'async_trait>(
&'life0 self,
execution_id: &'life1 ExecutionId,
start_idx: usize,
interrupt_after: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JoinSetResponseEventOuter>, SubscribeError>> + 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.
If no response arrives immediately and interrupt_after
resolves, return an interrupt.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_backtrace<'life0, 'async_trait>(
&'life0 self,
append: BacktraceInfo,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append_backtrace_batch<'life0, 'async_trait>(
&'life0 self,
batch: Vec<BacktraceInfo>,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_backtrace<'life0, 'life1, 'async_trait>(
&'life0 self,
execution_id: &'life1 ExecutionId,
filter: BacktraceFilter,
) -> Pin<Box<dyn Future<Output = Result<BacktraceInfo, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_backtrace<'life0, 'life1, 'async_trait>(
&'life0 self,
execution_id: &'life1 ExecutionId,
filter: BacktraceFilter,
) -> Pin<Box<dyn Future<Output = Result<BacktraceInfo, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Used by gRPC only.
Get the latest backtrace if version is not set.
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,
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
.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 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_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,
Get a single event without
backtrace_id
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 list_executions<'life0, 'async_trait>(
&'life0 self,
ffqn: Option<FunctionFqn>,
top_level_only: bool,
pagination: ExecutionListPagination,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionWithState>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_executions<'life0, 'async_trait>(
&'life0 self,
ffqn: Option<FunctionFqn>,
top_level_only: bool,
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,
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.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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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<Result<SupportedFunctionReturnValue, FinishedExecutionError>>, DbError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§impl<S: Sleep + 'static> DbPool for SqlitePool<S>
impl<S: Sleep + 'static> DbPool for SqlitePool<S>
Auto Trait Implementations§
impl<S> Freeze for SqlitePool<S>where
S: Freeze,
impl<S> RefUnwindSafe for SqlitePool<S>where
S: RefUnwindSafe,
impl<S> Send for SqlitePool<S>
impl<S> Sync for SqlitePool<S>
impl<S> Unpin for SqlitePool<S>where
S: Unpin,
impl<S> UnwindSafe for SqlitePool<S>where
S: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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 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>
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