pub struct TenantDovecote { /* private fields */ }Expand description
Ordinary SQLite operations restricted to one validated tenant.
Implementations§
Source§impl TenantDovecote
impl TenantDovecote
Sourcepub const fn pool(&self) -> &SqlitePool
pub const fn pool(&self) -> &SqlitePool
Borrows the underlying pool.
Sourcepub const fn busy_config(&self) -> BusyConfig
pub const fn busy_config(&self) -> BusyConfig
Returns this handle’s busy policy.
Sourcepub async fn check_schema(&self) -> Result<(), SchemaError>
pub async fn check_schema(&self) -> Result<(), SchemaError>
Verifies the installed schema.
§Errors
Returns an error for an unsupported backend, missing or incompatible migration markers, tables, constraints or indexes, or failed catalog reads.
Sourcepub async fn begin_write(
&self,
) -> Result<Transaction<'static, Sqlite>, EnqueueError>
pub async fn begin_write( &self, ) -> Result<Transaction<'static, Sqlite>, EnqueueError>
Begins a caller-owned writer transaction.
§Errors
Returns an error for invalid busy configuration or if the SQLite writer
reservation cannot be acquired within the configured busy budget.
Sourcepub async fn begin_enqueue(
&self,
) -> Result<Transaction<'static, Sqlite>, EnqueueError>
pub async fn begin_enqueue( &self, ) -> Result<Transaction<'static, Sqlite>, EnqueueError>
Alias for Self::begin_write.
§Errors
Returns an error for invalid busy configuration or if the SQLite writer
reservation cannot be acquired within the configured busy budget.
Sourcepub async fn enqueue<'c>(
&self,
tx: &mut Transaction<'c, Sqlite>,
event: NewEvent,
) -> Result<EnqueueOutcome, EnqueueError>
pub async fn enqueue<'c>( &self, tx: &mut Transaction<'c, Sqlite>, event: NewEvent, ) -> Result<EnqueueOutcome, EnqueueError>
Enqueues in a caller-owned transaction.
§Errors
Returns an identity conflict for different immutable content, a schema or backend incompatibility, invalid stored data, or a database error. The caller must roll back its transaction on failure; this method never commits it.
Sourcepub async fn import_for_migration<'c>(
&self,
tx: &mut Transaction<'c, Sqlite>,
event: NewEvent,
state: ImportedDeliveryState,
) -> Result<ImportOutcome, ImportError>
pub async fn import_for_migration<'c>( &self, tx: &mut Transaction<'c, Sqlite>, event: NewEvent, state: ImportedDeliveryState, ) -> Result<ImportOutcome, ImportError>
Imports one event and delivery state in a caller-owned transaction.
§Errors
Returns a conflict if existing immutable content or delivery history differs, or an error for unsupported history, incompatible schema, invalid stored data, or database failure. Roll back the caller-owned transaction on failure.
Sourcepub async fn finalize_pending_delivery_for_migration<'c>(
&self,
tx: &mut Transaction<'c, Sqlite>,
row_id: RowId,
delivered_at: OffsetDateTime,
) -> Result<FinalizeOutcome, FinalizeError>
pub async fn finalize_pending_delivery_for_migration<'c>( &self, tx: &mut Transaction<'c, Sqlite>, row_id: RowId, delivered_at: OffsetDateTime, ) -> Result<FinalizeOutcome, FinalizeError>
Finalizes one migration delivery in a caller-owned transaction.
§Errors
Returns an error for invalid occurrence time, conflicting or non-pending delivery history, incompatible schema, or database failure. The caller owns rollback and commit; a failed operation must not be committed.
Sourcepub async fn page(
&self,
after: Option<RowId>,
limit: Limit,
) -> Result<Vec<PagedEvent>, PageError>
pub async fn page( &self, after: Option<RowId>, limit: Limit, ) -> Result<Vec<PagedEvent>, PageError>
Reads one tenant page.
§Errors
Returns an error for incompatible schema, invalid stored event or delivery state, or a database failure. No delivery state is changed.
Sourcepub async fn begin_snapshot(&self) -> Result<SnapshotPager, PageError>
pub async fn begin_snapshot(&self) -> Result<SnapshotPager, PageError>
Begins one tenant snapshot.
§Errors
Returns an error if the backend cannot establish the required snapshot, the schema is incompatible, or a database operation fails.
Sourcepub async fn claim(
&self,
worker: WorkerId,
lease: Lease,
limit: Limit,
) -> Result<Vec<ClaimedEvent>, ClaimError>
pub async fn claim( &self, worker: WorkerId, lease: Lease, limit: Limit, ) -> Result<Vec<ClaimedEvent>, ClaimError>
Claims one tenant’s pending deliveries.
§Errors
Returns an error for incompatible backend or schema, invalid stored state, attempt-counter overflow, unavailable entropy, or database failure. The owned transaction is rolled back on pre-commit failure; an unknown commit requires recovery from durable state rather than assuming no claim occurred.
Sourcepub async fn renew(
&self,
row_id: RowId,
token: &ClaimToken,
lease: Lease,
) -> Result<(), MutationError>
pub async fn renew( &self, row_id: RowId, token: &ClaimToken, lease: Lease, ) -> Result<(), MutationError>
Renews one tenant claim.
§Errors
Returns LostClaim if the token no longer owns an unexpired claim, or an
error for invalid stored state, duration overflow, or database failure.
Sourcepub async fn ack(
&self,
row_id: RowId,
token: &ClaimToken,
) -> Result<(), MutationError>
pub async fn ack( &self, row_id: RowId, token: &ClaimToken, ) -> Result<(), MutationError>
Acknowledges one tenant claim.
§Errors
Returns LostClaim if the token no longer owns an unexpired claim, or an
error for invalid stored state or database failure. A lost commit response
requires durable-state recovery; delivery remains at least once.
Sourcepub async fn retry(
&self,
row_id: RowId,
token: &ClaimToken,
failure: &Failure,
delay: Delay,
) -> Result<(), MutationError>
pub async fn retry( &self, row_id: RowId, token: &ClaimToken, failure: &Failure, delay: Delay, ) -> Result<(), MutationError>
Retries one tenant claim.
§Errors
Returns LostClaim if the token no longer owns an unexpired claim, or an
error for invalid stored state, delay overflow, or database failure.
Sourcepub async fn release(
&self,
row_id: RowId,
token: &ClaimToken,
delay: Delay,
) -> Result<(), MutationError>
pub async fn release( &self, row_id: RowId, token: &ClaimToken, delay: Delay, ) -> Result<(), MutationError>
Releases one tenant claim.
§Errors
Returns LostClaim if the token no longer owns an unexpired claim, or an
error for invalid stored state, delay overflow, or database failure.
Sourcepub async fn quarantine(
&self,
row_id: RowId,
token: &ClaimToken,
reason: &QuarantineReason,
) -> Result<(), MutationError>
pub async fn quarantine( &self, row_id: RowId, token: &ClaimToken, reason: &QuarantineReason, ) -> Result<(), MutationError>
Quarantines one tenant claim.
§Errors
Returns LostClaim if the token no longer owns an unexpired claim, or an
error for invalid stored state or database failure.
Trait Implementations§
Source§impl Clone for TenantDovecote
impl Clone for TenantDovecote
Source§fn clone(&self) -> TenantDovecote
fn clone(&self) -> TenantDovecote
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TenantDovecote
impl !UnwindSafe for TenantDovecote
impl Freeze for TenantDovecote
impl Send for TenantDovecote
impl Sync for TenantDovecote
impl Unpin for TenantDovecote
impl UnsafeUnpin for TenantDovecote
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
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> ⓘ
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> ⓘ
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