C++ · Introspection

Introspection

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

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/usearch/cpp/introspection.md' | claude -p "How would this fit my code?"

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:

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

expectedA call's value beside its status, bound natively as auto [value, status].
types.hpp:78 ↗
template <typename value_type_>
struct expected

Fields

valuevalue_type_
statusstatus_t
outputsWhere a call writes what value_type_ is made of.
types.hpp:85 ↗
template <typename value_type_>
struct outputs

Fields

valuevalue_type_The answer, which the call writes in place.
outputs< void >A call that outputs nothing but its status.
types.hpp:95 ↗
template <>
struct outputs< void >

Fields

valuevoidThe answer, which the call writes in place.
awaiterA 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 ↗
template <typename value_type_,
          a_scheduler scheduler_type_>
class awaiter
ownerOwns one handle of handle_type_, which free_ releases, moving it and never copying it.
types.hpp:240 ↗
template <typename handle_type_,
          void(*)(handle_type_) free_>
class owner
owningA handle owned, moved and never copied, whose verbs block on the calling thread.
types.hpp:283 ↗
template <typename handle_type_,
          void(*)(handle_type_) free_>
struct owning

Fields

caller_ownedA handle its caller owns and the executor its verbs run on, both valid while this lives, completing as completion_ says.
types.hpp:294 ↗
template <typename handle_type_,
          usearch_completion_t completion_>
struct caller_owned

Fields

ClassplanA 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 ↗
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 ↗
plan() noexcept=default;
plan(plan && other) noexcept;
plan(plan const &)=delete;
operator=
types.hpp:742 ↗
plan & operator=(plan && other) noexcept;
plan & operator=(plan const &)=delete;
phaseWhere the last call naming the plan stopped; usearch_phase_name spells its phase.
types.hpp:751 ↗
usearch_phase_progress_t phase() const noexcept;
handle_fieldThe lazy handle field a verb naming the plan opens, continues and leaves.
types.hpp:756 ↗
handle_type_ * handle_field() noexcept;
phase_fieldThe progress field a verb naming the plan writes where it stops.
types.hpp:759 ↗
usearch_phase_progress_t * phase_field() noexcept;

Functions

version_nameThe linked library's version, a release-candidate suffix included.
types.hpp:724 ↗
std::string_view version_name() noexcept;
handle_field_ofThe handle field of live, or nullptr when a call names no plan.
types.hpp:768 ↗
template <typename handle_type_>
handle_type_ * handle_field_of(plan<handle_type_> *live) noexcept;
phase_field_ofThe progress field of live, or nullptr when a call names no plan.
types.hpp:774 ↗
template <typename handle_type_>
usearch_phase_progress_t * phase_field_of(
    plan<handle_type_> *live) noexcept;