committed_meta

Function committed_meta 

Source
pub fn committed_meta(
    repo: impl Repo,
) -> Result<Option<Metadata>, SegmentMetadata>
Expand description

Extract the most recently written segment::Metadata from the commitlog in repo.

Returns None if the commitlog is empty.

Note that this function validates the most recent segment, which entails traversing it from the start.

The function can be used instead of the pattern:

let log = Commitlog::open(..)?;
let max_offset = log.max_committed_offset();

like so:

let max_offset = committed_meta(..)?.map(|meta| meta.tx_range.end);

Unlike open, no segment will be created in an empty repo.