pub const DenseReserve = struct Fields
capacity | usize | |
|---|---|---|
outcome | Outcome |
Where the payload lives is the constructor’s name, as in the C lifecycle verbs, so a residency an index lacks has no constructor to call. Each names the hardware its shards are placed across, one shard per memory domain, device or path, and an empty slice derives one from the machine.
// One graph per socket.
var in_memory = try usearch.DenseIndex.initRam(.{ .dimensions = 768 }, &.{ 0, 1 });
// Sharded across the devices, never replicated.
var on_device = try usearch.DenseIndex.initVram(.{ .dimensions = 768 }, &.{ 0, 1 });
// Served in place, read-only, and sized past RAM.
var on_disk = try usearch.DenseIndex.viewNvme("index.safegraphs.json", .{
.executor = nvme_executor,
.paths = &.{.of("/mnt/nvme0")},
});An NVMe index is never initialized, only viewed in place, and it is read-only, so every mutating verb on it fails with Error.ReadOnly.
Until NVMe checkpoints carry keys, viewNvme answers Error.Unsupported.
DenseReserveOne DenseIndex.reserve, as a Deferred holds it.DenseClearOne DenseIndex.clear, as a Deferred holds it.ResidencyWhere an index's payload lives and which engine traverses it - the vocabulary the lifecycle verbs spell in their names, as DenseIndex.initVram does.2pub const Residency = enum(c_int) Kept for its name table.
ram | 1 | Volatile-memory index traversed by CPU threads. |
|---|---|---|
vram | 2 | Accelerator-memory index traversed by GPU warps. |
nvme | 3 | Persisted index traversed through pluggable I/O engines. |
nameThe canonical spelling, as .ram spells "ram".fromNameReads a spelling back, or null when no residency spells it.