Type Alias b_tree::BTreeWriteGuard

source ·
pub type BTreeWriteGuard<S, C, FE> = BTree<S, C, DirWriteGuardOwned<FE>>;
Expand description

A write guard acquired on a BTreeLock

Aliased Type§

struct BTreeWriteGuard<S, C, FE> { /* private fields */ }

Implementations

source§

impl<S, C, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value>,

source

pub fn schema(&self) -> &S

Borrow the Schema of this BTree.

source§

impl<S, C, FE, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value>, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync, G: DirDeref<Entry = FE>, Node<Vec<Vec<S::Value>>>: FileLoad + Debug,

source

pub async fn contains(&self, key: &[S::Value]) -> Result<bool, Error>

Return true if this B+Tree contains the given key.

source

pub async fn count<BV>(&self, range: &Range<BV>) -> Result<u64, Error>where BV: Borrow<S::Value>,

Count how many keys lie within the given range of this B+Tree.

source

pub async fn first<BV>( &self, range: Range<BV> ) -> Result<Option<Key<S::Value>>, Error>where BV: Borrow<S::Value>,

Return the first key in this B+Tree within the given range, if any.

source

pub async fn last<BV>( &self, range: Range<BV> ) -> Result<Option<Key<S::Value>>, Error>where BV: Borrow<S::Value>,

Return the last key in this B+Tree with the given prefix, if any.

source

pub async fn is_empty<R: Borrow<Range<S::Value>>>( &self, range: R ) -> Result<bool, Error>

Return true if the given range of this B+Tree contains zero keys.

source§

impl<S, C, FE, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value> + Clone + Send + Sync + 'static, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static, G: DirDeref<Entry = FE> + Clone + Send + Sync + 'static, Node<Vec<Vec<S::Value>>>: FileLoad + Debug,

source

pub async fn keys<BV>( self, range: Range<BV>, reverse: bool ) -> Result<Keys<S::Value>, Error>where BV: Borrow<S::Value> + Clone + Send + Sync + 'static,

Construct a [Stream] of all the keys in the given range of this B+Tree.

source

pub async fn groups<BV>( self, range: Range<BV>, n: usize, reverse: bool ) -> Result<Keys<S::Value>, Error>where BV: Borrow<S::Value> + Clone + Send + Sync + 'static,

Construct a [Stream] of unique length-n prefixes within the given range.

source

pub async fn is_valid(self) -> Result<bool, Error>

source§

impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>

source

pub fn downgrade(self) -> BTreeReadGuard<S, C, FE>

Downgrade this BTreeWriteGuard into a BTreeReadGuard.

source§

impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where S: Schema + Send + Sync, C: Collate<Value = S::Value> + Send + Sync, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync, Node<Vec<Vec<S::Value>>>: FileLoad,

source

pub async fn delete<V>(&mut self, key: &[V]) -> Result<bool, Error>where V: Borrow<S::Value> + Send + Sync,

Delete the given key from this B+Tree.

source

pub async fn insert(&mut self, key: Vec<S::Value>) -> Result<bool, Error>

Insert the given key into this B+Tree. Return false if te given key is already present.

source

pub async fn truncate(&mut self) -> Result<(), Error>

Delete all the keys in this BTree.

source§

impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where S: Schema + Send + Sync, C: Collate<Value = S::Value> + Clone + Send + Sync + 'static, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static, Node<Vec<Vec<S::Value>>>: FileLoad,

source

pub async fn merge<G>(&mut self, other: BTree<S, C, G>) -> Result<(), Error>where G: DirDeref<Entry = FE> + Clone + Send + Sync + 'static,

Merge the keys from the other B+Tree range into this one.

The source B+Tree must have an identical schema and collation.

source

pub async fn delete_all<G>( &mut self, other: BTree<S, C, G> ) -> Result<(), Error>where G: DirDeref<Entry = FE> + Clone + Send + Sync + 'static,

Delete the keys in the other B+Tree from this one.

The source B+Tree must have an identical schema and collation.

Trait Implementations

source§

impl<S: Debug, C, G> Debug for BTree<S, C, G>

source§

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

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

impl<S, C, G> Clone for BTree<S, C, G>where C: Clone, G: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more