Struct SqliteStorage

Source
pub struct SqliteStorage { /* private fields */ }
Expand description

A storage implementation backed by sqlite.

Implementations§

Source§

impl SqliteStorage

Source

pub fn new(config: SqliteStorageConfig) -> Result<Self>

Create a new sqlite storage instance with the given connection.

Source

pub async fn optimize(&self) -> Result<()>

Run optimize on the database.

This should be called periodically (e.g. hourly).

Source

pub async fn vacuum(&self) -> Result<()>

Run vacuum on the database.

This should be called periodically depending on the amount of data generated and deleted (e.g. daily).

Trait Implementations§

Source§

impl Clone for SqliteStorage

Source§

fn clone(&self) -> SqliteStorage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SqliteStorage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Storage for SqliteStorage

Source§

fn job_types_added<'life0, 'async_trait>( &'life0 self, job_types: Vec<JobType>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add or update a job type.
Source§

fn jobs_added<'life0, 'async_trait>( &'life0 self, jobs: Vec<NewJob>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist the given new jobs.
Source§

fn job_added_conditionally<'life0, 'async_trait>( &'life0 self, job: NewJob, filters: JobQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<ConditionalJobResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist the given job if no jobs match the filter. Read more
Source§

fn jobs_cancelled<'life0, 'life1, 'async_trait>( &'life0 self, job_ids: &'life1 [Uuid], timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<Vec<CancelledJob>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel the given jobs. Read more
Source§

fn executions_added<'life0, 'async_trait>( &'life0 self, executions: Vec<NewExecution>, timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add new executions.
Source§

fn executions_ready<'life0, 'life1, 'async_trait>( &'life0 self, execution_ids: &'life1 [Uuid], timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

An execution is ready to be executed.
Source§

fn execution_assigned<'life0, 'async_trait>( &'life0 self, execution_id: Uuid, executor_id: Uuid, timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An execution was assigned to an executor.
Source§

fn execution_started<'life0, 'async_trait>( &'life0 self, execution_id: Uuid, timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set an execution as started.
Source§

fn execution_succeeded<'life0, 'async_trait>( &'life0 self, execution_id: Uuid, timestamp: SystemTime, output_payload_json: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set an execution as succeeded.
Source§

fn executions_failed<'life0, 'life1, 'async_trait>( &'life0 self, execution_ids: &'life1 [Uuid], timestamp: SystemTime, reason: String, mark_job_unschedulable: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set an execution as failed, if mark_job_unschedulable is false the job is not marked as unschedulable, this happens when the job is retried.
Source§

fn orphan_execution_ids<'life0, 'life1, 'async_trait>( &'life0 self, executor_ids: &'life1 [Uuid], ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return assigned executions that are not assigned to any of the given executor IDs.
Source§

fn jobs_unschedulable<'life0, 'life1, 'async_trait>( &'life0 self, job_ids: &'life1 [Uuid], timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a job as unschedulable. Read more
Source§

fn pending_executions<'life0, 'async_trait>( &'life0 self, after: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<PendingExecution>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executions that are not yet ready to be executed. Read more
Source§

fn ready_executions<'life0, 'async_trait>( &'life0 self, after: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ReadyExecution>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unassigned executions that are ready at the time of the call. Read more
Source§

fn pending_jobs<'life0, 'async_trait>( &'life0 self, after: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<PendingJob>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Jobs that satisfy the following conditions: Read more
Source§

fn query_jobs<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, limit: usize, order: JobQueryOrder, filters: JobQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<JobQueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query and return a list of jobs with the given parameters. Read more
Source§

fn query_job_ids<'life0, 'async_trait>( &'life0 self, filters: JobQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query and return a list of job IDs with the given parameters.
Source§

fn count_jobs<'life0, 'async_trait>( &'life0 self, filters: JobQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count the number of jobs that satisfy the given filters.
Source§

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

Query and return a list of job types with the given parameters.
Source§

fn delete_jobs<'life0, 'async_trait>( &'life0 self, filters: JobQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove jobs and all related data, returns the removed job IDs. Read more
Source§

fn schedules_added<'life0, 'async_trait>( &'life0 self, schedules: Vec<NewSchedule>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist the given new schedules.
Source§

fn schedule_added_conditionally<'life0, 'async_trait>( &'life0 self, schedule: NewSchedule, filter: ScheduleQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<ConditionalScheduleResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist the given schedule if no schedules match the filter. Read more
Source§

fn schedules_cancelled<'life0, 'life1, 'async_trait>( &'life0 self, schedule_ids: &'life1 [Uuid], timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<Vec<CancelledSchedule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel the given schedules. Read more
Source§

fn schedules_unschedulable<'life0, 'life1, 'async_trait>( &'life0 self, schedule_ids: &'life1 [Uuid], timestamp: SystemTime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark the given schedules as unschedulable.
Source§

fn pending_schedules<'life0, 'async_trait>( &'life0 self, after: Option<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<PendingSchedule>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return all pending schedules. Read more
Source§

fn query_schedules<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, limit: usize, filters: ScheduleQueryFilters, order: ScheduleQueryOrder, ) -> Pin<Box<dyn Future<Output = Result<ScheduleQueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query and return a list of schedules with the given parameters. Read more
Source§

fn query_schedule_ids<'life0, 'async_trait>( &'life0 self, filters: ScheduleQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query and return a list of schedule IDs with the given parameters.
Source§

fn count_schedules<'life0, 'async_trait>( &'life0 self, filters: ScheduleQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count the number of schedules that satisfy the given filters.
Source§

fn delete_schedules<'life0, 'async_trait>( &'life0 self, filters: ScheduleQueryFilters, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove schedules and all related data, returns the removed schedule IDs. Read more

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

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

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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