Documentation

Storage features

Opt-in engine features. Encryption, commit timestamps and graphs need v5 files; change feeds and sequence restore work on v4 and v5. Older binaries refuse v5 files with flags they do not understand (UnsupportedFeature). No operation modifies its source file: each writes a new, fully revalidated file or reads a closed or copied one.

Shared-lock read-only snapshots

Database::open_read_only(path) and open_read_only_encrypted(path, &key) take a shared OS lock, so several processes can read one file. A writer needs exclusive ownership; conflicting opens return Error::Locked without waiting. A handle sees the commits that existed when it opened. Mutations return Error::ReadOnly without poisoning the handle, incomplete tails are rejected rather than repaired, and is_read_only() reports the mode. In-memory ANN builds still work.

Python: native.open(path, read_only=True). Node: native.open(path, {readOnly: true}). C ABI Open: "read_only": true. The C ABI serializes calls per process, so parallel Python reads need separate processes. The server keeps its exclusive lock and serves concurrent reads itself; see MCP read-only access.

Encryption at rest

let key = EncryptionKey::from_bytes([7; 32]);            // or from_passphrase(..)
let db = Database::create_with_options(path, 384, CreateOptions {
    encryption: Some(key), ..Default::default() })?;
let db = Database::open_encrypted(path, &key)?;

Point-in-time restore

Create the database with CreateOptions { commit_timestamps: true, .. } to record a wall-clock time per commit, then:

maintenance::restore_to(Some(base_backup), log_copy, dest,
    RestoreTarget::Sequence(42) /* or TimestampMs(ms) */, key)?;

Change feed

let mut cursor = db.feed_cursor()?;                 // or FeedCursor::beginning(lineage)
let batch = db.changes_after(&cursor, 500)?;        // ChangeBatch { changes, next, has_more, head }
cursor = batch.next;
cursor.save(path)?;                                 // durable (tmp + fsync + rename)

Read replicas

let segment = primary.export_log(follower_sequence, 1 << 20)?;   // LogSegment
let mut follower = ReplicaFollower::create(path, &segment, key)?; // first segment
follower.apply(&next_segment)?;
let lag = follower.status()?;   // applied_sequence, primary_head, lag
follower.db().search(..)?;      // read-only access

Disk-based ANN

let source = db.build_disk_ann("default", sidecar, HnswConfig::default(), DistanceMetric::SquaredL2)?;
let index = DiskAnnIndex::open(sidecar, DiskAnnOptions { cache_bytes: 64 << 20 })?;
let hits = db.search_disk_ann(&index, &query, 10, /*ef*/ 100)?;

Enable the cargo feature gpu (wgpu compute shaders).

let gpu = GpuExactSearcher::new();                          // None without an adapter
let hits = GpuExactSearcher::search_or_cpu(gpu.as_ref(), &db, &query, 10)?;

WebAssembly

The engine builds for wasm32-unknown-unknown with --no-default-features. Database::create_in_memory, open_from_bytes and to_bytes use a byte-buffer backend without file locking. Encryption, change feeds and timestamps work, and the host must persist the image for durability. set_wasm_clock_ms supplies the time. Background HNSW rebuilds need threads and return an error, and path-based APIs fail at runtime. bindings/wasm is a wasm-bindgen package with a Node smoke test. The in-memory backend also works natively.

Graph-enabled files

Every build since v0.5.1 can store named property graphs in the same log as vectors; there is no graph Cargo feature. Every new file is graph-enabled: Database::create writes a v5 file with header flag FLAG_GRAPH = 4 (an explicit v3/v4 create stays plain); maintenance::enable_graph writes a graph-enabled copy of a v4 or v5 file. Graph commits are op-12 frames on the same commit path as vectors, so locking, sequences, checksums, encryption and commit timestamps work as usual.

Periodic (lazy) durability

