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

Function reset_to

crates/commitlog/src/commitlog.rs:700–703  ·  view source on GitHub ↗

Remove all data past the given transaction `offset`. The function deletes log segments starting from the newest. As multiple segments cannot be deleted atomically, the log may be left longer than `offset` if the function does not return successfully. If the function returns successfully, the most recent [`Commit`] in the log will contain the transaction at `offset`. The log must be re-opened if

(repo: &impl Repo, offset: u64)

Source from the content-addressed store, hash-verified

698///
699/// The log must be re-opened if it is to be used after calling this function.
700pub fn reset_to(repo: &impl Repo, offset: u64) -> io::Result<()> {
701 let segments = repo.existing_offsets()?;
702 reset_to_internal(repo, &segments, offset)
703}
704
705fn reset_to_internal(repo: &impl Repo, segments: &[u64], offset: u64) -> io::Result<()> {
706 for segment in segments.iter().copied().rev() {

Callers

nothing calls this directly

Calls 2

reset_to_internalFunction · 0.85
existing_offsetsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…