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),
raft_state: raft.RaftState,
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,
fn(List(fact.Value)) -> List(List(fact.Value)),
),
columnar_store: dict.Dict(String, List(internal.StorageChunk)),
config: Config,
query_history: List(QueryContext),
)
}
Constructors
-
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), raft_state: raft.RaftState, 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, fn(List(fact.Value)) -> List(List(fact.Value)), ), columnar_store: dict.Dict(String, List(internal.StorageChunk)), config: Config, query_history: List(QueryContext), )
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
-
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, ), )
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,
)
Notify(
changed_attributes: List(String),
current_state: DbState,
)
}
Constructors
-
Subscribe( query: ast.Query, attributes: List(String), subscriber: process.Subject(query_types.ReactiveDelta), initial_state: query_types.QueryResult, ) -
Notify(changed_attributes: List(String), current_state: DbState)
pub type VirtualAdapter =
fn(List(fact.Value)) -> List(List(fact.Value))