aarondb/transactor

Types

pub type Message {
  Transact(
    List(#(fact.Eid, String, fact.Value)),
    option.Option(Int),
    process.Subject(Result(state.DbState, String)),
  )
  Retract(
    List(#(fact.Eid, String, fact.Value)),
    option.Option(Int),
    process.Subject(Result(state.DbState, String)),
  )
  GetState(process.Subject(state.DbState))
  SetSchema(
    String,
    fact.AttributeConfig,
    process.Subject(Result(Nil, String)),
  )
  RegisterFunction(
    String,
    fn(state.DbState, Int, Int, List(fact.Value)) -> List(
      #(fact.Eid, String, fact.Value),
    ),
    process.Subject(Nil),
  )
  RegisterPredicate(
    String,
    fn(fact.Value) -> Bool,
    process.Subject(Nil),
  )
  RegisterComposite(
    List(String),
    process.Subject(Result(Nil, String)),
  )
  StoreRule(ast.Rule, process.Subject(Result(Nil, String)))
  SetReactive(process.Subject(state.ReactiveMessage))
  Join(process.Pid)
  SyncDatoms(List(fact.Datom))
  RaftMsg(raft.RaftMessage)
  Compact(process.Subject(Nil))
  SetConfig(state.Config, process.Subject(Nil))
  Sync(process.Subject(Nil))
  Boot(
    option.Option(String),
    storage.StorageAdapter,
    process.Subject(Nil),
  )
  RegisterIndexAdapter(state.IndexAdapter, process.Subject(Nil))
  CreateIndex(
    String,
    String,
    String,
    process.Subject(Result(Nil, String)),
  )
  CreateBM25Index(String, process.Subject(Result(Nil, String)))
  Subscribe(process.Subject(List(fact.Datom)))
  Prune(Int, List(String), process.Subject(Int))
  RetractEntity(
    fact.EntityId,
    process.Subject(Result(state.DbState, String)),
  )
  Tick
  LogQuery(state.QueryContext, process.Subject(Nil))
}

Constructors

Values

pub fn compute_next_state(
  state: state.DbState,
  facts: List(#(fact.Eid, String, fact.Value)),
  valid_time: option.Option(Int),
  op: fact.Operation,
) -> Result(#(state.DbState, List(fact.Datom)), String)
pub fn get_state(subj: process.Subject(Message)) -> state.DbState
pub fn log_query(
  subj: process.Subject(Message),
  ctx: state.QueryContext,
) -> Nil
pub fn register_composite(
  subj: process.Subject(Message),
  attrs: List(String),
) -> Result(Nil, String)
pub fn register_function(
  subj: process.Subject(Message),
  name: String,
  func: fn(state.DbState, Int, Int, List(fact.Value)) -> List(
    #(fact.Eid, String, fact.Value),
  ),
) -> Nil
pub fn register_predicate(
  subj: process.Subject(Message),
  name: String,
  pred: fn(fact.Value) -> Bool,
) -> Nil
pub fn retract(
  subj: process.Subject(Message),
  facts: List(#(fact.Eid, String, fact.Value)),
) -> Result(state.DbState, String)
pub fn retract_entity(
  subj: process.Subject(Message),
  eid: fact.EntityId,
  reply: process.Subject(Result(state.DbState, String)),
) -> Nil
pub fn set_config(
  subj: process.Subject(Message),
  config: state.Config,
) -> Nil
pub fn set_schema(
  subj: process.Subject(Message),
  attr: String,
  config: fact.AttributeConfig,
) -> Result(Nil, String)
pub fn set_schema_with_timeout(
  subj: process.Subject(Message),
  attr: String,
  config: fact.AttributeConfig,
  timeout_ms: Int,
) -> Result(Nil, String)
pub fn start_distributed(
  name: String,
  store: storage.StorageAdapter,
) -> Result(process.Subject(Message), actor.StartError)
pub fn start_named(
  name: String,
  store: storage.StorageAdapter,
) -> Result(process.Subject(Message), actor.StartError)
pub fn start_with_timeout(
  store: storage.StorageAdapter,
  timeout_ms: Int,
) -> Result(process.Subject(Message), actor.StartError)
pub fn store_rule(
  subj: process.Subject(Message),
  rule: ast.Rule,
) -> Result(Nil, String)
pub fn subscribe(
  subj: process.Subject(Message),
) -> process.Subject(List(fact.Datom))
pub fn transact(
  subj: process.Subject(Message),
  facts: List(#(fact.Eid, String, fact.Value)),
) -> Result(state.DbState, String)
pub fn transact_with_timeout(
  subj: process.Subject(Message),
  facts: List(#(fact.Eid, String, fact.Value)),
  timeout_ms: Int,
) -> Result(state.DbState, String)
Search Document