Class SnapshotChain

java.lang.Object
com.loomcache.server.persistence.SnapshotChain

public class SnapshotChain extends Object
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 Details

  • Method Details

    • addDelta

      public void addDelta(DeltaSnapshot delta)
      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

      public List<DeltaSnapshot> getDeltas()
      Get an unmodifiable view of the deltas.
      Returns:
      list of delta snapshots in order