aarondb/shared/state

Types

pub type Config {
  Config(
    parallel_threshold: Int,
    batch_size: Int,
    prefetch_enabled: Bool,
    zero_copy_threshold: Int,
  )
}

Constructors

  • Config(
      parallel_threshold: Int,
      batch_size: Int,
      prefetch_enabled: Bool,
      zero_copy_threshold: Int,
    )
pub type DbState {
  DbState(
    adapter: storage.StorageAdapter,
    eavt: dict.Dict(fact.EntityId, List(fact.Datom)),
    aevt: dict.Dict(String, List(fact.Datom)),
    avet: dict.Dict(String, dict.Dict(fact.Value, fact.EntityId)),
    latest_tx: Int,
    subscribers: List(process.Subject(List(fact.Datom))),
    schema: dict.Dict(String, fact.AttributeConfig),
    functions: dict.Dict(
      String,
      fn(DbState, Int, Int, List(fact.Value)) -> List(
        #(fact.Eid, String, fact.Value),
      ),
    ),
    composites: List(List(String)),
    reactive_actor: process.Subject(ReactiveMessage),
    followers: List(process.Pid),
    is_distributed: Bool,
    ets_name: option.Option(String),
    vec_index: vec_index.VecIndex,
    bm25_indices: dict.Dict(String, bm25.BM25Index),
    art_index: art.Art,
    registry: dict.Dict(String, IndexAdapter),
    extensions: dict.Dict(String, ExtensionInstance),
    predicates: dict.Dict(String, fn(fact.Value) -> Bool),
    stored_rules: List(ast.Rule),
    virtual_predicates: dict.Dict(String, VirtualAdapter),
    columnar_store: dict.Dict(String, List(internal.StorageChunk)),
    config: Config,
    query_history: List(QueryContext),
  )
}

Constructors

pub type ExtensionInstance {
  ExtensionInstance(
    adapter_name: String,
    attribute: String,
    data: dynamic.Dynamic,
  )
}

Constructors

  • ExtensionInstance(
      adapter_name: String,
      attribute: String,
      data: dynamic.Dynamic,
    )
pub type IndexAdapter {
  IndexAdapter(
    name: String,
    create: fn(String) -> dynamic.Dynamic,
    update: fn(dynamic.Dynamic, List(fact.Datom)) -> dynamic.Dynamic,
    search: fn(dynamic.Dynamic, IndexQuery, Float) -> List(
      fact.EntityId,
    ),
  )
}

Constructors

pub type IndexQuery {
  TextQuery(text: String)
  NumericRange(min: Float, max: Float)
  Custom(data: String)
}

Constructors

  • TextQuery(text: String)
  • NumericRange(min: Float, max: Float)
  • Custom(data: String)
pub type QueryContext {
  QueryContext(
    attributes: List(String),
    entities: List(fact.EntityId),
    timestamp: Int,
  )
}

Constructors

  • QueryContext(
      attributes: List(String),
      entities: List(fact.EntityId),
      timestamp: Int,
    )
pub type ReactiveMessage {
  Subscribe(
    query: ast.Query,
    attributes: List(String),
    subscriber: process.Subject(query_types.ReactiveDelta),
    initial_state: query_types.QueryResult,
  )
  Unsubscribe(
    subscriber: process.Subject(query_types.ReactiveDelta),
  )
  Notify(
    changed_attributes: List(String),
    current_state: DbState,
  )
}

Constructors

A local virtual predicate adapter.

The adapter runs synchronously inside the query actor. It must return either a complete ordered set of rows or a failure; it must not perform remote I/O or assume AaronDB can interrupt a blocked call.

pub type VirtualAdapter {
  VirtualAdapter(
    execute: fn(List(fact.Value)) -> Result(
      List(List(fact.Value)),
      VirtualAdapterError,
    ),
    max_rows: Int,
  )
}

Constructors

Typed result of running a bounded local virtual predicate adapter.

pub type VirtualAdapterError {
  InvalidVirtualRowLimit
  VirtualAdapterFailed(message: String)
  VirtualAdapterTimedOut
  VirtualRowLimitExceeded
}

Constructors

  • InvalidVirtualRowLimit
  • VirtualAdapterFailed(message: String)
  • VirtualAdapterTimedOut
  • VirtualRowLimitExceeded

Values

pub fn virtual_adapter(
  execute: fn(List(fact.Value)) -> Result(
    List(List(fact.Value)),
    VirtualAdapterError,
  ),
  max_rows: Int,
) -> Result(VirtualAdapter, VirtualAdapterError)
Search Document