Skip to main content

LogIndexTracker

Struct LogIndexTracker 

Source
pub struct LogIndexTracker<Op> { /* private fields */ }
Expand description

The default LogTracker: writes each entry into a single <prefix>__oplog table keyed by (peer_id, entry_idx), storing the HLC timestamp and the op’s decoded index key/value.

The (peer_id, entry_idx) primary key rejects a repeated index with a unique violation, rolling the whole apply back — so a reducer driven through this tracker is not required to be idempotent (see the duplicate-rejection contract).

Trait Implementations§

Source§

impl<Op: IndexableOp + Send + Sync> HistoryTracker<Op> for LogIndexTracker<Op>

Source§

fn read_entries<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, db: &'life1 dyn Db, peer_id: &'life2 Uuid, from: u64, limit: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, DecodedEntry<Op>)>, LogTrackerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Up to limit of peer_id’s entries at or after from, ascending (expunged markers included), reconstructed from stored rows.
Source§

impl<Op: IndexableOp + Send + Sync> LogTracker<Op> for LogIndexTracker<Op>

Source§

fn init<'life0, 'life1, 'async_trait>( db: &'life0 dyn Db, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Self, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize this tracker’s backing state, namespaced by prefix, and return an instance bound to it.
Source§

fn track_one( &self, peer_id: &Uuid, entry_idx: u64, timestamp: Timestamp, server_user_id: Option<Uuid>, op: &Op, batch: &mut dyn DbBatch, ) -> Result<(), LogTrackerError>

Record entry, identified by (peer_id, entry_idx), by enqueuing its writes into batch so they commit together with the rest of the entry’s application. Must not commit on its own.
Source§

fn all_cursors<'life0, 'life1, 'async_trait>( &'life0 self, db: &'life1 dyn Db, ) -> Pin<Box<dyn Future<Output = Result<PeerCursors, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Every peer’s cursor as a version vector; seeds a processor’s in-memory cursor view at open.
Source§

fn track_expunged( &self, peer_id: &Uuid, entry_idx: u64, hash: &Hash, batch: &mut dyn DbBatch, ) -> Result<(), LogTrackerError>

Record the expunged marker at (peer_id, entry_idx), naming the hash of the entry that was expunged, by enqueuing into batch. This occupies the stream index so the peer’s cursor advances past the gap without a real entry ever being applied there. Must not commit on its own.

Auto Trait Implementations§

§

impl<Op> Freeze for LogIndexTracker<Op>

§

impl<Op> RefUnwindSafe for LogIndexTracker<Op>
where Op: RefUnwindSafe,

§

impl<Op> Send for LogIndexTracker<Op>
where Op: Send,

§

impl<Op> Sync for LogIndexTracker<Op>
where Op: Sync,

§

impl<Op> Unpin for LogIndexTracker<Op>
where Op: Unpin,

§

impl<Op> UnsafeUnpin for LogIndexTracker<Op>

§

impl<Op> UnwindSafe for LogIndexTracker<Op>
where Op: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.