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>
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,
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>
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,
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>
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,
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>
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> 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
Mutably borrows from an owned value. Read more