pub struct AofWriter { /* private fields */ }Expand description
Buffered writer for appending AOF records to a file.
Implementations§
Source§impl AofWriter
impl AofWriter
Sourcepub fn open(path: impl Into<PathBuf>) -> Result<Self, FormatError>
pub fn open(path: impl Into<PathBuf>) -> Result<Self, FormatError>
Opens (or creates) an AOF file. If the file is new, writes the header. If the file already exists, appends to it.
Sourcepub fn write_record(&mut self, record: &AofRecord) -> Result<(), FormatError>
pub fn write_record(&mut self, record: &AofRecord) -> Result<(), FormatError>
Appends a record to the AOF. Writes tag+payload+crc32.
Sourcepub fn flush(&mut self) -> Result<(), FormatError>
pub fn flush(&mut self) -> Result<(), FormatError>
Flushes the internal buffer to the OS.
Sourcepub fn sync(&mut self) -> Result<(), FormatError>
pub fn sync(&mut self) -> Result<(), FormatError>
Flushes and fsyncs the file to disk.
Sourcepub fn truncate(&mut self) -> Result<(), FormatError>
pub fn truncate(&mut self) -> Result<(), FormatError>
Truncates the AOF file back to just the header. Used after a successful snapshot to reset the log.
Auto Trait Implementations§
impl Freeze for AofWriter
impl RefUnwindSafe for AofWriter
impl Send for AofWriter
impl Sync for AofWriter
impl Unpin for AofWriter
impl UnwindSafe for AofWriter
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