Skip to main content

AsyncProlly

Type Alias AsyncProlly 

Source
pub type AsyncProlly<S> = ProllyEngine<S>;
Expand description

Async Prolly tree manager.

AsyncProlly is part of the runtime-neutral core. It allows remote, browser, and object-store backends to serve tree operations without blocking on the synchronous Store trait.

The async surface covers reads, writes, range scans, diff, merge, CRDT merge, stats, cache pinning, large-value helpers, and route-planned batch mutation without requiring a Tokio dependency.

Aliased Type§

pub struct AsyncProlly<S> { /* private fields */ }

Implementations§

Source§

impl<S> AsyncProlly<S>
where S: AsyncStore, S::Error: Send + Sync,

Source

pub async fn prove_key( &self, tree: &Tree, key: &[u8], ) -> Result<KeyProof, Error>

Build a root-to-leaf proof for key.

The returned proof is self-contained and can be verified without access to this store. A valid proof may prove either key presence or absence.

Source

pub async fn prove_keys<K: AsRef<[u8]>>( &self, tree: &Tree, keys: &[K], ) -> Result<MultiKeyProof, Error>

Build one shared proof for multiple keys.

The returned proof de-duplicates shared path nodes while preserving the input key order. A valid proof may prove a mix of key presence and absence.

Source

pub async fn prove_range( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, ) -> Result<RangeProof, Error>

Build a complete proof for every entry in [start, end).

The returned proof contains all overlapping child subtrees needed to verify range completeness without access to this store.

Source

pub async fn prove_prefix( &self, tree: &Tree, prefix: &[u8], ) -> Result<RangeProof, Error>

Build a complete proof for every entry whose key starts with prefix.

Source

