use crate::TraceContext;
use crate::error::{ForgeError, Result};
use async_trait::async_trait;
use bytes::Bytes;
use serde::de::DeserializeOwned;
use std::fmt;
use std::sync::{
Arc,
atomic::{AtomicBool, Ordering},
};
use std::time::{Duration, SystemTime};
use tokio::sync::Notify;
use uuid::Uuid;
pub const MAX_PAYLOAD_BYTES: usize = 256 * 1024;
pub const MAX_WAIT: Duration = Duration::from_secs(20);
pub const MAX_VISIBILITY_TIMEOUT: Duration = Duration::from_secs(12 * 60 * 60);
pub const MAX_OPERATOR_BATCH: u32 = 100;
pub const MAX_ENQUEUE_BATCH: usize = 100;
pub const MAX_DEQUEUE_BATCH: usize = 10;
pub const MAX_FAILURE_SUMMARY_BYTES: usize = 512;
pub const MAX_CONCURRENCY_KEY_BYTES: usize = 256;
pub const MAX_CORRELATION_ID_BYTES: usize = 256;
pub const MAX_SCHEMA_BYTES: usize = 256;
pub const MAX_CONTENT_TYPE_BYTES: usize = 128;
pub const MAX_ARTIFACT_REFS: usize = 32;
#[derive(Debug, Clone, Copy)]
pub(crate) struct TerminalRetention {
pub succeeded: Duration,
pub dead: Duration,
pub cancelled: Duration,
}
#[derive(
Debug,
Clone,
Copy,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
serde::Serialize,
serde::Deserialize,
)]
#[serde(rename_all = "snake_case")]
pub enum Priority {
Low,
#[default]
Normal,
High,
}
impl Priority {
pub(crate) const fn rank(self) -> i16 {
match self {
Self::Low => 0,
Self::Normal => 1,
Self::High => 2,
}
}
pub(crate) const fn from_rank(value: i16) -> Self {
match value {
0 => Self::Low,
2 => Self::High,
_ => Self::Normal,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum JobState {
Queued,
Delayed,
Leased,
Retrying,
Succeeded,
Dead,
CancelRequested,
Cancelled,
}
impl JobState {
pub const fn is_terminal(self) -> bool {
matches!(self, Self::Succeeded | Self::Dead | Self::Cancelled)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct JobStatus {
pub id: JobId,
pub queue: String,
pub state: JobState,
pub attempt_count: u32,
pub max_attempts: u32,
pub priority: Priority,
pub concurrency_key: Option<String>,
pub enqueued_at: SystemTime,
pub available_at: SystemTime,
pub completed_at: Option<SystemTime>,
}
#[derive(Debug, Clone)]
pub struct JobStatusFilter {
pub queue: Option<String>,
pub states: Vec<JobState>,
pub cursor: Option<crate::Cursor>,
pub limit: u32,
}
impl Default for JobStatusFilter {
fn default() -> Self {
Self {
queue: None,
states: Vec::new(),
cursor: None,
limit: 50,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct JobStatusPage {
pub items: Vec<JobStatus>,
pub next_cursor: Option<crate::Cursor>,
}
#[derive(Clone, Default)]
pub struct JobCancellation {
cancelled: Arc<AtomicBool>,
notify: Arc<Notify>,
}
impl fmt::Debug for JobCancellation {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("JobCancellation")
.field("cancelled", &self.is_cancelled())
.finish()
}
}
impl JobCancellation {
pub fn is_cancelled(&self) -> bool {
self.cancelled.load(Ordering::Acquire)
}
pub async fn cancelled(&self) {
if self.is_cancelled() {
return;
}
let notified = self.notify.notified();
if self.is_cancelled() {
return;
}
notified.await;
}
pub(crate) fn signal(&self) {
if !self.cancelled.swap(true, Ordering::AcqRel) {
self.notify.notify_waiters();
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ArtifactRef {
pub uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct QueueEnvelope {
pub version: u16,
pub schema: String,
pub content_type: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub correlation_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub trace_context: Option<TraceContext>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub artifacts: Vec<ArtifactRef>,
pub body: Vec<u8>,
}
impl QueueEnvelope {
pub const VERSION: u16 = 1;
pub fn new(
schema: impl Into<String>,
content_type: impl Into<String>,
body: impl Into<Vec<u8>>,
) -> Self {
Self {
version: Self::VERSION,
schema: schema.into(),
content_type: content_type.into(),
correlation_id: None,
trace_context: None,
artifacts: Vec::new(),
body: body.into(),
}
}
pub fn encode(&self) -> Result<Bytes> {
self.validate()?;
let bytes = serde_json::to_vec(self)
.map_err(|e| ForgeError::invalid(format!("could not encode queue envelope: {e}")))?;
if bytes.len() > MAX_PAYLOAD_BYTES {
return Err(ForgeError::limit(format!(
"encoded envelope is {} bytes; max is {MAX_PAYLOAD_BYTES}; store large bodies in blob storage and reference them",
bytes.len()
)));
}
Ok(Bytes::from(bytes))
}
pub fn decode(bytes: &[u8]) -> Result<Self> {
let value: Self = serde_json::from_slice(bytes)
.map_err(|e| ForgeError::invalid(format!("could not decode queue envelope: {e}")))?;
value.validate()?;
if bytes.len() > MAX_PAYLOAD_BYTES {
return Err(ForgeError::limit(
"encoded envelope exceeds the queue payload limit",
));
}
Ok(value)
}
pub fn validate(&self) -> Result<()> {
if self.version != Self::VERSION {
return Err(ForgeError::invalid(format!(
"unsupported queue envelope version {}",
self.version
)));
}
check_metadata("schema", &self.schema, MAX_SCHEMA_BYTES)?;
check_metadata("content_type", &self.content_type, MAX_CONTENT_TYPE_BYTES)?;
if let Some(value) = &self.correlation_id {
check_metadata("correlation_id", value, MAX_CORRELATION_ID_BYTES)?;
}
if let Some(value) = &self.trace_context {
value.validate()?;
}
if self.artifacts.len() > MAX_ARTIFACT_REFS {
return Err(ForgeError::limit(format!(
"envelope has {} artifact references; max is {MAX_ARTIFACT_REFS}",
self.artifacts.len()
)));
}
for artifact in &self.artifacts {
check_metadata("artifact uri", &artifact.uri, 2048)?;
if let Some(value) = &artifact.content_type {
check_metadata("artifact content_type", value, MAX_CONTENT_TYPE_BYTES)?;
}
if let Some(value) = &artifact.version {
check_metadata("artifact version", value, 256)?;
}
}
Ok(())
}
}
fn check_metadata(name: &str, value: &str, max: usize) -> Result<()> {
if value.is_empty() {
return Err(ForgeError::invalid(format!("{name} must not be empty")));
}
if value.len() > max {
return Err(ForgeError::limit(format!(
"{name} is {} bytes; max is {max}",
value.len()
)));
}
Ok(())
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct JobId(pub Uuid);
impl JobId {
pub fn new() -> Self {
Self(Uuid::new_v4())
}
pub fn parse(value: &str) -> Result<Self> {
Uuid::parse_str(value)
.map(Self)
.map_err(|_| ForgeError::invalid("job id must be a UUID"))
}
}
impl Default for JobId {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for JobId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Backoff {
Exponential { base: Duration, cap: Duration },
}
impl Default for Backoff {
fn default() -> Self {
Self::Exponential {
base: Duration::from_secs(1),
cap: Duration::from_secs(300),
}
}
}
impl Backoff {
pub fn delay_for_attempt(&self, attempt: u32, seed: u64) -> Duration {
let n = attempt.max(1);
let Backoff::Exponential { base, cap } = self;
let factor = 1u64.checked_shl(n - 1).unwrap_or(u64::MAX);
let base_ms = duration_ms(*base)
.saturating_mul(factor)
.min(duration_ms(*cap));
let base_ms = base_ms.min(duration_ms(MAX_BACKOFF));
Duration::from_millis(jitter_ms(base_ms, seed))
}
}
const MAX_BACKOFF: Duration = Duration::from_secs(12 * 60 * 60);
fn duration_ms(d: Duration) -> u64 {
u64::try_from(d.as_millis()).unwrap_or(u64::MAX)
}
fn jitter_ms(base_ms: u64, seed: u64) -> u64 {
if base_ms == 0 {
return 0;
}
let r = seed
.wrapping_mul(6_364_136_223_846_793_005)
.wrapping_add(1_442_695_040_888_963_407);
let frac = (r >> 11) as f64 / (1u64 << 53) as f64;
let factor = 0.75 + 0.5 * frac; (base_ms as f64 * factor) as u64
}
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct EnqueueOpts {
pub delay: Duration,
pub max_attempts: u32,
pub dedup_id: Option<String>,
pub job_id: Option<JobId>,
pub trace_context: Option<TraceContext>,
pub priority: Priority,
pub concurrency_key: Option<String>,
}
impl Default for EnqueueOpts {
fn default() -> Self {
Self {
delay: Duration::ZERO,
max_attempts: 5,
dedup_id: None,
job_id: None,
trace_context: None,
priority: Priority::Normal,
concurrency_key: None,
}
}
}
impl EnqueueOpts {
pub fn new() -> Self {
Self::default()
}
pub fn with_delay(mut self, delay: Duration) -> Self {
self.delay = delay;
self
}
pub fn with_max_attempts(mut self, max_attempts: u32) -> Self {
self.max_attempts = max_attempts;
self
}
pub fn with_dedup_id(mut self, dedup_id: impl Into<String>) -> Self {
self.dedup_id = Some(dedup_id.into());
self
}
pub fn with_job_id(mut self, job_id: JobId) -> Self {
self.job_id = Some(job_id);
self
}
pub fn with_trace_context(mut self, trace_context: TraceContext) -> Self {
self.trace_context = Some(trace_context);
self
}
pub fn with_priority(mut self, priority: Priority) -> Self {
self.priority = priority;
self
}
pub fn with_concurrency_key(mut self, key: impl Into<String>) -> Self {
self.concurrency_key = Some(key.into());
self
}
}
#[derive(Debug, Clone)]
pub struct BatchEnqueueItem {
pub payload: Bytes,
pub opts: EnqueueOpts,
}
impl BatchEnqueueItem {
pub fn new(payload: impl Into<Bytes>, opts: EnqueueOpts) -> Self {
Self {
payload: payload.into(),
opts,
}
}
}
#[derive(Debug)]
pub struct BatchEnqueueResult {
pub job_id: Option<JobId>,
pub error: Option<ForgeError>,
}
impl BatchEnqueueResult {
fn from_result(result: Result<JobId>) -> Self {
match result {
Ok(job_id) => Self {
job_id: Some(job_id),
error: None,
},
Err(error) => Self {
job_id: None,
error: Some(error),
},
}
}
}
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct DequeueOpts {
pub wait: Duration,
pub visibility_timeout: Duration,
pub concurrency_limit_per_key: Option<u32>,
}
impl Default for DequeueOpts {
fn default() -> Self {
Self {
wait: Duration::from_secs(20),
visibility_timeout: Duration::from_secs(30),
concurrency_limit_per_key: None,
}
}
}
impl DequeueOpts {
pub fn new() -> Self {
Self::default()
}
pub fn with_wait(mut self, wait: Duration) -> Self {
self.wait = wait;
self
}
pub fn with_visibility_timeout(mut self, vt: Duration) -> Self {
self.visibility_timeout = vt;
self
}
pub fn with_concurrency_limit_per_key(mut self, limit: u32) -> Self {
self.concurrency_limit_per_key = Some(limit);
self
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Default)]
pub struct NackOpts {
pub retry_in: Option<Duration>,
pub failure_summary: Option<String>,
}
impl NackOpts {
pub fn retry_in(delay: Duration) -> Self {
Self {
retry_in: Some(delay),
failure_summary: None,
}
}
pub fn with_failure_summary(mut self, summary: impl Into<String>) -> Self {
self.failure_summary = Some(safe_failure_summary(summary.into()));
self
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RedriveDedupPolicy {
Clear,
Preserve,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RedriveOpts {
pub destination: String,
pub dedup_policy: RedriveDedupPolicy,
}
impl RedriveOpts {
pub fn new(destination: impl Into<String>, dedup_policy: RedriveDedupPolicy) -> Self {
Self {
destination: destination.into(),
dedup_policy,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeadLetterInfo {
pub job_id: JobId,
pub queue: String,
pub attempt_count: u32,
pub enqueued_at: SystemTime,
pub dead_lettered_at: SystemTime,
pub failure_summary: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeadLetterPage {
pub items: Vec<DeadLetterInfo>,
pub next_cursor: Option<crate::Cursor>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RedriveBatchResult {
pub redriven: u32,
pub next_cursor: Option<crate::Cursor>,
}
pub(crate) fn safe_failure_summary(mut value: String) -> String {
if value.len() <= MAX_FAILURE_SUMMARY_BYTES {
return value;
}
let mut end = MAX_FAILURE_SUMMARY_BYTES;
while !value.is_char_boundary(end) {
end -= 1;
}
value.truncate(end);
value
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Default)]
pub struct QueueDepth {
pub visible: u64,
pub in_flight: u64,
pub delayed: u64,
pub oldest_visible_age_ms: Option<u64>,
}
impl PartialEq for QueueDepth {
fn eq(&self, other: &Self) -> bool {
self.visible == other.visible
&& self.in_flight == other.in_flight
&& self.delayed == other.delayed
}
}
impl Eq for QueueDepth {}
impl QueueDepth {
pub fn new(visible: u64, in_flight: u64, delayed: u64) -> Self {
Self {
visible,
in_flight,
delayed,
oldest_visible_age_ms: None,
}
}
pub fn with_oldest_visible_age_ms(mut self, age: Option<u64>) -> Self {
self.oldest_visible_age_ms = age;
self
}
pub fn total(&self) -> u64 {
self.visible
.saturating_add(self.in_flight)
.saturating_add(self.delayed)
}
}
#[derive(Debug, Clone, Copy, Default, PartialEq)]
pub struct QueueStats {
pub enqueued_total: u64,
pub settled_total: u64,
pub dead_total: u64,
pub cancelled_total: u64,
pub enqueue_rate_per_minute: f64,
pub settle_rate_per_minute: f64,
pub oldest_visible_age_ms: Option<u64>,
pub paused: bool,
}
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct Job {
pub id: JobId,
pub queue: String,
pub payload: Bytes,
pub attempt: u32,
pub max_attempts: u32,
pub leased_until: SystemTime,
pub(crate) lease_token: Uuid,
pub trace_context: Option<TraceContext>,
pub cancellation: JobCancellation,
pub priority: Priority,
pub concurrency_key: Option<String>,
}
impl Job {
#[allow(clippy::too_many_arguments)]
pub fn new(
id: JobId,
queue: String,
payload: Bytes,
attempt: u32,
max_attempts: u32,
leased_until: SystemTime,
lease_token: Uuid,
) -> Self {
Self {
id,
queue,
payload,
attempt,
max_attempts,
leased_until,
lease_token,
trace_context: None,
cancellation: JobCancellation::default(),
priority: Priority::Normal,
concurrency_key: None,
}
}
pub fn with_trace_context(mut self, trace_context: Option<TraceContext>) -> Self {
self.trace_context = trace_context;
self
}
pub fn with_scheduling(mut self, priority: Priority, concurrency_key: Option<String>) -> Self {
self.priority = priority;
self.concurrency_key = concurrency_key;
self
}
pub fn lease_token(&self) -> Uuid {
self.lease_token
}
pub fn payload_json<T: DeserializeOwned>(&self) -> Result<T> {
serde_json::from_slice(&self.payload)
.map_err(|e| ForgeError::invalid(format!("could not deserialize payload: {e}")))
}
}
#[async_trait]
pub trait Queue: Send + Sync {
async fn enqueue(&self, queue: &str, payload: Bytes, opts: EnqueueOpts) -> Result<JobId>;
async fn enqueue_batch(
&self,
queue: &str,
items: Vec<BatchEnqueueItem>,
) -> Result<Vec<BatchEnqueueResult>> {
if items.is_empty() || items.len() > MAX_ENQUEUE_BATCH {
return Err(ForgeError::limit(format!(
"batch enqueue size must be in 1..={MAX_ENQUEUE_BATCH}"
)));
}
let mut results = Vec::with_capacity(items.len());
for item in items {
results.push(BatchEnqueueResult::from_result(
self.enqueue(queue, item.payload, item.opts).await,
));
}
Ok(results)
}
async fn dequeue(&self, queue: &str, opts: DequeueOpts) -> Result<Option<Job>>;
async fn dequeue_batch(
&self,
queue: &str,
max_items: usize,
opts: DequeueOpts,
) -> Result<Vec<Job>> {
if max_items == 0 || max_items > MAX_DEQUEUE_BATCH {
return Err(ForgeError::limit(format!(
"batch dequeue size must be in 1..={MAX_DEQUEUE_BATCH}"
)));
}
let mut jobs = Vec::with_capacity(max_items);
let mut next = opts;
for _ in 0..max_items {
let Some(job) = self.dequeue(queue, next.clone()).await? else {
break;
};
jobs.push(job);
next.wait = Duration::ZERO;
}
Ok(jobs)
}
async fn ack(&self, job: &Job) -> Result<()>;
async fn nack(&self, job: &Job, opts: NackOpts) -> Result<()>;
async fn heartbeat(&self, job: &Job) -> Result<()>;
async fn cancellation_requested(&self, job: &Job) -> Result<bool> {
let _ = job;
Ok(false)
}
async fn cancel(&self, id: JobId) -> Result<Option<JobStatus>> {
let _ = id;
Err(ForgeError::not_configured(
"queue backend does not implement cancellation",
))
}
async fn finish_cancellation(&self, job: &Job) -> Result<()> {
let _ = job;
Err(ForgeError::not_configured(
"queue backend does not implement cancellation",
))
}
async fn status(&self, id: JobId) -> Result<Option<JobStatus>> {
let _ = id;
Err(ForgeError::not_configured(
"queue backend does not implement status lookup",
))
}
async fn list_status(&self, filter: JobStatusFilter) -> Result<JobStatusPage> {
let _ = filter;
Err(ForgeError::not_configured(
"queue backend does not implement status listing",
))
}
async fn depth(&self, queue: &str) -> Result<QueueDepth>;
async fn pause(&self, queue: &str) -> Result<()> {
let _ = queue;
Err(ForgeError::not_configured(
"queue backend does not implement pause",
))
}
async fn resume(&self, queue: &str) -> Result<()> {
let _ = queue;
Err(ForgeError::not_configured(
"queue backend does not implement resume",
))
}
async fn is_paused(&self, queue: &str) -> Result<bool> {
let _ = queue;
Err(ForgeError::not_configured(
"queue backend does not implement pause inspection",
))
}
async fn stats(&self, queue: &str) -> Result<QueueStats> {
let _ = queue;
Err(ForgeError::not_configured(
"queue backend does not implement activity stats",
))
}
async fn dead_letters(
&self,
queue: &str,
cursor: Option<crate::Cursor>,
limit: u32,
) -> Result<DeadLetterPage> {
let _ = (queue, cursor, limit);
Err(ForgeError::not_configured(
"queue backend does not implement dead-letter inspection",
))
}
async fn redrive(&self, job_id: JobId, opts: RedriveOpts) -> Result<bool> {
let _ = (job_id, opts);
Err(ForgeError::not_configured(
"queue backend does not implement dead-letter redrive",
))
}
async fn redrive_batch(
&self,
queue: &str,
cursor: Option<crate::Cursor>,
limit: u32,
opts: RedriveOpts,
) -> Result<RedriveBatchResult> {
let _ = (queue, cursor, limit, opts);
Err(ForgeError::not_configured(
"queue backend does not implement batch redrive",
))
}
async fn purge_dead_letters_dry_run(&self, queue: &str) -> Result<u64> {
let _ = queue;
Err(ForgeError::not_configured(
"queue backend does not implement dead-letter purge",
))
}
async fn purge_dead_letters(&self, queue: &str, confirmation: &str) -> Result<u64> {
let _ = (queue, confirmation);
Err(ForgeError::not_configured(
"queue backend does not implement dead-letter purge",
))
}
}
#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::indexing_slicing, clippy::panic)]
mod tests {
use super::*;
#[test]
fn exponential_backoff_grows_and_caps() {
let b = Backoff::Exponential {
base: Duration::from_secs(1),
cap: Duration::from_secs(300),
};
let d1 = b.delay_for_attempt(1, 7).as_millis();
let d2 = b.delay_for_attempt(2, 7).as_millis();
let d3 = b.delay_for_attempt(3, 7).as_millis();
assert!((750..=1250).contains(&d1), "attempt1 ~1s, got {d1}ms");
assert!((1500..=2500).contains(&d2), "attempt2 ~2s, got {d2}ms");
assert!((3000..=5000).contains(&d3), "attempt3 ~4s, got {d3}ms");
let far = b.delay_for_attempt(40, 7).as_millis();
assert!(far <= 375_000, "capped at 300s + jitter, got {far}ms");
assert!(far >= 225_000, "capped near 300s, got {far}ms");
}
#[test]
fn backoff_respects_the_global_ceiling() {
let b = Backoff::Exponential {
base: Duration::from_secs(3600),
cap: Duration::from_secs(1000 * 3600),
};
let d = b.delay_for_attempt(999, 7).as_millis();
let ceiling_ms = (MAX_BACKOFF.as_millis() as f64 * 1.25) as u128;
assert!(d <= ceiling_ms, "capped at 12h + jitter, got {d}ms");
}
#[test]
fn high_attempt_does_not_panic_or_overflow() {
let b = Backoff::Exponential {
base: Duration::from_secs(1),
cap: Duration::from_secs(300),
};
let _ = b.delay_for_attempt(u32::MAX, 1);
}
#[test]
fn jitter_varies_with_seed_but_is_deterministic() {
let b = Backoff::Exponential {
base: Duration::from_secs(10),
cap: Duration::from_secs(300),
};
let a = b.delay_for_attempt(1, 1);
let a_again = b.delay_for_attempt(1, 1);
let other = b.delay_for_attempt(1, 999);
assert_eq!(a, a_again, "same seed => same delay");
assert_ne!(a, other, "different seed => (very likely) different delay");
}
#[test]
fn zero_base_stays_zero() {
let b = Backoff::Exponential {
base: Duration::ZERO,
cap: Duration::from_secs(300),
};
assert_eq!(b.delay_for_attempt(3, 42), Duration::ZERO);
}
}
pub mod worker;
mod memory;
mod postgres;
pub(crate) use memory::MemQueue;
pub(crate) use postgres::PgQueue;