Struct background_jobs::memory_storage::Storage
source · pub struct Storage<T> { /* private fields */ }
Expand description
An In-Memory store for jobs
Implementations§
Trait Implementations§
source§impl<T> Storage for Storage<T>
impl<T> Storage for Storage<T>
source§fn push<'life0, 'async_trait>(
&'life0 self,
job: NewJobInfo
) -> Pin<Box<dyn Future<Output = Result<Uuid, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
fn push<'life0, 'async_trait>(
&'life0 self,
job: NewJobInfo
) -> Pin<Box<dyn Future<Output = Result<Uuid, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
push a job into the queue
source§fn pop<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 str,
runner_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<JobInfo, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Storage<T>: 'async_trait,
fn pop<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 str,
runner_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<JobInfo, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Storage<T>: 'async_trait,
pop a job from the provided queue
source§fn heartbeat<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
runner_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<(), <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
fn heartbeat<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
runner_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<(), <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
mark a job as being actively worked on
source§fn complete<'life0, 'async_trait>(
&'life0 self,
__arg1: ReturnJobInfo
) -> Pin<Box<dyn Future<Output = Result<bool, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
__arg1: ReturnJobInfo
) -> Pin<Box<dyn Future<Output = Result<bool, <Storage<T> as Storage>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Storage<T>: 'async_trait,
“Return” a job to the database, marking it for retry if needed
§type Error = Infallible
type Error = Infallible
The error type used by the storage mechansim.
Auto Trait Implementations§
impl<T> RefUnwindSafe for Storage<T>where
T: RefUnwindSafe,
impl<T> Send for Storage<T>where
T: Send,
impl<T> Sync for Storage<T>where
T: Sync,
impl<T> Unpin for Storage<T>where
T: Unpin,
impl<T> UnwindSafe for Storage<T>where
T: 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, Conn> RunQueryDsl<Conn> for T
impl<T, Conn> RunQueryDsl<Conn> for T
§fn execute<'query, 'conn>(
self,
conn: &'conn mut Conn
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where
Conn: AsyncConnection + Send,
Self: ExecuteDsl<Conn> + 'query,
fn execute<'query, 'conn>(
self,
conn: &'conn mut Conn
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where
Conn: AsyncConnection + Send,
Self: ExecuteDsl<Conn> + 'query,
Executes the given command, returning the number of rows affected. Read more
§fn load<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
§fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
Executes the given query, returning a [
Stream
] with the returned rows. Read more§fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
Runs the command, and returns the affected row. Read more
§fn get_results<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_results<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
Runs the command, returning an
Vec
with the affected rows. Read more§fn first<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: <Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>) -> Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>>
fn first<'query, 'conn, U>( self, conn: &'conn mut Conn ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: <Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>) -> Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>>
Attempts to load a single record. Read more