MTBL_METADATA(3)
π MTBL_METADATA π
okay bestie, pull up a chair, because today we're talking about the mtbl_metadata page from the MTBL manual (section 3, library calls, iykyk) β¨
πΈ NAME πΈ
mtbl_metadata β get MTBL file metadata π«Ά
β¨ SYNOPSIS β¨
#include <mtbl.h>
mtbl_file_version
mtbl_metadata_file_version(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_index_block_offset(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_data_block_size(const struct mtbl_metadata *m);
mtbl_compression_type
mtbl_metadata_compression_algorithm(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_count_entries(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_count_data_blocks(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_bytes_data_blocks(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_bytes_index_block(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_bytes_keys(const struct mtbl_metadata *m);
uint64_t
mtbl_metadata_bytes_values(const struct mtbl_metadata *m);
π DESCRIPTION π
so here's the tea: you get yourself an mtbl_metadata object from an mtbl_reader(3). that's the source, that's the plug, that's where it comes from. and then all its little accessor functions spill the attributes and the file statistics that got recorded in the metadata block. it's giving receipts, honestly. every number you could possibly want about your file is just sitting there, waiting. obsessed π
π¦ RETURN VALUE π¦
mtbl_metadata_file_version()
the file format version of the MTBL file, bestie. it's either MTBL_FORMAT_V1 or MTBL_FORMAT_V2. that's it, that's the whole vibe check. β¨
mtbl_metadata_index_block_offset()
the byte offset in the MTBL file where the index begins π
mtbl_metadata_data_block_size()
the maximum size of an uncompressed data block. and if you wanna know more about that, go look at mtbl_writer(3) fr fr.
mtbl_metadata_compression_algorithm()
one of the compression values that mtbl_writer(3) allows. literally just one of those. π
mtbl_metadata_count_entries()
the total number of key-value entries. every single one. counted. periodt.
mtbl_metadata_count_data_blocks()
the total number of data blocks π
mtbl_metadata_bytes_data_blocks()
the total number of bytes consumed by data blocks πΈ
mtbl_metadata_bytes_index_block()
the total number of bytes consumed by the index π
mtbl_metadata_bytes_keys()
the total number of bytes that all keys would occupy if they were stored end-to-end in a byte array with no delimiters. no commas, no nothing. just keys, shoulder to shoulder, iconic behavior honestly.
mtbl_metadata_bytes_values()
the total number of bytes that all values in the file would occupy if they were stored end-to-end in a byte array with no delimiters. same deal, different data. slay π
not a single option, flag, or caveat got left behind, bestie. we keep every detail around here, no cap. π«Ά
that's the whole page!! mwah π
signing off β this was page MTBL_METADATA(3), dated 02/10/2017, and yes she ate. go forth and read your metadata, main character. πβ¨
π¦ 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