lightspeed/pipeline/operator

Operator control workflows for pause/resume/drain/replay orchestration.

Types

Operator action.

pub type Action {
  Pause(reason: String)
  Resume(reason: String)
  Drain(reason: String)
  Replay(from_stage: String, reason: String)
}

Constructors

  • Pause(reason: String)
  • Resume(reason: String)
  • Drain(reason: String)
  • Replay(from_stage: String, reason: String)

One operator audit event.

pub type AuditEvent {
  AuditEvent(
    action: Action,
    before: ControlState,
    after: ControlState,
    at_ms: Int,
  )
}

Constructors

Operator control state.

pub type ControlState {
  Running
  Paused(reason: String, at_ms: Int)
  Draining(reason: String, at_ms: Int)
  Replaying(from_stage: String, reason: String, at_ms: Int)
}

Constructors

  • Running
  • Paused(reason: String, at_ms: Int)
  • Draining(reason: String, at_ms: Int)
  • Replaying(from_stage: String, reason: String, at_ms: Int)

Runtime

opaque

Operator runtime.

pub opaque type Runtime

Values

pub fn action_label(action: Action) -> String

Action label.

pub fn apply(
  runtime: Runtime,
  action: Action,
  at_ms: Int,
) -> Result(Runtime, String)

Apply one operator action.

pub fn audit_event_label(event: AuditEvent) -> String

Audit-event label.

pub fn audits(runtime: Runtime) -> List(AuditEvent)

Audit events in application order.

pub fn can_enqueue(runtime: Runtime) -> Bool

Whether new work can be enqueued.

pub fn can_start_work(runtime: Runtime) -> Bool

Whether queued work can be started.

pub fn new() -> Runtime

Build one operator runtime.

pub fn signature(runtime: Runtime) -> String

Stable runtime signature.

pub fn state(runtime: Runtime) -> ControlState

Current control state.

pub fn state_label(state: ControlState) -> String

Control-state label.

pub fn valid(runtime: Runtime) -> Bool

Validate operator runtime invariants.

Search Document