Since v0.5.1 file handles default to Durability::Periodic with a 60 s interval (1 ms–60 s allowed): commits reach the OS immediately and a background flusher syncs them, for vector and graph writes alike. A process crash loses nothing acknowledged; an OS crash or power loss can lose up to about the last interval (~60 s by default). Durability::Full syncs every commit before acknowledgement. Durability::None is the in-memory mode: nothing touches disk and all data is lost on restart. Use sync() for an explicit durable point; close() syncs and a failed sync poisons the handle. The mode is not persisted. Server: --durability periodic|full|none [--flush-interval-ms N]; C ABI, Python and Node: durability and flush_interval_ms plus sync. See periodic durability for reopen cases.

Key-value store

Database::kv_store(collection) (Rust, v4+) stores namespaced string keys with byte values, no vector needed. It uses an ordinary one-dimension collection, created on first use, so the file format is unchanged.

use vlite::{Expected, kv::KvPut};
let mut kv = db.kv_store("agent-memory")?;
let token = kv.put("pool", "claim/42", b"worker-a", KvPut {
    expected: Expected::Absent,        // create only
    expires_at_ms: Some(deadline_ms),  // v5 files only
})?;
kv.delete("pool", "claim/42", Expected::Revision(token))?;
use vlite::kv::{KvOp, KvOutcome};
let outcomes = kv.write_batch(&[
    KvOp::Put {
        namespace: "pool",
        key: "claim/43",
        value: b"worker-b",
        options: KvPut { expected: Expected::Absent, expires_at_ms: None },
    },
    KvOp::Delete { namespace: "pool", key: "claim/41", expected: Expected::Any },
])?;                                   // all or nothing; one KvOutcome each
assert!(matches!(outcomes[0], KvOutcome::Put { .. }));
let entries = kv.view().get_many(&[("pool", "claim/43"), ("pool", "claim/41")])?;

Directory store

Database::create_directory(path, dimensions, options) (Rust only, v5) stores a database as a directory instead of one file. Every other API, including Database::open, open_read_only, the server and the maintenance tools, accepts the directory path unchanged.

store/
  LOCK            held while open (exclusive, or shared for read-only)
  MANIFEST        ordered list of the live files, replaced atomically
  image-N.vlite   checkpoint image, optional
  wal-N.log       write-ahead logs; only the last one is appended

Filter block summaries

A collection with declared metadata indexes (CollectionSettings::metadata_indexes) also keeps in-memory summaries of each block of 1024 records over the declared fields. Exact filtered search and the exact scan of search_auto skip blocks whose summary proves that no record can match and recheck every other record, so hits, distances and order are unchanged; only SearchStats::records_scanned can be lower. Geo radius and undeclared fields never skip. Nothing is written to disk: summaries are derived again on first use after open.

Choose the index kind by the filter. Eq and EqRange keep equality postings for any value type, which narrow an equality filter to its matches wherever they lie. Range and EqRange order integers and floats, which serves numeric ranges. On any other type a Range index adds only these summaries: they help when the matching records sit together in ID order, and a filter whose matches are spread over every block runs at the speed of no index. Measured gains are in the supplemental results.

Server file compaction

A single-file database keeps old pages after updates and deletes until it is compacted to a new file. Offline, vlite-maintain compact writes that new file. The managed vlite-server can also do it while it runs, from the dashboard (Administration → Backup & recovery → File compaction) or the admin API, now or on an opt-in daily UTC schedule.

The server makes a frozen copy of the database, builds and validates a compact file from it, then restarts its whole storage generation on the new file during a short pause. The live file is never changed in place, and the original is kept as a recovery copy. Records, graphs, credentials, the lineage, the global commit sequence and ID high-water marks are kept. Record ETags and graph revisions can advance, so earlier If-Match and expected_revision values fail instead of overwriting data. Change history from before compaction is dropped, so the server requires explicit consent first.

The feature is experimental and off unless started or enabled. It is qualified only for Linux with the database and admin directory on one local ext4 filesystem, for files up to 1 GiB. SMB/Azure Files, NFS, overlay and native Windows or macOS stay disabled with a reason. See API.md for routes and limits.

Limitations

View or edit this page on GitHub ↗