pub fn restore_cache_snapshot_and_replay_tail<B, F>(
cache: &mut Cache,
reader: &EventStoreReader<B>,
restore_snapshot: F,
) -> Result<CacheReplayReport, CacheReplayError>where
B: EventStore,
F: FnOnce(&mut Cache, Option<&SnapshotAnchor>) -> Result<(), CacheReplayError>,Expand description
Replays the cache snapshot tail after the caller restores the cache-owned snapshot blob.
The restore hook runs before the tail iterator is consumed. When anchor is Some,
the hook should fetch and apply the cache-owned blob identified by
SnapshotAnchor::blob_ref and validate it against
SnapshotAnchor::content_hash. When anchor is None, restore starts from
event-store seq 1 and the hook may be a no-op.
This is a bootstrap path: it mutates cache state directly and never publishes replay entries to the live message bus.
ยงErrors
Returns an error if:
- The reader fails.
- The
restore_snapshothook fails. - A supported payload cannot be decoded.
- The decoded payload cannot be applied to the cache.