Zig · Introspection

Introspection

const usearch = @import("usearch"); 3.0.0-rc.1 · 4c3e5023

const description = try index.describe();
std.debug.print("{d} entries in {d} bytes\n", .{ description.size, description.memory_usage });
std.debug.print("dispatched to {s} across {d} shards\n", .{ description.cpu_class, description.shards_count });
std.debug.print("compiled for {s}\n", .{usearch.capabilitiesCompiled()});
std.debug.print("available here {s}\n", .{usearch.capabilitiesAvailable()});

const reachability = try index.on(executor).health();
std.debug.print("{d} of {d} entries reachable\n", .{ reachability.reachable, reachability.audited });

health audits how much of the graph a search reaches from its landmarks; entries it misses stay unfound until a refine re-links them.

API

Types

DenseIndexDescriptionA live index's state, reported by DenseIndex.describe.
pub const DenseIndexDescription = struct

Each counter is read once, so under concurrent insertions they may come from slightly different moments. Mirrors usearch_dense_index_description_t.

Fields

metadataDenseMetadataThe frozen metric, quantization, dimensions and connectivity.
sizeusizeStored entries.
capacityusizeEntries hosted without growing again.
memory_usageusizeBytes the handle holds; traversal scratch is the executor's.
cpu_class[:0]const u8The CPU class dispatch picked on this machine, as usearch_cpu_class_name spells it.
gpu_class[:0]const u8The GPU class dispatch picked on the index's devices; "unknown" for a host index.
shards_countusizeLive shards.
DenseReachabilityOne reachability audit: the population it judged, and how much of it a search reaches.
pub const DenseReachability = extern struct

Mirrors usearch_reachability_t.

Fields

auditedusizeEntries published when the audit started; compare reachable against this, never a later size.
reachableusizeOf those, the entries a search reaches from the landmarks; the rest wait for a refine.
sweepsusizeLevels the sweep took to converge.
back_sweepsusizeLevels the sweep back toward the entry point took, where an audit sweeps both ways.
DenseDescribeOne DenseIndex.describe, as a Deferred holds it.
pub const DenseDescribe = struct

Fields

descriptionusearch_dense_index_description_t
outcomeOutcome
DenseCountOne DenseIndex.count, as a Deferred holds it.
pub const DenseCount = struct

Fields

keyKey
entriesusize
outcomeOutcome
DenseHealthOne DenseIndex.health, as a Deferred holds it.
pub const DenseHealth = struct

Fields

reachabilityDenseReachability
outcomeOutcome

Functions

versionThe library's version, as a static null-terminated string.
pub fn version() [:0]const u8

Calls usearch_version_name.

capabilitiesCompiledThe hardware capabilities this binary was compiled with, comma-separated.
pub fn capabilitiesCompiled() [:0]const u8

Calls usearch_capabilities_compiled.

capabilitiesAvailableThe hardware capabilities the current machine offers at runtime, comma-separated.
pub fn capabilitiesAvailable() [:0]const u8

Calls usearch_capabilities_available.