# Introspection

> Read an index's size, memory and the CPU and GPU classes dispatch picked, the kernels compiled in and runnable here, how much of the graph a search reaches, and how many entries share a key.

`#include <usearch/types.hpp>` 3.0.0-rc.1 · cabb6603

Read an index’s size, memory and the CPU and GPU classes dispatch picked, the kernels compiled in and runnable here, how much of the graph a search reaches, and how many entries share a key:

```cpp
auto [description, status] = index.describe();
std::printf("%zu entries in %zu bytes\n", description.size, description.memory_usage);
std::printf("dispatched to %s and %s\n", usearch_cpu_class_name(description.cpu_class),
            usearch_gpu_class_name(description.gpu_class));
std::printf("compiled for %s\n", usearch_capabilities_compiled());
std::printf("available here %s\n", usearch_capabilities_available());

auto [reachability, health_status] = index.health();
std::printf("%zu of %zu entries reachable\n", reachability.reachable, reachability.audited);

auto [entries, count_status] = index.count(key);
std::printf("%zu entries under the key\n", entries);
```

`describe` reads the frozen metadata and the counters once each, so under concurrent insertions they may come from slightly different moments, and `memory_usage` excludes the executor’s scratch. `health` measures how much of the graph a search reaches from the root; entries it misses stay unfound until a `refine` re-links them.

## API

### Types

#### `expected`

A call's value beside its status, bound natively as `auto [value, status]`.

[types.hpp:78 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L78)

```cpp
template <typename value_type_>
struct expected
```

#### Fields

| `value` | `value_type_` | |
| - | - | - |
| `status` | `status_t` | |

#### `outputs`

Where a call writes what `value_type_` is made of.

[types.hpp:85 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L85)

```cpp
template <typename value_type_>
struct outputs
```

#### Fields

| `value` | `value_type_` | The answer, which the call writes in place. |
| - | - | - |

#### `outputs< void >`

A call that outputs nothing but its status.

[types.hpp:95 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L95)

```cpp
template <>
struct outputs< void >
```

#### Fields

| `value` | `void` | The answer, which the call writes in place. |
| - | - | - |

#### `awaiter`

A [`deferred`](https://www.unum.cloud/docs/usearch/cpp/metrics.md#deferred) being awaited, living in the awaiting coroutine's frame: each poll reads the status word, and one not yet final posts itself again.

[types.hpp:174 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L174)

```cpp
template <typename value_type_,
          a_scheduler scheduler_type_>
class awaiter
```

#### `owner`

Owns one handle of `handle_type_`, which `free_` releases, moving it and never copying it.

[types.hpp:240 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L240)

```cpp
template <typename handle_type_,
          void(*)(handle_type_) free_>
class owner
```

#### `owning`

A handle owned, moved and never copied, whose verbs block on the calling thread.

[types.hpp:283 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L283)

```cpp
template <typename handle_type_,
          void(*)(handle_type_) free_>
struct owning
```

#### Fields

| `completion` | `usearch_completion_t` | |
| - | - | - |

#### `caller_owned`

A handle its caller owns and the executor its verbs run on, both valid while this lives, completing as `completion_` says.

[types.hpp:294 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L294)

```cpp
template <typename handle_type_,
          usearch_completion_t completion_>
struct caller_owned
```

#### Fields

| `completion` | `usearch_completion_t` | |
| - | - | - |

#### Class `plan`

A long operation in flight behind `handle_type_`, which its verb opens on the first call naming it and continues on every later one, until the operation's finish consumes it.5

[types.hpp:738 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L738)

```cpp
template <typename handle_type_>
class plan
```

Nothing finishes it on destruction: a dropped live plan leaks and keeps every handle it names closed to insertion and saving, as an unfinished plan does in C.

##### `plan`

[types.hpp:740 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L740)

```cpp
plan() noexcept=default;
```

```cpp
plan(plan && other) noexcept;
```

```cpp
plan(plan const &)=delete;
```

##### `operator=`

[types.hpp:742 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L742)

```cpp
plan & operator=(plan && other) noexcept;
```

```cpp
plan & operator=(plan const &)=delete;
```

##### `phase`

Where the last call naming the plan stopped; `usearch_phase_name` spells its phase.

[types.hpp:751 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L751)

```cpp
usearch_phase_progress_t phase() const noexcept;
```

##### `handle_field`

The lazy handle field a verb naming the plan opens, continues and leaves.

[types.hpp:756 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L756)

```cpp
handle_type_ * handle_field() noexcept;
```

##### `phase_field`

The progress field a verb naming the plan writes where it stops.

[types.hpp:759 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L759)

```cpp
usearch_phase_progress_t * phase_field() noexcept;
```

### Functions

#### `version_name`

The linked library's version, a release-candidate suffix included.

[types.hpp:724 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L724)

```cpp
std::string_view version_name() noexcept;
```

#### `handle_field_of`

The handle field of `live`, or `nullptr` when a call names no plan.

[types.hpp:768 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L768)

```cpp
template <typename handle_type_>
handle_type_ * handle_field_of(plan<handle_type_> *live) noexcept;
```

#### `phase_field_of`

The progress field of `live`, or `nullptr` when a call names no plan.

[types.hpp:774 ↗](https://github.com/unum-cloud/USearch/blob/cabb660355b45ed0d6ade2dc86ca58be01d61e29/cpp/usearch/types.hpp#L774)

```cpp
template <typename handle_type_>
usearch_phase_progress_t * phase_field_of(
    plan<handle_type_> *live) noexcept;
```
