MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / adjust_initial_offset

Method adjust_initial_offset

crates/commitlog/src/commitlog.rs:828–839  ·  view source on GitHub ↗

If initial offset falls within a commit, adjust it to the commit boundary. Returns `true` if the initial offset is past `commit`. Returns `false` if `self` isn't `Self::Initial`, or the initial offset has been adjusted to the starting offset of `commit`. For iteration, `true` means to skip the commit, `false` to yield it.

(&mut self, commit: &StoredCommit)

Source from the content-addressed store, hash-verified

826 //
827 // For iteration, `true` means to skip the commit, `false` to yield it.
828 fn adjust_initial_offset(&mut self, commit: &StoredCommit) -> bool {
829 if let Self::Initial { next_offset } = self {
830 let last_tx_offset = commit.min_tx_offset + commit.n as u64 - 1;
831 if *next_offset > last_tx_offset {
832 return true;
833 } else {
834 *next_offset = commit.min_tx_offset;
835 }
836 }
837
838 false
839 }
840}
841
842pub struct Commits<R: Repo> {

Callers 1

next_commitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected