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>
impl<S> AsyncProlly<S>
Sourcepub async fn prove_key(
&self,
tree: &Tree,
key: &[u8],
) -> Result<KeyProof, Error>
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.
Sourcepub async fn prove_keys<K: AsRef<[u8]>>(
&self,
tree: &Tree,
keys: &[K],
) -> Result<MultiKeyProof, Error>
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.
Sourcepub async fn prove_range(
&self,
tree: &Tree,
start: &[u8],
end: Option<&[u8]>,
) -> Result<RangeProof, Error>
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.
Sourcepub async fn prove_prefix(
&self,
tree: &Tree,
prefix: &[u8],
) -> Result<RangeProof, Error>
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.
Sourcepub async fn prove_range_page(
&self,
tree: &Tree,
cursor: &RangeCursor,
end: Option<&[u8]>,
limit: usize,
) -> Result<ProvedRangePage, Error>
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.
Sourcepub async fn prove_diff_page(
&self,
base: &Tree,
other: &Tree,
cursor: &RangeCursor,
end: Option<&[u8]>,
limit: usize,
) -> Result<ProvedDiffPage, Error>
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>
impl<S> AsyncProlly<S>
Sourcepub async fn read<'manager, 'tree>(
&'manager self,
tree: &'tree Tree,
) -> Result<AsyncReadSession<'manager, 'tree, S>, Error>
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.
Sourcepub async fn len(&self, tree: &Tree) -> Result<u64, Error>
pub async fn len(&self, tree: &Tree) -> Result<u64, Error>
Return the number of logical key/value entries in a tree.
Sourcepub async fn rank(&self, tree: &Tree, key: &[u8]) -> Result<u64, Error>
pub async fn rank(&self, tree: &Tree, key: &[u8]) -> Result<u64, Error>
Return the number of keys strictly less than key.
Sourcepub async fn select(
&self,
tree: &Tree,
ordinal: u64,
) -> Result<Option<KeyValue>, Error>
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.
pub async fn select_with<R>( &self, tree: &Tree, ordinal: u64, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Sourcepub async fn first_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>
pub async fn first_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>
Return the first key/value entry in key order.
pub async fn first_entry_with<R>( &self, tree: &Tree, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Sourcepub async fn last_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>
pub async fn last_entry(&self, tree: &Tree) -> Result<Option<KeyValue>, Error>
Return the last key/value entry in key order.
pub async fn last_entry_with<R>( &self, tree: &Tree, read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Sourcepub async fn lower_bound(
&self,
tree: &Tree,
key: &[u8],
) -> Result<Option<KeyValue>, Error>
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.
pub async fn lower_bound_with<R>( &self, tree: &Tree, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Sourcepub async fn upper_bound(
&self,
tree: &Tree,
key: &[u8],
) -> Result<Option<KeyValue>, Error>
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.
pub async fn upper_bound_with<R>( &self, tree: &Tree, key: &[u8], read: impl for<'entry> FnOnce(EntryRef<'entry>) -> R, ) -> Result<Option<R>, Error>
Sourcepub async fn get_with<R>(
&self,
tree: &Tree,
key: &[u8],
read: impl FnOnce(&[u8]) -> R,
) -> Result<Option<R>, Error>
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.
Sourcepub async fn get_value_ref_with<R>(
&self,
tree: &Tree,
key: &[u8],
read: impl for<'value> FnOnce(ValueRefView<'value>) -> R,
) -> Result<Option<R>, Error>
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.
Sourcepub async fn get_many_with<K, F>(
&self,
tree: &Tree,
keys: &[K],
visit: F,
) -> Result<(), Error>
pub async fn get_many_with<K, F>( &self, tree: &Tree, keys: &[K], visit: F, ) -> Result<(), Error>
Visit async point-read results exactly once per input position.
Sourcepub async fn scan_range(
&self,
tree: &Tree,
start: &[u8],
end: Option<&[u8]>,
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
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.
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>
Sourcepub async fn scan_prefix(
&self,
tree: &Tree,
prefix: &[u8],
visit: impl for<'entry> FnMut(EntryRef<'entry>),
) -> Result<u64, Error>
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.
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>
pub async fn scan_range_reverse( &self, tree: &Tree, start: &[u8], end: Option<&[u8]>, visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
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>
pub async fn scan_prefix_reverse( &self, tree: &Tree, prefix: &[u8], visit: impl for<'entry> FnMut(EntryRef<'entry>), ) -> Result<u64, Error>
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>where
S: AsyncStore + AsyncManifestStore + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
impl<S> AsyncProlly<S>where
S: AsyncStore + AsyncManifestStore + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
Sourcepub fn begin_transaction(&self) -> Result<AsyncProllyTransaction<'_, S>, Error>
pub fn begin_transaction(&self) -> Result<AsyncProllyTransaction<'_, S>, Error>
Start a strict optimistic async transaction.
Sourcepub fn begin_owned_transaction(
&self,
) -> Result<OwnedAsyncProllyTransaction<S>, Error>where
S: Clone,
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.
Sourcepub async fn transaction<T, F>(&self, f: F) -> Result<T, Error>
pub async fn transaction<T, F>(&self, f: F) -> Result<T, Error>
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>
impl<S: AsyncStore> AsyncProlly<S>
Sourcepub fn versioned_map(&self, id: impl AsRef<[u8]>) -> AsyncVersionedMap<'_, S>
pub fn versioned_map(&self, id: impl AsRef<[u8]>) -> AsyncVersionedMap<'_, S>
Open an async managed map.
Source§impl<S> AsyncProlly<S>
impl<S> AsyncProlly<S>
Sourcepub async fn scan_diff(
&self,
base: &Tree,
other: &Tree,
visit: impl for<'diff> FnMut(DiffRef<'diff>),
) -> Result<u64, Error>
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.
Sourcepub async fn scan_diff_until<B>(
&self,
base: &Tree,
other: &Tree,
visit: impl for<'diff> FnMut(DiffRef<'diff>) -> ControlFlow<B>,
) -> Result<ScanOutcome<B>, Error>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub async fn scan_conflicts(
&self,
base: &Tree,
left: &Tree,
right: &Tree,
visit: impl for<'conflict> FnMut(ConflictRef<'conflict>),
) -> Result<u64, Error>
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.
Sourcepub 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>
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.
Sourcepub async fn merge_with(
&self,
base: &Tree,
left: &Tree,
right: &Tree,
resolver: Option<&dyn BorrowedMergeResolver>,
) -> Result<Tree, Error>
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.