Class CheckpointStore
-
- All Implemented Interfaces:
public final class CheckpointStoreResumable transfer checkpoints with conditional writes (HEL-236 scenario 4).
Design: checkpoints are an APPEND-ONLY sequence of immutable objects (
<prefix>/checkpoint-<seq>.json), each created with WriteCondition.IfAbsent. Advancing means creating sequencelatest + 1; when two workers race, exactly one create succeeds and the loser gets a PreconditionFailedException — it must reload latest and re-plan, so concurrent workers can never silently overwrite each other's progress. Deliberately built on CONDITIONAL_CREATE only (universally the best-supported conditional primitive across S3-compatible providers) rather than etag-If-Match update-in-place.The payload is caller-defined (Checkpoint.data); keep it a POSITION (keys, offsets, watermarks) — never row values or credentials.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCheckpointStore.Checkpoint
-
Constructor Summary
Constructors Constructor Description CheckpointStore(ObjectStore store, String prefix, Clock clock)
-
Method Summary
Modifier and Type Method Description final CheckpointStore.Checkpointlatest()The newest committed checkpoint, or null when none exists yet. final CheckpointStore.Checkpointsave(String data, Long expectedSequence)Commit the next checkpoint. -
-
Constructor Detail
-
CheckpointStore
CheckpointStore(ObjectStore store, String prefix, Clock clock)
-
-
Method Detail
-
latest
final CheckpointStore.Checkpoint latest()
The newest committed checkpoint, or null when none exists yet.
-
save
final CheckpointStore.Checkpoint save(String data, Long expectedSequence)
Commit the next checkpoint. expectedSequence is the fence: pass the sequence you resumed from (or null for "first checkpoint") and the write lands at
expectedSequence + 1— if another worker got there first this throws PreconditionFailedException WITHOUT touching its progress.
-
-
-
-