# Introspection

> USearch for Mojo

```mojo
var description = index.describe()
print(description.size, description.memory_usage, library.cpu_class_name(description.cpu_class))  # the class dispatch picked
print(index.count(Key(integer=42)))  # entries sharing one key

var reachability = index.health()
print(reachability.reachable, "of", reachability.audited, "entries reachable")
print(library.version_name(), library.capabilities_available())
```

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

`from usearch import DenseReachability, DenseIndexDescription, Library, …`

## DenseReachability

One reachability audit - `usearch_reachability_t`: the population it judged, and how much of it a search reaches.

```mojo
struct DenseReachability
```

- `audited` `c_size_t`: Entries published when the audit started; compare `reachable` against this, never a later size.
- `reachable` `c_size_t`: Of those, the entries a search reaches; the rest no search finds until a [`refine`](https://www.unum.cloud/docs/usearch/mojo/executors.md#refine) re-links them.
- `sweeps` `c_size_t`: Levels the sweep took to converge.
- `back_sweeps` `c_size_t`: Levels the sweep back toward the entry point took, where an audit sweeps both ways.

Conforms to: `Copyable`, `Defaultable`, `Deinitable`, `ImplicitlyCopyable`, `Movable`

## __init__

Zeroes the audit, which is what a failed call leaves.

```mojo
def __init__(out self)
```

## DenseIndexDescription

`usearch_dense_index_description_t`: a live index's frozen metadata and current counters.

```mojo
struct DenseIndexDescription
```

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

- `metadata` `DenseMetadata`: The frozen metric, quantization, dimensions and connectivity, as a checkpoint reports them.
- `size` `c_size_t`: Stored entries.
- `capacity` `c_size_t`: Entries hosted without growing again.
- `memory_usage` `c_size_t`: Bytes the handle holds; traversal scratch is the executor's.
- `cpu_class` `CpuClass`: The CPU class dispatch picked on this machine; [`UNKNOWN`](#UNKNOWN) for a device index.
- `gpu_class` `GpuClass`: The GPU class dispatch picked on the index's devices; [`UNKNOWN`](#UNKNOWN) for a host index.
- `shards_count` `c_size_t`: Live shards.

Conforms to: `Copyable`, `Deinitable`, `Movable`

## Library

A reference to the loaded engine, cheap to copy and shared by everything it creates.

```mojo
struct Library
```

Every handle carries one, which is what keeps the shared object mapped for as long as anything
can still call into it. It is a loader reference and nothing more: an executor never retains an
index, and an index never retains an executor.

- `shared` `ArcPointer[_Loaded]`: The handle and its symbols, refcounted so the last holder unmaps the object.

Conforms to: `Copyable`, `Deinitable`, `ImplicitlyCopyable`, `Movable`

## __init__

Opens the shared object and resolves it, which every handle then shares.

```mojo
def __init__(out self)
```

Raises: With [`LIBRARY_MISSING`](https://www.unum.cloud/docs/usearch/mojo/errors.md#LIBRARY_MISSING), when nothing is on the loader path, with [`VERSION_MISMATCH`](https://www.unum.cloud/docs/usearch/mojo/errors.md#VERSION_MISMATCH) when what loaded is another major version, or with [`SYMBOL_MISSING`](https://www.unum.cloud/docs/usearch/mojo/errors.md#SYMBOL_MISSING) when it does not export an entry point the binding needs.

## symbols

The resolved entry points, borrowed rather than copied on every call.

```mojo
def symbols(self) -> ref[self.shared.symbols] Symbols
```

## version_name

The loaded engine's own version, which is also the cheapest check that loading worked. Calls `usearch_version_name`.

```mojo
def version_name(self) -> String
```

## capabilities_compiled

The hardware capabilities this build of the engine was compiled with. Calls `usearch_capabilities_compiled`.

```mojo
def capabilities_compiled(self) -> String
```

## capabilities_available

The hardware capabilities this machine offers now, which the build does not imply. Calls `usearch_capabilities_available`.

```mojo
def capabilities_available(self) -> String
```

## status_name

The engine's spelling of a status, "unrecognized" for a code it does not name. Calls `usearch_status_name`.

```mojo
def status_name(self, status: Status) -> String
```

## status_from_name

Reads a spelling back; [`INVALID_ARGUMENT`](https://www.unum.cloud/docs/usearch/mojo/errors.md#INVALID_ARGUMENT) when unrecognized. Calls `usearch_status_from_name`.

```mojo
def status_from_name(self, name: StringSpan) -> Status
```

## scalar_name

The engine's spelling of a scalar kind, as [`F32`](https://www.unum.cloud/docs/usearch/mojo/inputs-and-outputs.md#F32) spells "f32". Calls `usearch_scalar_name`.

```mojo
def scalar_name(self, scalar: ScalarKind) -> String
```

## scalar_from_name

Reads a spelling back; [`UNKNOWN`](#UNKNOWN) when unrecognized. Calls `usearch_scalar_from_name`.

```mojo
def scalar_from_name(self, name: StringSpan) -> ScalarKind
```

## residency_name

The engine's spelling of a residency, as [`RAM`](https://www.unum.cloud/docs/usearch/mojo/residency.md#RAM) spells "ram". Calls `usearch_residency_name`.

```mojo
def residency_name(self, residency: Residency) -> String
```

## residency_from_name

Reads a spelling back; [`RAM`](https://www.unum.cloud/docs/usearch/mojo/residency.md#RAM) when unrecognized. Calls `usearch_residency_from_name`.

```mojo
def residency_from_name(self, name: StringSpan) -> Residency
```

## traversal_name

The engine's spelling of a traversal, as [`SCAN`](https://www.unum.cloud/docs/usearch/mojo/inputs-and-outputs.md#SCAN) spells "scan". Calls `usearch_traversal_name`.

```mojo
def traversal_name(self, traversal: Traversal) -> String
```

## traversal_from_name

Reads a spelling back; [`WALK`](https://www.unum.cloud/docs/usearch/mojo/inputs-and-outputs.md#WALK) when unrecognized. Calls `usearch_traversal_from_name`.

```mojo
def traversal_from_name(self, name: StringSpan) -> Traversal
```

## cpu_class_name

The engine's spelling of a CPU class, as dispatch reports it. Calls `usearch_cpu_class_name`.

```mojo
def cpu_class_name(self, cpu_class: CpuClass) -> String
```

## gpu_class_name

The engine's spelling of a GPU class, as dispatch reports it. Calls `usearch_gpu_class_name`.

```mojo
def gpu_class_name(self, gpu_class: GpuClass) -> String
```

## mood_name

The engine's spelling of a mood, as [`PARKED`](https://www.unum.cloud/docs/usearch/mojo/executors.md#PARKED) spells "parked". Calls `usearch_mood_name`.

```mojo
def mood_name(self, mood: Mood) -> String
```

## mood_from_name

Reads a spelling back; [`PARKED`](https://www.unum.cloud/docs/usearch/mojo/executors.md#PARKED) when unrecognized. Calls `usearch_mood_from_name`.

```mojo
def mood_from_name(self, name: StringSpan) -> Mood
```

## dense_metric_name

The engine's spelling of a metric kind, as [`INNER`](https://www.unum.cloud/docs/usearch/mojo/metrics.md#INNER) spells "inner". Calls `usearch_dense_metric_name`.

```mojo
def dense_metric_name(self, metric: DenseMetric) -> String
```

## dense_metric_from_name

Reads a spelling back; [`UNKNOWN`](#UNKNOWN) when unrecognized. Calls `usearch_dense_metric_from_name`.

```mojo
def dense_metric_from_name(self, name: StringSpan) -> DenseMetric
```

## CpuClass

The CPU family dispatch picks, or a placement pins - `usearch_cpu_class_t`.

```mojo
struct CpuClass
```

- `UNKNOWN` = `CpuClass(Int32(0))`: Derives the CPU's own class.
- `code` `c_int`: The raw `usearch_cpu_class_t` value the ABI exchanges.

Conforms to: `Copyable`, `Deinitable`, `Equatable`, `ImplicitlyCopyable`, `Movable`, `RegisterPassable`, `TrivialRegisterPassable`

## GpuClass

The GPU family dispatch picks, or a placement pins - `usearch_gpu_class_t`.

```mojo
struct GpuClass
```

- `UNKNOWN` = `GpuClass(Int32(0))`: Derives the devices' own class.
- `code` `c_int`: The raw `usearch_gpu_class_t` value the ABI exchanges.

Conforms to: `Copyable`, `Deinitable`, `Equatable`, `ImplicitlyCopyable`, `Movable`, `RegisterPassable`, `TrivialRegisterPassable`

## NvmeClass

The NVMe I/O engine family an executor drives - `usearch_nvme_class_t`.

```mojo
struct NvmeClass
```

- `UNKNOWN` = `NvmeClass(Int32(0))`: Derives the devices' own class.
- `code` `c_int`: The raw `usearch_nvme_class_t` value the ABI exchanges.

Conforms to: `Copyable`, `Deinitable`, `Equatable`, `ImplicitlyCopyable`, `Movable`, `RegisterPassable`, `TrivialRegisterPassable`

