Struct spacetimedb::db::message_log::MessageLog
source · pub struct MessageLog {
pub open_segment_max_offset: u64,
/* private fields */
}Fields§
§open_segment_max_offset: u64Implementations§
source§impl MessageLog
impl MessageLog
pub fn open(path: impl AsRef<Path>) -> Result<Self, DBError>
pub fn options() -> OpenOptions
pub fn reset_hard(&mut self) -> Result<(), DBError>
pub fn append(&mut self, message: impl AsRef<[u8]>) -> Result<(), DBError>
pub fn flush(&mut self) -> Result<(), DBError>
pub fn sync_all(&mut self) -> Result<(), DBError>
pub fn size(&self) -> u64
pub fn max_segment_size(&self) -> u64
pub fn get_root(&self) -> PathBuf
sourcepub fn segments(&self) -> Segments ⓘ
pub fn segments(&self) -> Segments ⓘ
Obtains an iterator over all segments in the log, in the order they were created.
The iterator represents a snapshot of the log at the time this method is called. That is, segments created after the method returns will not appear in the iteration. The last segment yielded by the iterator may be incomplete (i.e. still be appended to).
See also: MessageLog::segments_from
sourcepub fn segments_from(&self, offset: u64) -> Segments ⓘ
pub fn segments_from(&self, offset: u64) -> Segments ⓘ
Obtains an iterator over all segments containing messages equal to or
newer than offset.
offset counts all messages (not: bytes) in the log, starting from
zero.
Note that the first segment yielded by the iterator may contain messages with an offset smaller than the argument, as segments do not currently support slicing.
If offset is larger than the offset of any message already written to
the log, an empty iterator is returned.
The iterator represents a snapshot of the log at the time this method is called. That is, segments created after the method returns will not appear in the iteration. The last segment yielded by the iterator may be incomplete (i.e. still be appended to).