lightspeed/pipeline/checkpoint

Checkpoint and watermark contracts for deterministic pipeline replay.

Types

Persisted checkpoint entry for one stage transition.

pub type Checkpoint {
  Checkpoint(
    run_id: String,
    stage: String,
    sequence: Int,
    watermark: Watermark,
    idempotency_key: String,
    at_ms: Int,
  )
}

Constructors

  • Checkpoint(
      run_id: String,
      stage: String,
      sequence: Int,
      watermark: Watermark,
      idempotency_key: String,
      at_ms: Int,
    )

Resume point derived from a checkpoint chain.

pub type ResumePoint {
  ResumePoint(
    run_id: String,
    stage: String,
    sequence: Int,
    watermark: Watermark,
  )
}

Constructors

  • ResumePoint(
      run_id: String,
      stage: String,
      sequence: Int,
      watermark: Watermark,
    )

Replay-safe stage watermark.

pub type Watermark {
  Watermark(offset: Int, event_time_ms: Int)
}

Constructors

  • Watermark(offset: Int, event_time_ms: Int)

Values

pub fn chain_signature(entries: List(Checkpoint)) -> String

Stable checkpoint chain signature.

pub fn checkpoint(
  run_id: String,
  stage: String,
  sequence: Int,
  watermark: Watermark,
  idempotency_key: String,
  at_ms: Int,
) -> Checkpoint

Build one checkpoint.

pub fn checkpoint_label(entry: Checkpoint) -> String

Stable checkpoint label.

pub fn latest(
  entries: List(Checkpoint),
) -> option.Option(Checkpoint)

Latest checkpoint in chronological order.

pub fn latest_for_stage(
  entries: List(Checkpoint),
  stage: String,
) -> option.Option(Checkpoint)

Latest checkpoint for one stage.

pub fn resume_point_for_stage(
  entries: List(Checkpoint),
  stage: String,
) -> Result(ResumePoint, String)

Derive one resume point for a stage.

pub fn resume_point_label(point: ResumePoint) -> String

Stable resume-point label.

pub fn valid(entry: Checkpoint) -> Bool

Checkpoint invariants.

pub fn valid_watermark(mark: Watermark) -> Bool

Watermark invariants.

pub fn watermark(offset: Int, event_time_ms: Int) -> Watermark

Build one watermark.

pub fn watermark_label(mark: Watermark) -> String

Stable watermark label.

Search Document