aarondb
Types
pub type BodyClause =
ast.BodyClause
pub type Db =
process.Subject(transactor.Message)
pub type DbState =
state.DbState
pub type DiffScanError {
InvalidDiffRange
InvalidDiffScanLimit
DiffScanBudgetExceeded
}
Constructors
-
InvalidDiffRange -
InvalidDiffScanLimit -
DiffScanBudgetExceeded
Explicit limits for a local transaction-history diff scan.
max_datoms is a hard upper bound: bounded diffs return an error rather
than a partial change set when the current local history exceeds it.
pub type DiffScanLimits {
DiffScanLimits(max_datoms: Int)
}
Constructors
-
DiffScanLimits(max_datoms: Int)
pub type PullPattern =
List(ast.PullItem)
pub type PullResult =
query_types.PullResult
pub type QueryResult =
query_types.QueryResult
pub type SpeculativeResult {
SpeculativeResult(
state: state.DbState,
datoms: List(fact.Datom),
)
}
Constructors
-
SpeculativeResult(state: state.DbState, datoms: List(fact.Datom))
pub type TemporalScanError {
InvalidTemporalScanLimit
TemporalScanBudgetExceeded
}
Constructors
-
InvalidTemporalScanLimit -
TemporalScanBudgetExceeded
Explicit limits for a local temporal history scan.
max_datoms is a hard upper bound: bounded APIs return an error rather
than a partial answer when the current local history exceeds it.
pub type TemporalScanLimits {
TemporalScanLimits(max_datoms: Int)
}
Constructors
-
TemporalScanLimits(max_datoms: Int)
Values
pub fn as_of(
db: process.Subject(transactor.Message),
tx: Int,
q_clauses: List(ast.BodyClause),
) -> query_types.QueryResult
pub fn as_of_bitemporal(
db: process.Subject(transactor.Message),
tx: Int,
valid_time: Int,
q_clauses: List(ast.BodyClause),
) -> query_types.QueryResult
pub fn as_of_bitemporal_bounded(
db: process.Subject(transactor.Message),
tx: Int,
valid_time: Int,
q_clauses: List(ast.BodyClause),
limits: TemporalScanLimits,
) -> Result(query_types.QueryResult, TemporalScanError)
Runs a bitemporal snapshot after checking the local history scan budget.
pub fn as_of_bounded(
db: process.Subject(transactor.Message),
tx: Int,
q_clauses: List(ast.BodyClause),
limits: TemporalScanLimits,
) -> Result(query_types.QueryResult, TemporalScanError)
pub fn as_of_valid(
db: process.Subject(transactor.Message),
valid_time: Int,
q_clauses: List(ast.BodyClause),
) -> query_types.QueryResult
pub fn as_of_valid_bounded(
db: process.Subject(transactor.Message),
valid_time: Int,
q_clauses: List(ast.BodyClause),
limits: TemporalScanLimits,
) -> Result(query_types.QueryResult, TemporalScanError)
Runs a valid-time snapshot after checking the local history scan budget.
pub fn connect(
name: String,
) -> Result(process.Subject(transactor.Message), String)
pub fn diff(
db: process.Subject(transactor.Message),
from_tx: Int,
to_tx: Int,
) -> List(fact.Datom)
Returns all local datoms committed in (from_tx, to_tx].
This compatibility API has no scan budget and may return index-dependent
order. Use diff_bounded for a typed, deterministically ordered result.
pub fn diff_bounded(
db: process.Subject(transactor.Message),
from_tx: Int,
to_tx: Int,
limits: DiffScanLimits,
) -> Result(List(fact.Datom), DiffScanError)
Returns a complete, transaction-ordered diff for (from_tx, to_tx] or a
typed error. The bounded API never returns a partial change set.
pub fn diff_scan_limits(
max_datoms: Int,
) -> Result(DiffScanLimits, DiffScanError)
pub fn execute(
db: process.Subject(transactor.Message),
query: ast.Query,
) -> query_types.QueryResult
pub fn explain_speculation(
res: Result(SpeculativeResult, String),
) -> String
Provides a human-readable explanation of a speculative result or failure.
pub fn get(
db: process.Subject(transactor.Message),
eid: fact.Eid,
attr: String,
) -> List(fact.Value)
pub fn get_one(
db: process.Subject(transactor.Message),
eid: fact.Eid,
attr: String,
) -> Result(fact.Value, Nil)
pub fn get_state(
db: process.Subject(transactor.Message),
) -> state.DbState
pub fn history(
db: process.Subject(transactor.Message),
eid: fact.Eid,
) -> List(fact.Datom)
pub fn new() -> process.Subject(transactor.Message)
Compatibility constructor. This convenience API returns a Db directly
and therefore cannot report actor startup failures. New integrations should
call start_link/2 and handle its Result instead.
pub fn new_with_adapter(
adapter: option.Option(storage.StorageAdapter),
) -> process.Subject(transactor.Message)
pub fn new_with_adapter_and_timeout(
adapter: option.Option(storage.StorageAdapter),
timeout_ms: Int,
) -> process.Subject(transactor.Message)
pub fn p(triple: #(ast.Part, String, ast.Part)) -> ast.BodyClause
pub fn prune(
db: process.Subject(transactor.Message),
threshold: Int,
sovereign: List(String),
) -> Int
pub fn pull(
db: process.Subject(transactor.Message),
eid: fact.Eid,
pattern: List(ast.PullItem),
) -> query_types.PullResult
pub fn pull_all() -> List(ast.PullItem)
pub fn pull_attr(attr: String) -> List(ast.PullItem)
pub fn pull_except(
exclusions: List(String),
) -> List(ast.PullItem)
pub fn pull_recursive(
attr: String,
depth: Int,
) -> List(ast.PullItem)
pub fn q(
db: process.Subject(transactor.Message),
q_builder: q.QueryBuilder,
) -> query_types.QueryResult
pub fn query(
db: process.Subject(transactor.Message),
q_clauses: List(ast.BodyClause),
) -> query_types.QueryResult
pub fn query_at(
db: process.Subject(transactor.Message),
q_clauses: List(ast.BodyClause),
as_of_tx: option.Option(Int),
as_of_valid: option.Option(Int),
) -> query_types.QueryResult
pub fn query_state(
state: state.DbState,
q_clauses: List(ast.BodyClause),
) -> query_types.QueryResult
pub fn query_state_at(
state: state.DbState,
q_clauses: List(ast.BodyClause),
as_of_tx: option.Option(Int),
as_of_valid: option.Option(Int),
) -> query_types.QueryResult
pub fn query_state_with_rules(
state: state.DbState,
q_clauses: List(ast.BodyClause),
rules: List(ast.Rule),
) -> query_types.QueryResult
pub fn query_with_rules(
db: process.Subject(transactor.Message),
q_clauses: List(ast.BodyClause),
rules: List(ast.Rule),
) -> query_types.QueryResult
pub fn register_composite(
db: process.Subject(transactor.Message),
attrs: List(String),
) -> Result(Nil, String)
pub fn register_composite_with_timeout(
db: process.Subject(transactor.Message),
attrs: List(String),
timeout_ms: Int,
) -> Result(Nil, String)
pub fn register_function(
db: process.Subject(transactor.Message),
name: String,
func: fn(state.DbState, Int, Int, List(fact.Value)) -> List(
#(fact.Eid, String, fact.Value),
),
) -> Nil
pub fn register_function_with_timeout(
db: process.Subject(transactor.Message),
name: String,
func: fn(state.DbState, Int, Int, List(fact.Value)) -> List(
#(fact.Eid, String, fact.Value),
),
timeout_ms: Int,
) -> Result(Nil, String)
pub fn register_predicate(
db: process.Subject(transactor.Message),
name: String,
pred: fn(fact.Value) -> Bool,
) -> Nil
Compatibility registration helper. This function cannot surface an
actor timeout. New integrations should use register_predicate_with_timeout/4.
pub fn register_predicate_with_timeout(
db: process.Subject(transactor.Message),
name: String,
pred: fn(fact.Value) -> Bool,
timeout_ms: Int,
) -> Result(Nil, String)
pub fn retract(
db: process.Subject(transactor.Message),
facts: List(#(fact.Eid, String, fact.Value)),
) -> Result(state.DbState, String)
pub fn retract_at(
db: process.Subject(transactor.Message),
facts: List(#(fact.Eid, String, fact.Value)),
valid_time: Int,
) -> Result(state.DbState, String)
pub fn retract_entity(
db: process.Subject(transactor.Message),
eid: fact.Eid,
) -> Result(state.DbState, String)
pub fn set_config(
db: process.Subject(transactor.Message),
config: state.Config,
) -> Nil
pub fn set_config_with_timeout(
db: process.Subject(transactor.Message),
config: state.Config,
timeout_ms: Int,
) -> Result(Nil, String)
pub fn set_schema(
db: process.Subject(transactor.Message),
attr: String,
config: fact.AttributeConfig,
) -> Result(Nil, String)
pub fn set_schema_with_timeout(
db: process.Subject(transactor.Message),
attr: String,
config: fact.AttributeConfig,
timeout_ms: Int,
) -> Result(Nil, String)
pub fn start_distributed(
name: String,
adapter: option.Option(storage.StorageAdapter),
) -> Result(process.Subject(transactor.Message), actor.StartError)
pub fn start_link(
adapter: option.Option(storage.StorageAdapter),
timeout_ms: Int,
) -> Result(process.Subject(transactor.Message), actor.StartError)
pub fn start_named(
name: String,
adapter: option.Option(storage.StorageAdapter),
) -> Result(process.Subject(transactor.Message), actor.StartError)
pub fn store_rule(
db: process.Subject(transactor.Message),
rule: ast.Rule,
) -> Result(Nil, String)
pub fn store_rule_with_timeout(
db: process.Subject(transactor.Message),
rule: ast.Rule,
timeout_ms: Int,
) -> Result(Nil, String)
pub fn subscribe(
db: process.Subject(transactor.Message),
query: ast.Query,
subscriber: process.Subject(query_types.ReactiveDelta),
) -> Nil
Subscribe to local reactive query updates.
The initial result and later deltas are emitted by the reactive actor in mailbox
order. Delivery is unbounded BEAM mailbox delivery: it does not block writers or
drop updates, so callers must drain their own mailbox. Call unsubscribe when
finished; stopped subscribers are also removed on the next notification.
pub fn subscribe_wal(
db: process.Subject(transactor.Message),
subscriber: process.Subject(List(fact.Datom)),
) -> Nil
pub fn sync(db: process.Subject(transactor.Message)) -> Nil
pub fn temporal_scan_limits(
max_datoms: Int,
) -> Result(TemporalScanLimits, TemporalScanError)
pub fn transact(
db: process.Subject(transactor.Message),
facts: List(#(fact.Eid, String, fact.Value)),
) -> Result(state.DbState, String)
pub fn transact_at(
db: process.Subject(transactor.Message),
facts: List(#(fact.Eid, String, fact.Value)),
valid_time: Int,
) -> Result(state.DbState, String)
pub fn transact_with_timeout(
db: process.Subject(transactor.Message),
facts: List(#(fact.Eid, String, fact.Value)),
timeout_ms: Int,
) -> Result(state.DbState, String)
pub fn traverse(
db: process.Subject(transactor.Message),
eid: fact.Eid,
path: List(ast.Step),
max_depth: Int,
) -> Result(List(fact.Value), String)
pub fn trigger_eviction(
db: process.Subject(transactor.Message),
) -> Result(Nil, String)
pub fn unsubscribe(
db: process.Subject(transactor.Message),
subscriber: process.Subject(query_types.ReactiveDelta),
) -> Nil
Stop local reactive updates for a subscriber.
Unsubscription is ordered with notifications received by the reactive actor: deltas already sent to the subscriber remain in its mailbox, while later actor notifications do not produce new deltas for it.
pub fn with_facts(
state: state.DbState,
facts: List(#(fact.Eid, String, fact.Value)),
) -> Result(SpeculativeResult, String)