pub struct EventJournal { /* private fields */ }Expand description
Append-only writer for the change-feed journal.
Implementations§
Source§impl EventJournal
impl EventJournal
Sourcepub fn open(dir: PathBuf) -> Result<(EventJournal, u64), Error>
pub fn open(dir: PathBuf) -> Result<(EventJournal, u64), Error>
Open (or create) the journal directory and recover the max seq seen.
Returns the writer plus the recovered max seq (0 for a fresh journal), which the caller uses to seed the sequence counter.
Sourcepub fn open_with_threshold(
dir: PathBuf,
rotate_threshold: u64,
) -> Result<(EventJournal, u64), Error>
pub fn open_with_threshold( dir: PathBuf, rotate_threshold: u64, ) -> Result<(EventJournal, u64), Error>
Like Self::open but with a custom rotation threshold (bytes). A small
threshold forces one file per event, which retention/resume tests use to
build a multi-file journal deterministically.
Sourcepub fn append(&mut self, ce: &ChangeEvent) -> Result<(), Error>
pub fn append(&mut self, ce: &ChangeEvent) -> Result<(), Error>
Append one change event as a JSON line, rotating first if needed.
The line is flushed immediately: change events are low-volume, and
flushing keeps concurrent /stream replays able to read the latest
line without waiting on a timer.
Auto Trait Implementations§
impl Freeze for EventJournal
impl RefUnwindSafe for EventJournal
impl Send for EventJournal
impl Sync for EventJournal
impl Unpin for EventJournal
impl UnsafeUnpin for EventJournal
impl UnwindSafe for EventJournal
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