Struct mtbl::Reader
[−]
[src]
pub struct Reader { pub options: ReaderOptions, // some fields omitted }
A reader for a single MTBL file.
Reader uses a memory-mapped file and is immutable and entirely thread-safe.
To create a Reader with options other than the default, use ReaderOptions.
Fields
options: ReaderOptions
The options used to open this MTBL file.
Methods
impl Reader
[src]
fn open_from_path<T: AsRef<Path>>(path: T) -> IOResult<Reader>
Open an MTBL reader from a file described by the given path.
fn open_from_file<T: 'static + AsRawFd>(file: &T) -> IOResult<Reader>
Open an MTBL reader from a file object.
fn index_block_offset(self: &Self) -> u64
Metadata: Byte offset in the MTBL file where the index begins.
fn data_block_size(self: &Self) -> u64
Metadata: Maximum size of an uncompressed data block, see mtbl_writer(3).
fn compression_algorithm(self: &Self) -> CompressionType
Metadata: One of the compression values allowed by mtbl_writer(3).
fn count_entries(self: &Self) -> u64
Metadata: Total number of key-value entries.
fn count_data_blocks(self: &Self) -> u64
Metadata: Total number of data blocks.
fn bytes_data_blocks(self: &Self) -> u64
Metadata: Total number of bytes consumed by data blocks.
fn bytes_index_block(self: &Self) -> u64
Metadata: Total number of bytes consumed by the index.
fn bytes_keys(self: &Self) -> u64
Metadata: Total number of bytes that all keys would occupy if stored end-to-end in a byte array with no delimiters.
fn bytes_values(self: &Self) -> u64
Metadata: Total number of bytes that all values in the file would occupy if stored end-to-end in a byte array with no delimiters.
Trait Implementations
impl Read for Reader
[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 Reader
[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
impl Drop for Reader
[src]
impl Send for Reader
[src]
Reader is thread-safe.
impl Sync for Reader
[src]
Reader is thread-safe.