pub async fn prove_range_page( &self, tree: &Tree, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<ProvedRangePage, Error>

Read a bounded range page and build a proof for exactly that page window.

Source

pub async fn prove_diff_page( &self, base: &Tree, other: &Tree, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<ProvedDiffPage, Error>

Read a bounded diff page through the async store and build a proof for exactly that page.

Source§

impl<S> AsyncProlly<S>
where S: AsyncStore, S::Error: Send + Sync,

Source

pub async fn read<'manager, 'tree>( &'manager self, tree: &'tree Tree, ) -> Result<AsyncReadSession<'manager, 'tree, S>, Error>

Open a reusable borrowed async read session over an immutable tree.

Source

pub async fn len(&self, tree: &Tree) -> Result<u64, Error>

Return the number of logical key/value entries in a tree.

Source

pub async fn rank(&self, tree: &Tree, key: &[u8]) -> Result<u64, Error>

Return the number of keys strictly less than key.

Source

pub async fn select( &self, tree: &Tree, ordinal: u64, ) -> Result<Option<KeyValue>, Error>

Return the zero-based entry at ordinal, or None when out of range.

Source

pub async fn select_with<R>( &self, tree: &Tree, ordinal: u64, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>

Source

pub async fn first_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>

Return the first key/value entry in key order.

Source

pub async fn first_entry_with<R>( &self, tree: &Tree, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>

Source

pub async fn last_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>

Return the last key/value entry in key order.

Source

pub async fn last_entry_with<R>( &self, tree: &Tree, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>

Source

pub async fn lower_bound( &self, tree: &Tree, key: &[u8], ) -> Result<Option<KeyValue>, Error>

Return the first entry whose key is greater than or equal to key.

Source

pub async fn lower_bound_with<R>( &self, tree: &Tree, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>

Source

pub async fn upper_bound( &self, tree: &Tree, key: &[u8], ) -> Result<Option<KeyValue>, Error>

Return the first entry whose key is strictly greater than key.

Source

pub async fn upper_bound_with<R>( &self, tree: &Tree, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>

Source

pub async fn get_with<R>( &self, tree: &Tree, key: &[u8], read: impl FnOnce(&[u8]) -> R, ) -> Result<Option<R>, Error>

Read one async-store value without allocating an owned result.

Source

pub async fn get_value_ref_with<R>( &self, tree: &Tree, key: &[u8], read: impl for<'value> FnOnce(ValueRefView<'value>) -> R, ) -> Result<Option<R>, Error>

Inspect a stored large-value envelope without copying inline bytes.

Source

pub async fn get_many_with<K, F>( &self, tree: &Tree, keys: &[K], visit: F, ) -> Result<(), Error>
where K: AsRef<[u8]>, F: for<'value> FnMut(usize, &[u8], Option<&'value [u8]>),

Visit async point-read results exactly once per input position.

Source

pub async fn scan_range( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>

Visit an async half-open range without allocating entries.

Source

pub async fn scan_range_until<B>( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Source

pub async fn scan_prefix( &self, tree: &Tree, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>

Visit an async prefix without allocating entries.

Source

pub async fn scan_prefix_until<B>( &self, tree: &Tree, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Source

pub async fn scan_range_reverse( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>

Source

pub async fn scan_range_reverse_until<B>( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Source

pub async fn scan_prefix_reverse( &self, tree: &Tree, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>

Source

pub async fn scan_prefix_reverse_until<B>( &self, tree: &Tree, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Source§

impl<S> AsyncProlly<S>

Source

pub fn begin_transaction(&self) -> Result<AsyncProllyTransaction<'_, S>, Error>

Start a strict optimistic async transaction.

Source

pub fn begin_owned_transaction( &self, ) -> Result<OwnedAsyncProllyTransaction<S>, Error>
where S: Clone,

Start a strict optimistic async transaction that owns a cloned store handle and can therefore outlive a borrow of this manager.

Source

pub async fn transaction<T, F>(&self, f: F) -> Result<T, Error>
where F: for<'tx> FnOnce(&'tx mut AsyncProllyTransaction<'_, S>) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'tx>>,

Run a boxed future in a transaction, committing on success and rolling back automatically when the future returns an error or commit validation fails.

Source§

impl<S: AsyncStore> AsyncProlly<S>

Source

pub fn versioned_map(&self, id: impl AsRef<[u8]>) -> AsyncVersionedMap<'_, S>

Open an async managed map.

Source§

impl<S> AsyncProlly<S>
where S: AsyncStore, S::Error: Send + Sync,

Source

pub async fn scan_diff( &self, base: &Tree, other: &Tree, visit: impl for<'diff> FnMut(DiffRef<'diff>), ) -> Result<u64, Error>

Visit async structural differences without owned diff records.

Source

pub async fn scan_diff_until<B>( &self, base: &Tree, other: &Tree, visit: impl for<'diff> FnMut(DiffRef<'diff>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Visit async structural differences with early termination.

Source

pub async fn scan_range_diff( &self, base: &Tree, other: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'diff> FnMut(DiffRef<'diff>), ) -> Result<u64, Error>

Visit async differences in [start, end) without owned records.

Source

pub async fn scan_range_diff_until<B>( &self, base: &Tree, other: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'diff> FnMut(DiffRef<'diff>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Visit async range differences with early termination.

Source

pub async fn scan_conflicts( &self, base: &Tree, left: &Tree, right: &Tree, visit: impl for<'conflict> FnMut(ConflictRef<'conflict>), ) -> Result<u64, Error>

Visit async three-way conflicts through a callback-scoped view.

The current async iterator retains one owned conflict at a time so no borrowed node data crosses an await. The callback API is stable for a future retained-node-handle implementation and never accumulates all conflicts in memory.

Source

pub async fn scan_conflicts_until<B>( &self, base: &Tree, left: &Tree, right: &Tree, visit: impl for<'conflict> FnMut(ConflictRef<'conflict>) -> ControlFlow<B>, ) -> Result<ScanOutcome<B>, Error>

Visit async conflicts with callback-controlled early termination.

Source

pub async fn merge_with( &self, base: &Tree, left: &Tree, right: &Tree, resolver: Option<&dyn BorrowedMergeResolver>, ) -> Result<Tree, Error>

Async merge with a callback-scoped symbolic conflict resolver.

Source

pub async fn merge_range_with( &self, base: &Tree, left: &Tree, right: &Tree, start: &[u8], end: Option<&[u8]>, resolver: Option<&dyn BorrowedMergeResolver>, ) -> Result<Tree, Error>

Async range merge with a borrowed conflict resolver.

Source

pub async fn merge_prefix_with( &self, base: &Tree, left: &Tree, right: &Tree, prefix: &[u8], resolver: Option<&dyn BorrowedMergeResolver>, ) -> Result<Tree, Error>

Async prefix merge with a borrowed conflict resolver.