pub struct JournalWriter { /* private fields */ }Expand description
An append handle over a single journal file.
The file is opened lazily on first append. The parent directory is fsynced
once on the first JournalWriter::sync when the file may have been freshly
created, so the file’s existence survives a crash.
Implementations§
Source§impl JournalWriter
impl JournalWriter
Sourcepub fn new(needs_parent_sync: bool) -> Self
pub fn new(needs_parent_sync: bool) -> Self
Create a writer. Set needs_parent_sync when the file may not exist yet, so
the parent directory is fsynced once the file is created.
Sourcepub fn append<C: FrameCodec>(
&mut self,
path: &Path,
record: &C::Record,
) -> Result<()>
pub fn append<C: FrameCodec>( &mut self, path: &Path, record: &C::Record, ) -> Result<()>
Append one record as a framed payload. Does not durably flush; pair with
JournalWriter::sync once per batch.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JournalWriter
impl RefUnwindSafe for JournalWriter
impl Send for JournalWriter
impl Sync for JournalWriter
impl Unpin for JournalWriter
impl UnsafeUnpin for JournalWriter
impl UnwindSafe for JournalWriter
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