Package com.google.genkit.ai.agent
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.
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 Summary
-
Method Details
-
apply
Applies the mutation.- Parameters:
existing- the existing snapshot, ornullif no snapshot exists yet- Returns:
- the snapshot to persist, or
nullto decline (no write performed)
-