C · Keys

Keys

#include <usearch/types.h> 3.0.0-rc.1 · 4c3e5023

A usearch_key_t is sixteen opaque bytes, enough for a UUID, a content hash, or a 64-bit integer with room to spare, and spelled canonically as a lowercase dashed UUID. Integer identities sit big-endian in the last bytes with the rest zeroed, which is how the other bindings convert integers:

usearch_key_t key_of(uint64_t value) {
    usearch_key_t key = {{0}};
    for (unsigned byte = 0; byte != 8; ++byte) key.bytes[15 - byte] = (uint8_t)(value >> (byte * 8));
    return key;
}

Keys need not be unique: an index admits up to its values_per_key entries under one key, unbounded by default, and the count verbs report how many a key holds. A batch passes its keys as a usearch_keys_view_t, a pointer and a byte stride, where a zero stride repeats the first key for every row.

API

Types

usearch_key_tUser-facing 128-bit key identifying one entry of any index - sixteen opaque bytes, rendered canonically as a lowercase dashed UUID, matching SafeGraphs' uuid key column.
types.h:146 ↗
struct usearch_key_t

Keys need not be unique: several entries may share one, and count-like functions report how many. Integer identities sit in the low bytes with the rest zeroed.

Fields

usearch_keys_view_tA strided run of keys - how a batch names the identities it carries, one per row of the call's count, or one per entry a cursor pull wrote into its arena.
types.h:178 ↗
struct usearch_keys_view_t

A zero stride repeats the first key for every row, which is how a batch of rows is written under one key without a caller materializing the copies. An output's keys are packed, so the call writes one key's size as stride.

Fields

datausearch_key_t const *First key of the run.
stridesize_tBytes between consecutive keys; zero repeats the first.
usearch_keys_tape_view_tA ragged run of keys a call wrote into its arena, for verbs whose entries name as many keys as each one links to: keys end to end, and one more offset than entries.
types.h:497 ↗
struct usearch_keys_tape_view_t

Entry i spans offsets[i] up to offsets[i+1], so the last offset is the total.

Fields

keysusearch_key_t const *Every entry's keys, end to end.
offsetssize_t const *The call's written + 1 non-decreasing offsets into keys.