Struct MemoryStorage

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

A storage backend that holds all data in memory.

It serves as a reference implementation for storage backends as well as a test platform for the server itself. It is optimized for simplicity and readability, and is not intended for production use.

It may be used for small-scale production applications where persistence is not required and the amount of data is small enough to fit in memory.

Implementations§

Source§

impl MemoryStorage

Source

pub fn new() -> Self

Create a new in-memory storage backend.

Trait Implementations§

Source§

impl Clone for MemoryStorage

Source§

fn clone(&self) -> MemoryStorage

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 MemoryStorage

Source§

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

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

impl Default for MemoryStorage

Source§

fn default() -> MemoryStorage

Returns the “default value” for a type. Read more
Source§

impl Storage for MemoryStorage

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, new_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_inactive: 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, _filters: 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
Source§

impl StorageSnapshot for MemoryStorage

Source§

fn export_snapshot(&self) -> BoxStream<'static, Result<SnapshotData>>

Export a snapshot of the storage.
Source§

fn import_snapshot<'life0, 'async_trait>( &'life0 self, snapshot: BoxStream<'static, Result<SnapshotData>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Import a snapshot of the storage. 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> 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> 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