Skip to main content

snapshot_ops

Function snapshot_ops 

pub fn snapshot_ops<S: State>(session: &S) -> Result<OpsBuf, TryReserveError>
Available on crate feature alloc only.
Expand description

Encodes the entire current state of session as a sequence of “store” ops.

This is the basis for file-journal compaction: the returned ops replay into an equivalent session, so a journal can be rewritten as one compact snapshot instead of a long history of mutations. Frame the result with encode_frames to produce the bytes to write.

§Errors

Returns TryReserveError if the buffer cannot grow.