Struct Fileset

Source
pub struct Fileset {
    pub options: FilesetOptions,
    /* private fields */
}
Expand description

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.

Filesets 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);

Fields§

§options: FilesetOptions

The options used to open this Fileset.

Implementations§

Source§

impl Fileset

Source

pub 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).

Source

pub fn reload(&mut self)

Reload the list of MTBL files (ignored if less than the configured reload interval has passed).

Trait Implementations§

Source§

impl Drop for Fileset

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> IntoIterator for &'a Fileset

Source§

type Item = (Vec<u8>, Vec<u8>)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a>

Creates an iterator from a value. Read more
Source§

impl Read for Fileset

Source§

fn raw_mtbl_source(&self) -> &*const mtbl_source

Get the internal mtbl_source pointer.
Source§

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.
Source§

fn iter(&self) -> Iter<'_>

Get an iterator over all keys and values.
Source§

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.
Source§

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).

Auto Trait Implementations§

§

impl Freeze for Fileset

§

impl !RefUnwindSafe for Fileset

§

impl !Send for Fileset

§

impl !Sync for Fileset

§

impl Unpin for Fileset

§

impl !UnwindSafe for Fileset

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.