Class CaptureSessionStore
java.lang.Object
com.shaft.capture.storage.CaptureSessionStore
Thread-safe start, append, checkpoint, stop, and interruption lifecycle for one capture file.
-
Constructor Summary
ConstructorsConstructorDescriptionCaptureSessionStore(Path path) Creates a store for one capture path.CaptureSessionStore(Path path, CaptureJsonCodec codec) Creates a store with an explicit codec. -
Method Summary
Modifier and TypeMethodDescriptionappend(CaptureEvent event) Appends an event and atomically publishes the updated session.append(CaptureEvent event, List<ExternalTestDataReference> references, RedactionSummary summary) Appends an event with privacy references and summary in one atomic snapshot.checkpoint(Checkpoint checkpoint) Adds a checkpoint and atomically publishes the updated session.checkpoint(Checkpoint checkpoint, RedactionSummary summary) Adds a checkpoint and its sanitized-text summary atomically.voiddiscard()Deletes the session file and forgets the in-memory snapshot, so an intentional discard can never be undone by the vanished-file self-heal.markIncomplete(Instant interruptedAt) Explicitly marks an interrupted session while keeping it readable.Returns the current network transactions derived from the on-disk session.longAtomically reserves and returns the next unique event sequence number for this session, based on the highest sequence currently persisted.read()Reads the latest complete file snapshot.voidstart(CaptureSession session) Starts and persists a new incomplete session.steps()Returns the current step list derived from the on-disk session, so the recorder UI can rehydrate its step list from the server instead of page-scoped storage across navigations.Completes and atomically publishes the session.updateEvents(UnaryOperator<List<CaptureEvent>> operation) Atomically rewrites the event list.
-
Constructor Details
-
CaptureSessionStore
Creates a store for one capture path.- Parameters:
path- session JSON path
-
CaptureSessionStore
Creates a store with an explicit codec.- Parameters:
path- session JSON pathcodec- capture codec
-
-
Method Details
-
start
Starts and persists a new incomplete session.- Parameters:
session- new incomplete session
-
append
Appends an event and atomically publishes the updated session.- Parameters:
event- event to append- Returns:
- updated session
-
append
public CaptureSession append(CaptureEvent event, List<ExternalTestDataReference> references, RedactionSummary summary) Appends an event with privacy references and summary in one atomic snapshot.- Parameters:
event- event to appendreferences- external references used by the eventsummary- safe privacy summary- Returns:
- updated session
-
nextSequence
public long nextSequence()Atomically reserves and returns the next unique event sequence number for this session, based on the highest sequence currently persisted. Intended for recorders (for exampleCaptureNetworkRecorder, viaManagedCaptureRecorder) that build aCaptureEventoff the mainCaptureEventPipelinethread and must still avoid colliding with its independently-assigned sequence numbers.- Returns:
- the next sequence number, one greater than the highest currently persisted
-
checkpoint
Adds a checkpoint and atomically publishes the updated session.- Parameters:
checkpoint- checkpoint to add- Returns:
- updated session
-
checkpoint
Adds a checkpoint and its sanitized-text summary atomically.- Parameters:
checkpoint- checkpoint to addsummary- safe privacy summary- Returns:
- updated session
-
updateEvents
Atomically rewrites the event list.- Parameters:
operation- event list rewrite- Returns:
- updated session
-
stop
Completes and atomically publishes the session.- Parameters:
stoppedAt- stop time- Returns:
- completed session
-
markIncomplete
Explicitly marks an interrupted session while keeping it readable.- Parameters:
interruptedAt- interruption time- Returns:
- incomplete interrupted session
-
discard
public void discard()Deletes the session file and forgets the in-memory snapshot, so an intentional discard can never be undone by the vanished-file self-heal.- Throws:
UncheckedIOException- when the file exists but could not be deleted
-
read
-
steps
Returns the current step list derived from the on-disk session, so the recorder UI can rehydrate its step list from the server instead of page-scoped storage across navigations.- Returns:
- ordered safe step summaries for every event carrying a client action ID
-
networkTransactions
Returns the current network transactions derived from the on-disk session.- Returns:
- ordered safe network transaction summaries
-