Rust · Residency

Residency

use usearch::Residency; 3.0.0-rc.1 · 4c3e5023

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 takes only the placement its own hardware has, as memory domains, devices or paths with one shard per entry, and an empty list derives the placement: every NUMA node, one free device, or wherever the manifest points.

use std::path::Path;

let in_ram = DenseIndex::init_ram(&options, &[0, 1])?;               // one graph per socket
let in_vram = DenseIndex::init_vram(&options, &[0, 1, 2, 3])?;       // sharded, never replicated
let on_nvme = DenseIndex::view_nvme(DenseViewNvmeConfig {
    paths: &[Path::new("/mnt/nvme0")],                               // striped across the drives named
    ..DenseViewNvmeConfig::from("index.safegraphs")
})?;

An NVMe handle serves a checkpoint in place and is read-only, so every mutating verb fails on it with Status::ReadOnly. Bigger indexes come from merging, never mutating: shards build in RAM, serialize, and join a manifest.

API

EnumResidencyWhere an executor computes, and with it where the arenas it makes keep their memory.
types.rs:1653 ↗
pub enum Residency

Values

Ram1Volatile memory, traversed by CPU threads.
Vram2Accelerator memory, traversed by GPU warps on a chosen device.
Nvme3Persisted storage, traversed through pluggable I/O engines.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Hash, Display, FromStr