pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
pub async fn connect(database_url: &str) -> Result<Self, PostgresError>
pub async fn connect_with_config( config: &StoreConfig, ) -> Result<Self, PostgresError>
pub fn from_pool(pool: PgPool) -> Self
pub fn from_pools(pool: PgPool, listener_pool: PgPool) -> Self
pub const fn pool(&self) -> &PgPool
pub async fn health(&self) -> Result<(), PostgresError>
pub async fn storage_protocol_version(&self) -> Result<u32, PostgresError>
pub async fn storage_protocol_range( &self, ) -> Result<StorageProtocolRange, PostgresError>
Sourcepub async fn ensure_storage_protocol(
&self,
client: StorageProtocolRange,
) -> Result<Option<StorageProtocolRange>, PostgresError>
pub async fn ensure_storage_protocol( &self, client: StorageProtocolRange, ) -> Result<Option<StorageProtocolRange>, PostgresError>
Returns None when the schema is absent, so a caller may still migrate it.
pub async fn ready_listener( &self, queue_name: &QueueName, ) -> Result<ReadyListener, PostgresError>
pub async fn ready_listener_for( &self, queue_names: &[QueueName], ) -> Result<ReadyListener, PostgresError>
pub async fn result_listener( &self, task_id: TaskId, ) -> Result<ReadyListener, PostgresError>
pub async fn register_worker( &self, worker_id: WorkerId, queue_name: &QueueName, version: &str, capabilities: &[(TaskName, HandlerVersion, RetryPolicy)], ttl: Duration, ) -> Result<(), PostgresError>
pub async fn heartbeat_worker( &self, worker_id: WorkerId, ttl: Duration, draining: bool, ) -> Result<bool, PostgresError>
Sourcepub async fn live_worker_count(
&self,
queue_name: &QueueName,
) -> Result<u64, PostgresError>
pub async fn live_worker_count( &self, queue_name: &QueueName, ) -> Result<u64, PostgresError>
Counts workers the database still considers live, which is not the same as the number of processes reporting metrics: a worker whose heartbeat fails keeps reporting and stops counting.
pub async fn get_worker( &self, worker_id: WorkerId, ) -> Result<Option<WorkerRecord>, PostgresError>
pub async fn migrate(&self) -> Result<(), PostgresError>
pub async fn configure_grants( &self, owner: &str, producer: &str, worker: &str, observer: &str, administrator: &str, ) -> Result<(), PostgresError>
pub async fn put_queue( &self, config: &QueueConfig, ) -> Result<Queue, PostgresError>
pub async fn get_queue( &self, queue_name: &QueueName, ) -> Result<Option<Queue>, PostgresError>
pub async fn queue_demand( &self, queue_name: &QueueName, capabilities: &[(TaskName, HandlerVersion)], ) -> Result<QueueDemand, PostgresError>
pub async fn set_queue_paused( &self, queue_name: &QueueName, paused: bool, ) -> Result<Option<Queue>, PostgresError>
pub async fn put_schedule( &self, config: &ScheduleConfig, ) -> Result<Schedule, PostgresError>
pub async fn get_schedule( &self, schedule_id: ScheduleId, ) -> Result<Option<Schedule>, PostgresError>
pub async fn set_schedule_paused( &self, schedule_id: ScheduleId, paused: bool, ) -> Result<Option<Schedule>, PostgresError>
pub async fn delete_schedule( &self, schedule_id: ScheduleId, ) -> Result<bool, PostgresError>
pub async fn materialize_due_schedules( &self, limit: u16, ) -> Result<u64, PostgresError>
pub async fn next_schedule_delay( &self, ) -> Result<Option<Duration>, PostgresError>
pub async fn next_task_delay( &self, queue_name: &QueueName, capabilities: &[(TaskName, HandlerVersion)], ) -> Result<Option<Duration>, PostgresError>
pub async fn delete_expired_terminal( &self, queue_name: &QueueName, limit: u16, ) -> Result<u64, PostgresError>
pub async fn delete_expired_idempotency_keys( &self, queue_name: &QueueName, limit: u16, ) -> Result<u64, PostgresError>
pub async fn enqueue( &self, request: &EnqueueRequest, ) -> Result<EnqueueResult, PostgresError>
pub async fn spawn_task( &self, request: SpawnRequest<'_>, ) -> Result<Option<EnqueueResult>, PostgresError>
pub async fn enqueue_on( connection: &mut PgConnection, request: &EnqueueRequest, ) -> Result<EnqueueResult, PostgresError>
pub async fn enqueue_many( &self, requests: &[EnqueueRequest], ) -> Result<Vec<EnqueueResult>, PostgresError>
pub async fn enqueue_many_on( connection: &mut PgConnection, requests: &[EnqueueRequest], ) -> Result<Vec<EnqueueResult>, PostgresError>
pub async fn claim( &self, queue_name: &QueueName, worker_id: WorkerId, capabilities: &[(TaskName, HandlerVersion)], limit: u16, lease_duration: Duration, ) -> Result<Vec<Task>, PostgresError>
pub async fn get_task( &self, task_id: TaskId, ) -> Result<Option<Task>, PostgresError>
pub async fn task_count_by_state( &self, queue_name: &QueueName, state: TaskState, ) -> Result<u64, PostgresError>
pub async fn get_checkpoint( &self, task_id: TaskId, handler_version: HandlerVersion, step_name: &StepName, occurrence: u32, ) -> Result<Option<Checkpoint>, PostgresError>
pub async fn commit_checkpoint( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, step_name: &StepName, occurrence: u32, value: &Value, ) -> Result<Option<Checkpoint>, PostgresError>
pub async fn sleep_until( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, step_name: &StepName, occurrence: u32, wake_at: DateTime<Utc>, ) -> Result<Option<DateTime<Utc>>, PostgresError>
pub async fn sleep_for( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, step_name: &StepName, occurrence: u32, duration: Duration, ) -> Result<Option<DateTime<Utc>>, PostgresError>
pub async fn emit_signal( &self, task_id: TaskId, signal_name: &SignalName, occurrence: u32, value: &Value, ) -> Result<Signal, PostgresError>
pub async fn wait_for_signal( &self, request: SignalWaitRequest<'_>, ) -> Result<Option<SignalWait>, PostgresError>
pub async fn wait_for_result( &self, request: ResultWaitRequest<'_>, ) -> Result<Option<ResultWait>, PostgresError>
pub async fn task_result( &self, task_id: TaskId, ) -> Result<Option<TaskResult>, PostgresError>
pub async fn wait_for_task_result( &self, task_id: TaskId, timeout: Option<Duration>, ) -> Result<TaskResultWait, PostgresError>
pub async fn recover_wait_timeouts( &self, limit: u16, ) -> Result<u64, PostgresError>
pub async fn recover_result_wait_timeouts( &self, limit: u16, ) -> Result<u64, PostgresError>
pub async fn next_wait_delay(&self) -> Result<Option<Duration>, PostgresError>
pub async fn cancel(&self, task_id: TaskId) -> Result<bool, PostgresError>
pub async fn renew_lease( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, lease_duration: Duration, ) -> Result<bool, PostgresError>
pub async fn renew_leases( &self, leases: &[LeaseRenewal], lease_duration: Duration, ) -> Result<Vec<TaskId>, PostgresError>
pub async fn complete( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, result: Option<&Value>, ) -> Result<bool, PostgresError>
pub async fn fail( &self, task_id: TaskId, attempt: u16, lease_token: LeaseToken, error: &Value, retry_after: Option<Duration>, ) -> Result<Option<TaskState>, PostgresError>
pub async fn recover_expired( &self, queue_name: &QueueName, limit: u16, ) -> Result<u64, PostgresError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Store
impl !UnwindSafe for Store
impl Freeze for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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