MTBL_MERGE(1)
π mtbl_merge β the merge-y one π
okay so bestie, this is the mtbl_merge manual page, section 1 of the MTBL fam. sit down, grab a lil drink, we're merging data π
β¨ NAME β¨
mtbl_merge β merge MTBL data from multiple input files into a single output file π«Ά
πΈ SYNOPSIS πΈ
First up, the user-provided functions, and yes you literally have to write these, they're not optional vibes:
typedef void *
(*mtbl_merge_init_func)(void);
typedef void
(*mtbl_merge_free_func)(void *clos);
typedef void
(*mtbl_merge_func)(void *clos,
const uint8_t *key, size_t len_key,
const uint8_t *val0, size_t len_val0,
const uint8_t *val1, size_t len_val1,
uint8_t **merged_val, size_t *len_merged_val);
and then the command line tool itself, she's giving very much:
export MTBL_MERGE_DSO="libexample.so.0"
export MTBL_MERGE_FUNC_PREFIX="example_merge"
mtbl_merge [-b SIZE] [-c COMPRESSION] [-l LEVEL] INPUT [INPUT]... OUTPUT
π¦ DESCRIPTION π¦
So mtbl_merge(1) is a command-line driver for the mtbl_merger(3) interface. and here's the thing β the mtbl_merger(3) interface needs a user-provided merge function. like, it cannot function without you. main character energy but for you. that merge function gets loaded from a shared object, and the filename of that shared object comes from the environment variable MTBL_MERGE_DSO. no cap.
Your user-provided merge function has to have the same type as the mtbl_merge_func function type up there in the synopsis π. The symbol name of the merge function that gets loaded out of your user-provided DSO is built by appending "_func" to the string you put in the MTBL_MERGE_FUNC_PREFIX environment variable β and that variable must be non-empty, fr fr, don't leave it blank.
Also, bonus round: you can optionally provide two more functions π
- an "init" function, whose symbol name is
"_init"appended to the function prefix - a "free" function, whose symbol name is
"_free"appended to the function prefix
If the "init" function exists, it gets called at the beginning β before any calls to the merge function β and its return value gets passed as the first argument to the merge function. and if the "free" function exists, it gets called at the end, after any calls to the merge function, and its argument is the return value of the "init" function. cute lil lifecycle, honestly obsessed π
And one more: the environment variable MTBL_MERGE_BLOCK_SIZE may optionally be set, if you wanna configure the MTBL block size (in bytes) of the output file. you don't have to! but you can β¨
π OPTIONS π
-b SIZEβ the uncompressed data block size hint for the output file, in bytes. if you don't specify it, the default is8192bytes (that's 8 kilobytes, bestie).-c COMPRESSIONβ the compression algorithm to use for data blocks in the output file. if you don't specify it, the default iszlib. wanna know what else you can pick? go read themtbl_info(1)manpage, it's got the whole list of possible compression algorithms π-l LEVELβ the numeric compression level that gets passed to the compression algorithm. and look, the default value and the valid range both depend on which compression algorithm you chose, so check accordingly π
π§ SEE ALSO π§
okay that's the whole page, you ate it, you understood it, periodt π β¨
this was the MTBL_MERGE(1) page, dated 10/21/2021 β love u, go merge something iconic π«Άππ¦
π¦ where this page comes from
- debian trixie: mtbl-bin 1.6.1-1+b1 Β· Apache-2.0
- ubuntu questing: mtbl-bin 1.6.1-1
- ubuntu resolute: mtbl-bin 1.6.1-1build1 Β· Apache-2.0
- ubuntu stonking: mtbl-bin 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