pub struct Position { /* private fields */ }Expand description
How far a session log has been read. The default is the start.
Serialize it to continue in another process.
Implementations§
Source§impl Position
impl Position
Sourcepub fn at_offset(path: impl AsRef<Path>, offset: u64) -> Result<Self>
pub fn at_offset(path: impl AsRef<Path>, offset: u64) -> Result<Self>
The position at a byte offset, counted without compression, such as
ChunkEntry::offset.
From a place inside an entry, reading starts at the next one. Reading
from an offset past the end gives Truncated, or Replaced if the log
has grown past it since.
This does not check that the log is the one the offset came from. Save the position instead of the offset to have later reads check that.
A compressed log is decompressed to find the position.
Sourcepub fn before_end(path: impl AsRef<Path>, bytes: u64) -> Result<Self>
pub fn before_end(path: impl AsRef<Path>, bytes: u64) -> Result<Self>
The position bytes before the end of a log, counted without
compression, or the start of a shorter log.
From a place inside an entry, reading starts at the next one, so there
may be nothing to read if the last entry is longer than bytes.
A compressed log is decompressed to find the position.