pub struct FileRecorder<'a> {
pub last_rn: u32,
/* private fields */
}Expand description
recorder for one file
Fields§
§last_rn: u32number of the last record written (relative to the first_rec_num)
Implementations§
Source§impl<'a> FileRecorder<'_>
impl<'a> FileRecorder<'_>
Sourcepub fn new(
path: &Path,
first_rec_num: u64,
max_num_segments: u32,
max_nrps: u32,
) -> Result<Self>
pub fn new( path: &Path, first_rec_num: u64, max_num_segments: u32, max_nrps: u32, ) -> Result<Self>
Create a new file recorder
§Arguments
path- The path of the file to be recorded.first_rec_num- The first record number. Al the record numbers in the file are relative to this onemax_num_seg- The maximum number of segments that can be stored in the file. This determines the size of the headermax_nrps- The maximum number of records per segment
Sourcepub fn append(&mut self, rn: u64, msg: &[u8], is_pdef: bool) -> Result<()>
pub fn append(&mut self, rn: u64, msg: &[u8], is_pdef: bool) -> Result<()>
append the record to the end of the file
pub fn is_full(&self) -> bool
pub fn flush(&mut self) -> Result<()>
Trait Implementations§
Source§impl<'a> Drop for FileRecorder<'_>
impl<'a> Drop for FileRecorder<'_>
Auto Trait Implementations§
impl<'a> !UnwindSafe for FileRecorder<'a>
impl<'a> Freeze for FileRecorder<'a>
impl<'a> RefUnwindSafe for FileRecorder<'a>
impl<'a> Send for FileRecorder<'a>
impl<'a> Sync for FileRecorder<'a>
impl<'a> Unpin for FileRecorder<'a>
impl<'a> UnsafeUnpin for FileRecorder<'a>
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