bankai/projections

AaronDB 4.2 projection adapter for Bankai’s committed Mnesia change source.

Mnesia remains the only task authority. This module owns no task state: it adapts the committed snapshot/tail to AaronDB’s durable-log, changefeed, and projection contracts, making offset, lag, duplicate-delivery, and failure state explicit for daemon diagnostics and query routing.

Types

pub type Health {
  Health(
    high_watermark: Int,
    history: projection.Status,
    text: projection.Status,
    vector_membership: projection.Status,
  )
}

Constructors

pub type RuntimeStatus {
  RuntimeStatus(
    healthy: Bool,
    high_watermark: Int,
    history_state: String,
    history_offset: Int,
    history_lag: Int,
    history_failure: String,
    text_state: String,
    text_offset: Int,
    text_lag: Int,
    text_failure: String,
    vector_state: String,
    vector_offset: Int,
    vector_lag: Int,
    vector_failure: String,
  )
}

Constructors

  • RuntimeStatus(
      healthy: Bool,
      high_watermark: Int,
      history_state: String,
      history_offset: Int,
      history_lag: Int,
      history_failure: String,
      text_state: String,
      text_offset: Int,
      text_lag: Int,
      text_failure: String,
      vector_state: String,
      vector_offset: Int,
      vector_lag: Int,
      vector_failure: String,
    )
pub type View {
  View(
    source: durable_log.DurableLog,
    history: projection.Projection,
    text: projection.Projection,
    vector_membership: projection.Projection,
  )
}

Constructors

Values

pub fn bootstrap(workspace: String) -> Result(View, String)

Rebuild an AaronDB durable-log image from Bankai’s Mnesia snapshot plus ordered tail. The source offsets must exactly match the Mnesia snapshot watermark; otherwise the projection refuses to appear fresh.

pub fn catch_up(
  view: View,
  workspace: String,
) -> Result(View, String)

Apply a tail after the last known offset. AaronDB projection semantics make repeated entries a no-op, preserving at-least-once replay safety.

pub fn empty(workspace: String) -> View
pub fn ensure_runtime(workspace: String) -> Result(Nil, String)

Advance the existing runtime view from its durable Mnesia change cursor. A daemon request sees a fully caught-up view or an explicit error, never an in-between index.

pub fn health(view: View) -> Health
pub fn healthy(view: View) -> Bool

A derived read is healthy only when all three projections have caught up to the committed source and carry no projection failure.

pub fn pull(
  view: View,
  cursor: Int,
  credits: Int,
) -> Result(List(durable_log.Entry), String)

Demonstrates the bounded-credit, resumable AaronDB feed contract used by daemon workers. credits must be positive; callers retain their own cursor.

pub fn reset_runtime_for_test(
  workspace: String,
) -> Result(Nil, String)
pub fn runtime_status(
  workspace: String,
) -> Result(RuntimeStatus, String)
pub fn start_runtime(workspace: String) -> Result(Nil, String)

Start the daemon-owned projection runtime. The FFI retains only a replayable AaronDB view; Mnesia remains the source for every rebuild.

Search Document