pub struct FileJournal { /* private fields */ }Expand description
On-disk journal format (per node, one file per channel or a single multiplexed file).
Record: u32 channel_id ‖ u64 seq ‖ u32 len ‖ [len] payload (little-endian).
Append-only; readers scan from the start (or from a cached offset index).
Implementations§
Source§impl FileJournal
impl FileJournal
pub fn open(path: impl Into<PathBuf>) -> Result<Self, JournalError>
pub fn path(&self) -> &Path
Sourcepub fn append(
&self,
channel_id: u32,
payload: &[u8],
) -> Result<u64, JournalError>
pub fn append( &self, channel_id: u32, payload: &[u8], ) -> Result<u64, JournalError>
Append a payload; returns the assigned seq.
pub fn replay_after( &self, channel_id: u32, after: u64, limit: usize, ) -> Result<Vec<JournalEntry>, JournalError>
Sourcepub fn reply_body(
&self,
channel_id: u32,
after: u64,
limit: usize,
) -> Result<JournalReplyBody, JournalError>
pub fn reply_body( &self, channel_id: u32, after: u64, limit: usize, ) -> Result<JournalReplyBody, JournalError>
Build a wire reply body for an uplink JournalReq.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileJournal
impl RefUnwindSafe for FileJournal
impl Send for FileJournal
impl Sync for FileJournal
impl Unpin for FileJournal
impl UnsafeUnpin for FileJournal
impl UnwindSafe for FileJournal
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