Tree

Struct Tree 

Source
pub struct Tree<E> { /* private fields */ }
Expand description

A flash-sympathetic persistent lock-free B+ tree.

Implementations§

Source§

impl<E> Tree<E>
where E: Encryption,

Source

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

Source

pub fn insert<K, V>(&self, key: K, value: V) -> Result<Option<IVec>>
where K: AsRef<[u8]>, V: Into<IVec>,

Source

pub fn remove<K: AsRef<[u8]>>(&self, key: K) -> Result<Option<IVec>>

Source

pub fn apply_batch(&self, batch: Batch) -> Result<()>

Source

pub fn transaction<F, A, Error>(&self, f: F) -> TransactionResult<A, Error>

Source

pub fn watch_prefix<P: AsRef<[u8]>>(&self, prefix: P) -> Result<Subscriber<E>>

Source

pub fn compare_and_swap<K, OV, NV>( &self, key: K, old: Option<OV>, new: Option<NV>, ) -> Result<Result<(), CompareAndSwapError>>
where K: AsRef<[u8]>, OV: AsRef<[u8]>, NV: Into<IVec>,

Source

pub fn update_and_fetch<K, V, F>(&self, key: K, f: F) -> Result<Option<IVec>>
where K: AsRef<[u8]>, F: FnMut(Option<IVec>) -> Option<V>, V: Into<IVec>,

Source

pub fn fetch_and_update<K, V, F>(&self, key: K, f: F) -> Result<Option<IVec>>
where K: AsRef<[u8]>, F: FnMut(Option<IVec>) -> Option<V>, V: Into<IVec>,

Source

pub fn flush(&self) -> Result<usize>

Source

pub async fn flush_async(&self) -> Result<usize>

Source

pub fn contains_key<K: AsRef<[u8]>>(&self, key: K) -> Result<bool>

Source

pub fn get_lt<K>(&self, key: K) -> Result<Option<(IVec, IVec)>>
where K: AsRef<[u8]>,

Source

pub fn get_gt<K>(&self, key: K) -> Result<Option<(IVec, IVec)>>
where K: AsRef<[u8]>,

Source

pub fn first(&self) -> Result<Option<(IVec, IVec)>>

Source

pub fn last(&self) -> Result<Option<(IVec, IVec)>>

Source

pub fn pop_min(&self) -> Result<Option<(IVec, IVec)>>

Source

pub fn pop_max(&self) -> Result<Option<(IVec, IVec)>>

Source

pub fn iter(&self) -> Iter<E>

Source

pub fn range<K, R>(&self, range: R) -> Result<Iter<E>>
where K: AsRef<[u8]>, R: RangeBounds<K>,

Source

pub fn scan_prefix<P>(&self, prefix: P) -> Result<Iter<E>>
where P: AsRef<[u8]>,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&self) -> Result<()>

Source

pub fn name(&self) -> Result<IVec>

Source

pub fn checksum(&self) -> Result<u32>

Source§

impl<E> Tree<E>
where E: Encryption + 'static,

Source

pub fn merge<K, V>(&self, key: K, value: V) -> Result<Option<IVec>>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn set_merge_operator(&self, merge_operator: impl MergeOperator + 'static)

Trait Implementations§

Source§

impl<E: Clone> Clone for Tree<E>

Source§

fn clone(&self) -> Tree<E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for Tree<E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E> Freeze for Tree<E>

§

impl<E> !RefUnwindSafe for Tree<E>

§

impl<E> Send for Tree<E>
where E: Sync + Send,

§

impl<E> Sync for Tree<E>
where E: Sync + Send,

§

impl<E> Unpin for Tree<E>

§

impl<E> !UnwindSafe for Tree<E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V