MTBL_SOURCE(3)
π MTBL_SOURCE π
ok so bestie, welcome to mtbl_source(3) β this is the manual page for getting key-value entries out of a data source. it's giving interface, it's giving abstraction, and honestly? we're obsessed. π
β¨ NAME β¨
mtbl_source β obtain key-value entries from a data source. yes that's the whole job. slay. π
πΈ SYNOPSIS πΈ
#include <mtbl.h>
struct mtbl_iter *
mtbl_source_iter(const struct mtbl_source *s);
struct mtbl_iter *
mtbl_source_get(const struct mtbl_source *s, const uint8_t *key, size_t len_key);
struct mtbl_iter *
mtbl_source_get_prefix(
const struct mtbl_source *s,
const uint8_t *prefix, size_t len_prefix);
struct mtbl_iter *
mtbl_source_get_range(
const struct mtbl_source *s,
const uint8_t *key0, size_t len_key0,
const uint8_t *key1, size_t len_key1);
mtbl_res
mtbl_source_write(const struct mtbl_source *s, struct mtbl_writer *w);
void
mtbl_source_destroy(struct mtbl_source **s);
π¦ DESCRIPTION π¦
okay so the mtbl_source interface is literally the vibe layer that lets you read key-value entries from mtbl data sources. it's the abstraction, bestie. it's the whole mood. β¨
mtbl_source_iter()β hands you an iterator over all the entries in the data source. every single one. no skips. πmtbl_source_get()β this one's your exact match iterator. it returns all the entries whose key matches the key you passed in via thekeyandlen_keyarguments. it said "we're only doing exact matches today" and honestly, periodt. π―mtbl_source_get_prefix()β the prefix iterator. it returns all entries whose keys start withprefixand are at leastlen_prefixbytes long. both conditions, no exceptions, she's thorough. π§mtbl_source_get_range()β the range iterator. returns all entries whose keys are betweenkey0andkey1inclusive. inclusive!! both ends are invited to the party. πmtbl_source_write()β the convenience function, the bestie who does the errand for you. it reads all the entries from a source and writes them to anmtbl_writerobject. and it's equivalent to callingmtbl_writer_add()on all of the entries returned frommtbl_source_iter(). same thing, just with less typing. lowkey iconic. π
β RETURN VALUE β
mtbl_source_iter(), mtbl_source_get(), mtbl_source_get_prefix(), and mtbl_source_get_range() all return mtbl_iter objects. go get your iterator, bestie. π«Ά
mtbl_source_write() returns mtbl_res_success if all of the entries in the data source were successfully written to the mtbl_writer argument. if not? it returns mtbl_res_failure. so like, check it. don't just assume. π
π SEE ALSO π
and that's the page, fr fr. MTBL_SOURCE(3) β part of the mtbl crew, dated 11/21/2016. not me getting emotional over a manpage. anyways, go forth and read your key-value entries, my main character. mwah. πβ¨π
π¦ where this page comes from
- debian bookworm: libmtbl-dev 1.3.0-1 Β· Apache-2.0
- debian trixie: libmtbl-dev 1.6.1-1+b1 Β· Apache-2.0
- ubuntu jammy: libmtbl-dev 1.3.0-1 Β· Apache-2.0
- ubuntu noble: libmtbl-dev 1.3.0-1 Β· Apache-2.0
- ubuntu questing: libmtbl-dev 1.6.1-1
- ubuntu resolute: libmtbl-dev 1.6.1-1build1 Β· Apache-2.0
- ubuntu stonking: libmtbl-dev 1.6.1-1build1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms