Struct mtbl::Fileset
[−]
[src]
pub struct Fileset { pub options: FilesetOptions, // some fields omitted }
An MTBL reader that watches a "setfile" containing a list of MTBL files to read from.
It acts like a Merger
that watches that setfile for
updates to a list of MTBL files. Note that paths in the setfile are
relative paths from the directory of the setfile.
Fileset
s are not thread-safe because reloading, which happens
automatically when reading, is not thread-safe--so only one thread can read
from a Fileset
.
To create a Fileset with non-default options, see FilesetOptions.
Examples
$ cp my-data.mtbl /tmp/my-data.mtbl $ echo "my-data.mtbl" >> /tmp/fs.mtbl-fileset ... let fileset = Fileset::open_from_path("/tmp/fs.mtbl-fileset", my_merge_fn);Run
Fields
options: FilesetOptions
The options used to open this Fileset
.
Methods
impl Fileset
[src]
fn open_from_path<T: AsRef<Path>>(setfile: T, merge_fn: Box<MergeFn>) -> Fileset
Open a Fileset
from a path. Note that you must include a MergeFn
to
combine colliding entries (entries that have the same key).
fn reload(&mut self)
Reload the list of MTBL files (ignored if less than the configured reload interval has passed).
Trait Implementations
impl Read for Fileset
[src]
fn raw_mtbl_source(&self) -> &*const mtbl_source
Get the internal mtbl_source pointer.
fn get<T>(&self, key: T) -> Option<Vec<u8>> where Self: Sized, T: AsRef<[u8]>
Get the value of a key, if it's present.
fn iter(&self) -> Iter
Get an iterator over all keys and values.
fn get_prefix<T>(&self, prefix: T) -> Iter where Self: Sized, T: AsRef<[u8]>
Get an iterator over all keys and values where the key starts with the given prefix.
fn get_range<T, U>(&self, key0: T, key1: U) -> Iter where Self: Sized, T: AsRef<[u8]>, U: AsRef<[u8]>
Get an iterator over all keys and values, where the keys are between key0 and key1 (inclusive). Read more
impl<'a> IntoIterator for &'a Fileset
[src]
type Item = (Vec<u8>, Vec<u8>)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a>
Creates an iterator from a value. Read more