awa-model
Schema, types, and admin surface for the Awa
Postgres-native job queue. This is the foundation crate: every other
awa-* crate depends on it, and it owns the SQL migrations, the row
types, and the admin queries that back both the CLI and the web UI.
Most Rust applications should depend on the awa
facade rather than awa-model directly. Reach for this crate when you
need a smaller dependency footprint (e.g. an enqueue-only producer that
does not link the worker runtime), or when you are building tooling
against the admin API.
What's in here
- Job model —
JobRow,JobState,InsertOpts,UniqueOpts,InsertParams. - Insertion —
insert,insert_with,insert_many,insert_many_copy(COPY-batched for large fan-outs). - Migrations —
migrations::runapplies the schema;migrations,migrations_range, andcurrent_migration_versionexpose the catalog for tooling. - Admin (
admin) — retry, cancel (single, by unique key, bulk), pause/resume/drain queues, queue and job-kind overviews, runtime instance snapshots, dirty-key recompute, and descriptor sync (sync_queue_descriptors,sync_job_kind_descriptors,cleanup_stale_descriptors). - Dead Letter Queue (
dlq) —DlqRow,DlqMetadata,ListDlqFilter,RetryFromDlqOpts, list / retry / move / purge helpers backing theawa dlqCLI and the DLQ admin UI tab. - Cron (
cron) —PeriodicJob,PeriodicJobBuilder,CronJobRow. - Queue storage (
queue_storage) —QueueStorage,QueueStorageConfig,ClaimedRuntimeJob,RotateOutcome,PruneOutcome. The vacuum-aware engine introduced in 0.6. - Storage status (
storage) —StorageStatusand the transition-state primitives theawa storageCLI surfaces. - Bridge adapters (
bridge) —PreparedRowand friends used by the Python and tokio-postgres enqueue bridges. - Errors —
AwaError, the single error type shared across the workspace.
#[derive(JobArgs)] is re-exported from awa-macros
so applications get the macro automatically.
Example: enqueue-only producer
use ;
use ;
async
Versioning
awa-model is versioned in lockstep with the rest of the workspace.
Pin to the same minor version as awa and awa-worker if you depend
on multiple crates directly.
See also
- Architecture overview
- Migrations reference
- Configuration
- Dead Letter Queue
- ADR-019: queue storage engine
- ADR-022: descriptor catalog
License
MIT OR Apache-2.0