Interface SnapshotMutator<S>

Type Parameters:
S - the type of custom session state
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SnapshotMutator<S>
The mutator for an atomic read-modify-write on a session snapshot.

Receives the existing snapshot (or null if none exists) and returns the snapshot to persist, or null to decline / no-op.

Contract: implementations MUST be pure functions — the store may retry the mutator on transient conflicts, so side effects are not safe.

  • Method Details

    • apply

      SessionSnapshot<S> apply(SessionSnapshot<S> existing)
      Applies the mutation.
      Parameters:
      existing - the existing snapshot, or null if no snapshot exists yet
      Returns:
      the snapshot to persist, or null to decline (no write performed)