Class CaptureSessionStore

java.lang.Object
com.shaft.capture.storage.CaptureSessionStore

public final class CaptureSessionStore extends Object
Thread-safe start, append, checkpoint, stop, and interruption lifecycle for one capture file.
  • Constructor Details

    • CaptureSessionStore

      public CaptureSessionStore(Path path)
      Creates a store for one capture path.
      Parameters:
      path - session JSON path
    • CaptureSessionStore

      public CaptureSessionStore(Path path, CaptureJsonCodec codec)
      Creates a store with an explicit codec.
      Parameters:
      path - session JSON path
      codec - capture codec
  • Method Details

    • start

      public void start(CaptureSession session)
      Starts and persists a new incomplete session.
      Parameters:
      session - new incomplete session
    • append

      public CaptureSession append(CaptureEvent event)
      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 append
      references - external references used by the event
      summary - safe privacy summary
      Returns:
      updated session
    • checkpoint

      public CaptureSession checkpoint(Checkpoint checkpoint)
      Adds a checkpoint and atomically publishes the updated session.
      Parameters:
      checkpoint - checkpoint to add
      Returns:
      updated session
    • checkpoint

      public CaptureSession checkpoint(Checkpoint checkpoint, RedactionSummary summary)
      Adds a checkpoint and its sanitized-text summary atomically.
      Parameters:
      checkpoint - checkpoint to add
      summary - safe privacy summary
      Returns:
      updated session
    • stop

      public CaptureSession stop(Instant stoppedAt)
      Completes and atomically publishes the session.
      Parameters:
      stoppedAt - stop time
      Returns:
      completed session
    • markIncomplete

      public CaptureSession markIncomplete(Instant interruptedAt)
      Explicitly marks an interrupted session while keeping it readable.
      Parameters:
      interruptedAt - interruption time
      Returns:
      incomplete interrupted session
    • read

      public CaptureSession read()
      Reads the latest complete file snapshot.
      Returns:
      current session