The Command enum is the instruction set of StrataDB. Every operation that can be performed on the database is represented as a variant. Commands are self-contained, serializable, and typed.

This reference is primarily for SDK builders and contributors. Most users should use the typed Strata API instead.

Command Categories

CategoryCountDescription
KV5Key-value operations
JSON5JSON document operations
Event4Event log operations
State5State cell operations
Vector9Vector store operations
Branch5Branch lifecycle operations
Space4Space management operations
Transaction5Transaction control
Retention3Retention policy
Database4Database-level operations
Bundle3Branch export/import
Intelligence1Cross-primitive search

KV Commands

CommandFieldsOutput
KvPutbranch?, space?, key, valueVersion(u64)
KvGetbranch?, space?, keyMaybe(Option<Value>)
KvDeletebranch?, space?, keyBool(existed)
KvListbranch?, space?, prefix?Keys(Vec<String>)
KvGetvbranch?, space?, keyVersionHistory(Option<Vec<VersionedValue>>)

JSON Commands

CommandFieldsOutput
JsonSetbranch?, space?, key, path, valueVersion(u64)
JsonGetbranch?, space?, key, pathMaybe(Option<Value>)
JsonDeletebranch?, space?, key, pathUint(count)
JsonGetvbranch?, space?, keyVersionHistory(Option<Vec<VersionedValue>>)
JsonListbranch?, space?, prefix?, cursor?, limitJsonListResult { keys, cursor }

Event Commands

CommandFieldsOutput
EventAppendbranch?, space?, event_type, payloadVersion(u64)
EventGetbranch?, space?, sequenceMaybeVersioned(Option<VersionedValue>)
EventGetByTypebranch?, space?, event_typeVersionedValues(Vec<VersionedValue>)
EventLenbranch?, space?Uint(count)

State Commands

CommandFieldsOutput
StateSetbranch?, space?, cell, valueVersion(u64)
StateGetbranch?, space?, cellMaybe(Option<Value>)
StateCasbranch?, space?, cell, expected_counter?, valueMaybeVersion(Option<u64>)
StateInitbranch?, space?, cell, valueVersion(u64)
StateGetvbranch?, space?, cellVersionHistory(Option<Vec<VersionedValue>>)

Vector Commands

CommandFieldsOutput
VectorCreateCollectionbranch?, space?, collection, dimension, metricVersion(u64)
VectorDeleteCollectionbranch?, space?, collectionBool(existed)
VectorListCollectionsbranch?, space?VectorCollectionList(Vec<CollectionInfo>)
VectorCollectionStatsbranch?, space?, collectionVectorCollectionList(Vec<CollectionInfo>)
VectorUpsertbranch?, space?, collection, key, vector, metadata?Version(u64)
VectorBatchUpsertbranch?, space?, collection, entriesVersions(Vec<u64>)
VectorGetbranch?, space?, collection, keyVectorData(Option<VersionedVectorData>)
VectorDeletebranch?, space?, collection, keyBool(existed)
VectorSearchbranch?, space?, collection, query, k, filter?, metric?VectorMatches(Vec<VectorMatch>)

Branch Commands

CommandFieldsOutput
BranchCreatebranch_id?, metadata?BranchWithVersion { info, version }
BranchGetbranchBranchInfoVersioned(info) or Maybe(None)
BranchListstate?, limit?, offset?BranchInfoList(Vec<VersionedBranchInfo>)
BranchExistsbranchBool(exists)
BranchDeletebranchUnit

Space Commands

CommandFieldsOutput
SpaceListbranch?SpaceList(Vec<String>)
SpaceCreatebranch?, spaceUnit
SpaceDeletebranch?, space, forceUnit
SpaceExistsbranch?, spaceBool(exists)

Transaction Commands

CommandFieldsOutput
TxnBeginbranch?, options?TxnBegun
TxnCommit(none)TxnCommitted { version }
TxnRollback(none)TxnAborted
TxnInfo(none)TxnInfo(Option<TransactionInfo>)
TxnIsActive(none)Bool(active)

Database Commands

CommandFieldsOutput
Ping(none)Pong { version }
Info(none)DatabaseInfo(info)
Flush(none)Unit
Compact(none)Unit

Bundle Commands

CommandFieldsOutput
BranchExportbranch_id, pathBranchExported(result)
BranchImportpathBranchImported(result)
BranchBundleValidatepathBundleValidated(result)

Retention Commands

CommandFieldsOutput
RetentionApplybranch?(retention result)
RetentionStatsbranch?(retention stats)
RetentionPreviewbranch?(retention preview)

Intelligence Commands

CommandFieldsOutput
Searchbranch?, query, k?, primitives?SearchResults(Vec<SearchResultHit>)

Branch Field Convention

Data-scoped commands have an optional branch field. When None, it defaults to the “default” branch. Branch lifecycle commands (BranchGet, BranchDelete, etc.) have a required branch field.

Space Field Convention

Data-scoped commands have an optional space field. When None, it defaults to the current space on the handle (initially "default"). Space lifecycle commands (SpaceList, SpaceCreate, SpaceDelete, SpaceExists) do not have a space field — they operate on spaces within the specified branch.

Serialization

All commands implement Serialize and Deserialize with deny_unknown_fields. The format uses serde’s externally tagged representation:

{"KvPut": {"key": "foo", "value": {"Int": 42}}}
{"KvGet": {"key": "foo"}}
{"TxnCommit": null}