Package com.tnsai.coordination.lifecycle
Class GroupCheckpoint
java.lang.Object
com.tnsai.coordination.lifecycle.GroupCheckpoint
Captures and persists snapshots of group state for recovery.
GroupCheckpoint provides a mechanism to serialize the current state of an
AgentGroup to disk and reload it later. This enables checkpoint-based
recovery where a group can be restored to a previously known good state.
Usage Example
// Capture a snapshot
GroupCheckpoint.Snapshot snapshot = GroupCheckpoint.capture(group);
// Save to disk
GroupCheckpoint.save(snapshot, Path.of("/tmp/group-checkpoint.json"));
// Load from disk
GroupCheckpoint.Snapshot loaded = GroupCheckpoint.load(Path.of("/tmp/group-checkpoint.json"));
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSnapshot of a group's state at a point in time. -
Method Summary
Modifier and TypeMethodDescriptionstatic GroupCheckpoint.Snapshotcapture(com.tnsai.agents.groups.AgentGroup group) Captures a snapshot of the current group state.static GroupCheckpoint.SnapshotLoads a snapshot from a JSON file.static voidsave(GroupCheckpoint.Snapshot snapshot, Path path) Saves a snapshot to a file in JSON format.
-
Method Details
-
capture
Captures a snapshot of the current group state.- Parameters:
group- the group to capture- Returns:
- snapshot of the group's current state
- Throws:
NullPointerException- if group is null
-
save
Saves a snapshot to a file in JSON format.- Parameters:
snapshot- the snapshot to savepath- the file path to write to- Throws:
IOException- if an I/O error occurs during writingNullPointerException- if snapshot or path is null
-
load
Loads a snapshot from a JSON file.- Parameters:
path- the file path to read from- Returns:
- the loaded snapshot
- Throws:
IOException- if an I/O error occurs during reading or the file is invalidNullPointerException- if path is null
-