pub struct LogReader { /* private fields */ }Implementations§
Source§impl LogReader
impl LogReader
Sourcepub fn new(
file: Rc<RefCell<dyn SequentialFile>>,
reporter: Rc<RefCell<dyn LogReaderReporter>>,
checksum: bool,
initial_offset: u64,
) -> LogReader
pub fn new( file: Rc<RefCell<dyn SequentialFile>>, reporter: Rc<RefCell<dyn LogReaderReporter>>, checksum: bool, initial_offset: u64, ) -> LogReader
| Create a reader that will return log records | from “*file”. “*file” must remain live while | this Reader is in use. | | If “reporter” is non-null, it is notified | whenever some data is dropped due to | a detected corruption. “*reporter” must | remain live while this Reader is in use. | | If “checksum” is true, verify checksums if | available. | | The Reader will start reading at the first | record located at physical position >= | initial_offset within the file.
Sourcepub fn skip_to_initial_block(&mut self) -> bool
pub fn skip_to_initial_block(&mut self) -> bool
| Skips all blocks that are completely before | “initial_offset_”. | | Returns true on success. Handles reporting.
Sourcepub fn read_record(&mut self, record: *mut Slice, scratch: *mut String) -> bool
pub fn read_record(&mut self, record: *mut Slice, scratch: *mut String) -> bool
| Read the next record into *record. Returns | true if read successfully, false if we hit | end of the input. May use “*scratch” as | temporary storage. The contents filled in | *record will only be valid until the next | mutating operation on this reader or the next | mutation to *scratch.
Sourcepub fn last_record_offset(&mut self) -> u64
pub fn last_record_offset(&mut self) -> u64
| Returns the physical offset of the last | record returned by ReadRecord. | | Undefined before the first call to | ReadRecord.
Sourcepub fn report_corruption(&mut self, bytes: u64, reason: *const u8)
pub fn report_corruption(&mut self, bytes: u64, reason: *const u8)
| Reports dropped bytes to the reporter. | buffer_ must be updated to remove the | dropped bytes prior to invocation. |
pub fn report_drop(&mut self, bytes: u64, reason: &Status)
Sourcepub fn read_physical_record(&mut self, result: *mut Slice) -> u32
pub fn read_physical_record(&mut self, result: *mut Slice) -> u32
| Return type, or one of the preceding | special values |