pub struct BTree<S: Store> { /* private fields */ }Implementations§
Source§impl<S: Store> BTree<S>
impl<S: Store> BTree<S>
pub fn new(store: Arc<S>, options: BTreeOptions) -> Self
pub async fn insert( &self, root: Option<&Cid>, key: &str, value: &str, ) -> Result<Cid, BTreeError>
pub async fn get( &self, root: Option<&Cid>, key: &str, ) -> Result<Option<String>, BTreeError>
pub async fn insert_link( &self, root: Option<&Cid>, key: &str, target_cid: &Cid, ) -> Result<Cid, BTreeError>
pub async fn insert_link_unchecked( &self, root: Option<&Cid>, key: &str, target_cid: &Cid, ) -> Result<Cid, BTreeError>
pub async fn get_link( &self, root: Option<&Cid>, key: &str, ) -> Result<Option<Cid>, BTreeError>
Sourcepub async fn get_links<I>(
&self,
root: Option<&Cid>,
keys: I,
) -> Result<BTreeMap<String, Cid>, BTreeError>where
I: IntoIterator<Item = String>,
pub async fn get_links<I>(
&self,
root: Option<&Cid>,
keys: I,
) -> Result<BTreeMap<String, Cid>, BTreeError>where
I: IntoIterator<Item = String>,
Resolve many link keys in one tree walk, skipping subtrees that cannot contain any requested key.
pub async fn entries( &self, root: Option<&Cid>, ) -> Result<Vec<(String, String)>, BTreeError>
pub async fn links_entries( &self, root: Option<&Cid>, ) -> Result<Vec<(String, Cid)>, BTreeError>
pub async fn links_entries_limited( &self, root: Option<&Cid>, limit: usize, ) -> Result<Vec<(String, Cid)>, BTreeError>
Sourcepub async fn count_links(&self, root: Option<&Cid>) -> Result<u64, BTreeError>
pub async fn count_links(&self, root: Option<&Cid>) -> Result<u64, BTreeError>
Count CID links by walking the tree.
Uses stored subtree sizes when available, but scans descendants when older roots do not carry complete counts.
Sourcepub async fn scan_links(&self, root: Option<&Cid>) -> Result<u64, BTreeError>
pub async fn scan_links(&self, root: Option<&Cid>) -> Result<u64, BTreeError>
Count CID links by explicitly walking the tree.
Sourcepub async fn count_stored_links(
&self,
root: Option<&Cid>,
) -> Result<Option<u64>, BTreeError>
pub async fn count_stored_links( &self, root: Option<&Cid>, ) -> Result<Option<u64>, BTreeError>
Read the stored CID-link count from the root node without scanning.
Returns Ok(None) when the root was built by older code that does not
store complete subtree sizes.
pub async fn range( &self, root: &Cid, start: Option<&str>, end: Option<&str>, ) -> Result<Vec<(String, String)>, BTreeError>
pub async fn prefix( &self, root: &Cid, prefix: &str, ) -> Result<Vec<(String, String)>, BTreeError>
pub async fn prefix_links( &self, root: &Cid, prefix: &str, ) -> Result<Vec<(String, Cid)>, BTreeError>
pub async fn prefix_links_limited( &self, root: &Cid, prefix: &str, limit: usize, ) -> Result<Vec<(String, Cid)>, BTreeError>
pub async fn delete( &self, root: &Cid, key: &str, ) -> Result<Option<Cid>, BTreeError>
pub async fn merge( &self, base: Option<&Cid>, other: Option<&Cid>, prefer_other: bool, ) -> Result<Option<Cid>, BTreeError>
pub async fn merge_links( &self, base: Option<&Cid>, other: Option<&Cid>, prefer_other: bool, ) -> Result<Option<Cid>, BTreeError>
pub async fn build<I>(&self, items: I) -> Result<Option<Cid>, BTreeError>
Sourcepub async fn update<I>(
&self,
root: Option<&Cid>,
changes: I,
) -> Result<Option<Cid>, BTreeError>
pub async fn update<I>( &self, root: Option<&Cid>, changes: I, ) -> Result<Option<Cid>, BTreeError>
Apply a sorted batch of string insertions and deletions, reusing
untouched subtrees. Repeated changes for one key use the last value;
None deletes a key.
pub async fn build_links<I>(&self, items: I) -> Result<Option<Cid>, BTreeError>
Sourcepub async fn update_links<I>(
&self,
root: Option<&Cid>,
changes: I,
) -> Result<Option<Cid>, BTreeError>
pub async fn update_links<I>( &self, root: Option<&Cid>, changes: I, ) -> Result<Option<Cid>, BTreeError>
Apply a sorted batch of link insertions and deletions, reusing untouched
subtrees. Repeated changes for one key use the last value; None deletes
a key.