pub struct RefLog { /* private fields */ }Expand description
The ref log of one repository.
Implementations§
Source§impl RefLog
impl RefLog
pub fn new(path: impl Into<PathBuf>) -> Self
Sourcepub fn next_push_seq(&self) -> Result<u64>
pub fn next_push_seq(&self) -> Result<u64>
The next push_seq this log should use: one past the highest already
recorded. Derived from the log itself, so a crashed writer that lost its
counter cannot reuse a sequence number and silently reorder history.
Sourcepub fn push(&self, updates: &[RefUpdate]) -> Result<u64>
pub fn push(&self, updates: &[RefUpdate]) -> Result<u64>
Append one push atomically. Returns the push_seq it was given.
Sourcepub fn append_batch(&self, batch: &RecordBatch) -> Result<u64>
pub fn append_batch(&self, batch: &RecordBatch) -> Result<u64>
Append an already-built push batch, whose push_seq the caller assigned.
For a server that holds its own counter: push re-derives
the sequence by rescanning the log, which is the safe default but is
O(log) per push. Returns the byte offset the frame starts at.
pub fn scan(&self) -> Result<PushLogScan>
Sourcepub fn compact(&self) -> Result<CompactionReport>
pub fn compact(&self) -> Result<CompactionReport>
Fold every frame into one. See PushLog::compact — rows and their
order are preserved, so fold answers identically before and after.
Sourcepub fn maybe_compact(
&self,
policy: CompactionPolicy,
) -> Result<Option<CompactionReport>>
pub fn maybe_compact( &self, policy: CompactionPolicy, ) -> Result<Option<CompactionReport>>
Compact if the log has grown past policy.
Sourcepub fn seal_section(&self) -> Result<ReservedSection>
pub fn seal_section(&self) -> Result<ReservedSection>
The reserved section to seal into the archive.