pub struct PostgresStorage<Args, Compact = CompactType, Codec = JsonCodec<CompactType>, Fetcher = PgFetcher<Args, Compact, Codec>> { /* private fields */ }Implementations§
Source§impl<Args> PostgresStorage<Args>
impl<Args> PostgresStorage<Args>
pub fn new(pool: &PgPool) -> Self
Sourcepub fn new_with_config(pool: &PgPool, config: &Config) -> Self
pub fn new_with_config(pool: &PgPool, config: &Config) -> Self
Creates a new PostgresStorage instance.
pub fn new_with_notify( pool: &PgPool, config: &Config, ) -> PostgresStorage<Args, CompactType, JsonCodec<CompactType>, PgNotify>
Source§impl<Args, Compact, Codec, Fetcher> PostgresStorage<Args, Compact, Codec, Fetcher>
impl<Args, Compact, Codec, Fetcher> PostgresStorage<Args, Compact, Codec, Fetcher>
pub fn with_codec<NewCodec>( self, ) -> PostgresStorage<Args, Compact, NewCodec, Fetcher>
Trait Implementations§
Source§impl<Args, Decode> Backend for PostgresStorage<Args, CompactType, Decode, PgFetcher<Args, CompactType, Decode>>
impl<Args, Decode> Backend for PostgresStorage<Args, CompactType, Decode, PgFetcher<Args, CompactType, Decode>>
Source§type Context = SqlContext
type Context = SqlContext
Context associated with each task.
Source§type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, Error>> + Send>>
type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, Error>> + Send>>
A stream of tasks provided by the backend.
Source§type Beat = Pin<Box<dyn Stream<Item = Result<(), Error>> + Send>>
type Beat = Pin<Box<dyn Stream<Item = Result<(), Error>> + Send>>
A stream representing heartbeat signals.
Source§type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
The type representing backend middleware layer.
Source§fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
Returns a heartbeat stream for the given worker.
Source§fn middleware(&self) -> Self::Layer
fn middleware(&self) -> Self::Layer
Returns the backend’s middleware layer.
Source§fn poll(self, worker: &WorkerContext) -> Self::Stream
fn poll(self, worker: &WorkerContext) -> Self::Stream
Polls the backend for tasks for the given worker.
Source§impl<Args, Decode> Backend for PostgresStorage<Args, CompactType, Decode, PgNotify>
impl<Args, Decode> Backend for PostgresStorage<Args, CompactType, Decode, PgNotify>
Source§type Context = SqlContext
type Context = SqlContext
Context associated with each task.
Source§type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, Error>> + Send>>
type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, Error>> + Send>>
A stream of tasks provided by the backend.
Source§type Beat = Pin<Box<dyn Stream<Item = Result<(), Error>> + Send>>
type Beat = Pin<Box<dyn Stream<Item = Result<(), Error>> + Send>>
A stream representing heartbeat signals.
Source§type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
The type representing backend middleware layer.
Source§fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
Returns a heartbeat stream for the given worker.
Source§fn middleware(&self) -> Self::Layer
fn middleware(&self) -> Self::Layer
Returns the backend’s middleware layer.
Source§fn poll(self, worker: &WorkerContext) -> Self::Stream
fn poll(self, worker: &WorkerContext) -> Self::Stream
Polls the backend for tasks for the given worker.
Source§type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, <PostgresStorage<Args, Vec<u8>, Decode, SharedFetcher> as Backend>::Error>> + Send>>
type Stream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, SqlContext, Ulid>>, <PostgresStorage<Args, Vec<u8>, Decode, SharedFetcher> as Backend>::Error>> + Send>>
A stream of tasks provided by the backend.
Source§type Beat = Pin<Box<dyn Stream<Item = Result<(), <PostgresStorage<Args, Vec<u8>, Decode, SharedFetcher> as Backend>::Error>> + Send>>
type Beat = Pin<Box<dyn Stream<Item = Result<(), <PostgresStorage<Args, Vec<u8>, Decode, SharedFetcher> as Backend>::Error>> + Send>>
A stream representing heartbeat signals.
Source§type Context = SqlContext
type Context = SqlContext
Context associated with each task.
Source§type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
type Layer = Stack<LockTaskLayer, AcknowledgeLayer<PgAck>>
The type representing backend middleware layer.
Source§fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
fn heartbeat(&self, worker: &WorkerContext) -> Self::Beat
Returns a heartbeat stream for the given worker.
Source§fn middleware(&self) -> Self::Layer
fn middleware(&self) -> Self::Layer
Returns the backend’s middleware layer.
Source§fn poll(self, worker: &WorkerContext) -> Self::Stream
fn poll(self, worker: &WorkerContext) -> Self::Stream
Polls the backend for tasks for the given worker.
Source§impl<Args, Compact, Codec, Fetcher: Clone> Clone for PostgresStorage<Args, Compact, Codec, Fetcher>
impl<Args, Compact, Codec, Fetcher: Clone> Clone for PostgresStorage<Args, Compact, Codec, Fetcher>
Source§impl<Args: Sync, D, F> ConfigExt for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
impl<Args: Sync, D, F> ConfigExt for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Source§impl<Args, D, F> FetchById<Args> for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = PgContext, Compact = CompactType, IdType = Ulid, Error = Error>,
D: Codec<Args, Compact = CompactType>,
D::Error: Error + Send + Sync + 'static,
Args: 'static,
impl<Args, D, F> FetchById<Args> for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = PgContext, Compact = CompactType, IdType = Ulid, Error = Error>,
D: Codec<Args, Compact = CompactType>,
D::Error: Error + Send + Sync + 'static,
Args: 'static,
Source§impl<Args, D, F> ListAllTasks for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
impl<Args, D, F> ListAllTasks for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Source§impl<Args, D, F> ListQueues for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
impl<Args, D, F> ListQueues for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Source§impl<Args, D, F> ListTasks<Args> for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
D: Codec<Args, Compact = CompactType>,
D::Error: Error + Send + Sync + 'static,
Args: 'static,
impl<Args, D, F> ListTasks<Args> for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
D: Codec<Args, Compact = CompactType>,
D::Error: Error + Send + Sync + 'static,
Args: 'static,
Source§impl<Args: Sync, D, F> ListWorkers for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
impl<Args: Sync, D, F> ListWorkers for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Source§fn list_workers(
&self,
queue: &str,
) -> impl Future<Output = Result<Vec<RunningWorker>, Self::Error>> + Send
fn list_workers( &self, queue: &str, ) -> impl Future<Output = Result<Vec<RunningWorker>, Self::Error>> + Send
List all registered workers in the current queue
Source§fn list_all_workers(
&self,
) -> impl Future<Output = Result<Vec<RunningWorker>, Self::Error>> + Send
fn list_all_workers( &self, ) -> impl Future<Output = Result<Vec<RunningWorker>, Self::Error>> + Send
List all registered workers in all queues
Source§impl<Args, D, F> Metrics for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
impl<Args, D, F> Metrics for PostgresStorage<Args, CompactType, D, F>where
PostgresStorage<Args, CompactType, D, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Source§impl<Args, Encode, Fetcher> Sink<Task<Vec<u8>, SqlContext, Ulid>> for PostgresStorage<Args, CompactType, Encode, Fetcher>
impl<Args, Encode, Fetcher> Sink<Task<Vec<u8>, SqlContext, Ulid>> for PostgresStorage<Args, CompactType, Encode, Fetcher>
Source§fn poll_ready(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(
self: Pin<&mut Self>,
item: PgTask<CompactType>,
) -> Result<(), Self::Error>
fn start_send( self: Pin<&mut Self>, item: PgTask<CompactType>, ) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<O: 'static + Send, Args, F, Decode> WaitForCompletion<O> for PostgresStorage<Args, CompactType, Decode, F>where
PostgresStorage<Args, CompactType, Decode, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Result<O, String>: DeserializeOwned,
impl<O: 'static + Send, Args, F, Decode> WaitForCompletion<O> for PostgresStorage<Args, CompactType, Decode, F>where
PostgresStorage<Args, CompactType, Decode, F>: Backend<Context = SqlContext, Compact = CompactType, IdType = Ulid, Error = Error>,
Result<O, String>: DeserializeOwned,
Source§type ResultStream = Pin<Box<dyn Stream<Item = Result<TaskResult<O>, <PostgresStorage<Args, Vec<u8>, Decode, F> as Backend>::Error>> + Send>>
type ResultStream = Pin<Box<dyn Stream<Item = Result<TaskResult<O>, <PostgresStorage<Args, Vec<u8>, Decode, F> as Backend>::Error>> + Send>>
The result stream type yielding task results
Source§fn wait_for(
&self,
task_ids: impl IntoIterator<Item = TaskId<Self::IdType>>,
) -> Self::ResultStream
fn wait_for( &self, task_ids: impl IntoIterator<Item = TaskId<Self::IdType>>, ) -> Self::ResultStream
Wait for multiple tasks to complete, yielding results as they become available
Source§fn check_status(
&self,
task_ids: impl IntoIterator<Item = TaskId<Self::IdType>> + Send,
) -> impl Future<Output = Result<Vec<TaskResult<O>>, Self::Error>> + Send
fn check_status( &self, task_ids: impl IntoIterator<Item = TaskId<Self::IdType>> + Send, ) -> impl Future<Output = Result<Vec<TaskResult<O>>, Self::Error>> + Send
Check current status of tasks without waiting
Source§fn wait_for_single(&self, task_id: TaskId<Self::IdType>) -> Self::ResultStream
fn wait_for_single(&self, task_id: TaskId<Self::IdType>) -> Self::ResultStream
Wait for a single task to complete, yielding its result
impl<'pin, Args, Compact, Codec, Fetcher> Unpin for PostgresStorage<Args, Compact, Codec, Fetcher>where
PinnedFieldsOf<__PostgresStorage<'pin, Args, Compact, Codec, Fetcher>>: Unpin,
Auto Trait Implementations§
impl<Args, Compact, Codec, Fetcher> Freeze for PostgresStorage<Args, Compact, Codec, Fetcher>where
Fetcher: Freeze,
impl<Args, Compact = Vec<u8>, Codec = JsonCodec<Vec<u8>>, Fetcher = PgFetcher<Args, Compact, Codec>> !RefUnwindSafe for PostgresStorage<Args, Compact, Codec, Fetcher>
impl<Args, Compact, Codec, Fetcher> Send for PostgresStorage<Args, Compact, Codec, Fetcher>
impl<Args, Compact, Codec, Fetcher> Sync for PostgresStorage<Args, Compact, Codec, Fetcher>
impl<Args, Compact = Vec<u8>, Codec = JsonCodec<Vec<u8>>, Fetcher = PgFetcher<Args, Compact, Codec>> !UnwindSafe for PostgresStorage<Args, Compact, Codec, Fetcher>
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> 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 moreSource§impl<T, Item> SinkExt<Item> for T
impl<T, Item> SinkExt<Item> for T
Source§fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
Composes a function in front of the sink. Read more
Source§fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
Composes a function in front of the sink. Read more
Source§fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
Transforms the error returned by the sink.
Source§fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
Map this sink’s error to a different error type using the
Into trait. Read moreSource§fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
Adds a fixed-size buffer to the current sink. Read more
Source§fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
Flush the sink, processing all pending items. Read more
Source§fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
A future that completes after the given item has been fully processed
into the sink, including flushing. Read more
Source§fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
A future that completes after the given item has been received
by the sink. Read more
Source§fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
A future that completes after the given stream has been fully processed
into the sink, including flushing. Read more
Source§fn right_sink<Si1>(self) -> Either<Si1, Self>
fn right_sink<Si1>(self) -> Either<Si1, Self>
Source§fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
A convenience method for calling
Sink::poll_ready on Unpin
sink types.Source§fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
A convenience method for calling
Sink::start_send on Unpin
sink types.