pub struct SqliteOutbox { /* private fields */ }Implementations§
Source§impl SqliteOutbox
impl SqliteOutbox
pub async fn open(path: impl AsRef<Path>) -> Result<Self, String>
pub fn pool(&self) -> &SqlitePool
pub fn path(&self) -> &Path
Sourcepub async fn create_snapshot(
&self,
destination: impl AsRef<Path>,
) -> Result<OutboxSnapshot, String>
pub async fn create_snapshot( &self, destination: impl AsRef<Path>, ) -> Result<OutboxSnapshot, String>
Create an immutable SQLite backup at destination.
VACUUM INTO runs against a consistent SQLite snapshot and includes
the WAL contents in the resulting file. The temporary file is synced
before an atomic rename so a crash cannot publish a partial backup.
pub fn verify_snapshot(snapshot: &OutboxSnapshot) -> Result<(), String>
Sourcepub fn restore_snapshot(
snapshot: &OutboxSnapshot,
destination: impl AsRef<Path>,
) -> Result<(), String>
pub fn restore_snapshot( snapshot: &OutboxSnapshot, destination: impl AsRef<Path>, ) -> Result<(), String>
Restore a verified snapshot before opening the live database.
pub async fn register_target(&self, target: &TargetId) -> Result<(), String>
pub async fn create_index_generation( &self, target: &TargetId, index_id: u64, generation: u64, snapshot_lsn: CommitLsn, ) -> Result<(), String>
pub async fn transition_generation_to_backfilling( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<(), String>
pub async fn transition_generation_to_catching_up( &self, target: &TargetId, index_id: u64, generation: u64, barrier_lsn: CommitLsn, ) -> Result<(), String>
pub async fn transition_generation_to_publishing( &self, target: &TargetId, index_id: u64, generation: u64, barrier_lsn: CommitLsn, ) -> Result<(), String>
pub async fn activate_generation( &self, target: &TargetId, index_id: u64, generation: u64, barrier_lsn: CommitLsn, ) -> Result<(), String>
pub async fn drain_generation( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<(), String>
pub async fn drop_generation( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<(), String>
pub async fn fail_generation( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<(), String>
pub async fn get_generation_state( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<Option<(String, Option<CommitLsn>)>, String>
pub async fn get_active_generation( &self, target: &TargetId, index_id: u64, ) -> Result<Option<u64>, String>
Sourcepub async fn list_index_generations(
&self,
target: &TargetId,
index_id: u64,
) -> Result<Vec<(u64, String)>, String>
pub async fn list_index_generations( &self, target: &TargetId, index_id: u64, ) -> Result<Vec<(u64, String)>, String>
List all known generations (with states) for one index. Used by the rebuild driver to detect and fail generations left behind by crashes.
Sourcepub async fn fetch_rebuild_events(
&self,
target: &TargetId,
index_id: u64,
after_lsn: CommitLsn,
upto_lsn: CommitLsn,
limit: u64,
) -> Result<Vec<RebuildEvent>, String>
pub async fn fetch_rebuild_events( &self, target: &TargetId, index_id: u64, after_lsn: CommitLsn, upto_lsn: CommitLsn, limit: u64, ) -> Result<Vec<RebuildEvent>, String>
Fetch materialized events for catch-up replay in a commit-LSN range. Status-agnostic on purpose: retried, dead-lettered, or skipped events in the range are replayed idempotently so the rebuilt index converges even when the live delivery plane degraded mid-rebuild.
pub async fn materialize_commit( &self, commit_lsn: CommitLsn, intents: &[OutboxIntent], targets: &[TargetId], ) -> Result<(), String>
pub async fn claim_next( &self, target: &TargetId, owner: &str, now_ms: u64, lease_duration_ms: u64, ) -> Result<Option<ClaimedEvent>, String>
pub async fn acknowledge(&self, event: &ClaimedEvent) -> Result<bool, String>
pub async fn retry( &self, event: &ClaimedEvent, next_attempt_at_ms: u64, error: &str, ) -> Result<bool, String>
pub async fn dead_letter( &self, event: &ClaimedEvent, failed_at_ms: u64, error: &str, ) -> Result<bool, String>
pub async fn requeue_dead_letter(&self, event_id: i64) -> Result<bool, String>
Sourcepub async fn requeue_dead_letters_batch(
&self,
target: Option<&TargetId>,
index_id: Option<u64>,
generation: Option<u64>,
limit: usize,
) -> Result<usize, String>
pub async fn requeue_dead_letters_batch( &self, target: Option<&TargetId>, index_id: Option<u64>, generation: Option<u64>, limit: usize, ) -> Result<usize, String>
Batch requeue dead letters filtered by target/index/generation. Returns number of events requeued.
pub async fn list_dead_letters( &self, target: Option<&TargetId>, index_id: Option<u64>, generation: Option<u64>, limit: usize, offset: usize, ) -> Result<Vec<DeadLetterRow>, String>
pub async fn list_degraded_ranges( &self, target: Option<&TargetId>, index_id: Option<u64>, generation: Option<u64>, ) -> Result<Vec<DegradedRangeRow>, String>
pub async fn clear_degraded_range( &self, target: &TargetId, index_id: u64, generation: u64, start_lsn: CommitLsn, end_lsn: CommitLsn, ) -> Result<bool, String>
pub async fn delivery_targets(&self) -> Result<Vec<TargetId>, String>
Sourcepub async fn stats(&self) -> Result<OutboxStats, String>
pub async fn stats(&self) -> Result<OutboxStats, String>
Return aggregate delivery statistics from the durable projection.
The in-memory transaction staging map is intentionally not used here: once a commit has crossed the WAL and SQLite materialization fences, SQLite is the source of truth for backlog, leases, retries, and dead-letter state.
pub async fn prune_applied_events( &self, retention_lsn: CommitLsn, ) -> Result<u64, String>
pub async fn retention_lsn(&self) -> Result<CommitLsn, String>
pub async fn update_retention_lsn( &self, retention_lsn: CommitLsn, ) -> Result<(), String>
Sourcepub async fn archive_dead_letters(
&self,
retention_lsn: CommitLsn,
) -> Result<u64, String>
pub async fn archive_dead_letters( &self, retention_lsn: CommitLsn, ) -> Result<u64, String>
Archive dead letters older than retention_lsn into dead_letters_archive and remove from events.
Sourcepub async fn prune_degraded_ranges(
&self,
max_age_ms: u64,
) -> Result<u64, String>
pub async fn prune_degraded_ranges( &self, max_age_ms: u64, ) -> Result<u64, String>
Prune degraded ranges older than max age.
Sourcepub async fn compute_safe_retention_lsn(
&self,
grace_lsn_distance: u64,
) -> Result<CommitLsn, String>
pub async fn compute_safe_retention_lsn( &self, grace_lsn_distance: u64, ) -> Result<CommitLsn, String>
Compute a safe retention LSN based on min applied frontier. Safe = min(target frontiers, index frontiers) - grace, at least 0.
pub async fn retry_count(&self, event_id: i64) -> Result<u64, String>
pub async fn materialized_lsn(&self) -> Result<CommitLsn, String>
pub async fn target_frontier( &self, target: &TargetId, ) -> Result<CommitLsn, String>
pub async fn index_frontier( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<CommitLsn, String>
pub async fn wait_for_minimum_lsn( &self, target: &TargetId, index_id: u64, generation: u64, minimum_lsn: CommitLsn, timeout_ms: u64, ) -> Result<bool, String>
pub async fn skip_event_degraded( &self, event: &ClaimedEvent, reason: &str, ) -> Result<bool, String>
pub async fn has_degraded_range( &self, target: &TargetId, index_id: u64, generation: u64, ) -> Result<bool, String>
pub async fn has_degraded_range_through( &self, target: &TargetId, index_id: u64, generation: u64, minimum_lsn: CommitLsn, ) -> Result<bool, String>
pub async fn dead_lettered_count( &self, target: &TargetId, ) -> Result<u64, String>
Sourcepub async fn diagnostics(&self) -> Result<SyncDiagnostics, String>
pub async fn diagnostics(&self) -> Result<SyncDiagnostics, String>
Return a single consistent view of outbox backlog, delivery frontiers, degraded ranges, and index-generation progress.
Trait Implementations§
Source§impl Clone for SqliteOutbox
impl Clone for SqliteOutbox
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteOutbox
impl !UnwindSafe for SqliteOutbox
impl Freeze for SqliteOutbox
impl Send for SqliteOutbox
impl Sync for SqliteOutbox
impl Unpin for SqliteOutbox
impl UnsafeUnpin for SqliteOutbox
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
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.