Class SnapshotChain
java.lang.Object
com.loomcache.server.persistence.SnapshotChain
A chain of snapshots: one full (base) snapshot followed by zero or more delta snapshots.
materialize() replays all deltas onto the base to produce a complete
StateMachineSnapshotManager.FullSnapshot suitable for restoration.
Delta ordering matters: deltas are applied in the order they were added (oldest first). Later deltas overwrite earlier ones for the same structure ID.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a snapshot chain with the given base snapshot and no deltas, using a dedicated defaultKryoSerializerfor map snapshot merging.SnapshotChain(StateMachineSnapshotManager.FullSnapshot base, KryoSerializer mapSnapshotSerializer) Create a snapshot chain sharing aKryoSerializerwith the rest of the server so that map snapshot merging sees the same registered classes. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDelta(DeltaSnapshot delta) Append a delta snapshot to this chain.intGet the number of deltas in this chain.Get an unmodifiable view of the deltas.Materialize the chain into a single full snapshot by applying all deltas to the base in order.
-
Constructor Details
-
SnapshotChain
Create a snapshot chain with the given base snapshot and no deltas, using a dedicated defaultKryoSerializerfor map snapshot merging. -
SnapshotChain
public SnapshotChain(StateMachineSnapshotManager.FullSnapshot base, KryoSerializer mapSnapshotSerializer) Create a snapshot chain sharing aKryoSerializerwith the rest of the server so that map snapshot merging sees the same registered classes.
-
-
Method Details
-
addDelta
Append a delta snapshot to this chain.Deltas must be added in chronological order.
- Parameters:
delta- the delta snapshot to append
-
materialize
Materialize the chain into a single full snapshot by applying all deltas to the base in order.For each delta:
- Changed structures overwrite or add entries in the result map
- Deleted structures are removed from the result map
- Returns:
- a new FullSnapshot representing the merged state
-
deltaCount
public int deltaCount()Get the number of deltas in this chain.- Returns:
- the delta count
-
getDeltas
Get an unmodifiable view of the deltas.- Returns:
- list of delta snapshots in order
-