aarondb/cluster_data_plane

cluster_data_plane — committed services composed behind one node boundary

This is the stateful library boundary used by a cluster runtime after Raft has supplied leader and quorum evidence. It never exposes a write before the corresponding consensus command has committed. Derived services consume the committed durable log and remain explicitly non-authoritative.

Types

pub type Error {
  WriteRejected(consensus.SubmitError)
  ReadRejected(consensus.ReadError)
  LeaseRejected(consensus.SubmitError)
  FeedRejected(changefeed.ChangefeedError)
  ProjectionRejected(projection.ProjectionError)
  IndexRejected(projection_index.Error)
}

Constructors

pub type State {
  State(
    consensus: consensus.State,
    log: durable_log.DurableLog,
    projection: projection.Projection,
    index: projection_index.Index,
    recovery: identity.RecoveryState,
  )
}

Constructors

Values

pub fn catch_up(state: State) -> Result(State, Error)

Builds both derived services from the committed source. If either boundary fails it remains visibly behind/degraded instead of answering from partial state.

pub fn lease(
  state: State,
  index: Int,
  replicated: Int,
  now: Int,
  request: consensus.LeaseCommand,
) -> Result(#(State, option.Option(consensus.Lease)), Error)
pub fn new(node: String, source: String) -> State

Starts a node-local data plane. Production adapters replace the initial single-node bootstrap with a persisted multi-voter Raft recovery image.

pub fn query_index(state: State) -> Result(List(String), Error)
pub fn read(
  state: State,
  read_index: Int,
  quorum_confirmed: Bool,
  key: String,
) -> Result(option.Option(String), Error)
pub fn rebuild_index(
  state: State,
  schema_version: Int,
) -> Result(State, Error)
pub fn resume_feed(
  state: State,
  cursor: Int,
  credit: Int,
) -> Result(changefeed.Changefeed, Error)
pub fn status(
  state: State,
  acknowledged: Int,
  follower_match_index: Int,
) -> operations.Status
pub fn validate_fence(
  state: State,
  resource: String,
  fence: Int,
) -> Result(Nil, Error)
pub fn write(
  state: State,
  index: Int,
  replicated: Int,
  request: command.CommandRequest,
) -> Result(#(State, command.CommandResult), Error)

Applies only a quorum-committed deterministic command, then appends its committed audit event. Retries retain the original command result and do not produce another log entry.

Search Document