mtblr
: Tools to work with mtbl
files in R
mtbl
is a C library implementation of the Sorted String Table (SSTable) data
structure, based on the SSTable implementation in the open source Google
LevelDB library. An SSTable is a file
containing an immutable mapping of keys to values. Keys are stored in sorted
order, with an index at the end of the file allowing keys to be located quickly.
mtbl
is not a database library. It does not provide an updateable key-value
data store, but rather exposes primitives for creating, searching and merging
SSTable files. Unlike databases which use the SSTable data structure internally
as part of their data store, management of SSTable files -- creation, merging,
deletion, combining of search results from multiple SSTables -- is left to the
discretion of the mtbl
library user.
The following functions are implemented:
read_mtbl
: Open an mtbl filemtbl_length
: Retrieve the number of records in an open mtbl fileclose_mtbl
: Close an mtbl filemtbl_map
: Start an iterator over an mtbl filemtbl_next
: Iterate over mtbl file entriesmtbl_iter_close
: Close an iterator when finishedmtbl_get
: Retrieve a key/value pair from an mtbl by keymtbl_get_prefix
: Retrieve value(s) for a given key in an mtblmtbl_keys
: Return all the keys of an mtblmtbl_values
: Return all the values of an mtblmtbl_export_values
: Export mtbl values to a fileThe following data sets are included:
system.file("extdata/sample.mtbl", package="mtblr")
devtools::install_github("brudis-r7/mtblr")
options(width=120)
library(mtblr) # current verison packageVersion("mtblr") mtbl <- read_mtbl(system.file("extdata/sample.mtbl", package="mtblr")) mtbl_length(mtbl) head(mtbl_keys(mtbl)) head(mtbl_values(mtbl)) mtbl_next(mtbl_map(mtbl))[99][[1]]$value mtbl_next(mtbl_get(mtbl, "aa"))[[1]]$value mtbl_next(mtbl_get_prefix(mtbl, "a"))[[10]]$value
library(mtblr) library(testthat) date() test_dir("tests/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.