Every method on the Strata struct, grouped by category.

Database

MethodSignatureReturns
open(path: impl AsRef<Path>) -> Result<Self>New Strata instance
cache() -> Result<Self>Ephemeral in-memory instance
new_handle() -> Result<Self>Independent handle to same database
ping() -> Result<String>Version string
info() -> Result<DatabaseInfo>Database statistics
flush() -> Result<()>Flushes pending writes
compact() -> Result<()>Triggers compaction

Branch Context

MethodSignatureReturns
current_branch() -> &strCurrent branch name
set_branch(name: &str) -> Result<()>Switches current branch
create_branch(name: &str) -> Result<()>Creates empty branch
list_branches() -> Result<Vec<String>>All branch names
delete_branch(name: &str) -> Result<()>Deletes branch + data
fork_branch(dest: &str) -> Result<()>Copies current branch to dest
branches() -> Branches<'_>Power API handle

Space Context

MethodSignatureReturns
current_space() -> &strCurrent space name
set_space(name: &str) -> Result<()>Switches current space
list_spaces() -> Result<Vec<String>>All space names in current branch
delete_space(name: &str) -> Result<()>Deletes empty space
delete_space_force(name: &str) -> Result<()>Deletes space and all its data

Note: All data methods (KV, Event, State, JSON, Vector) operate on the current space set via set_space. The default space is "default".

KV Store

MethodSignatureReturnsNotes
kv_put(key: &str, value: impl Into<Value>) -> Result<u64>VersionCreates or overwrites
kv_get(key: &str) -> Result<Option<Value>>Value or None
kv_delete(key: &str) -> Result<bool>Whether key existed
kv_list(prefix: Option<&str>) -> Result<Vec<String>>Key names

Event Log

MethodSignatureReturnsNotes
event_append(event_type: &str, payload: Value) -> Result<u64>Sequence numberPayload must be Object
event_get(sequence: u64) -> Result<Option<VersionedValue>>Event or None
event_get_by_type(event_type: &str) -> Result<Vec<VersionedValue>>All events of type
event_len() -> Result<u64>Total event count

State Cell

MethodSignatureReturnsNotes
state_set(cell: &str, value: impl Into<Value>) -> Result<u64>VersionUnconditional write
state_get(cell: &str) -> Result<Option<Value>>Value or None
state_init(cell: &str, value: impl Into<Value>) -> Result<u64>VersionOnly if absent
state_cas(cell: &str, expected: Option<u64>, value: impl Into<Value>) -> Result<Option<u64>>New version or NoneCAS

JSON Store

MethodSignatureReturnsNotes
json_set(key: &str, path: &str, value: impl Into<Value>) -> Result<u64>VersionUse ”$” for root
json_get(key: &str, path: &str) -> Result<Option<Value>>Value or None
json_delete(key: &str, path: &str) -> Result<u64>Count deleted
json_list(prefix: Option<String>, cursor: Option<String>, limit: u64) -> Result<(Vec<String>, Option<String>)>Keys + cursor

Vector Store

MethodSignatureReturnsNotes
vector_create_collection(name: &str, dimension: u64, metric: DistanceMetric) -> Result<u64>Version
vector_delete_collection(name: &str) -> Result<bool>Whether it existed
vector_list_collections() -> Result<Vec<CollectionInfo>>All collections
vector_collection_stats(collection: &str) -> Result<CollectionInfo>Collection detailsIncludes index_type, memory_bytes
vector_upsert(collection: &str, key: &str, vector: Vec<f32>, metadata: Option<Value>) -> Result<u64>Version
vector_batch_upsert(collection: &str, entries: Vec<BatchVectorEntry>) -> Result<Vec<u64>>VersionsAtomic bulk insert
vector_get(collection: &str, key: &str) -> Result<Option<VersionedVectorData>>Vector data or None
vector_delete(collection: &str, key: &str) -> Result<bool>Whether it existed
vector_search(collection: &str, query: Vec<f32>, k: u64) -> Result<Vec<VectorMatch>>Top-k matches8 metadata filter operators

Branch Operations (Low-Level)

MethodSignatureReturns
branch_create(branch_id: Option<String>, metadata: Option<Value>) -> Result<(BranchInfo, u64)>Info + version
branch_get(branch: &str) -> Result<Option<VersionedBranchInfo>>Branch info or None
branch_list(state: Option<BranchStatus>, limit: Option<u64>, offset: Option<u64>) -> Result<Vec<VersionedBranchInfo>>Branch info list
branch_exists(branch: &str) -> Result<bool>Whether branch exists
branch_delete(branch: &str) -> Result<()>Deletes branch

Bundle Operations

MethodSignatureReturns
branch_export(branch_id: &str, path: &str) -> Result<BranchExportResult>Export info
branch_import(path: &str) -> Result<BranchImportResult>Import info
branch_validate_bundle(path: &str) -> Result<BundleValidateResult>Validation info

Branches Power API

Methods on the Branches handle returned by db.branches():

MethodSignatureReturns
list() -> Result<Vec<String>>Branch names
exists(name: &str) -> Result<bool>Whether branch exists
create(name: &str) -> Result<()>Creates empty branch
delete(name: &str) -> Result<()>Deletes branch
fork(source: &str, dest: &str) -> Result<ForkInfo>Copies branch data
diff(branch1: &str, branch2: &str) -> Result<BranchDiff>Compares two branches
merge(source: &str, target: &str, strategy: MergeStrategy) -> Result<MergeInfo>Merges source into target

Session

MethodSignatureReturns
Session::new(db: Arc<Database>) -> SelfNew session
execute(cmd: Command) -> Result<Output>Command result
in_transaction() -> boolWhether a txn is active