Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mtbl_reader(3) [debian man page]

MTBL_READER(3)															    MTBL_READER(3)

NAME
mtbl_reader - read an MTBL file SYNOPSIS
#include <mtbl.h> Reader objects: struct mtbl_reader * mtbl_reader_init(const char *fname, const struct mtbl_reader_options *ropt); struct mtbl_reader * mtbl_reader_init_fd(int fd, const struct mtbl_reader_options *ropt); void mtbl_reader_destroy(struct mtbl_reader **r); const struct mtbl_source * mtbl_reader_source(struct mtbl_reader *r); Reader options: struct mtbl_reader_options * mtbl_reader_options_init(void); void mtbl_reader_options_destroy(struct mtbl_reader_options **ropt); void mtbl_reader_options_set_verify_checksums( struct mtbl_reader_options *ropt, bool verify_checksums); DESCRIPTION
MTBL files are accessed by creating an mtbl_reader object, calling mtbl_reader_source() to obtain an mtbl_source handle, and using the mtbl_source(3) interface to read entries. mtbl_reader objects may be created by calling mtbl_reader_init() with an fname argument specifying the filename to be opened, or mtbl_reader_init_fd() may be called with an fd argument specifying an open, readable file descriptor. Since MTBL files are immutable, the same MTBL file may be opened and read from concurrently by independent threads or processes. If the ropt parameter to mtbl_reader_init() or mtbl_reader_init_fd() is non-NULL, the parameters specified in the mtbl_reader_options object will be configured into the mtbl_reader object. Reader options verify_checksums Specifies whether or not the CRC32C checksum on each data block should be verified or not. If verify_checksums is enabled, a checksum mismatch will cause a runtime error. Note that the checksum on the index block is always verified, since the overhead of doing this once when the reader object is instantiated is minimal. The default is to not verify data block checksums. RETURN VALUE
mtbl_reader_init() and mtbl_reader_init_fd() return NULL on failure, and non-NULL on success. 05/29/2012 MTBL_READER(3)

Check Out this Related Man Page

MTBL_SOURCE(3)															    MTBL_SOURCE(3)

NAME
mtbl_source - obtain key-value entries from a data source 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
The mtbl_source iterface provides an abstraction for reading key-value entries from mtbl data sources. mtbl_source_iter() provides an iterator over all of the entries in the data source. mtbl_source_get() provides an exact match iterator which returns all entries whose key matches the key provided in the arguments key and len_key. mtbl_source_get_prefix() provides a prefix iterator which returns all entries whose keys start with prefix and are at least len_prefix bytes long. mtbl_source_get_range() provides a range iterator which returns all entries whose keys are between key0 and key1 inclusive. mtbl_source_write() is a convenience function for reading all of the entries from a source and writing them to an mtbl_writer object. It is equivalent to calling mtbl_writer_add() on all of the entries returned from mtbl_source_iter(). RETURN VALUE
mtbl_source_iter(), mtbl_source_get(), mtbl_source_get_prefix(), and mtbl_source_get_range() return mtbl_iter objects. mtbl_source_write() returns mtbl_res_success if all of the entries in the data source were successfully written to the mtbl_writer argument, and mtbl_res_failure otherwise. SEE ALSO
mtbl_iter(3) 05/29/2012 MTBL_SOURCE(3)
Man Page