THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class documentation
class DatabaseQueueDriver(IQueueDriver): (source)
Constructor: DatabaseQueueDriver(connection, table)
Persist queued jobs using atomic conditional updates and expiring leases.
| Method | __init__ |
Bind the queue driver to a framework database connection. |
| Async Method | _ensure |
Create the queue table on first use. |
| Method | _ownership |
Require a current, unexpired reservation for a transition. |
| Async Method | clear |
Remove every job in one logical queue. |
| Async Method | close |
Leave the shared database connection under its manager's ownership. |
| Async Method | delete |
Acknowledge an owned reservation by removing its row. |
| Async Method | push |
Store an envelope for immediate or delayed consumption. |
| Async Method | release |
Release an owned reservation for another attempt. |
| Async Method | reserve |
Claim one eligible job in queue priority order. |
| Async Method | size |
Count ready, delayed, and reserved jobs in one queue. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _connection |
Undocumented |
| Instance Variable | _definition |
Undocumented |
| Instance Variable | _ready |
Undocumented |
| Instance Variable | _ready |
Undocumented |
Bind the queue driver to a framework database connection.
| Parameters | |
connection:IConnection | Shared framework connection used for queue persistence. |
table:str, optional | Logical table name, with the connection prefix applied by DB. |
| Returns | |
None | Complete the documented operation without returning a value. |
Require a current, unexpired reservation for a transition.
| Parameters | |
reserved:ReservedJob | Reservation whose ownership must still hold. |
| Returns | |
list of WhereClause | Predicates fencing reclaimed and expired reservations. |
Leave the shared database connection under its manager's ownership.
| Returns | |
None | Preserve the framework-managed connection lifecycle. |
Acknowledge an owned reservation by removing its row.
| Parameters | |
reserved:ReservedJob | Reservation owned by the acknowledging worker. |
| Returns | |
bool | Whether a current reservation was removed. |
Store an envelope for immediate or delayed consumption.
| Parameters | |
envelope:JobEnvelope | Immutable serialized job configuration and state. |
delay:float, optional | Seconds before the job becomes available. |
| Returns | |
str | Persisted job identifier. |
Release an owned reservation for another attempt.
| Parameters | |
reserved:ReservedJob | Reservation owned by the releasing worker. |
delay:float, optional | Seconds before the job becomes available again. |
| Returns | |
bool | Whether a current reservation was released. |
async def reserve(self, queues:
tuple[ str, ...], retry_after: float) -> ReservedJob | None:
(source)
¶
Claim one eligible job in queue priority order.
| Parameters | |
queues:tuple of str | Logical queues ordered from highest to lowest priority. |
retryfloat | Lease duration in seconds. |
| Returns | |
ReservedJob or None | Acquired reservation, or no available job. |
| Raises | |
QueueStorageError | If an ambient transaction would prevent committing the claim. |