API
VLite APIs
One engine, every interface. Choose an API, find a call, and read its signature, behavior and access requirements in one place.
REST
HTTP routes, scopes and operations
EmbeddedNode.js
Promise-based calls and typed options
EmbeddedRust
Types, methods and free functions
EmbeddedC ABI
Native functions and JSON requests
EmbeddedPython
Synchronous calls and typed values
ServergRPC
Protobuf methods and streaming
AgentsMCP
Read and write tools for AI agents
EmbeddedWebAssembly
In-memory databases for the browser
Browse APIs
Quick start and conventionsComplete inventory checked against source. This reference never sends API requests. Need another interface? Choose its name above.
Quick start
Open a file in your process. No server is needed.
from vlite_embedded import NativeLibrary
meta = {"category": {"type": "string", "value": "docs"}}
native = NativeLibrary()
with native.create("docs.vlite", dimensions=3) as db:
db.put("1", [1.0, 0.0, 0.0], metadata=meta)
db.batch([{"op": "put", "id": "2", "vector": [0.0, 1.0, 0.0]}])
print(db.search([0.9, 0.1, 0.0], k=5,
filter=[{"op": "eq", "field": "category", "value": meta["category"]}]))
import { NativeLibrary } from "@vlite/embedded";
const native = new NativeLibrary();
const db = await native.create("docs.vlite", 3);
await db.put("1", [1, 0, 0]);
console.log(await db.search([0.9, 0.1, 0], 5));
await db.close();
await native.close();
use vlite::Database;
let mut db = Database::create("docs.vlite", 3)?;
db.put(1, &[1.0, 0.0, 0.0], b"hello")?;
for hit in db.search(&[0.9, 0.1, 0.0], 5)? {
println!("{} {}", hit.id, hit.distance);
}
db.close()?;
Guides: Python · Node.js · C ABI · Installation
Conventions
- Record IDs are unsigned 64-bit integers. SDKs and JSON pass them as decimal strings.
- Lower distance means nearer, for every metric.
- A write survives a process crash when the call returns; by default it is synced within 60 s, or before returning with full durability. Batches are all-or-nothing.
- Metadata values are typed. A filter is an AND of up to 64 conditions.
- Errors carry a stable, machine-readable code.
| Metric | Distance | HNSW |
|---|---|---|
squared_l2 (default) | Σ (a − b)² | Yes |
cosine | 1 − cosine similarity | Yes |
inner_product | −(a · b) | Exact only |
Shared types
The SDKs, the C ABI, REST and MCP use these JSON shapes. gRPC uses the same values in protobuf messages.
Metadata values
Metadata is a map of up to 64 fields, at most 64 KiB in total. Every value is tagged with its type, and filters only match values of the same type.
| Type | JSON form |
|---|---|
string | {"type": "string", "value": "docs"} |
integer | {"type": "integer", "value": "42"}, a decimal string so 64-bit values survive JSON |
float | {"type": "float", "value": 0.5} |
boolean | {"type": "boolean", "value": true} |
geopoint | {"type": "geopoint", "value": {"latitude": 47.6, "longitude": -122.3}}; needs format 5 |
Filters
A filter is a list of up to 64 conditions. A record matches only when every condition matches.
| Condition | Matches |
|---|---|
{"op": "eq", "field": "category", "value": {...}} | The field equals the typed value. |
{"op": "range", "field": "year", "min": {...}, "max": {...}} | The field lies within the inclusive bounds. Bounds are integers or floats of the field's type; give at least one. |
{"op": "georadius", "field": "place", "latitude": 47.6, "longitude": -122.3, "radius_meters": 5000} | The geopoint lies within the radius. |
Revisions
Every write gives the record a new revision, returned as a decimal string. To make a write conditional, pass the revision you expect, or "absent" to require that the record does not exist. A mismatch fails and writes nothing. Revisions survive reopening, but change when a file is compacted, upgraded or restored.
File formats
| Format | Adds |
|---|---|
3 | Records with typed metadata, exact search and in-memory HNSW indexes |
4 | Named collections, resumable imports and the change feed |
5 (default) | Record expiry, metadata-only updates, geopoints, named and sparse vectors, encryption, commit timestamps and property graphs |
Each format includes everything before it. The format is chosen when the file is created, and opening a file never upgrades it. New files are format 5 with property graphs; ask for format 3 or 4 to create a plain vector file. An older reader rejects a newer format rather than guessing.
Python and Node.js
Both SDKs wrap the same native library and share one method set. Python methods are synchronous and use snake_case. Node.js methods return promises and use camelCase. Each row shows both signatures, and a badge marks a method only one SDK has. Record IDs and revisions are decimal strings. Methods with a collection option use the default collection when it is omitted.
NativeLibrary · Records · Search · Approximate indexes · Collections · Imports · Named and sparse vectors · Change feed · Encryption · Property graph · Key-value · Errors
NativeLibrary
Load the native library once per process, then create or open databases with it.
| Signature | Description |
|---|---|
class NativeLibraryclass NativeLibrary | Loads the native library and checks that it speaks ABI version 1. Creates and opens databases. |
NativeLibrary(path=None)new NativeLibrary(options?: { libraryPath?: string; addonPath?: string; maxPending?: number }) | Loads the bundled library, or the library at an explicit path, and checks ABI version 1. A missing library is an error. Node.js also takes maxPending, the request queue size (1 to 1024, default 64); a full queue fails with busy. |
supports_float32 -> bool | True when the library exports both typed float32 entry points, so search_f32 and batch_put_f32 skip JSON encoding. property Python only |
create(path, dimensions, *, format=None, key=None, passphrase=None, commit_timestamps=False, flush_interval_ms=None) -> Databasecreate(path: string, dimensions: number, options?: CreateOptions): Promise<Database> | Creates a new file and fails if the path already exists. New files are format 5 with property graphs; pass format 3 or 4 for a plain vector file. Options choose encryption and commit timestamps. |
capabilities() -> dictcapabilities(): Promise<{ graph: boolean }> | Reports what the library supports, such as {"graph": true}. Libraries older than this call report graph as false. |
supports_graph -> boolsupportsGraph(): Promise<boolean> | True when the library includes the property graph, as every current release does. property |
create_in_memory(dimensions, *, format=None, key=None, passphrase=None, commit_timestamps=False) -> DatabasecreateInMemory(dimensions: number, options?: CreateOptions): Promise<Database> | Creates a database held in memory by your process. Save it with to_bytes and reopen it with open_from_bytes. |
open(path, *, key=None, passphrase=None, read_only=False, flush_interval_ms=None) -> Databaseopen(path: string, options?: Credentials & { readOnly?: boolean }): Promise<Database> | Opens an existing file. Pass the key or passphrase for an encrypted file. Read-only mode takes a shared lock so many processes can read at once; it sees the data as of open, writes fail with read_only, and writers fail with locked until readers close. |
open_from_bytes(data, *, key=None, passphrase=None) -> DatabaseopenFromBytes(data: Uint8Array, options?: Credentials): Promise<Database> | Opens a database image made by to_bytes, in memory. |
restore_to(log_path, destination, *, sequence=None, timestamp_ms=None, base_backup=None, key=None, passphrase=None) -> dictrestoreTo(logPath: string, destination: string, options: Credentials & { sequence?: string | number; timestampMs?: string | number; baseBackup?: string; }): Promise<RestoreReport> | Restores a closed copy of a commit log to a new path, as of one sequence number or one timestamp; give exactly one. It never overwrites, and can start from a base backup. |
close(): Promise<void> | Shuts down the library's worker after the requests already sent to it finish, so in-flight commits complete. Node.js only |
Records
A write is written when the call returns and synced within the flush interval (60 s by default), or before returning with durability: "full". A batch is atomic and applies to one collection.
| Signature | Description |
|---|---|
class Databaseclass Database | An open database. Close it when you are done; Python handles also work as context managers. |
Database(library, handle) | Created by NativeLibrary; do not call it directly. Python only |
close() -> Noneclose(): Promise<void> | Closes the database and releases its file lock. |
info() -> dictinfo(): Promise<{ dimensions: number; records: number; format_version: number }> | Returns the dimensions, the record count and the file format version. |
sync() -> None | Forces acknowledged commits to stable storage. It matters only when the handle was opened with a flush interval (1 to 60000 ms): then a process crash loses nothing, but an operating-system crash can lose the latest commits. Python only |
get(id, *, collection=None) -> dictget(id: string, options?: Scope): Promise<VectorRecord> | Returns a record: its vector, payload, metadata and current revision. A missing ID fails with not_found. |
get_many(ids, *, collection=None) -> list[dict | None]getMany(ids: string[], options?: Scope): Promise<(VectorRecord | null)[]> | Returns records in request order, with null (None in Python) for each missing ID. |
put(id, vector, *, payload_base64="", metadata=None, collection=None, expected_revision=None, expires_at_ms=None) -> str | Noneput(id: string, vector: number[], options: Scope & { payload?: Uint8Array; metadata?: Metadata; expectedRevision: ExpectedRevision }): Promise<string>
put(id: string, vector: number[], options?: Scope & { payload?: Uint8Array; metadata?: Metadata; expiresAtMs?: string | number }): Promise<void> | Inserts or replaces a record. With an expected revision ("absent" or a revision string) the write is compare-and-set and returns the new revision. An expiry cannot be combined with an expected revision. |
delete(id, *, collection=None, expected_revision=None) -> booldelete(id: string, options?: Scope & { expectedRevision?: ExpectedRevision }): Promise<boolean> | Deletes a record and returns whether it existed. An expected revision makes the delete conditional. |
batch(operations, *, collection=None) -> Nonebatch(operations: BatchOperation[], options?: Scope): Promise<void> | Applies put and delete operations to one collection in a single commit: all or nothing. |
batch_put_f32(records, vectors, dimensions, *, collection=None, require_native=False) -> NonebatchPutF32(operations: Float32PutOperation[], options?: Scope): Promise<void> | Inserts up to 4096 records in one atomic commit, taking their vectors from a contiguous float32 buffer. |
revision(id, *, collection=None) -> str | Nonerevision(id: string, options?: Scope): Promise<string | null> | Returns the record's current revision, or null when the record does not exist. |
put_with_expiry(id, vector, *, expires_at_ms=None, payload_base64="", metadata=None, collection=None) -> strputWithExpiry(id: string, vector: number[], options?: Scope & { payload?: Uint8Array; metadata?: Metadata; expiresAtMs?: string | number | null; }): Promise<string> | Writes a record that expires at an absolute Unix time in milliseconds (null means never) and returns its revision. Needs format 5. |
update_metadata(id, metadata, *, collection=None) -> strupdateMetadata(id: string, metadata: Metadata, options?: Scope): Promise<string> | Replaces a record's metadata but keeps its vectors, payload and expiry. Returns the new revision. Needs format 5. |
to_bytes() -> bytestoBytes(): Promise<Uint8Array> | Returns an in-memory database as a byte image for open_from_bytes. |
Search
Hits come back nearest first. Filters are typed metadata conditions; see Shared types above.
| Signature | Description |
|---|---|
search(vector, k, *, filter=None, metric=None, collection=None, explain=False) -> list[dict] | dictsearch(vector: number[], k: number, options: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain: true }): Promise<{ hits: Hit[]; stats: SearchStats }>
search(vector: number[], k: number, options?: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain?: false }): Promise<Hit[]> | Exact nearest-neighbour search, with an optional filter and metric. With explain, it also returns scan statistics. |
search_f32(vector, k, *, filter=None, metric=None, collection=None, explain=False, mode="exact", ef_search=None, quantization=None, rerank_multiplier=None, require_native=False) -> list[dict] | dictsearchF32(vector: Float32Array, k: number, options: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain: true }): Promise<{ hits: Hit[]; stats: SearchStats }>
searchF32(vector: Float32Array, k: number, options?: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain?: false }): Promise<Hit[]> | Exact search from a float32 buffer, which skips JSON encoding of the query. Python also accepts mode auto or approximate_ready, and falls back to JSON when the typed entry point is missing unless require_native is set. |
searchManyF32(vectors: Float32Array[], k: number, options: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain: true }): Promise<Array<{ hits: Hit[]; stats: SearchStats }>>
searchManyF32(vectors: Float32Array[], k: number, options?: Scope & { filter?: Condition[]; metric?: DistanceMetric; explain?: false }): Promise<Hit[][]> | Runs 1 to 128 float32 queries of the same dimensions in one native call. Node.js only |
search_auto(vector, k, *, filter=None, metric=None, collection=None, ef_search=None, quantization=None, rerank_multiplier=None, explain=False) -> dictsearchAuto(vector: number[], k: number, options?: Scope & AnnOptions & { filter?: Condition[]; metric?: DistanceMetric; efSearch?: number; explain?: boolean }): Promise<{ hits: Hit[]; plan?: QueryPlan; stats?: SearchStats }> | Planned search: the planner chooses exact or approximate search. With explain, it also returns the plan and statistics. |
search_hybrid(text, k, *, vector=None, filter=None, metric=None, collection=None, fusion=None, vector_leg=None, ef_search=None, quantization=None, rerank_multiplier=None, explain=False) -> dictsearchHybrid(text: string, k: number, options?: Scope & AnnOptions & { vector?: number[]; filter?: Condition[]; metric?: DistanceMetric; efSearch?: number; explain?: boolean; vectorLeg?: "exact" | "approximate_ready"; fusion?: { candidates?: number; rrfK?: number; vectorWeight?: number; textWeight?: number }; }): Promise<{ hits: HybridHit[]; stats?: SearchStats }> | BM25 text search over the collection's declared text fields, optionally fused with a vector leg (exact or approximate_ready). |
search_grouped(vector, groups, hits_per_group, field, *, filter=None, metric=None, collection=None) -> list[dict]searchGrouped(vector: number[], groups: number, hitsPerGroup: number, field: string, options?: FilterOptions): Promise<SearchGroup[]> | Nearest hits grouped by a metadata field: up to a number of groups, with a cap on hits per group. |
recommend(k, *, positive_ids=None, negative_ids=None, positive_vectors=None, negative_vectors=None, filter=None, metric=None, collection=None) -> list[dict]recommend(k: number, options?: FilterOptions & { positiveIds?: string[]; negativeIds?: string[]; positiveVectors?: number[][]; negativeVectors?: number[][]; }): Promise<Hit[]> | Finds records near positive examples and away from negative ones, given as IDs or vectors. |
facets(field, *, filter=None, collection=None) -> list[dict]facets(field: string, options?: Scope & { filter?: Condition[] }): Promise<FacetCount[]> | Counts records for each value of a metadata field, optionally filtered. |
numeric_stats(field, *, filter=None, collection=None) -> dictnumericStats(field: string, options?: Scope & { filter?: Condition[] }): Promise<NumericStats> | Summarizes a numeric metadata field over the records that match a filter. |
search_geo(vector, k, field, latitude, longitude, radius_meters, *, sort="vector_distance", filter=None, metric=None, collection=None) -> list[dict]searchGeo(vector: number[], k: number, field: string, latitude: number, longitude: number, radiusMeters: number, options?: FilterOptions & { sort?: "vector_distance" | "geo_distance" }): Promise<GeoHit[]> | Vector search limited to records whose geopoint field lies within a radius, sorted by vector distance or by geographic distance. |
rerank(vector, candidates, limit, *, method="exact", metric=None, lambda_=None, collection=None) -> list[dict]rerank(vector: number[], candidates: { id: string; distance?: number }[], limit: number, options?: Scope & { method?: "exact" | "mmr"; metric?: DistanceMetric; lambda?: number; }): Promise<Hit[]> | Reorders candidate records by exact distance to a query vector, or by maximal marginal relevance (mmr) with a lambda trade-off, and returns at most limit hits. |
query(query, parameters=None, *, collection=None) -> dictquery(query: string, parameters?: Record<string, number[]>, options?: Scope): Promise<QueryOutput> | Runs one read-only statement in the VLite query language, binding named vector parameters. |
Approximate indexes
HNSW indexes live in memory and are rebuilt from the file, which they never change. Disk indexes and ANN snapshots are optional sidecar files.
| Signature | Description |
|---|---|
build_index(*, metric=None, collection=None, quantization=None, rerank_multiplier=None) -> NonebuildIndex(options?: Scope & AnnOptions & { metric?: "squared_l2" | "cosine" }): Promise<void> | Builds an in-memory HNSW index for a collection without changing the file. It supports squared_l2 and cosine; quantization trades recall for memory. |
search_approximate_ready(vector, k, *, ef_search=100, metric=None, collection=None, quantization=None, rerank_multiplier=None) -> list[dict]searchApproximateReady(vector: number[], k: number, options?: Scope & AnnOptions & { efSearch?: number; metric?: "squared_l2" | "cosine" }): Promise<Hit[]> | Searches the collection's built HNSW index. The search breadth (ef_search) defaults to 100. |
ann_quality(*, collection=None, metric=None, quantization=None, rerank_multiplier=None, samples=None, k=None, ef_search=None, seed=None, max_distance_evaluations=None) -> dictannQuality(options?: Scope & AnnOptions & { metric?: "squared_l2" | "cosine"; samples?: number; k?: number; efSearch?: number; seed?: string; maxDistanceEvaluations?: number; }): Promise<AnnQualityReport> | Measures the HNSW index's recall against exact search on sampled queries, within a distance-evaluation budget. |
ann_memory(*, collection=None, metric=None, quantization=None, rerank_multiplier=None) -> dictannMemory(options?: Scope & AnnOptions & { metric?: "squared_l2" | "cosine" }): Promise<AnnMemoryReport> | Reports the memory used by the collection's HNSW index. |
save_ann_snapshot(path) -> dict | Atomically writes every in-memory HNSW index to a sidecar file, conventionally <datafile>.ann, and returns the index count and size. Refused for encrypted files, because the sidecar is not encrypted. Python only |
load_ann_snapshot(path) -> dict | Installs HNSW indexes from a snapshot sidecar instead of rebuilding them. The status is loaded, missing or a rejection code; anything but loaded leaves the database unchanged. Python only |
build_disk_ann(path, *, metric=None, collection=None) -> dictbuildDiskAnn(path: string, options?: Scope & { metric?: "squared_l2" | "cosine" }): Promise<DiskAnnSource> | Writes an HNSW index to a sidecar file and returns the committed state it was built from. Refused for encrypted files. Any later commit makes it stale. |
search_disk_ann(path, vector, k, *, ef_search=100, cache_bytes=8 * 1024 * 1024) -> list[dict]searchDiskAnn(path: string, vector: number[], k: number, options?: { efSearch?: number; cacheBytes?: number }): Promise<Hit[]> | Searches a disk index through a bounded cache (default 8 MiB, ef_search 100). The index must match the database's current state. |
Collections
Named collections need format 4 or later. Each has its own dimensions and settings.
| Signature | Description |
|---|---|
list_collections() -> list[dict]listCollections(): Promise<CollectionInfo[]> | Lists the collections with their dimensions and live record counts. |
create_collection(name, dimensions, *, settings=None) -> dictcreateCollection(name: string, dimensions: number, settings?: CollectionSettingsInput): Promise<CollectionInfo> | Creates a named collection with its own dimensions and optional settings. Names match ^[a-z][a-z0-9_-]{0,62}$, and default is reserved. |
drop_collection(name) -> NonedropCollection(name: string): Promise<void> | Drops an empty named collection. A collection with live records or an open import job is rejected, and default cannot be dropped. |
set_collection_settings(name, settings) -> dictsetCollectionSettings(name: string, settings: CollectionSettingsInput): Promise<{ persisted: boolean }> | Replaces a collection's settings; omitted settings revert to the defaults. Reports whether the settings were persisted. |
Imports
Imports load large datasets in chunks under one job ID. Check progress with import_status, then finish or abort the job. They need format 4 or later.
| Signature | Description |
|---|---|
next_import_job_id() -> strnextImportJobId(): Promise<string> | Returns a new import job ID. |
import_chunk(job, chunk, operations, *, collection=None, policy=None) -> dictimportChunk(job: string, chunk: string, operations: BatchOperation[], options?: Scope & { policy?: "reject_chunk" | "skip_invalid" }): Promise<ImportChunkReport> | Applies one chunk of operations to an import job. The policy either rejects the whole chunk when an operation is invalid (reject_chunk) or skips invalid operations (skip_invalid). |
import_status(job) -> dictimportStatus(job: string): Promise<ImportStatus> | Reports an import job's progress. |
import_finish(job, *, collection=None) -> dictimportFinish(job: string, options?: Scope): Promise<ImportStatus> | Finishes an import job and returns its final status. |
import_abort(job, *, collection=None) -> dictimportAbort(job: string, options?: Scope): Promise<ImportStatus> | Aborts an import job and returns its status. |
Named and sparse vectors
Format 5 files can store named dense vectors and sparse vectors beside each record's main vector. Named vectors keep versions, so you can re-embed a collection while it stays searchable.
| Signature | Description |
|---|---|
configure_vector(name, dimensions, *, active_version, metric="squared_l2", history=0, collection=None) -> NoneconfigureVector(name: string, dimensions: number, options: Scope & { activeVersion: string; metric?: DistanceMetric; history?: number; }): Promise<void> | Declares a named dense vector: its dimensions, metric (default squared_l2), active version and how many old versions to keep (default 0). Needs format 5. |
vector_specs(*, collection=None) -> dictvectorSpecs(options?: Scope): Promise<Record<string, VectorSpec>> | Returns the declared named vectors. |
record_vectors(id, *, collection=None) -> dict | NonerecordVectors(id: string, options?: Scope): Promise<RecordVectors | null> | Returns a record's named dense and sparse vectors, or null. |
put_vectors(id, *, dense=None, sparse=None, collection=None) -> NoneputVectors(id: string, options?: Scope & { dense?: Record<string, VectorVersion[]>; sparse?: Record<string, SparseVector> }): Promise<void> | Replaces all of a record's named dense and sparse vectors in one commit. The record must exist. |
put_vector_version(id, name, version, vector, *, collection=None) -> NoneputVectorVersion(id: string, name: string, version: string, vector: number[], options?: Scope): Promise<void> | Writes one version of a record's named vector, then applies the history limit. |
prune_vector_history(name, history, *, collection=None) -> NonepruneVectorHistory(name: string, history: number, options?: Scope): Promise<void> | Sets how many old versions a named vector keeps and removes the rest. |
search_named(name, vector, k, *, version=None, collection=None) -> list[dict]searchNamed(name: string, vector: number[], k: number, options?: Scope & { version?: string }): Promise<Hit[]> | Exact search over a named vector, at its active version or a given one. |
search_sparse(name, vector, k, *, collection=None) -> list[dict]searchSparse(name: string, vector: SparseVector, k: number, options?: Scope): Promise<Hit[]> | Searches a named sparse vector with a query of index and weight pairs. |
search_dense_sparse(dense_name, dense, sparse_name, sparse, k, *, version=None, fusion=None, collection=None) -> list[dict]searchDenseSparse(denseName: string, dense: number[], sparseName: string, sparse: SparseVector, k: number, options?: Scope & { version?: string; fusion?: FusionOptions }): Promise<HybridHit[]> | Fuses a named dense search and a named sparse search into one ranking. |
Change feed
The change feed reads committed vector and graph changes in order from a cursor. It needs format 4 or later. Graph events have the kind graph_created, graph_dropped or graph_batch.
| Signature | Description |
|---|---|
feed_cursor() -> strfeedCursor(): Promise<string> | Returns a cursor at the current end of the change feed. |
changes_after(cursor=None, max_events=1000) -> dictchangesAfter(cursor?: string | null, maxEvents?: number): Promise<ChangeBatch> | Reads committed changes after a cursor, or from the beginning, up to a maximum number of events (default 1000). Returns the changes, the next cursor, whether more remain and the head. A batch is never split across reads. |
Encryption
Choose encryption when you create a file, with a 32-byte key or a passphrase but never both. Pass the same credential to open it.
| Signature | Description |
|---|---|
encryption_info() -> dictencryptionInfo(): Promise<{ is_encrypted: boolean; key_id: string | null }> | Returns whether the file is encrypted and its key ID. |
is_encrypted() -> boolisEncrypted(): Promise<boolean> | True when the file is encrypted at rest. |
encryption_key_id() -> str | NoneencryptionKeyId(): Promise<string | null> | Returns the encryption key ID, or null for an unencrypted file. |
Property graph
The property graph is built into every library, and every new file can hold graphs. On a plain vector file, such as a format 3 or 4 file, these methods fail with graphs_not_enabled. Select a node or edge by key, or with {"key": "alice"} or {"id": "42"}.
| Signature | Description |
|---|---|
is_graph_enabled() -> boolisGraphEnabled(): Promise<boolean> | True when the file can hold property graphs. |
list_graphs() -> list[dict]listGraphs(): Promise<GraphInfo[]> | Lists the graphs with their node and edge counts. |
create_graph(name) -> dictcreateGraph(name: string): Promise<GraphInfo> | Creates an empty named graph. |
drop_graph(name) -> NonedropGraph(name: string): Promise<void> | Drops a graph. The graph must be empty. |
graph_write_batch(graph, ops) -> dictgraphWriteBatch(graph: string, ops: GraphOp[]): Promise<GraphBatchResult> | Applies node, edge, attachment and vector operations in order, in one atomic commit. Nothing is written on error. |
graph_get_node(graph, node, *, limits=None, projection=None) -> dictgraphGetNode(graph: string, node: GraphSelector, options?: GraphReadOptions): Promise<GraphReadResult & { node: GraphNode | null }> | Fetches one node, or null when it does not exist. |
graph_get_edge(graph, edge, *, limits=None, projection=None) -> dictgraphGetEdge(graph: string, edge: GraphSelector, options?: GraphReadOptions): Promise<GraphReadResult & { edge: GraphEdge | null }> | Fetches one edge, or null when it does not exist. |
graph_find_nodes(graph, *, label=None, conditions=None, limit=None, cursor=None, limits=None, projection=None) -> dictgraphFindNodes(graph: string, options?: GraphReadOptions & { label?: string; conditions?: Condition[]; limit?: number; cursor?: string; }): Promise<GraphReadResult & { nodes: GraphNode[] }> | Finds nodes by label and typed property conditions, in ascending ID order, with cursor paging. |
graph_neighbors(graph, node, *, direction=None, types=None, edge_conditions=None, limit=None, cursor=None, limits=None, projection=None) -> dictgraphNeighbors(graph: string, node: GraphSelector, options?: GraphReadOptions & { direction?: GraphDirection; types?: string[]; edgeConditions?: Condition[]; limit?: number; cursor?: string; }): Promise<GraphReadResult & { edges: GraphEdge[]; nodes: GraphNode[] }> | Lists a node's edges and adjacent nodes, filtered by direction, relationship type and edge conditions, with cursor paging. |
graph_traverse(graph, start, *, direction=None, types=None, expand_filter=None, return_filter=None, edge_filter=None, include_paths=False, limits=None, projection=None) -> dictgraphTraverse(graph: string, start: GraphSelector[], options?: GraphReadOptions & { direction?: GraphDirection; types?: string[]; expandFilter?: GraphNodeFilter; returnFilter?: GraphNodeFilter; edgeFilter?: Condition[]; includePaths?: boolean; }): Promise<GraphReadResult & { nodes: { depth: number; node: GraphNode }[]; edges: GraphEdge[]; paths: GraphPath[] }> | Bounded breadth-first traversal from start nodes, with separate filters for expansion, results and edges, and optional paths. |
graph_shortest_path(graph, source, destination, *, direction=None, types=None, limits=None, projection=None) -> dictgraphShortestPath(graph: string, source: GraphSelector, destination: GraphSelector, options?: GraphReadOptions & { direction?: GraphDirection; types?: string[]; }): Promise<GraphReadResult & { shortest_path: GraphPathOutcome }> | Finds one unweighted shortest path between two nodes, within limits. |
graph_explain(query) -> dictgraphExplain(query: Record<string, unknown> & { op: string; graph: string }): Promise<GraphExplanation> | Plans a graph read request without running it. |
Key-value
Namespaced byte values with compare-and-set, optional expiry and ordered prefix listing, in an existing collection that has one dimension. A missing collection is never created. Values are bytes in Python and Uint8Array in Node.js. Versions and deadlines are int in Python and bigint in Node.js, never a float or a Number. expected is "any" (the default), "absent" or the version you read: {"revision": 42} in Python, { revision: 42n } in Node.js. A failed check fails with precondition_failed and writes nothing. See the key-value guide.
| Signature | Description |
|---|---|
kv_get(*, collection, namespace, key) -> dictkvGet(options: KvAddress): Promise<KvEntry> | Reads one entry as key, value, version and expires_at_ms. An absent or expired key fails with kv_not_found. |
kv_put(*, collection, namespace, key, value, expected="any", expires_at_ms=None) -> dictkvPut(options: KvPutOptions): Promise<KvPutResult> | Writes a value of 0 to 1,047,290 bytes and returns its new version and expires_at_ms. The deadline is an absolute Unix-millisecond time (expiresAtMs in Node.js) and needs format 5. Without it the entry never expires, so a put clears an old deadline. An entry that is already due reads as absent. |
kv_delete(*, collection, namespace, key, expected="any") -> boolkvDelete(options: KvAddress & { expected?: KvExpected }): Promise<boolean> | Deletes an entry. Returns false when it was absent or expired. |
kv_list(*, collection, namespace, prefix="", after=None, limit=100) -> dictkvList(options: KvListOptions): Promise<KvPage> | Lists live entries in UTF-8 key order as items and next_after. A page holds at most limit (1 to 10,000) entries and 16 MiB of JSON. Pass next_after as after until it is null. |
Errors
Failures raise EmbeddedError in Python and reject with it in Node.js. Its code is a stable string such as not_found, locked, read_only or unsupported.
| Signature | Description |
|---|---|
class EmbeddedErrorclass EmbeddedError | The error type for every SDK failure. |
EmbeddedError(code, message)new EmbeddedError(code: string, message: string) | Creates an error from a code and a message. Its text is code: message. |
code: strcode: string | The stable error code, such as not_found or locked. |
Rust
The vlite crate is the engine; every other interface wraps it. Database owns the file and its exclusive lock. Optional crate features add GPU exact search (gpu) and an HTTP embedder (http-embedder); badges mark the items that need one. See the Rust reference for details.
Database · Collections and snapshots · Search helpers · Disk index and ANN snapshots · Durability, change feed and replication · Embedding · Property graph · Free functions
Database
Methods without a collection argument act on the default collection.
Database struct
vlite::Database One exclusive database owner. All operations are serialized by the caller.
| Signature | Description |
|---|---|
| Open, create and close | |
fn create(path: impl AsRef<Path>, dimensions: usize) -> Result<Self> | Creates a new format 5 database with property graphs, without overwriting any existing path. |
fn create_with_format(path: impl AsRef<Path>, dimensions: usize, format: FormatVersion) -> Result<Self> | Creates a new database in an explicit format. Format 5 holds property graphs; formats 3 and 4 create plain vector files. dimensions applies to the default collection. Formats 4 and 5 draw a random nonzero lineage from the OS. |
fn create_with_options(path: impl AsRef<Path>, dimensions: usize, options: CreateOptions) -> Result<Self> | Creates a new database with optional encryption and commit timestamps. The default is format 5 with property graphs. Either feature needs format 5; an explicit older format is rejected. |
fn create_in_memory(dimensions: usize, options: CreateOptions) -> Result<Self> | Creates a database held entirely in memory (no file, no lock): the WebAssembly backend. Commits are durable only as far as the caller persists to_bytes(). |
fn create_directory(path: impl AsRef<Path>, dimensions: usize, options: CreateOptions) -> Result<Self> | Creates a format 5 database as a directory of write-ahead logs and an optional checkpoint image, listed by an atomic MANIFEST. open, open_read_only and the maintenance tools accept the directory path. Commit timestamps and older formats are rejected. See directory store. |
fn open_from_bytes(bytes: Vec<u8>, key: Option<&EncryptionKey>) -> Result<Self> | Opens a database from a complete byte image (as produced by to_bytes, backup or a closed file). Corrupt or incomplete images are rejected. |
fn to_bytes(&self) -> Option<Vec<u8>> | The full committed byte image of an in-memory database, or None for a file-backed one. Opening it with open_from_bytes reproduces the state. |
fn open(path: impl AsRef<Path>) -> Result<Self> | Opens an existing database, validating every record without modifying it. |
fn open_encrypted(path: impl AsRef<Path>, key: &EncryptionKey) -> Result<Self> | Opens an encrypted database. A wrong key is EncryptionKeyMismatch (never garbage data); an unencrypted file is NotEncrypted. |
fn open_read_only(path: impl AsRef<Path>) -> Result<Self> | Opens an existing database for reading only, under a shared OS lock. |
fn open_read_only_encrypted(path: impl AsRef<Path>, key: &EncryptionKey) -> Result<Self> | Encrypted variant of open_read_only. |
fn is_read_only(&self) -> bool | Whether this handle came from open_read_only. |
fn discard_incomplete_tail(path: impl AsRef<Path>) -> Result<RepairReport> | Destructively discards only a structurally incomplete trailing frame. |
fn discard_incomplete_tail_encrypted(path: impl AsRef<Path>, key: &EncryptionKey) -> Result<RepairReport> | discard_incomplete_tail for an encrypted file. |
fn close(mut self) -> Result<()> | Consumes the handle and releases its OS lock. Under Durability::Full commits are already synced; under Periodic (the default) this stops the flusher and syncs every acknowledged commit first, returning CommitIndeterminate if that final sync fails. |
| Properties and durability | |
fn dimensions(&self) -> usize | Dimensions of the default collection. |
fn format_version(&self) -> u32 | The file format version: 3, 4 or 5. |
fn lineage(&self) -> Option<u64> | Random nonzero file-family identity of a format 4 database; None for formats 1–3. Compaction, upgrade and restore assign a new lineage. |
fn len(&self) -> usize | Live records in the default collection. |
fn is_empty(&self) -> bool | True when the default collection has no live records. |
fn is_poisoned(&self) -> bool | Whether this handle refuses all further operations (a failed commit or a failed periodic sync). Close and reopen. |
fn durability(&self) -> Durability | The handle's current durability mode: Durability::default() (Periodic, 60 s) for files unless changed, None for in-memory handles. |
fn set_durability(&mut self, durability: Durability) -> Result<()> | Selects when commits reach stable storage for this open handle; the setting is not persisted and every file open starts in Durability::default() (Periodic, 60 s). Full syncs every commit; None is the fixed mode of in-memory handles and is rejected for files. |
fn with_durability(mut self, durability: Durability) -> Result<Self> | Consuming builder form of set_durability, for example Database::open(path)?.with_durability(Durability::periodic(interval)?)?. |
fn sync(&self) -> Result<()> | Forces every acknowledged commit to stable storage now. A no-op under Durability::Full (each commit is already synced) and for read-only or in-memory handles. A sync failure returns CommitIndeterminate and poisons the handle. |
fn unsynced_commits(&self) -> u64 | Acknowledged commits not yet covered by a completed sync (always 0 under Durability::Full). |
fn is_directory(&self) -> bool | Whether this handle is a directory store. |
fn set_checkpoint_threshold(&mut self, bytes: Option<u64>) | Active-log size at which a commit starts a background checkpoint in a directory store (default DEFAULT_CHECKPOINT_BYTES, 64 MiB). None turns automatic checkpoints off. Not persisted; ignored for single files. |
fn checkpoint(&mut self) -> Result<Option<u64>> | Folds a directory store's logs into one checkpoint image and waits for it. Returns the history floor, or None when there is nothing to fold or the handle is not a directory store. Revisions and the lineage are kept; feed cursors below the floor then return CursorBeforeHistory. Read-only handles return ReadOnly. |
fn encryption_key_id(&self) -> Option<u64> | Key ID (non-secret fingerprint) of the encryption key, if encrypted. |
fn is_encrypted(&self) -> bool | True when the file is encrypted at rest. |
fn has_commit_timestamps(&self) -> bool | Whether commits carry wall-clock timestamps (timestamp restore). |
fn set_commit_clock(&mut self, clock: CommitClock) | Replaces the commit timestamp source (deterministic tests, simulated time). |
| Records | |
fn get(&self, id: u64) -> Result<Option<&Record>> | Returns a record, or None when its ID does not exist. |
fn get_at(&self, id: u64, now_ms: u64) -> Result<Option<&Record>> | Like get, but evaluates expiry at now_ms. Uses the default collection. |
fn revision(&self, id: u64) -> Result<Option<u64>> | Current revision of a live record, or None when it does not exist. |
fn put(&mut self, id: u64, vector: &[f32], payload: &[u8]) -> Result<()> | Durably replaces one record's vector and opaque payload, clearing any metadata. |
fn put_with_metadata(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata) -> Result<()> | Replaces the entire vector, payload and metadata map. Nonempty metadata requires format 3. |
fn put_with_expiry(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata, expires_at_ms: Option<u64>) -> Result<u64> | Durably puts a record with an optional absolute Unix-millisecond expiry. Requires format 5. |
fn expires_at(&self, id: u64) -> Result<Option<u64>> | Expiry of an existing record, or None for missing/non-expiring records. |
fn update_metadata(&mut self, id: u64, metadata: &Metadata) -> Result<u64> | Updates only metadata; vector and payload bytes are not rewritten. Requires format 5. |
fn put_with_metadata_if(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata, expected: Expected) -> Result<u64> | Conditional put. Input validation happens first; a failed precondition then returns RevisionMismatch { current } without writing. On success returns the record's new revision, acknowledged only after sync. |
fn delete(&mut self, id: u64) -> Result<bool> | Durably deletes one record. Missing IDs return false without a commit. |
fn delete_if(&mut self, id: u64, expected: Expected) -> Result<bool> | Conditional delete. A failed precondition returns RevisionMismatch without writing; Expected::Absent on a missing ID returns false. |
fn write_batch(&mut self, operations: &[Mutation]) -> Result<()> | Validates all operations, appends one atomic frame, then syncs once. |
fn read_snapshot(&self) -> Result<ReadSnapshot> | Captures the default collection at one committed version. |
fn snapshot_retention_stats(&self) -> SnapshotRetentionStats | Returns per-database snapshot retention counters. |
fn browse(&self, after: Option<u64>, limit: usize) -> Result<BrowsePage> | Returns a bounded page of records by ascending ID, excluding expired records. Uses the default collection. |
fn browse_at(&self, after: Option<u64>, limit: usize, now_ms: u64) -> Result<BrowsePage> | Deterministic form of browse for tests and applications with an injected clock. Uses the default collection. |
| Exact search | |
fn search_filtered_with_metric_at(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, now_ms: u64) -> Result<Vec<SearchHit>> | Exact search using a caller-supplied Unix-millisecond clock. |
fn search(&self, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | Exact squared-L2 nearest neighbors, ordered by distance then ascending ID. |
fn search_at(&self, query: &[f32], k: usize, now_ms: u64) -> Result<Vec<SearchHit>> | Exact search at a caller-supplied Unix-millisecond time. |
fn search_filtered(&self, query: &[f32], k: usize, conditions: &[Condition]) -> Result<Vec<SearchHit>> | Exact top-k over records satisfying every condition; no HNSW post-filtering. Retains at most min(k, live count) candidates, not one hit per matching record. |
fn search_with_metric(&self, query: &[f32], k: usize, metric: DistanceMetric) -> Result<Vec<SearchHit>> | Exact search with explicit metric; lower distance is better for every metric. |
fn search_filtered_with_metric(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Cosine rejects zero queries even for k=0, and excludes zero-norm records. Inner product returns negative dot product; cosine returns 1 - similarity. |
| Planned, hybrid and analytic search | |
fn search_hybrid(&self, query: &HybridQuery) -> Result<(Vec<HybridHit>, SearchStats)> | Hybrid search of the default collection; see CollectionRef::search_hybrid. |
fn search_auto(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, config: HnswConfig, options: AnnOptions, ef_search: usize) -> Result<PlannedSearch> | auto search of the default collection; see CollectionRef::search_auto. |
fn search_grouped(&self, query: &[f32], groups: usize, hits_per_group: usize, field: &str, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchGroup>> | Groups exact vector-search hits by a typed metadata value. Records without the grouping field are omitted; groups follow their nearest hit ordering. Uses the default collection. |
fn recommend(&self, query: &RecommendationQuery) -> Result<Vec<SearchHit>> | Recommendation from positive and negative example IDs and/or vectors. The query is the positive mean minus the negative mean. Example IDs are excluded from results. At least one positive example is required. Uses the default collection. |
fn facets(&self, field: &str, conditions: &[Condition]) -> Result<Vec<FacetCount>> | Counts typed values for one metadata field under an optional AND filter. Uses the default collection. |
fn numeric_stats(&self, field: &str, conditions: &[Condition]) -> Result<NumericStats> | Numeric min/max/sum/count/average over integer and float metadata values. Uses the default collection. |
fn search_geo(&self, query: &GeoSearchQuery) -> Result<Vec<GeoSearchHit>> | Vector search constrained to a spherical radius around a geo-point field. Vector distance remains available; sort selects vector or geographic ordering. Uses the default collection. |
fn text_index_status(&self) -> TextIndexStatus | Text index state of the default collection. |
| Approximate indexes (HNSW) | |
fn build_hnsw(&mut self, config: HnswConfig) -> Result<()> | Builds/replaces the optional in-memory HNSW index from committed live records. |
fn build_hnsw_with_metric(&mut self, config: HnswConfig, metric: DistanceMetric) -> Result<()> | Replaces the one in-memory index with a squared-L2 or cosine index. Cosine excludes zero-norm records. Inner product is not supported. |
fn start_hnsw_rebuild(&mut self, config: HnswConfig, metric: DistanceMetric, limits: HnswRebuildLimits) -> Result<()> | Captures a bounded committed-vector generation, then builds on one owned thread. |
fn set_background_hnsw_rebuild(&mut self, limits: Option<HnswRebuildLimits>) -> Result<()> | With Some(limits), a full mutation buffer starts a background rebuild instead of blocking the next query; searches keep using the current index plus an exact scan of the delta until the worker publishes. None (the default) restores inline rebuilds. Per collection, in memory only; set it again after reopening. |
fn poll_hnsw_rebuild(&mut self) -> Result<HnswRebuildStatus> | Nonblocking poll. A completed worker is joined and atomically published with bounded committed-mutation catch-up, or explicitly discarded. Catch-up has the same 256-ID / 8-MiB vector limits as the active graph. Overflow never rejects durable writes or publishes stale snapshot data. |
fn cancel_hnsw_rebuild(&mut self) -> bool | Requests cooperative cancellation. Poll until Cancelled (or another already-selected terminal reason). Returns false if no job is pending. Cancellation never waits or replaces the active graph. |
fn hnsw_maintenance_status(&self, config: HnswConfig, metric: DistanceMetric, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceStatus> | Observe matching-index capacity and worker progress without polling, publishing, starting, cancelling, or changing any state. |
fn maintain_hnsw(&mut self, config: HnswConfig, metric: DistanceMetric, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceReport> | Explicit maintenance tick: reap/publish one matching job, then start a replacement if the matching index is missing or either high-water mark is reached. Never waits for construction or silently falls back. |
fn search_approximate(&mut self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig) -> Result<Vec<SearchHit>> | Approximate squared-L2 search; exact search remains the default. |
fn search_approximate_with_metric(&mut self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, metric: DistanceMetric) -> Result<Vec<SearchHit>> | Approximate search that lazily rebuilds on metric or configuration mismatch. |
fn search_approximate_filtered_with_metric(&mut self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Filter-aware approximate search that lazily rebuilds like search_approximate_with_metric. Conditions are the same typed AND predicates as search_filtered_with_metric, validated before any zero-k/empty return or index build. |
fn search_approximate_ready(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig) -> Result<Vec<SearchHit>> | Searches an existing matching HNSW index without building one. |
fn search_approximate_ready_with_metric(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, metric: DistanceMetric) -> Result<Vec<SearchHit>> | Ready-only search; a metric mismatch returns IndexNotReady, never rebuilds. |
fn search_approximate_ready_filtered_with_metric(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Ready-only filter-aware search; never builds. Malformed filters are rejected before readiness and zero-k checks. Traversal, buffering and result semantics match search_approximate_filtered_with_metric. |
fn build_hnsw_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<()> | See CollectionMut::build_hnsw_with_options. |
fn start_hnsw_rebuild_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, limits: HnswRebuildLimits) -> Result<()> | See CollectionMut::start_hnsw_rebuild_with_options. |
fn hnsw_maintenance_status_with_options(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceStatus> | See CollectionMut::hnsw_maintenance_status_with_options. |
fn maintain_hnsw_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceReport> | See CollectionMut::maintain_hnsw_with_options. |
fn ann_memory(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<AnnMemoryReport> | See CollectionRef::ann_memory. |
fn hnsw_health(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<HnswHealth> | See CollectionRef::hnsw_health. |
fn ann_quality(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, sample: QualitySampleOptions) -> Result<AnnQualityReport> | See CollectionRef::ann_quality. |
fn search_approximate_ready_with_options(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, options: AnnOptions, conditions: &[Condition], metric: DistanceMetric) -> Result<(Vec<SearchHit>, SearchStats)> | See CollectionRef::search_approximate_ready_with_options. |
| Disk ANN and ANN snapshots | |
fn build_disk_ann(&self, collection: &str, path: impl AsRef<Path>, config: HnswConfig, metric: DistanceMetric) -> Result<DiskAnnSource> | Builds the disk-based ANN sidecar for collection at path (written to a temporary file, fsynced, then atomically renamed over path). |
fn search_disk_ann(&self, index: &DiskAnnIndex, query: &[f32], k: usize, ef_search: usize) -> Result<Vec<SearchHit>> | Searches through index after checking it still matches this database's lineage and revision; otherwise StaleIndex. Any write to the database (to any collection) makes an existing index stale. |
fn ann_snapshot_path(datafile: impl AsRef<Path>) -> PathBuf | Conventional sidecar path for a datafile: <datafile>.ann. |
fn save_ann_snapshot(&self, path: impl AsRef<Path>) -> Result<AnnSnapshotReport> | Atomically writes every in-memory HNSW index (graph, entry, norms, mutation buffer, quantizer and codes) with this database's identity and per-collection content digests. The datafile is never written. |
fn load_ann_snapshot(&mut self, path: impl AsRef<Path>) -> Result<AnnSnapshotLoad> | Installs HNSW indexes from a snapshot sidecar, but only if every section validates. Missing and Rejected leave the database unchanged. |
| Collections and imports | |
fn next_import_job_id(&self) -> Result<ImportJobId> | Smallest job ID a new import may use: one above every job ID already used in this file (closed and evicted jobs included). Format 4 only. |
fn import_chunk(&mut self, job: ImportJobId, chunk: u64, operations: &[Mutation], policy: InvalidRowPolicy) -> Result<ImportChunkReport> | Imports one chunk into the default collection; see CollectionMut::import_chunk. |
fn finish_import(&mut self, job: ImportJobId) -> Result<ImportStatus> | Finishes a default-collection job; see CollectionMut::finish_import. |
fn abort_import(&mut self, job: ImportJobId) -> Result<ImportStatus> | Aborts a default-collection job; see CollectionMut::abort_import. |
fn collection(&self, name: &str) -> Result<CollectionRef<'_>> | Read-only handle to a collection. default is always available. |
fn collection_mut(&mut self, name: &str) -> Result<CollectionMut<'_>> | Mutable handle to a collection. default is always available. |
fn collections(&self) -> Result<Vec<CollectionInfo>> | Live collections in ID order, including default. |
fn create_collection(&mut self, name: &str, spec: CollectionSpec) -> Result<CollectionInfo> | Creates a named collection with its own dimensions and settings. Needs format 4 or later. Names match ^[a-z][a-z0-9_-]{0,62}$, default is reserved, at most 64 collections can be live, and IDs are never reused. |
fn drop_collection(&mut self, name: &str) -> Result<()> | Durably drops an empty named collection (format 4 only). A collection with live records or open import jobs returns CollectionNotEmpty. |
fn set_collection_settings(&mut self, name: &str, settings: CollectionSettings) -> Result<SettingsPersistence> | Validates and replaces a collection's settings, then rebuilds its derived indexes. Format 4 commits a synced settings frame (Persisted); on formats 1–3 only default exists and the change is MemoryOnly. |
fn import_status(&self, job: u64) -> Result<ImportStatus> | Durable status of one import job (format 4 only). |
| Change feed | |
fn feed_cursor(&self) -> Result<changes::FeedCursor> | Cursor positioned at the current head: changes_after returns only commits made after this call. Needs format 4 or newer. |
fn changes_after(&self, cursor: &changes::FeedCursor, max_events: usize) -> Result<changes::ChangeBatch> | Reads up to about max_events committed changes after cursor, cut on commit boundaries (a batch commit is never split). Reads the durable log with a separate handle, so it observes exactly what a crash would keep. Covers vector and graph commits. Cost is one sequential scan of the log per call. |
fn temporal_changes_after(&self, cursor: &changes::FeedCursor, max_events: usize) -> Result<changes::ChangeBatch> | Unreleased (Gap 4): changes_after that also reports temporal-edge changes as GraphChange::Temporal, in commit order. Every other feed refuses a log with temporal changes rather than omit them. Production builds refuse it with UnsupportedFeature(64); temporal reads, public activation and production qualification remain outstanding. |
fn graph_changes_after(&self, cursor: &changes::GraphFeedCursor, graph_events: changes::GraphEventSet, max_events: usize) -> Result<changes::GraphFeedBatch, changes::GraphFeedError> | The durable change feed with exactly graph_events. With Empty it is changes_after with v1 cursors. With Ttl each graph node or edge operation carries a TTL annotation (deadline set or cleared, explicit removal, or expiry removal with the logged reclaim clock), and an expiry reclaim is reported in commit order as removals, chunked at 256 operations or 1 MiB, so a page can stop, and a cursor resume, inside a commit. Removals come only from logged reclaims, never from the reader's clock. A cursor bound to another set fails with CursorModeMismatch; a split cursor at a checkpoint floor fails with CursorBeforeHistory. |
fn export_log(&self, after_sequence: u64, max_bytes: usize) -> Result<LogSegment> | Cuts a log segment of commits after after_sequence for replication (see ReplicaFollower). max_bytes bounds the segment softly: whole commits are included until it is reached. |
| Property graph | |
fn is_graph_enabled(&self) -> bool | Whether this file can hold property graphs (FLAG_GRAPH). |
fn create_graph(&mut self, name: &str) -> Result<GraphInfo> | Durably creates an empty named graph. Names follow collection rules, ^[a-z][a-z0-9_-]{0,62}$. At most 64 graphs are live at once; the internal ID of a dropped graph may be reused. |
fn drop_graph(&mut self, name: &str) -> Result<()> | Durably drops an empty named graph (GraphNotEmpty otherwise). |
fn list_graphs(&self) -> Result<Vec<GraphInfo>> | Live graphs in name order. |
fn graph(&self, name: &str) -> Result<GraphRef<'_>> | Read handle to a live graph (GraphNotFound otherwise). |
fn graph_mut(&mut self, name: &str) -> Result<GraphMut<'_>> | Write handle to a live graph. Read-only handles return ReadOnly. |
Collections and snapshots
Database::collection returns a read view and collection_mut a write handle for one collection. read_snapshot captures a view that later commits do not change.
CollectionRef struct
vlite::CollectionRef Read-only handle to one collection. Obtain with Database::collection.
| Signature | Description |
|---|---|
| Properties and durability | |
fn id(&self) -> u16 | The collection's numeric ID. IDs are never reused within a database lineage. |
fn name(&self) -> &'a str | The collection name. |
fn dimensions(&self) -> usize | The vector dimensions of this collection. |
fn settings(&self) -> &'a CollectionSettings | The collection's settings, which supply defaults such as the metric and quantization. |
fn len(&self) -> usize | The number of live records in this collection. |
fn is_empty(&self) -> bool | True when the collection has no live records. |
| Records | |
fn get(&self, id: u64) -> Result<Option<&'a Record>> | Returns a record, or None when its ID does not exist. |
fn get_at(&self, id: u64, now_ms: u64) -> Result<Option<&'a Record>> | Like get, but evaluates expiry at now_ms. |
fn expires_at(&self, id: u64) -> Result<Option<u64>> | Expiry of an existing record, or None for missing/non-expiring records. |
fn revision(&self, id: u64) -> Result<Option<u64>> | See Database::revision. |
fn read_snapshot(&self) -> Result<ReadSnapshot> | Captures this collection without retaining the database owner lock. Returns InvalidQuery when the retention budget is exhausted. |
fn browse(&self, after: Option<u64>, limit: usize) -> Result<BrowsePage> | Returns a bounded page of records by ascending ID, excluding expired records. |
fn browse_at(&self, after: Option<u64>, limit: usize, now_ms: u64) -> Result<BrowsePage> | Deterministic form of browse for tests and applications with an injected clock. |
| Exact search | |
fn search(&self, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | Exact squared-L2 nearest neighbors, ordered by distance then ascending ID. |
fn search_filtered(&self, query: &[f32], k: usize, conditions: &[Condition]) -> Result<Vec<SearchHit>> | Exact top-k over records satisfying every condition; no HNSW post-filtering. Retains at most min(k, live count) candidates, not one hit per matching record. |
fn search_with_metric(&self, query: &[f32], k: usize, metric: DistanceMetric) -> Result<Vec<SearchHit>> | Exact search with explicit metric; lower distance is better for every metric. |
fn search_filtered_with_metric(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Same semantics as Database::search_filtered_with_metric. |
fn search_with_stats(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric) -> Result<(Vec<SearchHit>, SearchStats)> | Exact search that also reports work counters. |
fn search_filtered_with_metric_at(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, now_ms: u64) -> Result<Vec<SearchHit>> | Exact filtered retrieval at a caller-provided Unix-millisecond time. |
| Planned, hybrid and analytic search | |
fn search_hybrid(&self, query: &HybridQuery) -> Result<(Vec<HybridHit>, SearchStats)> | BM25 text search over the collection's declared text fields, fused with an optional exact or approximate vector leg. |
fn search_auto(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, config: HnswConfig, options: AnnOptions, ef_search: usize) -> Result<PlannedSearch> | Planned search per the collection's PlannerPolicy. |
fn search_auto_with_settings(&self, query: &[f32], k: usize, conditions: &[Condition], ef_search: usize) -> Result<PlannedSearch> | search_auto using the collection's persisted settings for metric, HNSW configuration, quantization and rerank multiplier. |
fn search_grouped(&self, query: &[f32], groups: usize, hits_per_group: usize, field: &str, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchGroup>> | Groups exact vector-search hits by a typed metadata value. Records without the grouping field are omitted; groups follow their nearest hit ordering. |
fn recommend(&self, request: &RecommendationQuery) -> Result<Vec<SearchHit>> | Recommendation from positive and negative example IDs and/or vectors. The query is the positive mean minus the negative mean. Example IDs are excluded from results. At least one positive example is required. |
fn facets(&self, field: &str, conditions: &[Condition]) -> Result<Vec<FacetCount>> | Counts typed values for one metadata field under an optional AND filter. |
fn numeric_stats(&self, field: &str, conditions: &[Condition]) -> Result<NumericStats> | Numeric min/max/sum/count/average over integer and float metadata values. |
fn search_geo(&self, request: &GeoSearchQuery) -> Result<Vec<GeoSearchHit>> | Vector search constrained to a spherical radius around a geo-point field. Vector distance remains available; sort selects vector or geographic ordering. |
fn rerank(&self, query: &[f32], hits: &[SearchHit], limit: usize, reranker: &dyn Reranker) -> Result<Vec<SearchHit>> | Fetches full-precision vectors for a bounded top-N list, then invokes the provider. |
fn text_index_status(&self) -> TextIndexStatus | State of this collection's BM25 text index. |
| Approximate indexes (HNSW) | |
fn search_approximate_ready_filtered_with_metric(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Same semantics as Database::search_approximate_ready_filtered_with_metric. |
fn ann_memory(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<AnnMemoryReport> | Component byte counts of the ready index; IndexNotReady otherwise. |
fn hnsw_health(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<HnswHealth> | Stale-node and buffer counters of the ready index. |
fn ann_quality(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, sample: QualitySampleOptions) -> Result<AnnQualityReport> | Deterministic sampled recall@k of the ready index against exact search, using stored vectors chosen by sample.seed as queries. |
fn search_approximate_ready_with_options(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, options: AnnOptions, conditions: &[Condition], metric: DistanceMetric) -> Result<(Vec<SearchHit>, SearchStats)> | Ready-only filtered ANN with explicit AnnOptions; never builds. options.rerank_multiplier applies to this query only. |
| Named and sparse vectors | |
fn vector_specs(&self) -> Result<&'a BTreeMap<String, VectorSpec>> | The declared named vectors (format 5). |
fn record_vectors(&self, id: u64) -> Result<Option<&'a RecordVectors>> | A record's named dense and sparse vectors, or None. |
fn search_named(&self, n: &str, version: Option<&str>, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | Exact search over a named vector, at version or the active version. |
fn search_named_at(&self, n: &str, version: Option<&str>, query: &[f32], k: usize, now_ms: u64) -> Result<Vec<SearchHit>> | Exact named-vector search using one explicit expiry clock. |
fn search_named_ann(&self, n: &str, version: Option<&str>, query: &[f32], k: usize, ef: usize) -> Result<Vec<SearchHit>> | Ready-only HNSW; reopen and mutations invalidate derived graphs. |
fn search_named_ann_at(&self, n: &str, version: Option<&str>, query: &[f32], k: usize, ef: usize, now_ms: u64) -> Result<Vec<SearchHit>> | Ready-only ANN using one explicit expiry clock. |
fn search_sparse(&self, n: &str, query: &[(u32, f32)], k: usize) -> Result<Vec<SearchHit>> | Dot-product scoring through derived inverted postings (rebuilt on open). |
fn search_dense_sparse(&self, query: &DenseSparseQuery) -> Result<Vec<crate::hybrid::HybridHit>> | Fuses a named dense search and a named sparse search into one ranking. |
| Re-embedding | |
fn reembed_status(&self, n: &str) -> Result<Option<&'a ReembedStatus>> | Re-embedding progress for the named vector, or None when no job runs. |
fn reembed_pending_checked(&self, n: &str, limit: usize) -> Result<Vec<ReembedRecord>> | Preferred iterator for work performed outside the database owner's lock. |
fn reembed_pending(&self, n: &str, limit: usize) -> Result<Vec<(u64, Record)>> | Returns missing target embeddings, including newly inserted IDs before the cursor. |
CollectionMut struct
vlite::CollectionMut Mutable handle to one collection. Obtain with Database::collection_mut.
| Signature | Description |
|---|---|
| Records | |
fn put(&mut self, id: u64, vector: &[f32], payload: &[u8]) -> Result<u64> | Durably replaces one record's vector and opaque payload, clearing any metadata. |
fn put_with_metadata(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata) -> Result<u64> | Replaces the entire vector, payload and metadata map. Nonempty metadata requires format 3. |
fn put_with_expiry(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata, expires_at_ms: Option<u64>) -> Result<u64> | Durably puts a record with an optional absolute Unix-millisecond expiry. Requires format 5. |
fn update_metadata(&mut self, id: u64, metadata: &Metadata) -> Result<u64> | Updates only metadata; vector and payload bytes are not rewritten. Requires format 5. |
fn put_with_metadata_if(&mut self, id: u64, vector: &[f32], payload: &[u8], metadata: &Metadata, expected: Expected) -> Result<u64> | See Database::put_with_metadata_if. |
fn delete(&mut self, id: u64) -> Result<bool> | Durably deletes one record. Missing IDs return false without a commit. |
fn delete_if(&mut self, id: u64, expected: Expected) -> Result<bool> | See Database::delete_if. |
fn write_batch(&mut self, operations: &[Mutation]) -> Result<()> | See Database::write_batch. Named collections always use format 4 frames. |
fn browse(&self, after: Option<u64>, limit: usize) -> Result<BrowsePage> | Returns a bounded page of records by ascending ID, excluding expired records. |
| Planned, hybrid and analytic search | |
fn search_hybrid(&self, query: &HybridQuery) -> Result<(Vec<HybridHit>, SearchStats)> | See CollectionRef::search_hybrid. |
fn search_auto(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, config: HnswConfig, options: AnnOptions, ef_search: usize) -> Result<PlannedSearch> | See CollectionRef::search_auto. |
fn search_auto_with_settings(&self, query: &[f32], k: usize, conditions: &[Condition], ef_search: usize) -> Result<PlannedSearch> | See CollectionRef::search_auto_with_settings. |
fn search_grouped(&self, query: &[f32], groups: usize, hits_per_group: usize, field: &str, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchGroup>> | Groups exact vector-search hits by a typed metadata value. Records without the grouping field are omitted; groups follow their nearest hit ordering. |
fn recommend(&self, query: &RecommendationQuery) -> Result<Vec<SearchHit>> | Recommendation from positive and negative example IDs and/or vectors. The query is the positive mean minus the negative mean. Example IDs are excluded from results. At least one positive example is required. |
fn facets(&self, field: &str, conditions: &[Condition]) -> Result<Vec<FacetCount>> | Counts typed values for one metadata field under an optional AND filter. |
fn numeric_stats(&self, field: &str, conditions: &[Condition]) -> Result<NumericStats> | Numeric min/max/sum/count/average over integer and float metadata values. |
fn search_geo(&self, query: &GeoSearchQuery) -> Result<Vec<GeoSearchHit>> | Vector search constrained to a spherical radius around a geo-point field. Vector distance remains available; sort selects vector or geographic ordering. |
fn text_index_status(&self) -> TextIndexStatus | See CollectionRef::text_index_status. |
| Approximate indexes (HNSW) | |
fn build_hnsw_with_metric(&mut self, config: HnswConfig, metric: DistanceMetric) -> Result<()> | Replaces the one in-memory index with a squared-L2 or cosine index. Cosine excludes zero-norm records. Inner product is not supported. |
fn search_approximate_filtered_with_metric(&mut self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Lazily (re)builds like Database::search_approximate_filtered_with_metric. |
fn start_hnsw_rebuild(&mut self, config: HnswConfig, metric: DistanceMetric, limits: HnswRebuildLimits) -> Result<()> | One background rebuild exists per database; another collection's job makes this return HnswRebuildBusy. |
fn poll_hnsw_rebuild(&mut self) -> Result<HnswRebuildStatus> | Returns Idle if no job exists for this collection. |
fn set_background_hnsw_rebuild(&mut self, limits: Option<HnswRebuildLimits>) -> Result<()> | Same as Database::set_background_hnsw_rebuild, for this collection. |
fn cancel_hnsw_rebuild(&mut self) -> bool | Returns false if no job exists for this collection. |
fn hnsw_maintenance_status(&self, config: HnswConfig, metric: DistanceMetric, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceStatus> | Observe matching-index capacity and worker progress without polling, publishing, starting, cancelling, or changing any state. |
fn maintain_hnsw(&mut self, config: HnswConfig, metric: DistanceMetric, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceReport> | Explicit maintenance tick: reap/publish one matching job, then start a replacement if the matching index is missing or either high-water mark is reached. Never waits for construction or silently falls back. |
fn build_hnsw_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<()> | Synchronously builds the index identified by (config, metric, options.quantization), superseding this collection's background job. |
fn start_hnsw_rebuild_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, limits: HnswRebuildLimits) -> Result<()> | Background rebuild with options. ScalarU8 snapshots hold u8 codes and count dims bytes per record against max_snapshot_vector_bytes. |
fn hnsw_maintenance_status_with_options(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceStatus> | hnsw_maintenance_status for the index with options.quantization. |
fn maintain_hnsw_with_options(&mut self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, policy: HnswMaintenancePolicy) -> Result<HnswMaintenanceReport> | maintain_hnsw for the index with options.quantization. A pending job for a different quantization returns HnswRebuildBusy. |
fn ann_memory(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<AnnMemoryReport> | See CollectionRef::ann_memory. |
fn hnsw_health(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions) -> Result<HnswHealth> | See CollectionRef::hnsw_health. |
fn ann_quality(&self, config: HnswConfig, metric: DistanceMetric, options: AnnOptions, sample: QualitySampleOptions) -> Result<AnnQualityReport> | See CollectionRef::ann_quality. |
fn search_approximate_ready_with_options(&self, query: &[f32], k: usize, ef_search: usize, config: HnswConfig, options: AnnOptions, conditions: &[Condition], metric: DistanceMetric) -> Result<(Vec<SearchHit>, SearchStats)> | See CollectionRef::search_approximate_ready_with_options. |
| Collections and imports | |
fn view(&self) -> CollectionRef<'_> | Read-only view of the same collection. |
fn import_chunk(&mut self, job: ImportJobId, chunk: u64, operations: &[Mutation], policy: InvalidRowPolicy) -> Result<ImportChunkReport> | Commits one chunk of an import job into this collection (format 4 only). |
fn finish_import(&mut self, job: ImportJobId) -> Result<ImportStatus> | Durably marks an open job finished with a marker-only frame. Repeating it returns the status without writing; an aborted job conflicts. |
fn abort_import(&mut self, job: ImportJobId) -> Result<ImportStatus> | Durably marks an open job aborted. Committed chunks are not rolled back. Repeating it returns the status without writing. |
| Named and sparse vectors | |
fn configure_vector(&mut self, n: &str, spec: VectorSpec) -> Result<()> | Declares a new named dense vector: its dimensions, metric, active version and history. An existing name is an error. |
fn put_vectors(&mut self, id: u64, vectors: RecordVectors) -> Result<()> | Atomic across all names and versions in this replacement; requires a live base record. |
fn put_vector_version(&mut self, id: u64, n: &str, version: &str, vector: Vec<f32>) -> Result<()> | Upserts a model version and applies the collection's bounded retention policy. |
fn prune_vector_history(&mut self, n: &str, history: usize) -> Result<()> | Sets how many old versions the named vector keeps and removes the rest. |
fn rebuild_named_hnsw(&mut self, n: &str, version: Option<&str>, config: HnswConfig) -> Result<()> | Builds an in-memory HNSW index for one version of a named vector, the active one by default. |
| Re-embedding | |
fn begin_reembed(&mut self, n: &str, target: &str) -> Result<()> | Starts re-embedding a named vector into a new target version. Apply batches, then call finish_reembed. |
fn apply_reembed_batch_checked(&mut self, n: &str, batch: &[ReembedUpdate]) -> Result<()> | Rejects an entire provider batch if any source changed while it was embedding. |
fn apply_reembed_batch(&mut self, n: &str, batch: &[(u64, Vec<f32>)]) -> Result<()> | The cursor and all vectors commit in one checksummed frame. Retry is idempotent. |
fn finish_reembed(&mut self, n: &str) -> Result<()> | Validates completeness against current live records before atomically switching readers. |
ReadSnapshot struct
vlite::ReadSnapshot An immutable, committed collection generation. It owns no file handle or database lock and can outlive its database. Capturing is O(1); the first subsequent write copies the ID tree, sharing unchanged record bodies.
| Signature | Description |
|---|---|
fn sequence(&self) -> u64 | The commit sequence the snapshot captured. |
fn lineage(&self) -> Option<u64> | Random nonzero file-family identity of a format 4 database; None for formats 1–3. Compaction, upgrade and restore assign a new lineage. |
fn dimensions(&self) -> usize | The vector dimensions of the captured collection. |
fn len(&self) -> usize | Physical records at capture time, including records hidden by TTL. |
fn is_empty(&self) -> bool | True when the captured collection has no live records. |
fn get(&self, id: u64) -> Result<Option<&Record>> | Returns a record, or None when its ID does not exist. |
fn get_at(&self, id: u64, now_ms: u64) -> Result<Option<&Record>> | Like get, but evaluates expiry at now_ms. |
fn browse(&self, after: Option<u64>, limit: usize) -> Result<BrowsePage> | Returns a bounded page of records by ascending ID, excluding expired records. |
fn browse_at(&self, after: Option<u64>, limit: usize, now_ms: u64) -> Result<BrowsePage> | Deterministic form of browse for tests and applications with an injected clock. |
fn search(&self, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | Exact squared-L2 nearest neighbors, ordered by distance then ascending ID. |
fn search_filtered_with_metric(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric) -> Result<Vec<SearchHit>> | Cosine rejects zero queries even for k=0, and excludes zero-norm records. Inner product returns negative dot product; cosine returns 1 - similarity. |
fn search_filtered_with_metric_at(&self, query: &[f32], k: usize, conditions: &[Condition], metric: DistanceMetric, now_ms: u64) -> Result<Vec<SearchHit>> | Exact search using a caller-supplied Unix-millisecond clock. |
Search helpers
Building blocks for planned, hybrid and reranked search, the query language and GPU search.
HybridQuery struct
vlite::hybrid::HybridQuery One hybrid query (text ≤1,024 bytes and ≤32 unique tokens; k ≤1000).
| Signature | Description |
|---|---|
fn new(vector: Option<Vec<f32>>, text: impl Into<String>, k: usize) -> Self | Exact squared-L2 vector leg with default fusion and no filter. |
PlannerPolicy struct
vlite::PlannerPolicy Thresholds for choosing exact-over-candidates versus filtered ANN.
| Signature | Description |
|---|---|
fn exact_limit(self, live: usize) -> usize | Largest candidate estimate answered exactly for live records. |
PlanStrategy enum
vlite::PlanStrategy Strategy selected by the auto search planner.
| Signature | Description |
|---|---|
fn name(self) -> &'static str | Stable snake_case name for logs and metrics. |
Reranker trait
vlite::rerank::Reranker Reorders top-N RerankCandidates, which carry full-precision vectors and payloads. Implement it for a cross-encoder or other provider. CollectionRef::rerank resolves up to 4,096 live candidates before calling it.
| Signature | Description |
|---|---|
fn rerank(&self, query: &[f32], candidates: &[RerankCandidate], limit: usize) -> Result<Vec<SearchHit>> | Reorders candidates for query and returns at most limit hits. |
ParsedQuery struct
vlite::query_language::ParsedQuery A read-only statement from parse: SEARCH <vector> NEAR $param or SEARCH TEXT MATCH "...", with optional VERSION, TEXT, K, WHERE, GROUP BY, FACET, ORDER BY and LIMIT clauses. Input is capped at 16 KiB and 64 predicates, the limit at 1,000 (default 10).
| Signature | Description |
|---|---|
fn execute(&self, collection: CollectionRef<'_>, parameters: &BTreeMap<String, Vec<f32>>) -> Result<QueryOutput> | Runs the read-only statement on a collection, binding named vector parameters. |
GpuExactSearcher struct
vlite::GpuExactSearcher A compute device for exact search. Construct with GpuExactSearcher::new.
| Signature | Description |
|---|---|
fn new() -> Option<Self> | Returns None when no compute-capable adapter is available. gpu |
fn adapter_name(&self) -> &str | The name of the GPU adapter in use. gpu |
fn search(&self, database: &Database, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | Exact squared-L2 search of the default collection on the GPU. gpu |
fn search_or_cpu(searcher: Option<&Self>, database: &Database, query: &[f32], k: usize) -> Result<Vec<SearchHit>> | GPU search, or the CPU path when searcher is None or the GPU fails. gpu |
Disk index and ANN snapshots
On-disk HNSW sidecars and the results of loading an ANN snapshot.
DiskAnnIndex struct
vlite::DiskAnnIndex An HNSW index stored in a <datafile>.dann sidecar and read through a byte-bounded LRU cache (default 8 MiB). It is bound to the database lineage and revision it was built from, and is not available for encrypted databases.
| Signature | Description |
|---|---|
fn open(path: impl AsRef<Path>, options: DiskAnnOptions) -> Result<Self> | Opens a .dann sidecar and validates its magic number, version, header checksum, layout and footer. Anything else is Corrupt. |
fn path(&self) -> &Path | The sidecar path. |
fn dimensions(&self) -> usize | The vector dimensions. |
fn metric(&self) -> DistanceMetric | The metric the index was built with. |
fn config(&self) -> HnswConfig | The HNSW parameters the index was built with. |
fn len(&self) -> usize | The number of indexed nodes. |
fn is_empty(&self) -> bool | True when the index has no nodes. |
fn source(&self) -> DiskAnnSource | The committed state the index was built from: lineage, sequence, collection ID and live record count. |
fn is_fresh_for(&self, database: &Database) -> bool | True when the database is exactly the state this index was built from. |
fn memory(&self) -> DiskAnnMemory | Resident bytes, cache capacity and use, cached nodes, disk reads and cache hits. |
fn verify(&self) -> Result<()> | Reads every node and the upper layers, verifying all checksums and structural invariants. Streams one node at a time. |
fn search(&self, query: &[f32], k: usize, ef_search: usize) -> Result<Vec<SearchHit>> | Approximate k-nearest search. ef_search is raised to k when smaller. Recall tracks in-memory HNSW built with the same configuration; an index with ef_search >= len() visits every reachable node. |
AnnSnapshotLoad enum
vlite::AnnSnapshotLoad Outcome of Database::load_ann_snapshot. Only Loaded changes state.
| Signature | Description |
|---|---|
fn code(&self) -> &'static str | Stable outcome code: loaded, missing, or the rejection code. |
AnnSnapshotRejection enum
vlite::AnnSnapshotRejection Why a sidecar was not installed. The detail strings are stable, non-sensitive labels (for example identity, content, checksum).
| Signature | Description |
|---|---|
fn code(&self) -> &'static str | One of stale, corrupt, unsupported_version, too_large, unreadable. |
Durability, change feed and replication
Durability policy, encryption keys, change-feed cursors, commit-log segments and read-only replicas.
Durability enum
vlite::Durability When a commit is forced to stable storage.
| Signature | Description |
|---|---|
fn periodic(interval: Duration) -> crate::Result<Self> | Validated Periodic mode (MIN_FLUSH_INTERVAL..=MAX_FLUSH_INTERVAL). |
fn periodic_ms(interval_ms: u64) -> crate::Result<Self> | Periodic with a millisecond interval, as used by CLI/JSON surfaces. |
fn validate(self) -> crate::Result<()> | Rejects invalid settings, such as an out-of-range periodic interval. |
EncryptionKey struct
vlite::EncryptionKey Caller-supplied encryption key: either a raw 32-byte key or a passphrase stretched with Argon2id. Key material is wiped on drop (best effort).
| Signature | Description |
|---|---|
fn from_bytes(key: [u8; 32]) -> Self | A raw 256-bit key from a secure random source or a key-management system. |
fn from_passphrase(passphrase: impl AsRef<[u8]>) -> Result<Self> | A passphrase key with default Argon2id parameters (19 MiB, 2 passes). |
fn from_passphrase_with_params(passphrase: impl AsRef<[u8]>, params: KdfParams) -> Result<Self> | A passphrase key with explicit Argon2id parameters. The parameters are used when creating or re-encrypting a file; when opening, the file's stored parameters apply. |
FeedCursor struct
vlite::changes::FeedCursor A position in the feed: everything up to and including sequence of the given lineage has been consumed.
| Signature | Description |
|---|---|
const fn beginning() -> Self | Reads every committed change in the current history. |
fn to_token(&self) -> String | Opaque, checksummed text form for storing a cursor elsewhere. |
fn from_token(token: &str) -> Result<Self> | Parses a token made by to_token. A malformed token is an error. |
fn save(&self, path: impl AsRef<Path>) -> Result<()> | Durably stores the cursor (write to a sibling file, fsync, rename). |
fn load(path: impl AsRef<Path>) -> Result<Option<Self>> | Loads a saved cursor; Ok(None) when none has been saved yet. |
GraphFeedCursor struct
vlite::changes::GraphFeedCursor A graph feed position bound to one exact GraphEventSet (Empty, the legacy feed, or Ttl, graph TTL events). A TTL cursor can stand inside one commit, after an event ordinal, because a large expiry reclaim is delivered in several chunks. Database::graph_changes_after and changes::read_log_graph_changes consume it.
| Signature | Description |
|---|---|
const fn beginning(graph_events: GraphEventSet) -> Self | Reads every committed change in the current history with graph_events. GraphEventSet is a non-exhaustive enum with variants Empty and Ttl; the set is exact, never a superset. |
const fn at_commit(position: FeedCursor, graph_events: GraphEventSet) -> Self | The boundary after commit position with graph_events; the explicit way to start a set from a legacy cursor or switch a boundary cursor to another set. A cursor of one set is never accepted for another: GraphFeedError (non-exhaustive: Engine(Error), CursorModeMismatch { cursor, requested }, CursorBeforeHistory { cursor, floor }, ResponseTooLarge { bytes, limit }) reports the mismatch. |
const fn position(&self) -> FeedCursor | The commit this cursor is in or after. Inside a commit it drops the remaining events' position, so it is not a legacy resume cursor. |
const fn ordinal(&self) -> Option<u32> | None when the whole commit has been consumed, Some(n) when its events through ordinal n have. |
const fn graph_events(&self) -> GraphEventSet | The exact event set the cursor is bound to. A Ttl page is a non-exhaustive GraphFeedBatch { changes, next, has_more, head } of GraphFeedChange { change, ttl }, where ttl holds one Option<GraphTtl> per graph operation: Updated { expires_at_ms, expiry_changed }, ExplicitRemoval or ExpiryRemoval { removal_reason, expires_at_ms, removed_at_ms }, with GraphRemovalReason Expired or NodeExpired. |
fn from_token(token: &str) -> Result<Self> | Lossless parsing of both token versions. A vlc1 token is an Empty commit boundary; a vlc2 token carries its set and ordinal and must use exact widths, lower case and a known set. A malformed, altered or impossible token is InvalidCursor. |
fn to_token(&self) -> String | Opaque, checksummed text form. Empty cursors remain exactly the vlc1 token of their position; Ttl cursors are vlc2 tokens, which FeedCursor::from_token rejects. |
LogSegment struct
vlite::LogSegment A contiguous run of whole commits from a primary's log, in exact on-disk form (sealed for encrypted databases), shipped to a read replica.
| Signature | Description |
|---|---|
fn is_empty(&self) -> bool | True when the segment holds no commits. |
fn save(&self, path: impl AsRef<Path>) -> Result<()> | Writes the serialized segment to a new file (write, fsync, rename); an existing destination is replaced only by the completed file. |
fn load(path: impl AsRef<Path>) -> Result<Self> | Reads and authenticates a segment file written by save. |
fn to_bytes(&self) -> Vec<u8> | Verifies the digest recorded by to_bytes (in memory it is recomputed). |
fn from_bytes(bytes: &[u8]) -> Result<Self> | Parses and authenticates a serialized segment. |
ReplicaFollower struct
vlite::ReplicaFollower A read-only follower file that applies commit-log segments from a primary. Applying a segment replays the file, so it costs time proportional to the file size. Call promote for failover.
| Signature | Description |
|---|---|
fn create(path: impl AsRef<Path>, segment: &LogSegment, key: Option<&EncryptionKey>) -> Result<Self> | Bootstraps a follower from the first segment of a primary (base_sequence == 0, which carries the file header). The destination must not exist. |
fn open(path: impl AsRef<Path>, key: Option<&EncryptionKey>) -> Result<Self> | Opens an existing follower file or a byte copy of a primary (maintenance::backup keeps the lineage). An incomplete tail left by a crash during apply is discarded: it is unacknowledged replica data the primary still has. |
fn path(&self) -> &Path | The follower's file path. |
fn db(&self) -> &Database | Read-only view of the replicated database. |
fn applied_sequence(&self) -> u64 | The last primary sequence number applied. |
fn status(&self) -> ReplicaStatus | The lineage, applied sequence, primary head and lag. |
fn apply(&mut self, segment: &LogSegment) -> Result<ReplicaStatus> | Applies the next segment in order. A segment that does not continue exactly from applied_sequence, belongs to another lineage or header, or fails any checksum, authentication or replay check is rejected and leaves the follower unchanged. |
fn apply_file(&mut self, segment_path: impl AsRef<Path>) -> Result<ReplicaStatus> | File-shipping mode: reads a segment file written by LogSegment::save. |
fn sync_from_log(&mut self, primary_log: impl AsRef<Path>, max_bytes: usize) -> Result<ReplicaStatus> | Same-machine tail of a closed or copied primary log: cuts the next segment from primary_log and applies it. A live primary holds an exclusive file lock; ship Database::export_log segments instead. |
fn put(&mut self, _id: u64, _vector: &[f32], _payload: &[u8]) -> Result<u64> | Replicas are read-only. |
fn delete(&mut self, _id: u64) -> Result<bool> | Always fails with ReadOnlyReplica: a follower accepts only replicated commits. |
fn write_batch(&mut self, _operations: &[crate::Mutation]) -> Result<()> | Always fails with ReadOnlyReplica: a follower accepts only replicated commits. |
fn promote(self) -> Database | Failover: turns the follower into a writable database. The replication link must already be stopped; the old primary must not be written again with the same lineage or the two histories diverge. |
Embedding
Providers that turn text or bytes into vectors.
Embedder trait
vlite::embedding::Embedder A Send + Sync embedding provider. Implement embed_bytes; embed_text defaults to embedding the text's UTF-8 bytes. No model runtime is linked: apart from HashEmbedder and the optional HttpEmbedder, providers are yours to supply.
| Signature | Description |
|---|---|
fn embed_bytes(&self, input: &[u8]) -> Result<Vec<f32>> | Embeds bytes into a vector. |
fn embed_text(&self, input: &str) -> Result<Vec<f32>> | Embeds text into a vector. The default implementation embeds its UTF-8 bytes. |
EmbedderRegistry struct
vlite::embedding::EmbedderRegistry Application-owned providers by name, stored as Arc<dyn Embedder>. Names are 1 to 256 bytes; registering an existing name replaces its provider.
| Signature | Description |
|---|---|
fn register(&mut self, name: impl Into<String>, provider: Arc<dyn Embedder>) -> Result<()> | Registers provider under name, replacing any provider with that name. The name must be 1 to 256 bytes. |
fn get(&self, name: &str) -> Option<Arc<dyn Embedder>> | The provider registered under name, or None. |
HashEmbedder struct
vlite::embedding::HashEmbedder Stable FNV-1a byte n-gram hashing, normalized to unit length. Not a semantic model.
| Signature | Description |
|---|---|
fn new(dimensions: usize) -> Result<Self> | A deterministic byte n-gram hashing embedder with dimensions outputs. It is for tests and pipelines, not semantic quality. |
HttpEmbedder struct
vlite::embedding::HttpEmbedder A blocking provider for OpenAI-compatible embeddings endpoints (feature http-embedder). It sends UTF-8 input with the model name and validates data[0].embedding.
| Signature | Description |
|---|---|
fn new(url: &str, model: &str, key: Option<String>) -> Result<Self> | Endpoint must include /embeddings. Secrets are never included in errors. http-embedder |
fn from_env() -> Result<Self> | Reads VLITE_EMBEDDING_URL, VLITE_EMBEDDING_MODEL and optional VLITE_EMBEDDING_KEY. http-embedder |
Property graph
Property graphs live in the same file as the vectors. Database::graph returns a read view and graph_mut a write handle.
GraphRef struct
vlite::property_graph::GraphRef Read handle to one live named graph, from Database::graph.
| Signature | Description |
|---|---|
fn name(&self) -> &str | The graph name. |
fn info(&self) -> GraphInfo | Information about the graph, including its node and edge counts. |
fn schema(&self) -> GraphSchema | The declared schema; empty when none was declared. |
fn observed_schema(&self, budget: Option<u64>) -> Result<ObservedSchema> | Summarizes the labels, relationship types and properties actually in use. It scans at most budget nodes and edges (default 100,000, at most 1,000,000); complete is false when the scan stopped early. |
fn view_sequence(&self) -> u64 | The commit sequence this handle reads at (echoed in every result). |
fn with_clock(&self, now_ms: u64) -> GraphRef<'db> | The same view read at now_ms (ms since the Unix epoch) instead of the current time. Nodes and edges whose deadline is at or before it are hidden, with every edge of a hidden node. It decides visibility only; it is not time travel. |
fn query(&self, query: &GraphQuery, options: &ReadOptions<'_>) -> Result<GraphRead<GraphOutput>> | Runs any read. |
fn explain(&self, query: &GraphQuery, options: &ReadOptions<'_>) -> Result<Explanation> | Validates and plans query like GraphRef::query and returns the normalized query, effective limits and index choices without examining any node or edge. |
fn query_text(&self, text: &str, params: &Metadata, limits: &GraphLimits) -> std::result::Result<GraphRead<GraphOutput>, GraphTextError> | Parses a read-only graph query text (see parse_graph_query) and runs it exactly like GraphRef::query on the typed query. The text's hop range and traversal LIMIT override limits; the result is still validated against GraphLimits::CEILING. |
fn explain_text(&self, text: &str, params: &Metadata, limits: &GraphLimits) -> std::result::Result<Explanation, GraphTextError> | Like GraphRef::query_text but returns GraphRef::explain's explanation without executing. |
fn get_node(&self, key: &str) -> Result<GraphRead<Option<NodeView>>> | The node with key, or None. |
fn get_node_by_id(&self, id: u64) -> Result<GraphRead<Option<NodeView>>> | The node with internal ID id, or None. |
fn get_edge(&self, id: u64) -> Result<GraphRead<Option<EdgeView>>> | The edge with internal ID id, or None. |
fn get_edge_by_key(&self, key: &str) -> Result<GraphRead<Option<EdgeView>>> | The edge with edge key key, or None. |
fn find_nodes(&self, request: &FindNodes, options: &ReadOptions<'_>) -> Result<GraphRead<Vec<NodeView>>> | See FindNodes. |
fn neighbors(&self, request: &Neighbors, options: &ReadOptions<'_>) -> Result<GraphRead<Neighborhood>> | See Neighbors. |
fn traverse(&self, request: &Traverse, options: &ReadOptions<'_>) -> Result<GraphRead<Traversal>> | See Traverse. |
fn shortest_path(&self, request: &ShortestPath, options: &ReadOptions<'_>) -> Result<GraphRead<PathOutcome>> | See ShortestPath. |
fn retrieve(&self, request: &Retrieve, options: &ReadOptions<'_>) -> Result<Retrieval> | Hybrid retrieval in one consistent view: a pivot search over a collection, then mapping to attached nodes, bounded expansion and evidence records. |
fn algorithm(&self, request: &GraphAlgorithmRequest, options: &GraphAlgorithmOptions<'_>) -> std::result::Result<GraphAlgorithmRead, GraphAlgorithmError> | Runs degree counts, hop-constrained weighted paths, PageRank, label propagation or sampled betweenness on an explicit local scope under shared work and memory limits. Incomplete extraction yields no values. Degree/path computation must finish before values are returned; iterative algorithms may return an earlier full step and sampled betweenness its completed sources as incomplete. |
Iterative graph algorithms
These additions to vlite::property_graph use GraphRef::algorithm, one graph view and one expiry clock. Results describe the explicit local scope, not the whole graph.
| Type or field | Meaning |
|---|---|
GraphAlgorithm::PageRank | Optional damping and tolerance default to 0.85 and 1e-8. Optional personalization gives positive masses for distinct scope seeds; otherwise teleport mass is uniform over scoped nodes. Optional weight_property selects edge weights; otherwise each arc has unit weight. |
GraphAlgorithm::LabelPropagation | Unweighted community detection with ascending-node, immediate label updates. Neighbors are symmetrized, parallel pairs collapsed and self-loops ignored. Ties keep the current label when possible, otherwise the smallest tied label. |
GraphAlgorithmLimits::max_iterations | Limits PageRank steps or label-propagation sweeps: default 20, at least 1, at most 100. Reaching the cap without convergence returns incomplete with IterationLimit; convergence on the final allowed step is not an iteration-limit stop. |
PageRankOutput, NodeScore | scores contains node_id/score rows; iterations, residual and converged describe the last full step. The residual is the L1 change over the full scoped vector. |
LabelPropagationOutput, CommunityAssignment | assignments contains node_id/community_id rows, with sweeps and converged. A community ID is its smallest member ID in the full scoped assignment. |
Interrupted steps or sweeps are discarded; no values are returned before the first full one. Rows are ordered by node ID and subject to output limits. Inspect GraphAlgorithmRead.complete and computation_complete, not just converged: output limits or a final cancellation/deadline stop can still make a converged result incomplete.
Sampled betweenness
This addition to vlite::property_graph uses GraphRef::algorithm with the same scope, view, expiry clock and limits. Scores describe the explicit local scope, not the whole graph.
| Type or field | Meaning |
|---|---|
GraphAlgorithm::Betweenness | Unweighted Brandes from sampled sources over directed arcs (both ways for Both), with parallel arcs collapsed and self-loops ignored. Every shortest path counts; endpoints are excluded. The required sampling_seed ranks scoped nodes by SplitMix64 of the seed XOR the node ID, then by ID. For more than two scoped nodes a score is (n / k) * dependencies / ((n - 1) * (n - 2)) over the k completed sources; otherwise every score is 0. |
GraphAlgorithmLimits::max_sampled_sources | Sources sampled: min(max_sampled_sources, n); default 16, at least 1, at most 64. Only sampling every scoped node gives exact scores. |
BetweennessOutput | scores contains node_id/score rows (NodeScore); selected_sources lists the sampled sources in sampling order, completed_sources the prefix that finished, completed_source_count its length, and estimated is true when fewer sources than scoped nodes completed. There is no confidence interval. |
An interrupted source is discarded; no values are returned before the first completed source. A stop after it returns the completed sources' scores, marked incomplete. A path count or dependency beyond the largest finite f64 fails with NumericOverflow. Rows are ordered by node ID and subject to output limits; the source lists are not.
GraphMut struct
vlite::property_graph::GraphMut Write handle to one live named graph, from Database::graph_mut. It borrows the database exclusively.
| Signature | Description |
|---|---|
fn name(&self) -> &str | The graph name. |
fn info(&self) -> GraphInfo | Information about the graph, including its node and edge counts. |
fn write_batch(&mut self, ops: &[GraphOp]) -> Result<GraphBatchResult> | Validates every operation, appends one frame, syncs, then applies it. On error nothing is written. At most 4096 operations, and at most 16 MiB encoded. |
fn create_node(&mut self, key: &str, labels: &[&str], properties: &Metadata) -> Result<GraphWrite> | Creates a node with a unique key, labels and properties. An existing key is an error. |
fn upsert_node(&mut self, key: &str, labels: &[&str], properties: &Metadata, expected: Expected) -> Result<GraphWrite> | Creates the node, or replaces its labels and properties, subject to expected. |
fn patch_node(&mut self, key: &str, patch: &NodePatch, expected: Expected) -> Result<GraphWrite> | Adds or removes labels and sets or unsets properties, subject to expected. |
fn delete_node(&mut self, key: &str, expected: Expected) -> Result<u64> | Returns the commit revision. |
fn create_edge(&mut self, key: Option<&str>, source: &str, relationship: &str, destination: &str, properties: &Metadata) -> Result<GraphWrite> | Creates an edge from source to destination with a relationship type, an optional unique key and properties. |
fn patch_edge(&mut self, edge: EdgeRef, set: &Metadata, unset: &[&str], expected: Expected) -> Result<GraphWrite> | Sets or unsets edge properties, subject to expected. |
fn delete_edge(&mut self, edge: EdgeRef, expected: Expected) -> Result<u64> | Returns the commit revision. |
fn set_node_expiry(&mut self, key: &str, expires_at_ms: Option<u64>, expected: Expected) -> Result<GraphWrite> | Sets (ms since the Unix epoch) or clears (None) the node's deadline, subject to expected. From the deadline the node and every edge of it are hidden and later removed. |
fn set_edge_expiry(&mut self, edge: EdgeRef, expires_at_ms: Option<u64>, expected: Expected) -> Result<GraphWrite> | Sets or clears the edge's own deadline, subject to expected; only the edge expires. |
fn attach(&mut self, node: &str, collection: &str, record: u64) -> Result<u64> | Returns the commit revision. |
fn detach(&mut self, node: &str, collection: &str) -> Result<u64> | Returns the ID of the detached record. |
fn put_schema(&mut self, schema: &GraphSchema) -> Result<u64> | Replaces the declared schema (see GraphOp::PutSchema); returns the commit revision. |
fn ensure_edge(&mut self, source: &str, relationship: &str, destination: &str, properties: &Metadata) -> Result<GraphWrite> | Creates the edge unless it exists (see GraphOp::EnsureEdge). |
GraphSchema struct
vlite::property_graph::GraphSchema The declared schema of one graph. The default (empty) schema declares nothing and enforces nothing.
| Signature | Description |
|---|---|
fn label(mut self, name: impl Into<String>, definition: LabelDefinition) -> Self | Declares (or replaces) one label. |
fn relationship(mut self, name: impl Into<String>, definition: RelationshipDefinition) -> Self | Declares (or replaces) one relationship type. |
fn is_empty(&self) -> bool | True when the schema declares nothing. |
fn validate(&self) -> Result<(), GraphError> | Checks every rule that does not depend on graph data. |
LabelDefinition struct
vlite::property_graph::LabelDefinition A declared label.
| Signature | Description |
|---|---|
fn new(description: impl Into<String>) -> Self | A node label definition with a description. |
fn property(mut self, name: impl Into<String>, definition: PropertyDefinition) -> Self | Declares (or replaces) one property. |
RelationshipDefinition struct
vlite::property_graph::RelationshipDefinition A declared relationship type.
| Signature | Description |
|---|---|
fn new(description: impl Into<String>) -> Self | A relationship type definition with a description. |
fn endpoint(mut self, source: impl Into<String>, destination: impl Into<String>) -> Self | Allows edges from a node with source to a node with destination. |
fn multiplicity(mut self, multiplicity: Multiplicity) -> Self | Sets the relationship's Multiplicity. |
fn property(mut self, name: impl Into<String>, definition: PropertyDefinition) -> Self | Declares (or replaces) one property. |
PropertyDefinition struct
vlite::property_graph::PropertyDefinition One declared property.
| Signature | Description |
|---|---|
fn new(value_type: PropertyType) -> Self | An optional, non-unique, unindexed property of value_type. |
fn required(mut self) -> Self | Marks the property as required. |
fn unique(mut self) -> Self | Requires the property's values to be unique. |
fn index(mut self, kind: PropertyIndexKind) -> Self | Adds an index of the given kind on the property. |
PropertyType enum
vlite::property_graph::PropertyType The type of a declared property: one MetadataValue variant.
| Signature | Description |
|---|---|
fn of(value: &PropertyValue) -> Self | The type of value. |
NodeSelector enum
vlite::property_graph::NodeSelector Names a node by internal ID or by key.
| Signature | Description |
|---|---|
fn key(key: &str) -> Self | Selects a node by its key. |
Neighbors struct
vlite::property_graph::Neighbors One page of a node's edges matching edge_conditions, ordered by (relationship type, edge ID), with their other endpoints. types: None means every type; an empty list is invalid. limit defaults to max_output_edges.
| Signature | Description |
|---|---|
fn new(node: NodeSelector) -> Self | Outgoing edges of every type, first page. |
Traverse struct
vlite::property_graph::Traverse Breadth-first traversal up to max_hops. Each node is visited once at its minimum depth. Nodes failing expand_filter are visited but not expanded; return_filter only selects returned nodes; only edges matching edge_filter are followed.
| Signature | Description |
|---|---|
fn new(start: Vec<NodeSelector>) -> Self | Outgoing edges of every type, no filters, no paths. |
ShortestPath struct
vlite::property_graph::ShortestPath One unweighted shortest path of at most max_hops edges. Ties go to the lexicographically smallest edge-ID sequence.
| Signature | Description |
|---|---|
fn new(source: NodeSelector, destination: NodeSelector) -> Self | Following outgoing edges of every type. |
Pivot struct
vlite::property_graph::Pivot The pivot search: search_hybrid over collection with at least one of vector and text. filter applies to both legs and to re-validation.
| Signature | Description |
|---|---|
fn new(collection: &str, k: usize) -> Self | No vector or text yet; exact squared-L2 vector leg, default fusion. |
GraphTextQuery struct
vlite::property_graph::GraphTextQuery A parsed graph query text: one typed query plus its RETURN projection and limit overrides. See the graph query guide.
| Signature | Description |
|---|---|
fn limits(&self, base: GraphLimits) -> GraphLimits | base with this query's overrides applied. |
GraphQueryErrorKind enum
vlite::property_graph::GraphQueryErrorKind What kind of problem a LanguageError reports.
| Signature | Description |
|---|---|
fn code(self) -> &'static str | A stable lowercase name. |
Key-value store
Namespaced string keys with byte values and no vector, stored in an ordinary one-dimension collection (format 4 or newer; expiry needs format 5). Versions are commit sequences: use them for compare-and-set; they are not durable lease-fencing tokens. See key-value store.
| Signature | Description |
|---|---|
fn kv_store(&mut self, collection: &str) -> Result<KvStore<'_>> | Write handle to the key-value store in collection, creating a one-dimension collection when it does not exist. An existing collection must have one dimension. |
fn kv_view(&self, collection: &str) -> Result<KvView<'_>> | Read-only view of an existing key-value collection. |
fn put(&mut self, namespace: &str, key: &str, value: &[u8], options: KvPut) -> Result<u64> | Durably writes value and returns its new version. options.expected is the precondition (Expected::Absent also matches an expired entry); a failed one returns RevisionMismatch { current } without writing. options.expires_at_ms sets an absolute expiry. |
fn put_at(&mut self, namespace: &str, key: &str, value: &[u8], options: KvPut, now_ms: u64) -> Result<u64> | put with a caller-supplied Unix-millisecond clock for expiry checks. |
fn delete(&mut self, namespace: &str, key: &str, expected: Expected) -> Result<bool> | Durably deletes the entry. Returns false when it is absent or expired. |
fn delete_at(&mut self, namespace: &str, key: &str, expected: Expected, now_ms: u64) -> Result<bool> | delete with a caller-supplied Unix-millisecond clock. |
fn write_batch(&mut self, operations: &[KvOp<'_>]) -> Result<Vec<KvOutcome>> | Commits puts and deletes of any namespaces of the collection, all or nothing, as one frame, and returns one KvOutcome for each in order: Put { version } or Deleted(bool). It behaves as if the operations ran one at a time, in order, on one clock. Every put of the batch gets the same version, a valid Expected::Revision for its key. Each (namespace, key) may appear once. The first operation that cannot run fails the whole batch with the error of its single call and nothing is written. A put with options.expires_at_ms set is refused with InvalidKvKey; a batch put clears the deadline of the entry it replaces. At most MAX_KV_BATCH_OPERATIONS (1,000) operations and MAX_KV_BATCH_VALUE_BYTES (4,194,304) value bytes. KvOp and KvOutcome are #[non_exhaustive]. |
fn write_batch_at(&mut self, operations: &[KvOp<'_>], now_ms: u64) -> Result<Vec<KvOutcome>> | write_batch with a caller-supplied Unix-millisecond clock for expiry checks. |
fn get(&self, namespace: &str, key: &str) -> Result<Option<KvEntry>> | The live entry, or None when it is absent or expired. |
fn view(&self) -> KvView<'_> | Read-only view of the same store, for listing. |
fn get(&self, namespace: &str, key: &str) -> Result<Option<KvEntry>> | The live entry with its value and version, or None. |
fn get_at(&self, namespace: &str, key: &str, now_ms: u64) -> Result<Option<KvEntry>> | get with a caller-supplied Unix-millisecond clock. |
fn get_many(&self, keys: &[(&str, &str)]) -> Result<Vec<Option<KvEntry>>> | The entries of (namespace, key) pairs of any namespaces, in the order given: None for a key that is absent or expired. A key may repeat. One view of the store and one clock serve the call, so its keys agree with each other; nothing is consistent between two calls. At most MAX_KV_GET_MANY_KEYS (1,000) keys, otherwise InvalidKvKey. Copies every returned value: use visit_many_at to read without copying. |
fn get_many_at(&self, keys: &[(&str, &str)], now_ms: u64) -> Result<Vec<Option<KvEntry>>> | get_many with a caller-supplied Unix-millisecond clock. |
fn list(&self, namespace: &str, prefix: &str, after: Option<&str>, limit: usize) -> Result<Vec<KvEntry>> | Live entries of namespace whose key starts with prefix, in key order, strictly after after when given. limit is 1 to 10,000. Scans the whole collection but keeps only limit + 1 candidate keys. Copies every returned value (up to 10,000 values of just under 1 MiB, roughly 10 GB): use a smaller limit or visit_at when values can be large. |
fn list_at(&self, namespace: &str, prefix: &str, after: Option<&str>, limit: usize, now_ms: u64) -> Result<Vec<KvEntry>> | list with a caller-supplied Unix-millisecond clock. |
fn visit_at(&self, namespace: &str, prefix: &str, after: Option<&str>, limit: usize, now_ms: u64, visitor: impl FnMut(KvRef<'_>) -> ControlFlow<()>) -> Result<()> | The entries list_at returns, lent to visitor in key order instead of copied. Each KvRef borrows its key and value for that call and carries version, expires_at_ms and has_next (another live entry follows, decided from keys alone). Return ControlFlow::Break(()) to stop. KvRef is #[non_exhaustive]: read its fields, only the library builds one, and a later release may add fields. One scan, working memory O(limit), and only what the visitor copies is allocated. |
fn visit_many_at(&self, keys: &[(&str, &str)], now_ms: u64, visitor: impl FnMut(usize, Option<KvRef<'_>>) -> ControlFlow<()>) -> Result<()> | The entries get_many_at returns, lent to visitor in the order of keys instead of copied. The visitor gets the position of each key and its live KvRef, or None when the key is absent or expired. KvRef::has_next says whether a later requested key follows. Return ControlFlow::Break(()) to stop; the keys after it are not read. The keys are checked as for get_many before the first visit. |
fn first_slot(namespace: &str, key: &str) -> u64vlite::kv::first_slot | First record ID probed for a key. The entry may occupy any of the next KV_PROBE_SLOTS (16) IDs, wrapping. Stable across releases, so other tools can locate entries. |
Free functions
Functions outside any type. The path under each signature shows where it lives.
| Signature | Description |
|---|---|
fn read_log_changes(path: impl AsRef<Path>, key: Option<&EncryptionKey>, cursor: &FeedCursor, max_events: usize) -> Result<ChangeBatch>vlite::changes::read_log_changes | Reads changes from a closed (or copied) log file without opening a Database. Pass key for encrypted logs. |
fn read_log_graph_changes(path: impl AsRef<Path>, key: Option<&EncryptionKey>, cursor: &GraphFeedCursor, graph_events: GraphEventSet, max_events: usize) -> Result<GraphFeedBatch, GraphFeedError>vlite::changes::read_log_graph_changes | Database::graph_changes_after from a closed (or copied) log file or log directory without opening a Database. Pass key for encrypted logs. |
fn default_sidecar_path(database: impl AsRef<Path>) -> PathBufvlite::disk_ann::default_sidecar_path | Conventional sidecar location for a datafile: <datafile>.dann. |
fn fuse_ranked(dense: &[crate::SearchHit], sparse: &[crate::SearchHit], k: usize, fusion: FusionOptions) -> Result<Vec<HybridHit>>vlite::hybrid::fuse_ranked | Weighted reciprocal rank fusion for arbitrary dense/sparse ranked legs. Distances are retained from the first leg; the second contributes rank only. |
fn set_wasm_clock_ms(now_ms: u64)vlite::set_wasm_clock_ms | WebAssembly has no system clock; the host (for example Date.now()) sets the current Unix-millisecond time used for TTL expiry and commit timestamps. wasm32 |
fn reencrypt(source_path: impl AsRef<Path>, source_key: Option<&EncryptionKey>, destination: impl AsRef<Path>, destination_key: Option<&EncryptionKey>) -> Result<Inspection>vlite::maintenance::reencrypt | Rewrites a database into a new file under a different key (key rotation), from unencrypted to encrypted, or from encrypted to unencrypted. |
fn restore_to(base_backup: Option<&Path>, log_path: impl AsRef<Path>, destination: impl AsRef<Path>, target: RestoreTarget, key: Option<&EncryptionKey>) -> Result<RestoreReport>vlite::maintenance::restore_to | Point-in-time restore into a new file. |
fn export_log_segment(log_path: impl AsRef<Path>, key: Option<&EncryptionKey>, after_sequence: u64, max_bytes: usize) -> Result<LogSegment>vlite::maintenance::export_log_segment | Cuts a log segment from a closed (or copied) log file. See read_segment. |
fn inspect(path: impl AsRef<Path>) -> Result<Inspection>vlite::maintenance::inspect | Fully validates a closed source while holding its exclusive OS lock. |
fn inspect_with_key(path: impl AsRef<Path>, key: &EncryptionKey) -> Result<Inspection>vlite::maintenance::inspect_with_key | inspect for an encrypted file; validates every frame's authentication tag. |
fn inspect_detail(path: impl AsRef<Path>) -> Result<InspectionDetail>vlite::maintenance::inspect_detail | Like inspect, also reporting lineage, collections and open import jobs. |
fn verify(path: impl AsRef<Path>) -> Result<Verification>vlite::maintenance::verify | Fully validates a complete closed file and computes a CRC-32 over all of its bytes. An incomplete tail is an error. The file is never modified. |
fn verify_with_key(path: impl AsRef<Path>, key: &EncryptionKey) -> Result<Verification>vlite::maintenance::verify_with_key | verify for an encrypted file. |
fn backup(source_path: impl AsRef<Path>, destination: impl AsRef<Path>) -> Result<Inspection>vlite::maintenance::backup | Creates a validated, byte-identical snapshot at a previously nonexistent path. |
fn backup_with_key(source_path: impl AsRef<Path>, destination: impl AsRef<Path>, key: &EncryptionKey) -> Result<Inspection>vlite::maintenance::backup_with_key | backup of an encrypted file: a byte-identical copy that stays encrypted under the same key. |
fn convert_to_directory(source_path: impl AsRef<Path>, destination: impl AsRef<Path>) -> Result<Inspection>vlite::maintenance::convert_to_directory | Converts a closed format 5 file into a new directory store: a checkpoint image plus an empty log. The lineage, revisions and feed cursors are kept. Files with commit timestamps are rejected. backup of a directory packs it back into one file. |
fn convert_to_directory_with_key(source_path: impl AsRef<Path>, destination: impl AsRef<Path>, key: &EncryptionKey) -> Result<Inspection>vlite::maintenance::convert_to_directory_with_key | convert_to_directory for an encrypted file; the directory stays encrypted under the same key. |
fn restore(backup_path: impl AsRef<Path>, destination: impl AsRef<Path>) -> Result<Inspection>vlite::maintenance::restore | Restores a valid backup into a new path. Existing paths are never replaced. |
fn restore_with_key(backup_path: impl AsRef<Path>, destination: impl AsRef<Path>, key: &EncryptionKey) -> Result<Inspection>vlite::maintenance::restore_with_key | restore of an encrypted backup (same key; the restored copy keeps its salt and key ID but gets a new lineage). |
fn compact(source_path: impl AsRef<Path>, destination: impl AsRef<Path>) -> Result<CompactionReport>vlite::maintenance::compact | Writes only live records to a new standalone file: format 3 for format 1–3 sources, format 4 (with a new lineage) for format 4 sources. |
fn compact_at(source_path: impl AsRef<Path>, destination: impl AsRef<Path>, now_ms: u64) -> Result<CompactionReport>vlite::maintenance::compact_at | Compacts at an explicit Unix-millisecond clock; format 5 records expired at or before now_ms are omitted. |
fn compact_with_key(source_path: impl AsRef<Path>, destination: impl AsRef<Path>, key: &EncryptionKey) -> Result<CompactionReport>vlite::maintenance::compact_with_key | Compacts an encrypted format 5 file into a new encrypted file under the same key (fresh salt, so every ciphertext differs from the source). |
fn upgrade(source_path: impl AsRef<Path>, destination: impl AsRef<Path>) -> Result<CompactionReport>vlite::maintenance::upgrade | Explicit offline upgrade of a closed format 1–4 file to format 4; format 5 sources stay format 5. |
fn drill(backup_path: impl AsRef<Path>, workdir: impl AsRef<Path>) -> Result<DrillReport>vlite::maintenance::drill | Restores a backup to a scratch file, validates it, compares counts and runs self-searches, then deletes the scratch file. A mismatch is Corrupt. |
fn inspect_graph(path: impl AsRef<Path>, key: Option<&EncryptionKey>) -> Result<GraphInspection>vlite::property_graph::inspect_graph | maintenance::inspect / inspect_with_key (key is required exactly for encrypted files) plus the graph flag and counts. Graph invariants are checked; a violation is Corrupt at offset 0. |
fn verify_graph(path: impl AsRef<Path>, key: Option<&EncryptionKey>) -> Result<GraphVerification>vlite::property_graph::verify_graph | maintenance::verify / verify_with_key plus the graph flag and counts, with the same invariant checks as inspect_graph. |
fn enable_graph(source: impl AsRef<Path>, destination: impl AsRef<Path>, key: Option<&EncryptionKey>) -> Result<CompactionReport>vlite::property_graph::enable_graph | Copies a closed plain format 4 or 5 file to a new format 5 file with graph support. The copy is compacted, and the source is left untouched. |
fn strip_graph(source: impl AsRef<Path>, destination: impl AsRef<Path>, key: Option<&EncryptionKey>, confirm_graph_data_loss: bool) -> Result<StripGraphReport>vlite::property_graph::strip_graph | Copies a file to a new format 5 file without its graphs. Records are kept. Needs confirm_graph_data_loss set to true. |
fn parse_graph_query(text: &str, params: &Metadata) -> std::result::Result<GraphTextQuery, GraphQueryError>vlite::property_graph::parse_graph_query | Parses a read-only graph query text into the typed query it stands for, binding $name parameters from params (every parameter must be used). No graph is touched; the typed query is validated when it runs. |
fn parse(input: &str) -> std::result::Result<ParsedQuery, ParseError>vlite::query_language::parse | Parses a query-language statement into a ParsedQuery. Invalid syntax is a ParseError. |
fn tokenize(text: &str) -> Vec<String>vlite::text_index::tokenize | Splits on non-alphanumeric characters, lowercases, drops tokens over MAX_TOKEN_BYTES and keeps at most MAX_TOKENS_PER_FIELD tokens. |
C ABI
The C library (vlite_ffi, header bindings/c/vlite.h) is the layer the Python and Node.js SDKs load. Release archives include it, built with graph support. Most work goes through one function, vlite_execute: send a JSON request with an op field and read back a JSON response.
{"op":"create","path":"documents.vlite","dimensions":3}
{"ok":true,"result":{"handle":"1"}}
{"ok":false,"error":{"code":"invalid_handle","message":"Unknown or closed handle"}}
Check that vlite_abi_version() returns 1. Pass handle 0 to create and open, then use the returned handle, a decimal string, for later calls. Handles belong to the loaded library and process. Free every response exactly once with vlite_response_free. Requests are UTF-8 JSON of at most 8 MiB, and unknown fields are errors. IDs, revisions and integer metadata values are decimal strings. Calls are synchronous and run one at a time.
Functions · Requests · Batch operations · Feature requests · Graph requests · Graph batch operations · Key-value requests
Functions
| Signature | Description |
|---|---|
uint32_t vlite_abi_version(void) | Returns the ABI major version, 1. Check it after loading the library. |
char *vlite_execute(uint64_t handle, const uint8_t *input, size_t length) | Runs one JSON request against a handle and returns a JSON response. input is borrowed for the call. Use handle 0 to create or open a database. |
char *vlite_search_f32(uint64_t handle, const uint8_t *input, size_t length, const float *vectors, size_t count) | Optional fast path. Runs a search or search_approximate_ready request with the vector field omitted and the query passed as native float32 values. Look the symbol up when loading, because older builds lack it. |
char *vlite_batch_put_f32(uint64_t handle, const uint8_t *input, size_t length, const float *vectors, size_t count) | Optional fast path. Puts up to 4,096 rows in one atomic batch. The JSON gives dimensions and each row's id, payload_base64 and metadata; the vectors are passed as row-major native float32 values. Look the symbol up when loading. |
void vlite_response_free(char *response) | Frees a response returned by this library. Call it exactly once per response. Freeing NULL is allowed. |
Requests
Send {"op": "name", ...} to vlite_execute. Omitting collection uses default. Named collections and imports need a format 4 file.
| Request | Description |
|---|---|
features { request } | Runs a feature request: {"op": "features", "request": {"op": ...}}. See Feature requests below. |
graph { request } | Runs a property-graph request: {"op": "graph", "request": {"op": ...}}. See Graph requests below. |
kv { request } | Runs a key-value request: {"op": "kv", "request": {"op": ...}}. See Key-value requests below. |
capabilities | Reports what the library supports, such as {"graph": true}. Works with any handle. |
create { path, dimensions, format?, flush_interval_ms? } | Creates a new database file and returns its handle. format defaults to 5, which holds property graphs; 3 or 4 creates a plain vector file. Use the feature create for encryption or commit timestamps. flush_interval_ms (1 to 60,000) turns on periodic durability. Use handle 0. |
open { path, read_only?, flush_interval_ms? } | Opens an existing file and returns its handle. read_only takes a shared lock, so several readers can open the file at once. Use handle 0. |
close | Closes the database and releases its file lock. |
sync | Forces acknowledged commits to stable storage. It matters only when the handle was opened with a flush interval (1 to 60000 ms): then a process crash loses nothing, but an operating-system crash can lose the latest commits. |
info | Returns the dimensions, the record count and the file format version. |
get { id, collection? } | Returns a record: its vector, payload, metadata and current revision. A missing ID fails with not_found. |
get_many { ids, collection? } | Returns records in request order, with null (None in Python) for each missing ID. |
put { id, vector, payload_base64?, metadata?, collection?, expected_revision? } | Inserts or replaces a record. With an expected revision ("absent" or a revision string) the write is compare-and-set and returns the new revision. An expiry cannot be combined with an expected revision. |
delete { id, collection?, expected_revision? } | Deletes a record and returns whether it existed. An expected revision makes the delete conditional. |
batch { operations, collection? } | Applies put and delete operations in order, in one atomic commit. |
revision { id, collection? } | Returns the record's current revision, or null when the record does not exist. |
search { vector?, k, filter?, metric?, collection?, mode?, explain?, text?, fusion?, vector_leg?, ef_search?, quantization?, rerank_multiplier? } | Searches with a mode: exact (the default); auto, which picks an exact scan, a metadata index or a ready ANN index and never builds one; or hybrid, which fuses BM25 text ranks with vector ranks. explain adds statistics, and the plan for auto. |
build_index { metric?, collection?, quantization?, rerank_multiplier? } | Builds an in-memory HNSW index for a collection without changing the file. It supports squared_l2 and cosine; quantization trades recall for memory. |
search_approximate_ready { vector?, k, ef_search, metric?, collection?, quantization?, rerank_multiplier? } | Searches the collection's built HNSW index. The search breadth (ef_search) defaults to 100. |
list_collections | Lists the collections with their dimensions and live record counts. |
create_collection { name, dimensions, settings? } | Creates a named collection with its own dimensions and optional settings. Names match ^[a-z][a-z0-9_-]{0,62}$, and default is reserved. |
drop_collection { name } | Drops an empty named collection. A collection with live records or an open import job is rejected, and default cannot be dropped. |
set_collection_settings { name, settings } | Replaces a collection's settings; omitted settings revert to the defaults. Reports whether the settings were persisted. |
next_import_job_id | Returns a new import job ID. |
import_chunk { job, chunk, operations, collection?, policy? } | Applies one chunk of operations to an import job. The policy either rejects the whole chunk when an operation is invalid (reject_chunk) or skips invalid operations (skip_invalid). |
import_status { job } | Reports an import job's progress. |
import_finish { job, collection? } | Finishes an import job and returns its final status. |
import_abort { job, collection? } | Aborts an import job and returns its status. |
ann_quality { collection?, metric?, quantization?, rerank_multiplier?, samples?, k?, ef_search?, seed?, max_distance_evaluations? } | Measures the HNSW index's recall against exact search on sampled queries, within a distance-evaluation budget. |
ann_memory { collection?, metric?, quantization?, rerank_multiplier? } | Reports the memory used by the collection's HNSW index. |
Batch operations
Each item of the batch request's operations list is one of these, tagged with op.
| Request | Description |
|---|---|
put { id, vector, payload_base64?, metadata? } | Inserts or replaces a record. payload_base64 and metadata are optional. |
delete { id } | Deletes a record. |
Feature requests
Send these inside {"op": "features", "request": {...}}. create, open, open_from_bytes and restore_to use handle 0. The handles they return work with every request.
| Request | Description |
|---|---|
create { path?, dimensions, options? } | Creates a database and returns its handle. Omit path for an in-memory database. options sets format (3, 4 or 5; default 5, with property graphs), credentials for encryption, commit_timestamps and flush_interval_ms. Use handle 0. |
open { path, credentials?, read_only?, flush_interval_ms? } | Opens a file and returns its handle. Pass credentials for an encrypted file. Use handle 0. |
open_from_bytes { bytes_base64, credentials? } | Opens a database image made by to_bytes, in memory. |
to_bytes | Returns an in-memory database as a byte image for open_from_bytes. |
encryption_info | Returns whether the file is encrypted and its key ID. |
put_with_expiry { id, vector, payload_base64?, metadata?, expires_at_ms?, collection? } | Writes a record that expires at an absolute Unix time in milliseconds (null means never) and returns its revision. Needs format 5. |
update_metadata { id, metadata, collection? } | Replaces a record's metadata but keeps its vectors, payload and expiry. Returns the new revision. Needs format 5. |
search_grouped { vector, groups, hits_per_group, field, filter?, metric?, collection? } | Nearest hits grouped by a metadata field: up to a number of groups, with a cap on hits per group. |
recommend { k, positive_ids?, negative_ids?, positive_vectors?, negative_vectors?, filter?, metric?, collection? } | Finds records near positive examples and away from negative ones, given as IDs or vectors. |
facets { field, filter?, collection? } | Counts records for each value of a metadata field, optionally filtered. |
numeric_stats { field, filter?, collection? } | Summarizes a numeric metadata field over the records that match a filter. |
search_geo { vector, k, field, latitude, longitude, radius_meters, filter?, metric?, sort?, collection? } | Vector search limited to records whose geopoint field lies within a radius, sorted by vector distance or by geographic distance. |
configure_vector { name, dimensions, metric?, active_version, history?, collection? } | Declares a named dense vector: its dimensions, metric (default squared_l2), active version and how many old versions to keep (default 0). Needs format 5. |
vector_specs { collection? } | Returns the declared named vectors. |
record_vectors { id, collection? } | Returns a record's named dense and sparse vectors, or null. |
put_vectors { id, dense?, sparse?, collection? } | Replaces all of a record's named dense and sparse vectors in one commit. The record must exist. |
put_vector_version { id, name, version, vector, collection? } | Writes one version of a record's named vector, then applies the history limit. |
prune_vector_history { name, history, collection? } | Sets how many old versions a named vector keeps and removes the rest. |
search_named { name, version?, vector, k, collection? } | Exact search over a named vector, at its active version or a given one. |
search_sparse { name, vector, k, collection? } | Searches a named sparse vector with a query of index and weight pairs. |
search_dense_sparse { dense_name, version?, dense, sparse_name, sparse, k, fusion?, collection? } | Fuses a named dense search and a named sparse search into one ranking. |
rerank { vector, candidates, limit, method?, metric?, lambda?, collection? } | Reorders candidate records by exact distance to a query vector, or by maximal marginal relevance (mmr) with a lambda trade-off, and returns at most limit hits. |
query { query, parameters?, collection? } | Runs one read-only statement in the VLite query language, binding named vector parameters. |
feed_cursor | Returns a cursor at the current end of the change feed. |
changes_after { cursor?, max_events? } | Reads committed changes after a cursor, or from the beginning, up to a maximum number of events (default 1000). Returns the changes, the next cursor, whether more remain and the head. A batch is never split across reads. Covers vector and graph commits. |
restore_to { log_path, destination, base_backup?, sequence?, timestamp_ms?, credentials? } | Restores a closed copy of a commit log to a new path, as of one sequence number or one timestamp; give exactly one. It never overwrites, and can start from a base backup. |
build_disk_ann { path, metric?, collection? } | Writes an HNSW index to a sidecar file and returns the committed state it was built from. Refused for encrypted files. Any later commit makes it stale. |
search_disk_ann { path, vector, k, ef_search?, cache_bytes? } | Searches a disk index through a bounded cache (default 8 MiB, ef_search 100). The index must match the database's current state. |
save_ann_snapshot { path } | Atomically writes every in-memory HNSW index to a sidecar file, conventionally <datafile>.ann, and returns the index count and size. Refused for encrypted files, because the sidecar is not encrypted. |
load_ann_snapshot { path } | Installs HNSW indexes from a snapshot sidecar instead of rebuilding them. The status is loaded, missing or a rejection code; anything but loaded leaves the database unchanged. |
Graph requests
Send these inside {"op": "graph", "request": {...}}. On a plain vector file they fail with graphs_not_enabled. Node and edge IDs, revisions and sequences are decimal strings.
| Request | Description |
|---|---|
is_graph_enabled | True when the file can hold property graphs. |
list_graphs | Lists the graphs with their node and edge counts. |
create_graph { graph } | Creates an empty named graph. |
drop_graph { graph } | Drops a graph. The graph must be empty. |
get_node { graph, node, limits?, projection? } | Fetches one node, or null when it does not exist. |
get_edge { graph, edge, limits?, projection? } | Fetches one edge, or null when it does not exist. |
find_nodes { graph, label?, conditions?, limit?, cursor?, limits?, projection? } | Finds nodes by label and typed property conditions, in ascending ID order, with cursor paging. |
neighbors { graph, node, direction?, types?, edge_conditions?, limit?, cursor?, limits?, projection? } | Lists a node's edges and adjacent nodes, filtered by direction, relationship type and edge conditions, with cursor paging. |
traverse { graph, start, direction?, types?, expand_filter?, return_filter?, edge_filter?, include_paths?, limits?, projection? } | Bounded breadth-first traversal from start nodes, with separate filters for expansion, results and edges, and optional paths. |
shortest_path { graph, source, destination, direction?, types?, limits?, projection? } | Finds one unweighted shortest path between two nodes, within limits. |
explain { query } | Plans a graph read request without running it. |
batch { graph, ops } | Applies graph batch operations in order, in one atomic commit. Returns the new revision and one outcome per operation. |
Graph batch operations
Each item of the batch graph request's ops list is one of these, tagged with op. A batch holds up to 4,096 operations. They apply in order, see earlier operations of the same batch, and commit together or not at all. expected is "any" (the default), "absent" or {"revision": "N"}. Edges are named by {"id": ...} or {"key": ...}.
| Request | Description |
|---|---|
create_node { key, labels?, properties? } | Creates a node with a new key. Fails if a live node has the key. |
upsert_node { key, labels?, properties?, expected? } | Creates a node, or replaces all labels and properties of an existing one. Its edges and attachments are kept. |
patch_node { key, add_labels?, remove_labels?, set?, unset?, expected? } | Adds or removes labels and sets or unsets properties on a node. |
delete_node { key, expected? } | Deletes a node that has no edges. Its attachments are removed; the records are kept. |
create_edge { key?, source, relationship, destination, properties? } | Creates a directed edge between two live nodes. If key names a live edge, an identical edge is returned unchanged and anything else fails. Without a key, a new edge is always created. |
patch_edge { edge, set?, unset?, expected? } | Sets or unsets properties on an edge. |
delete_edge { edge, expected? } | Deletes an edge. |
attach { node, collection, record } | Links a node to a live record without expiry. A node has at most one record per collection, and a record at most one node. Attached records cannot be deleted or given an expiry until detached. |
detach { node, collection } | Removes a node's link to its record in a collection. |
put_vector { collection, id, vector, payload_base64?, metadata? } | Inserts or replaces a vector record in the same commit. |
delete_vector { collection, id } | Deletes a vector record in the same commit. Fails while the record is attached. |
Key-value requests
Send these inside {"op": "kv", "request": {...}} on a database handle. collection is required and must already exist with one dimension; it is never created. Values are canonical padded base64, and versions and deadlines are decimal strings. expected is "any" (the default), "absent" or {"revision": "N"}. The fields, limits and error codes are those of the shell and MCP key-value tools; see the key-value guide.
| Request | Description |
|---|---|
get { collection, namespace, key } | Returns {key, value_base64, version, expires_at_ms}. An absent or expired key fails with kv_not_found. |
put { collection, namespace, key, value_base64, expected?, expires_at_ms? } | Writes a value of 0 to 1,047,290 bytes, atomically with the expected check, and returns {version, expires_at_ms}. The deadline is an absolute Unix-millisecond time and needs format 5; omitted or null it clears any old deadline. A failed check is precondition_failed. |
delete { collection, namespace, key, expected? } | Deletes an entry and returns {deleted}, false when it was absent or expired. |
list { collection, namespace, prefix?, after?, limit? } | Lists live entries in UTF-8 key order as {items, next_after}. A page holds at most limit (1 to 10,000, default 100) entries and 16 MiB of JSON, so it can be shorter than limit. Pass next_after as after until it is null. |
WebAssembly
The WebAssembly module runs an in-memory database in a browser, Node.js or another WebAssembly host. It is source-only: build bindings/wasm for wasm32-unknown-unknown and generate the JavaScript glue with wasm-bindgen. No package is published. To keep data, store the bytes from toBytes() and reopen them with fromBytes(). IDs are JavaScript numbers, exact up to 253.
| Signature | Description |
|---|---|
setClock(nowMs: number): void | Sets the clock, in Unix milliseconds, used for expiry and commit timestamps. WebAssembly has no system clock, so pass Date.now(). |
VLiteDatabase.create(dimensions: number, key?: Uint8Array): VLiteDatabase | Creates an empty format 5 database, like every new file. A 32-byte key turns on authenticated encryption. |
VLiteDatabase.fromBytes(bytes: Uint8Array, key?: Uint8Array): VLiteDatabase | Opens an image saved with toBytes. Pass the key for an encrypted image. |
toBytes(): Uint8Array | Returns the database image. Store it to keep the data. |
put(id: number, vector: Float32Array, payload: Uint8Array): void | Inserts or replaces a record. |
putWithExpiry(id: number, vector: Float32Array, payload: Uint8Array, expiresAtMs?: number, metadataJson?: string): void | Inserts or replaces a record with typed metadata as JSON and an optional expiry in Unix milliseconds. Needs format 5. |
updateMetadata(id: number, metadataJson: string): void | Replaces a record's metadata without rewriting its vector or payload. Needs format 5. |
groupedSearch(query: Float32Array, groups: number, hitsPerGroup: number, field: string): string | Exact search grouped by the values of a metadata field, using squared L2 distance. Returns JSON [{value, hits: [{id, distance}]}]. |
feedCursor(): string | Returns a change-feed cursor at the current head. Needs format 4 or later. |
changesAfter(cursor: string, maxEvents: number): string | Reads up to maxEvents committed changes after a cursor. Returns JSON {changes, next, has_more, head}; pass next to continue. |
delete(id: number): void | Deletes a record. A missing ID is not an error. |
get(id: number): Uint8Array | undefined | Returns the record's payload, or undefined when the ID does not exist. |
search(query: Float32Array, k: number): Float64Array | Exact nearest-neighbor search using squared L2 distance. Returns a flat array [id, distance, id, distance, ...]. |
len(): number | Returns the number of live records. |
isEmpty(): boolean | Returns whether the database has no live records. |
kvGet(collection: string, namespace: string, key: string): KvEntry | undefined | Reads a key-value entry as {key, value: Uint8Array, version: bigint, expires_at_ms: bigint | null}, or undefined when the key is absent or expired. The collection must already exist and have one dimension, such as the default collection of create(1). Failures throw an Error with a stable code property. |
kvPut(collection: string, namespace: string, key: string, value: Uint8Array, expected?: KvExpected, expiresAtMs?: bigint | null): KvPutResult | Writes a value of 0 to 1,047,290 bytes and returns {version, expires_at_ms}. expected is "any" (the default), "absent" or { revision: bigint }; a mismatch throws with the code precondition_failed. The deadline is an absolute Unix-millisecond bigint on the setClock clock; without it the entry never expires. Versions and deadlines are never number. |
kvDelete(collection: string, namespace: string, key: string, expected?: KvExpected): boolean | Deletes an entry. Returns false when it was absent or expired. |
kvList(collection: string, namespace: string, prefix?: string, after?: string, limit?: number): KvPage | Lists live entries in UTF-8 key order as {items, next_after}. A page holds at most limit (1 to 10,000, default 100) entries and 16 MiB of JSON. Pass next_after as after until it is null. |
REST
Experimental gateway measurement tools are opt-in, not new REST routes:
build the ha-meas004 and ha-meas005 examples with
--features server. vlite-server gateway-measure bootstrap
creates a private synthetic fixture; gateway-measure mint
exports a short-lived normally verified principal, not an authentication
bypass. See the
executable MEAS-004/005 contract
for exact configs, ABBA load, per-process observers and bounded command-bracket
propagation analysis. Evidence is proposal_evidence_only;
unknown scale/clock/coverage stays explicit. Deployment gates are unchanged.
Run vlite-server or the Docker image. Send an API key as a bearer token.
curl -s -X POST localhost:8080/v1/search \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"vector":[0.9,0.1,0],"k":5}'
Routes are grouped by area. The Access column shows who can call each route:
- Public needs no credentials.
- Any key accepts any valid credential or signed-in account.
- A scope name, such as
search, means a scopedvlk_credential needs that scope for the collection or graph. “on*” means the credential must be bound to every collection. Credentials bound to a tenant cannot call those routes, except to create collections. - Admin needs the admin token or an admin account.
The admin token can call every route. The read-only token can call any GET route outside /v1/admin/, plus the search and graph-read routes. Signed-in dashboard accounts get the access of their role. Routes without a collection name use the default collection, so a scoped credential must cover default to call them. Errors are JSON: {"error": {"code": "...", "message": "..."}}.
Service and health · Sign-in · Default collection · Collections and records · Search and analytics · Named and sparse vectors · Indexes · Imports · Change feed, webhooks and replication · Property graph · Credentials, users and tenants · Backups, maintenance and logs
Service and health
| Route | Description | Access |
|---|---|---|
GET /dashboard | Serves the dashboard. The page is public; every database request it makes needs a credential or a signed-in account. | Public |
GET /dashboard/app.js | Serves the dashboard's main script. | Public |
GET /dashboard/console-tools.js | Serves the dashboard's developer console script. | Public |
GET /dashboard/navigation.js | Serves the dashboard's navigation script. | Public |
GET /dashboard/observability.js | Serves the dashboard's observability script. | Public |
GET /dashboard/style.css | Serves the dashboard stylesheet. | Public |
GET /dashboard/admin-tools.js | Serves the dashboard administration controls. | Public |
GET /dashboard/graph.js | Serves the graph query and revision-checked editor controls. | Public |
GET /dashboard/graph.css | Serves graph workspace styles. | Public |
GET /dashboard/graph3d.js | Serves the force-directed 3D graph renderer and picking helpers. | Public |
GET /dashboard/ambience.js | Serves the reduced-motion-aware decorative 3D accents. | Public |
GET /dashboard/theme.css | Serves the shared light/dark theme tokens. | Public |
GET /dashboard/three.min.js | Serves the vendored three.js renderer without a CDN. | Public |
GET /dashboard/three.LICENSE | Serves the three.js MIT license. | Public |
GET /dashboard/fonts/outfit-latin-wght-normal.woff2 | Serves the self-hosted Outfit variable font. | Public |
GET /dashboard/fonts/jetbrains-mono-latin-wght-normal.woff2 | Serves the self-hosted JetBrains Mono variable font. | Public |
GET /dashboard/fonts/OFL-Outfit.txt | Serves the Outfit font license. | Public |
GET /dashboard/fonts/OFL-JetBrainsMono.txt | Serves the JetBrains Mono font license. | Public |
GET /health | Reports that the server process is alive. It does not check the database. | Public |
GET /metrics | Returns a metrics snapshot as JSON or in Prometheus text format. | diagnostics |
GET /openapi.json | Returns this server's OpenAPI contract. | Any key |
GET /ready | Reports whether the database can serve reads. Fails once the database is closed or has stopped after a storage error. | Any key |
GET /v1/capabilities | Returns the server version, the caller's role and compatibility details. | Any key |
GET /v1/database | Returns the dimensions, file format, live record count and encryption status. | read |
Sign-in
| Route | Description | Access |
|---|---|---|
GET /v1/auth/config | Lists the sign-in methods the dashboard offers. | Public |
POST /v1/auth/login | Signs in with a username and password, and sets a session cookie. | Public |
POST /v1/auth/logout | Signs out: ends the session and clears its cookie. | Any key |
POST /v1/auth/password | Changes the signed-in account's own password. | Any key |
GET /v1/auth/session | Returns who is signed in and how. | Any key |
An HA gateway (vlite-server gateway) serves the dashboard and answers these routes itself only with its opt-in dashboard block, and only for tenant editor and viewer accounts. Its session cookie is sealed with a key the replicas share, so a session works on any replica; password changes stay on the admin server, and /v1/auth/password answers 409 password_change_unavailable. See dashboard sign-in through a gateway.
Default collection
| Route | Description | Access |
|---|---|---|
POST /v1/batches | Applies all operations in order, in one durable atomic commit. | write |
POST /v1/search | Searches the default collection. Options you leave out use the original defaults, such as squared L2 distance. rerank mode custom ranks candidates with an administrator-bound provider alias. | search |
GET /v1/vectors | Lists a page of record IDs with their metadata, without vectors or payloads. | read |
GET /v1/vectors/{id} | Returns one record: its vector, payload and metadata. | read |
PUT /v1/vectors/{id} | Inserts or replaces a record and commits it durably. The whole metadata map is replaced; leaving out metadata clears it. | write |
DELETE /v1/vectors/{id} | Deletes a record and commits durably. Deleting a missing ID succeeds. | write |
PATCH /v1/vectors/{id}/metadata | Replaces a record's metadata without rewriting its vector or payload. Needs format 5. | write |
Agent memory
| Route | Description | Access |
|---|---|---|
POST /v1/memory/{binding}/remember | Remembers entity and episodic items in an explicitly provisioned binding and exact scope, with a body idempotency key. | graph_write + exact write scope |
POST /v1/memory/{binding}/recall | Recalls retained scoped memories with bounded work and explicit ranking. Text does not implicitly invoke an embedding provider. | graph_read + exact read or write scope |
POST /v1/memory/{binding}/facts/query | Queries retained facts in one exact slot. The first slice returns 409 memory_capability_unavailable; details.feature names the missing capability. | graph_read + exact read or write scope |
POST /v1/memory/{binding}/facts/correct | Corrects facts with revision guards. The first slice returns 409 memory_capability_unavailable; details.feature names the missing capability. | graph_write + exact write scope |
POST /v1/memory/{binding}/consolidate | Stores a caller-supplied episodic summary. The first slice supports C1: one revision-checked source, retained rather than deleted. | graph_write + exact write scope |
POST /v1/memory/{binding}/forget | Logically deletes IDs with revision guards in the first slice. This does not securely erase backups or external copies. | graph_write + exact write scope |
POST /v1/memory/{binding}/receipts/lookup | Looks up a retained mutation receipt. Remember lookup returns 409 memory_capability_unavailable with details.feature=remember_receipt_lookup in the first slice. | graph_read + exact write scope |
POST /v1/memory/{binding}/erasures/get | Reads erasure status. The first slice returns 409 memory_capability_unavailable; details.feature names the missing capability. | graph_read + exact write scope |
POST /v1/memory/{binding}/erasures/resume | Resumes one bounded erasure chunk. The first slice returns 409 memory_capability_unavailable; details.feature names the missing capability. | graph_write + exact write scope |
Collections and records
| Route | Description | Access |
|---|---|---|
GET /v1/collections | Lists the collections the caller can see. | read |
POST /v1/collections | Creates a named collection. Needs format 4 or later. | collections on * |
GET /v1/collections/{collection} | Returns a collection's settings and text-index state. | read |
DELETE /v1/collections/{collection} | Drops an empty named collection that has no open imports. default cannot be dropped. | collections |
POST /v1/collections/{collection}/batches | Applies put and delete operations to the collection in one atomic commit. | write |
PUT /v1/collections/{collection}/settings | Updates a collection's declared settings. | collections |
GET /v1/collections/{collection}/kv/entry | Reads a live namespaced byte value and its decimal-string version from an existing one-dimension collection. | read |
PUT /v1/collections/{collection}/kv/entry | Stores canonical base64 bytes with an optional expected version and deadline, following configured durability. | write |
DELETE /v1/collections/{collection}/kv/entry | Deletes a namespaced key with an optional expected-version condition; missing unconditional deletes are no-ops. | write |
GET /v1/collections/{collection}/kv/entries | Lists a UTF-8 byte-ordered prefix page bounded by limit and 16 MiB canonical JSON, with an exclusive continuation key. | read |
POST /v1/collections/{collection}/kv/batch | Applies up to 1,000 puts and deletes of one collection, all or nothing, with the expected conditions of the single routes. Every put gets the same version and has no deadline. Returns one result per operation, in order. | write |
POST /v1/collections/{collection}/kv/entries/get | Reads up to 1,000 named keys in one call. Returns items in the order given, null for an absent or due key, and next_index when the 16 MiB response cap ended the read early. | read |
GET /v1/collections/{collection}/vectors | Lists a page of the collection's live records. | read |
GET /v1/collections/{collection}/vectors/{id} | Returns one record and its strong ETag. | read |
PUT /v1/collections/{collection}/vectors/{id} | Inserts or replaces a record in the collection. | write |
DELETE /v1/collections/{collection}/vectors/{id} | Deletes a record from the collection. | write |
PATCH /v1/collections/{collection}/vectors/{id}/metadata | Replaces a record's metadata without rewriting its vector or payload. Needs format 5. | write |
Search and analytics
| Route | Description | Access |
|---|---|---|
POST /v1/collections/{collection}/embed | Turns text into a vector of the collection's dimensions, using a configured embedding provider: hashing, http or an alias an administrator has bound to the collection. Managed providers are off by default. | search |
POST /v1/collections/{collection}/facets | Counts metadata values among the records that match the filters. | search |
POST /v1/collections/{collection}/query | Runs a bounded, read-only query-language statement. | search |
POST /v1/collections/{collection}/recommend | Recommends records similar to positive examples and unlike negative ones, given as IDs or vectors. | search |
POST /v1/collections/{collection}/search | Searches the collection using its default settings. rerank mode custom ranks candidates with an administrator-bound provider alias. | search |
POST /v1/collections/{collection}/search/disk-ann | Searches the collection's disk ANN sidecar. The sidecar must be up to date. | search |
POST /v1/collections/{collection}/search/geo | Vector search limited to records within a geographic radius. | search |
POST /v1/collections/{collection}/search/grouped | Searches and groups the hits by the value of a metadata field. | search |
POST /v1/collections/{collection}/stats/numeric | Returns the minimum, maximum, sum, count and average of a numeric metadata field. | search |
Named and sparse vectors
| Route | Description | Access |
|---|---|---|
POST /v1/collections/{collection}/search/dense-sparse | Fuses named dense and sparse search results. Needs format 5. | search |
POST /v1/collections/{collection}/search/named | Searches one version of a named vector. Needs format 5. | search |
POST /v1/collections/{collection}/search/sparse | Searches a sparse vector. Needs format 5. | search |
POST /v1/collections/{collection}/vectors/configure | Declares a named dense vector. Needs format 5. | collections |
PUT /v1/collections/{collection}/vectors/{id}/named | Replaces a record's named dense and sparse vectors. Needs format 5. | write |
Indexes
| Route | Description | Access |
|---|---|---|
POST /v1/index/hnsw/quality | Measures the default collection's ready HNSW index against exact search. Uses the same quality request and report as the named-collection route; does not build an index. | index |
POST /v1/collections/{collection}/index/disk-ann | Builds a disk ANN sidecar file in the server's private admin directory. | index |
GET /v1/collections/{collection}/index/hnsw | Reports the collection index's identity, readiness and memory use by component. | read |
POST /v1/collections/{collection}/index/hnsw | Builds the collection's index now. | index |
GET /v1/collections/{collection}/index/hnsw/maintenance | Reports how much maintenance the collection's index needs. | read |
POST /v1/collections/{collection}/index/hnsw/maintenance/tick | Runs one bounded maintenance step for the collection. | index |
POST /v1/collections/{collection}/index/hnsw/quality | Measures a ready ANN index by comparing a sample of its results with exact search. | index |
GET /v1/collections/{collection}/index/hnsw/rebuild | Reports the collection's background rebuild without publishing it. | read |
POST /v1/collections/{collection}/index/hnsw/rebuild | Starts a bounded background rebuild for the collection. | index |
POST /v1/collections/{collection}/index/hnsw/rebuild/cancel | Asks the collection's rebuild to stop. | index |
POST /v1/collections/{collection}/index/hnsw/rebuild/poll | Checks the collection's rebuild and publishes the index if it has finished. | index |
GET /v1/index/hnsw | Reports whether the default collection's HNSW index is ready and how full its mutation buffer is. Never builds an index. | read |
POST /v1/index/hnsw | Rebuilds the default collection's in-memory HNSW index now. | index |
GET /v1/index/hnsw/maintenance | Reports the maintenance policy and status without publishing anything. | read |
PUT /v1/index/hnsw/maintenance | Replaces the in-process maintenance policy. Values you leave out return to their defaults. | Admin |
POST /v1/index/hnsw/maintenance/tick | Runs one maintenance step now: publishes a finished rebuild and starts a new one if the policy calls for it. | index |
GET /v1/index/hnsw/rebuild | Reports the background rebuild without publishing a finished index. | read |
POST /v1/index/hnsw/rebuild | Starts a bounded background rebuild. | index |
POST /v1/index/hnsw/rebuild/cancel | Asks the background rebuild to stop. The current index stays in use. | index |
POST /v1/index/hnsw/rebuild/poll | Checks the background rebuild without waiting, and publishes the index if it has finished. | index |
Imports
| Route | Description | Access |
|---|---|---|
POST /v1/collections/{collection}/imports | Reserves a resumable import job for the collection. | import |
GET /v1/imports/{job} | Reports an import's progress and the collection it writes to. | read |
POST /v1/imports/{job}/abort | Aborts an import. Chunks already committed stay committed. | import |
PUT /v1/imports/{job}/chunks/{chunk} | Commits one chunk of an import, or replays a chunk that was already committed. | import |
POST /v1/imports/{job}/finish | Finishes an import durably. | import |
Change feed, webhooks and replication
| Route | Description | Access |
|---|---|---|
GET /v1/admin/replication/export | Exports a log segment of whole commits, for shipping to a replica. | read on * |
GET /v1/admin/webhooks | Lists webhook subscriptions and their delivery status. | Admin |
POST /v1/admin/webhooks | Creates a webhook that delivers signed change-feed events. | Admin |
GET /v1/admin/webhooks/{id} | Returns one webhook's delivery status. | Admin |
DELETE /v1/admin/webhooks/{id} | Deletes a webhook subscription. | Admin |
GET /v1/changes | Reads committed vector and graph changes after a cursor. Needs format 4 or later. | read on * |
Property graph
| Route | Description | Access |
|---|---|---|
GET /v1/admin/graph/stats | Reports how long graph reads and writes have held the graph lock. | Admin |
GET /v1/graphs | Lists graphs. A scoped credential sees only the graphs it is bound to. | graph_read |
POST /v1/graphs | Creates an empty graph. | graph_write |
GET /v1/graphs/{graph} | Returns a graph's node and edge counts. | graph_read |
DELETE /v1/graphs/{graph} | Drops an empty graph. | graph_write |
POST /v1/graphs/{graph}/batch | Applies one batch of graph operations in a single atomic commit. | graph_write |
POST /v1/graphs/{graph}/edges/get | Gets one edge by ID or key. | graph_read |
POST /v1/graphs/{graph}/explain | Shows the plan for a graph read without running it. | graph_read |
POST /v1/graphs/{graph}/neighbors | Lists a node's edges and adjacent nodes, a page at a time. | graph_read |
POST /v1/graphs/{graph}/nodes/find | Finds nodes by label and property conditions, a page at a time. | graph_read |
POST /v1/graphs/{graph}/nodes/get | Gets one node by ID or key. | graph_read |
POST /v1/graphs/{graph}/query | Runs or explains a read-only graph query. | graph_read |
POST /v1/graphs/{graph}/retrieve | Hybrid retrieval: finds start nodes by vector or text search, expands from them within limits, and returns the attached records as evidence. | graph_read |
GET /v1/graphs/{graph}/schema | Returns the declared schema, plus the schema observed in a bounded scan of the data. | graph_read |
PUT /v1/graphs/{graph}/schema | Replaces the declared schema. | graph_write |
POST /v1/graphs/{graph}/shortest-path | Finds a shortest path by number of edges, within limits. | graph_read |
POST /v1/graphs/{graph}/traverse | Walks the graph breadth-first from start nodes, within limits. | graph_read |
Credentials, users and tenants
| Route | Description | Access |
|---|---|---|
GET /v1/admin/audit | Reads the recent in-process audit log, with secrets removed. | Admin |
GET /v1/admin/audit/persistent | Reads the durable audit records, with secrets removed. | Admin |
GET /v1/admin/credentials | Lists scoped credentials, without their secrets. | Admin |
POST /v1/admin/credentials | Issues an expiring vlk_ credential limited to chosen scopes, collections and graphs. | Admin |
POST /v1/admin/credentials/{id}/revoke | Revokes a credential. The revocation is saved. | Admin |
POST /v1/admin/credentials/{id}/rotate | Rotates a credential. The old token keeps working for a short grace period. | Admin |
GET /v1/admin/tenants | Lists active tenants. | Admin |
POST /v1/admin/tenants | Creates an isolated tenant. | Admin |
DELETE /v1/admin/tenants/{id} | Deletes an empty tenant and invalidates every credential bound to it. | Admin |
POST /v1/admin/tenants/{id}/resume | Resumes a suspended tenant. | Admin |
PUT /v1/admin/tenants/{id}/settings | Renames a tenant or changes its total vector limit. | Admin |
POST /v1/admin/tenants/{id}/suspend | Suspends a tenant. Its credentials are refused until it is resumed. | Admin |
GET /v1/admin/tenants/{id}/usage | Returns a tenant's current usage. | Admin |
POST /v1/admin/tls/reload | Reloads the TLS certificates and gRPC client CA roots from their files in one step. If any file is invalid, the old configuration stays in use. | Admin |
POST /v1/admin/memory/bindings/reload | Reloads grants for existing memory bindings from the configured file. Returns binding and change counts, and whether requests using older grants have finished. | Admin |
POST /v1/admin/memory/bindings/preflight | Advisory, read-only check of the configured file with reload's verdict and counts; reload rechecks. Takes no reload lock and names no binding, tenant, principal, scope, graph, collection or path. | Admin |
GET /v1/admin/memory/bindings/status | Read-only snapshot of configuration, reload availability, binding count, file agreement and drained requests. Takes no database or reload lock; poll after reload until file is agrees and drained is true. | Admin |
GET /v1/admin/tokens | Shows how the admin and read-only tokens are configured, without the secrets. | Admin |
POST /v1/admin/tokens/reload | Reloads the configured token files in one step. | Admin |
POST /v1/admin/tokens/revoke-read-only | Revokes the read-only token. The revocation is held in memory only. | Admin |
GET /v1/admin/users | Lists dashboard accounts. | Admin |
POST /v1/admin/users | Creates a dashboard account. | Admin |
PUT /v1/admin/users/{id} | Changes an account's username, role, tenant, graph access or status. | Admin |
DELETE /v1/admin/users/{id} | Deletes an account and ends its sessions. | Admin |
POST /v1/admin/users/{id}/password | Sets a new password for an account. | Admin |
Backups, maintenance and logs
| Route | Description | Access |
|---|---|---|
GET /v1/admin/backups | Lists backup files, at most 1,000. | backup on * |
POST /v1/admin/backups | Writes a backup of the database, syncs it to disk and validates it. | backup on * |
GET /v1/admin/backups/schedule | Shows the backup schedule and its state. | backup on * |
PUT /v1/admin/backups/schedule | Updates the in-process backup schedule. Only the fields you send change. | Admin |
POST /v1/admin/backups/schedule/run | Runs one backup cycle now: backup, verification, and the configured drill and retention. | Admin |
POST /v1/admin/backups/{name}/drill | Restores a backup into a private scratch copy and probes it. The live database is never touched. | backup on * |
POST /v1/admin/backups/{name}/verify | Checks a backup against its manifest. | backup on * |
GET /v1/admin/cloud-backup | Shows the Azure Blob backup policy, run status and next scheduled run. Never returns a secret. | Admin |
PUT /v1/admin/cloud-backup | Saves the persisted cloud backup policy (target, schedule, drill cadence, opt-in retention). Off by default; refuses credential fields. | Admin |
POST /v1/admin/cloud-backup/run | Publishes one backup set, including memory bindings in force, then drills and collects as the policy asks. Not idempotent: a retry after an uncertain response creates another set. | Admin |
POST /v1/admin/cloud-backup/collect | Removes unpublished staging sets and finishes interrupted deletions; applies retention only when the policy enables it. | Admin |
GET /v1/admin/cloud-backup/sets | Lists this installation's cloud backup sets with their state, pins and last drill. | Admin |
POST /v1/admin/cloud-backup/sets/{id}/drill | Verifies and probes a private scratch restore, including startup memory-binding checks. Records the result and memory counts on the set. | Admin |
POST /v1/admin/cloud-backup/sets/{id}/restore | Verifies a new-lineage restore-*.vlite copy and its memory bindings. Rekey-only: re-issue credentials and provision updated bindings separately; no bindings file is written by this route. | Admin |
POST /v1/admin/cloud-backup/sets/{id}/pins | Adds an operator hold; retention never deletes a pinned set. | Admin |
DELETE /v1/admin/cloud-backup/sets/{id}/pins/{pin} | Removes an operator hold. A restore or drill pin is refused; ?force=true releases one left by a crashed owner and is audited. | Admin |
GET /v1/admin/compaction | Shows file compaction status: availability and the reasons it is off, file size, settings, schedule, the running and last job, and retained recovery copies. | Admin |
PUT /v1/admin/compaction/config | Saves the automatic compaction settings (off by default; UTC window, run budget, size and growth limits) against the current settings version. | Admin |
POST /v1/admin/compaction/jobs | Starts one compaction now. Needs the downtime and history acknowledgements and an idempotency key; reads and writes pause while the server switches files. | Admin |
GET /v1/admin/compaction/jobs/{id} | Shows one compaction job: phase, outcome, before and after sizes. | Admin |
POST /v1/admin/compaction/jobs/{id}/cancel | Cancels a running compaction before the switch; the server keeps the original file. | Admin |
GET /v1/admin/diagnostics/slow-queries | Lists recent slow queries, with sensitive values removed. | diagnostics |
GET /v1/admin/logs | Reads recent structured server logs. | Admin |
GET /v1/admin/maintenance/auto | Shows the automatic maintenance policy and its state. | index on * |
PUT /v1/admin/maintenance/auto | Updates the in-process automatic maintenance policy. Only the fields you send change. | Admin |
POST /v1/admin/maintenance/auto/tick | Runs one bounded automatic maintenance step now. | Admin |
GET /v1/admin/metrics/summary | Returns a compact metrics snapshot for the dashboard. | Admin |
POST /v1/admin/restores | Restores a validated backup into a new copy of the database. | Admin |
POST /v1/admin/restores/select | Chooses a restored copy to open at the next startup. | Admin |
GET /v1/admin/serve-status | Reports the serve mode (standalone, writer or reader), drain state, lineage, change-feed sequence, archive progress and the last archive error. A reader refuses mutations and writer-only administration with 403 reader_mode; no role adds write capacity. | Admin |
GET /v1/admin/auto-failover | Reads the shared automatic failover switch that supervisors obey. Unqualified and off by default: qualified is always false while GATE-005 is open. available is false without a writer authority target. | Admin |
PUT /v1/admin/auto-failover | Turns automatic failover on (needs acknowledge_unqualified: true and the revision last read) or off. Turning off always writes a fresh disabled revision; a promotion past its final transfer check may still complete. Open development administration is refused with 401 admin_auth_required. | Admin |
POST /v1/admin/tenant-deployments | Managed tenant onboarding. Body: idempotency_key, a typed create request and the exact contents it references by digest. Writes the tenant's metadata under a server-allocated ID and reserves it, unrouted; 202 with the redacted operation, or the same operation for an identical retry. Cloud execution is not available yet. Needs configured administrator authentication and a managed deployment store, else 401 admin_auth_required or 409 tenant_deployments_not_configured. The legacy POST /v1/admin/tenants is unchanged. | Admin |
POST /v1/admin/tenant-deployments/{tenant}/readers | Accepts and reserves a set_readers intent for the tenant; same body and contracts as onboarding. | Admin |
POST /v1/admin/tenant-deployments/{tenant}/migrations | Accepts and reserves a migrate intent for the tenant; same body and contracts as onboarding. | Admin |
POST /v1/admin/tenant-deployments/{tenant}/retire | Accepts and reserves a retire intent for the tenant; same body and contracts as onboarding. | Admin |
GET /v1/admin/tenant-deployment-operations | Pages of operations in ascending operation ID order, each exactly the redacted status the single-operation read returns. Query: limit (1–100, default 50) and an exclusive after operation ID; next_after is the last returned ID when more follow, else null. Anything else is 400 invalid_query. | Admin |
GET /v1/admin/tenant-deployment-operations/{operation} | The operation's redacted status: phase, next step, desired and observed state, and the generations and receipt digest an action must quote. Never the idempotency key, retained content, tokens or secret version names. | Admin |
POST /v1/admin/tenant-deployment-operations/{operation}/{action} | Actions resume, cancel, acknowledge-delivery, replace-credentials, rollback, release. Body: idempotency_key, expected_operation_generation, expected_lifecycle_generation, optional expected_receipt and ack_irreversible. A stale token is 409 operation_generation_stale; a replay returns the stored result. Transitions without a handler yet answer 409 transition_unavailable; release first needs ack_irreversible: true. Resuming a present reader fleet answers 409 pin_scope_unproven until reader pin scope is proven. | Admin |
This inventory includes every explicitly registered HTTP method, including dashboard assets that are not in the OpenAPI snapshot. GET routes also accept HEAD through Axum. The server publishes the API schema at /openapi.json. See the REST guide for request bodies, responses and errors.
gRPC
The gRPC services vlite.v1.VLite and vlite.v1.Kv serve the same database as REST, with the same credentials, scopes and limits. They are off until you start vlite-server with --grpc-bind ADDR. Release binaries and the Docker image include them; source builds need the grpc Cargo feature. Add --grpc-tls-cert and --grpc-tls-key for TLS, and --grpc-tls-client-ca to require client certificates. The contract is proto/vlite/v1/vlite.proto. See the gRPC guide.
Key-value entries
vlite.v1.Kv uses explicit collection names, raw byte values and uint64 versions and deadlines. Validation, CAS, expiry, quotas, tenant bindings and the canonical-JSON page boundary match REST. No lease RPCs are provided.
| RPC | Description | Access |
|---|---|---|
GetKvEntry(KvGetRequest) returns (KvEntry) | Reads a live entry; missing or due entries return kv_not_found. | read |
PutKvEntry(KvPutRequest) returns (KvPutResponse) | Writes bytes with an optional atomic precondition. Unset expiry clears TTL. | write |
DeleteKvEntry(KvDeleteRequest) returns (KvDeleteResponse) | Deletes an entry with an optional atomic precondition; missing unconditional deletes return false. | write |
ListKvEntries(KvListRequest) returns (KvListResponse) | Lists live matching keys in UTF-8 byte order with exclusive after and optional next_after. | read |
GetKvEntries(KvGetManyRequest) returns (KvGetManyResponse) | Reads up to 1,000 keys. items follows the order of the keys and holds no entry for an absent or due key; optional next_index is set when the 16 MiB response cap ended the read early. | read |
WriteKvBatch(KvBatchRequest) returns (KvBatchResponse) | Applies up to 1,000 puts and deletes of one collection, all or nothing, with optional atomic preconditions. Every put gets the same version and has no deadline. | write |
Collections, vectors and imports
Send the credential as authorization: Bearer <token> metadata. Errors carry the REST error message, and the vlite-error-code trailer carries the REST error code. An empty collection field means the default collection. Requests are capped at 8 MiB and responses at 16 MiB. Graphs, automatic search planning, HNSW index builds and maintenance, backups, credentials, tenants, accounts and diagnostics are REST-only.
| RPC | Description | Access |
|---|---|---|
ListCollections(ListCollectionsRequest) returns (ListCollectionsResponse) | Lists the collections the caller can see. | read |
GetCollection(GetCollectionRequest) returns (Collection) | Returns a collection's effective settings, as the same JSON object REST returns. | read |
CreateCollection(CreateCollectionRequest) returns (Collection) | Creates a named collection. Needs format 4 or later. | collections on * |
DropCollection(DropCollectionRequest) returns (DropCollectionResponse) | Drops an empty named collection. | collections |
GetVector(GetVectorRequest) returns (Vector) | Returns one record. | read |
PutVector(PutVectorRequest) returns (PutVectorResponse) | Inserts or replaces a record. An optional precondition requires the ID to be absent, or the record to have a given revision. | write |
DeleteVector(DeleteVectorRequest) returns (DeleteVectorResponse) | Deletes a record, with the same optional precondition. | write |
WriteBatch(WriteBatchRequest) returns (WriteBatchResponse) | Applies put and delete operations to one collection atomically: every operation commits, or none does. | write |
Search(SearchRequest) returns (SearchResponse) | Exact, ANN or hybrid search. Never builds an index: ANN search fails with index_not_ready until a matching index exists. Build one with REST. RERANK_MODE_CUSTOM with rerank_provider ranks candidates with an administrator-bound alias. | search |
EmbedText(EmbedTextRequest) returns (EmbedTextResponse) | Returns a provider-embedded vector under the same provider, authentication and budget rules as REST embedding, without silent client fallback. | search |
UpdateMetadata(UpdateMetadataRequest) returns (UpdateMetadataResponse) | Replaces a record's metadata without rewriting its vector or payload. Needs format 5. | write |
SearchGrouped(GroupedSearchRequest) returns (GroupedSearchResponse) | Searches and groups the hits by the value of a metadata field. | search |
Recommend(RecommendRequest) returns (SearchResponse) | Recommends records similar to positive examples and unlike negative ones. | search |
Facets(FacetsRequest) returns (FacetsResponse) | Counts metadata values among the records that match the filters. | read |
NumericStats(NumericStatsRequest) returns (NumericStatsResponse) | Returns the minimum, maximum, sum, count and average of a numeric metadata field. | read |
GeoSearch(GeoSearchRequest) returns (GeoSearchResponse) | Vector search limited to records within a geographic radius. | search |
ConfigureNamedVector(ConfigureNamedVectorRequest) returns (Empty) | Declares a named dense vector. Needs format 5. | write |
PutNamedVectors(PutNamedVectorsRequest) returns (Empty) | Replaces a record's named dense and sparse vectors. Needs format 5. | write |
PutVectorVersion(PutVectorVersionRequest) returns (Empty) | Stores a new version of a record's named vector. Needs format 5. | write |
SearchNamed(SearchNamedRequest) returns (SearchResponse) | Searches one version of a named vector. | search |
SearchSparse(SearchSparseRequest) returns (SearchResponse) | Searches a sparse vector. | search |
SearchDenseSparse(SearchDenseSparseRequest) returns (SearchResponse) | Fuses named dense and sparse search results. | search |
Query(QueryRequest) returns (QueryResponse) | Runs a bounded, read-only query-language statement. | search |
Changes(ChangesRequest) returns (ChangesResponse) | Reads committed vector and graph changes after a cursor. Needs format 4 or later. | Admin |
WatchChanges(WatchChangesRequest) returns (stream ChangesResponse) | Streams committed changes after a cursor. | Admin |
BuildDiskAnn(BuildDiskAnnRequest) returns (DiskAnnBuildResponse) | Builds a disk ANN sidecar in the server's private admin directory. | index |
SearchDiskAnn(SearchDiskAnnRequest) returns (SearchResponse) | Searches a disk ANN sidecar that is up to date with the collection. | search |
Info(InfoRequest) returns (InfoResponse) | Returns the file format, commit sequence, encryption and commit-timestamp settings, and replica status. | Admin |
ReserveImport(ReserveImportRequest) returns (ImportJsonResponse) | Reserves a resumable import job. | import |
GetImportStatus(ImportJobRequest) returns (ImportJsonResponse) | Reports an import's progress. | read |
ImportChunk(ImportChunkRequest) returns (ImportJsonResponse) | Commits one chunk of an import, or replays a chunk that was already committed. | import |
FinishImport(ImportJobRequest) returns (ImportJsonResponse) | Finishes an import durably. | import |
AbortImport(ImportJobRequest) returns (ImportJsonResponse) | Aborts an import. Chunks already committed stay committed. | import |
ExportVectors(ExportVectorsRequest) returns (stream Vector) | Streams records in ascending ID order. Each page is read atomically; writes between pages may or may not appear. To resume, pass the last ID received as after. | read |
StreamImport(stream StreamImportRequest) returns (ImportJsonResponse) | Sends an import as a stream of chunks, each committed durably as it arrives. After an error or disconnect the job stays open: resume from the last committed chunk plus one. Replaying that chunk is harmless. | import |
MCP
vlite-mcp lets AI assistants use a VLite file through the Model Context Protocol. The assistant's host starts it over stdio: vlite-mcp --db documents.vlite. It is read-only by default; --writable adds the write tools. For an encrypted file, pass --encryption-key-file PATH or set VLITE_ENCRYPTION_KEY or VLITE_ENCRYPTION_KEY_HEX. To work through a running server instead, use vlite-mcp --server URL --token-env VAR. Plain vector files get no graph tools. Release archives include vlite-mcp. See the MCP guide.
Memory MCP safety refusals: only duplicate-free JSON objects are returned, with exact JSON values in structured content and text; credentials in decoded keys/strings or serialized representations are refused, not rewritten. Calls disable ambient proxies, require HTTPS except loopback HTTP, visible-ASCII tokens of 1..4096 bytes and binding names [a-z][a-z0-9_-]{0,62}. Graph discovery/tools retain ambient proxies. The trusted stdio host supplies parsed arguments; the 8 MiB request cap measures compact arguments, not raw lines. Malformed/truncated responses fail closed; reconcile uncertain mutations by receipt.
| Tool | Description | Mode |
|---|---|---|
vlite_info | Describes the database: format, dimensions, record counts, collections and access mode. | Read |
vlite_list_collections | Lists collections with their dimensions and live record counts. | Read |
vlite_search | Exact or approximate vector search with typed metadata filters. k is 1 to 100 (default 10). Metrics are squared_l2, cosine and inner_product. | Read |
vlite_get | Fetches one record by ID. Vectors are left out unless requested. | Read |
vlite_list | Lists records in ascending ID order, a page at a time, without vectors. limit is 1 to 100 (default 20). | Read |
vlite_index_status | Reports whether a collection's in-memory HNSW index is ready and how much maintenance it needs. | Read |
vlite_build_index | Builds a collection's in-memory HNSW index. The database file is not changed. | Read |
vlite_upsert | Inserts or replaces a record. The payload is optional UTF-8 text or base64 bytes. | --writable |
vlite_delete | Deletes a record by ID. | --writable |
vlite_memory_remember | Binding, scope, idempotency_key and items; POST remember. Exact valid-object JSON, subject to memory safety refusals; reconcile ambiguity by receipt. | --writable; --server only |
vlite_memory_recall | Binding, scope and recall fields; POST recall. Exact valid-object JSON, subject to memory safety refusals, including completeness diagnostics. | Read; --server only |
vlite_memory_facts | Binding, scope and slot; POST facts/query. Exact valid-object JSON, subject to memory safety refusals, including fact segments and integer strings. | Read; --server only |
vlite_memory_correct_facts | Flat guarded correction fields; POST facts/correct. Exact valid-object JSON, subject to memory safety refusals; server revision checks apply. | --writable; --server only |
vlite_memory_consolidate | Caller-produced inputs/output and optional dry_run; POST consolidate. Exact valid-object JSON, subject to memory safety refusals; dry runs require writable mode. | --writable; --server only |
vlite_memory_forget | Binding, scope, idempotency_key, target and mode; POST forget. Exact valid-object JSON, subject to memory safety refusals; 202 succeeds without polling, not secure erasure. | --writable; --server only |
vlite_memory_receipt | Binding, scope, operation and idempotency_key; POST receipts/lookup. Exact valid-object JSON, subject to memory safety refusals; explicitly reconciles mutations. | Read; --server only |
vlite_memory_erasure | Binding, scope and job_id; POST erasures/get. Exact valid-object JSON, subject to memory safety refusals; status/caveats without advancing jobs. | Read; --server only |
vlite_memory_resume_erasure | Guarded job revision/generation/token and idempotency_key; POST erasures/resume. Exact valid-object JSON, subject to memory safety refusals; one chunk, pending succeeds. | --writable; --server only |
vlite_kv_get | Gets a live namespaced key from a required existing one-dimensional collection. Returns canonical base64, decimal-string version and nullable deadline; absent/due is kv_not_found. | Read; local --db only |
vlite_kv_put | Commits canonical base64 with any/absent/revision expectation and optional decimal-string expiry (v5); omission/null clears TTL. Returns version and deadline. Never creates a collection or retries. | --writable; local --db only |
vlite_kv_delete | Deletes with an atomic expected-version check; returns deleted false for an absent/due entry with any/absent expectation. | --writable; local --db only |
vlite_kv_list | Lists a namespace by UTF-8 byte order with prefix, exclusive after and limit (1..10000, default 100). Returns items and nullable next_after within a 16 MiB canonical JSON page. | Read; local --db only |
vlite_kv_get_many | Reads up to 1,000 namespaced keys of a required existing one-dimensional collection. Returns items in the order given, null for an absent/due key, and nullable next_index. | Read; local --db only |
vlite_kv_batch | Commits up to 1,000 puts and deletes of one collection, all or nothing, with any/absent/revision expectations. Returns one version or deleted result per operation. A put has no expiry. Never creates a collection or retries. | --writable; local --db only |
vlite_graph_list | Lists the graphs in the file, with their node and edge counts. | Read |
vlite_graph_get | Fetches one node or edge by key or ID. A null result means it does not exist. | Read |
vlite_graph_find_nodes | Finds nodes by label and typed property conditions, in ascending ID order, a page at a time. | Read |
vlite_graph_neighbors | Lists a node's edges and adjacent nodes, ordered by relationship type and then edge ID. | Read |
vlite_graph_traverse | Walks the graph breadth-first from start nodes, within limits. Returns each node once with its hop depth, plus edges and optional paths. Check complete and the truncation fields. | Read |
vlite_graph_shortest_path | Finds one shortest path, by number of edges, between two nodes. The outcome is found, no_path_within_hops (fully searched) or exhausted (limits reached, so a path may still exist). | Read |
vlite_graph_schema | Returns the declared schema and a summary of the data actually stored, with counts. Call it before writing to or querying an unfamiliar graph. | Read |
vlite_graph_retrieve | Hybrid retrieval: a vector or text search over a collection finds records, which lead to their attached nodes. The tool expands from those nodes within limits and returns the attached records as evidence: metadata and payload excerpts, never vectors. | Read |
vlite_graph_query | Runs one read-only graph query, such as MATCH ... RETURN ... LIMIT. Values bind as typed $params. The output matches the typed tool the query maps to. | Read |
vlite_graph_create | Creates an empty named graph. | --writable |
vlite_graph_drop | Drops an empty graph. Fails with graph_not_empty while it has nodes. | --writable |
vlite_graph_write | Applies node, edge, schema, attachment and vector operations in order, in one atomic commit. Nothing is written if any operation fails. | --writable |
vlite_graph_put_schema | Replaces the declared schema in one commit. Existing data must conform, or nothing changes. | --writable |
Local KV shell commands
One command and JSON request per line in vlite-shell --db PATH; required collection is independent of use. Namespace is 1..255 UTF-8 bytes; key is 1..1024 bytes; values are at most 1,047,290 decoded bytes. Success prints one JSON object. Failure exits 1 with error: code: message on stderr and stops scripts. Writes commit before acknowledgement and sync only under full durability. See the shell guide.
| Command | Description | Mode |
|---|---|---|
kv-get REQUEST | Required collection, namespace and key; returns a live entry, or kv_not_found. | Read |
kv-put REQUEST | Same request and result as vlite_kv_put; value_base64 required, expected and expires_at_ms optional. | Refused with --read-only |
kv-delete REQUEST | Same address and optional expected check as vlite_kv_delete; returns deleted. | Refused with --read-only |
kv-list REQUEST | Collection, namespace, optional prefix/after/limit; returns items and nullable next_after. | Read |
kv-get-many REQUEST | Same request and result as vlite_kv_get_many; collection and keys required. | Read |
kv-batch REQUEST | Same request and result as vlite_kv_batch; collection and operations required. | Refused with --read-only |
Remote memory CLI
vlite-memory-cli --url URL --binding NAME --token-env ENV VERB --request FILE|- sends one authenticated POST to a provisioned memory binding. No database or tenant flags, retries, paging, job loops or ambient proxies. HTTPS is required except for loopback HTTP. Requests, responses and compact stdout including LF are bounded to 8,388,608 bytes. Success prints one duplicate-free JSON object line, including 202 pending; operation schemas remain server-authoritative. Credential-bearing successes and invalid responses fail closed with exit 6 and empty stdout. Failures print {"error":{"code":"<code>","message":"<message>"}} to stderr unless credential safety requires silence; the credential is never written to stdout or stderr. Optional --timeout-ms 1..5000 changes only HTTP timeout; reconcile ambiguous mutations by receipt. See the memory CLI guide.
| Verb | REST suffix under /v1/memory/{binding} | Result |
|---|---|---|
remember | /remember | Mutation receipt and ordered outcomes |
recall | /recall | Ranked memories and completeness metadata |
facts | /facts/query | Retained fact segments |
correct-facts | /facts/correct | Atomic correction receipt |
consolidate | /consolidate | Mutation receipt or dry-run plan |
forget | /forget | Logical deletion, retention or pending erasure |
receipt | /receipts/lookup | Original replayed mutation result |
erasure | /erasures/get | Erasure status without polling |
resume-erasure | /erasures/resume | One guarded chunk, possibly pending |