pub trait JournalSource: Send {
// Required methods
fn open(&mut self) -> Result<(), UsnError>;
fn query(&mut self) -> Result<JournalView, UsnError>;
fn read_blocking(
&mut self,
buf: &mut Vec<u8>,
) -> Result<ReadOutcome, UsnError>;
fn journal_id(&self) -> u64;
fn next_usn(&self) -> i64;
fn set_next_usn(&mut self, usn: i64);
fn open_stat_fetcher(&self) -> Result<Box<dyn StatFetcher>, UsnError>;
}Expand description
One volume’s USN journal session, reopenable across journal-gone
rescans. open must succeed before any other method is called (the
worker guarantees this; implementations may panic otherwise — the
worker’s panic firewall turns that into a visible VolumeFailed).
Required Methods§
Sourcefn open(&mut self) -> Result<(), UsnError>
fn open(&mut self) -> Result<(), UsnError>
(Re)open the journal, creating it when missing. Positions the cursor at the journal’s current end. Called once per establish cycle: at start and after every journal-gone rescan.
Sourcefn query(&mut self) -> Result<JournalView, UsnError>
fn query(&mut self) -> Result<JournalView, UsnError>
Live journal identity/retention for checkpoint validation.
Sourcefn read_blocking(&mut self, buf: &mut Vec<u8>) -> Result<ReadOutcome, UsnError>
fn read_blocking(&mut self, buf: &mut Vec<u8>) -> Result<ReadOutcome, UsnError>
Blocking read of the next batch. Semantics the worker relies on:
blocks until records exist, then returns them and advances the
cursor past the batch; Gone when the journal died under us; Err
on an unrecoverable failure. An empty Records batch is a benign
wakeup — the worker re-checks its stop flag and reads again (fakes
use this to unblock on stop; the live read returns on the next
volume write, which is what keeps Engine::shutdown’s join prompt).
Sourcefn journal_id(&self) -> u64
fn journal_id(&self) -> u64
Journal id of the open session (checkpoint identity).
Sourcefn set_next_usn(&mut self, usn: i64)
fn set_next_usn(&mut self, usn: i64)
Reposition the cursor (a snapshot restore replays from its persisted checkpoint instead of the journal’s current end).
Sourcefn open_stat_fetcher(&self) -> Result<Box<dyn StatFetcher>, UsnError>
fn open_stat_fetcher(&self) -> Result<Box<dyn StatFetcher>, UsnError>
Size/mtime fetcher bound to the same volume, opened once per tail
session. Per-record stat calls were already dynamic (usn::apply).