Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mtbl_source(3) [debian 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)

Check Out this Related Man Page

CDBR(3) 						   BSD Library Functions Manual 						   CDBR(3)

NAME
cdbr cdbr_open, cdbr_entries, cdbr_get, cdbr_find, cdbr_close, cdbr_write -- constant database access methods SYNOPSIS
struct cdbr * cdbr_open(const char *path, int flags); uint32_t cdbr_entries(struct cdbr *cdbr); int cdbr_get(struct cdbr *cdbr, uint32_t index, const void **data, size_t *datalen); int cdbr_find(struct cdbr *cdbr, const void *key, size_t keylen, const void **data, size_t *datalen); void cdbr_close(struct cdbr *cdbr); DESCRIPTION
The cdbr library provides a space efficient (key,value) database based on perfect hashing. A cdb database is opened for reading by calling cdbr_open(). The only supported value for flags is CDBR_DEFAULT. The function returns a handle to pass to the other functions. The database is closed by invoking cdbr_close(). All resources associated with the handle are freed and the memory returned by cdbr_get() and cdbr_find() is invalidated. The number of records in the database can be obtained by calling cdbr_entries(). Records can be obtained by record number using cdbr_get() or by key using cdbr_find(). Both functions return 0 on success and update data and datalen accordingly. The location *data remains valid until cdbr_close() is called. It is the responsibility of the caller of cdbr_find() to ensure that the key matches the returned data. The function returns the only possible match, but the database doesn't store the keys to minimize overhead. SEE ALSO
nbperf(1), cdbw(3), db(3), cdb(5) HISTORY
Support for the cdb format first appeared in NetBSD 6.0. AUTHORS
The cdbr and cdbw functions have been written by Joerg Sonnenberger <joerg@NetBSD.org>. BSD
March 3, 2010 BSD
Man Page