pub struct Tree { /* private fields */ }
Expand description

A patricia tree-based MKVS implementation.

Implementations§

source§

impl Tree

source

pub fn commit(&mut self, namespace: Namespace, version: u64) -> Result<Hash>

Commit tree updates to the underlying database and return the write log and new merkle root.

source§

impl Tree

source

pub fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<Vec<u8>>>

Insert a key/value pair into the tree.

source§

impl Tree

source

pub fn iter(&self) -> TreeIterator<'_>

Return an iterator over the tree.

source§

impl Tree

source

pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>

Get an existing key.

source

pub fn get_proof(&self, key: &[u8]) -> Result<Option<Proof>>

source

pub fn cache_contains_key(&self, key: &[u8]) -> bool

Check if the key exists in the local cache.

source§

impl Tree

source

pub fn prefetch_prefixes(&self, prefixes: &[Prefix], limit: u16) -> Result<()>

Populate the in-memory tree with nodes for keys starting with given prefixes.

source§

impl Tree

source

pub fn remove(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>

Remove entry with given key, returning the value at the key if the key was previously in the database.

source§

impl Tree

source

pub fn new(read_syncer: Box<dyn ReadSync>, opts: &Options) -> Tree

Construct a new tree instance using the given read syncer and options struct.

source

pub fn builder() -> Builder

Return an builder struct to chain configuration calls on.

Trait Implementations§

source§

impl Debug for Tree

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl FallibleMKVS for Tree

source§

fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>

Fetch entry with given key.
source§

fn get_proof(&self, key: &[u8]) -> Result<Option<Proof>>

Fetch proof for entry with given key.
source§

fn cache_contains_key(&self, key: &[u8]) -> bool

Check if the local MKVS cache contains the given key. Read more
source§

fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<Vec<u8>>>

Update entry with given key. Read more
source§

fn remove(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>

Remove entry with given key, returning the value at the key if the key was previously in the database.
source§

fn prefetch_prefixes(&self, prefixes: &[Prefix], limit: u16) -> Result<()>

Populate the in-memory tree with nodes for keys starting with given prefixes.
source§

fn iter(&self) -> Box<dyn Iterator + '_>

Returns an iterator over the tree.
source§

fn commit(&mut self, namespace: Namespace, version: u64) -> Result<Hash>

Commit all database changes to the underlying store.
source§

impl Send for Tree

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tree

§

impl !Sync for Tree

§

impl Unpin for Tree

§

impl !UnwindSafe for Tree

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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> ImmutableMKVS for T
where T: FallibleMKVS,

source§

fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>

Fetch entry with given key.
source§

fn get_proof(&self, key: &[u8]) -> Result<Option<Proof>, Error>

Fetch proof for entry with given key.
source§

fn prefetch_prefixes( &self, prefixes: &[Prefix], limit: u16 ) -> Result<(), Error>

Populate the in-memory tree with nodes for keys starting with given prefixes.
source§

fn iter(&self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + '_>

Returns an iterator over the tree.
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V