pub struct AsyncVersionedMap<'a, S: AsyncStore> { /* private fields */ }Expand description
Async counterpart to VersionedMap for remote and browser stores.
Implementations§
Source§impl<'a, S: AsyncStore> AsyncVersionedMap<'a, S>
impl<'a, S: AsyncStore> AsyncVersionedMap<'a, S>
Sourcepub fn new(prolly: &'a AsyncProlly<S>, id: impl AsRef<[u8]>) -> Self
pub fn new(prolly: &'a AsyncProlly<S>, id: impl AsRef<[u8]>) -> Self
Create an async managed-map handle.
Sourcepub fn versions_prefix(&self) -> &[u8] ⓘ
pub fn versions_prefix(&self) -> &[u8] ⓘ
Prefix containing this map’s immutable version roots.
Sourcepub fn version_root_name(&self, id: &MapVersionId) -> Vec<u8> ⓘ
pub fn version_root_name(&self, id: &MapVersionId) -> Vec<u8> ⓘ
Full durable named-root key for one content-derived version.
Source§impl<'a, S> AsyncVersionedMap<'a, S>where
S: AsyncStore + AsyncManifestStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
impl<'a, S> AsyncVersionedMap<'a, S>where
S: AsyncStore + AsyncManifestStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
Sourcepub async fn version(
&self,
id: &MapVersionId,
) -> Result<Option<MapVersion>, Error>
pub async fn version( &self, id: &MapVersionId, ) -> Result<Option<MapVersion>, Error>
Load a cataloged immutable version.
Sourcepub async fn snapshot(&self) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>
pub async fn snapshot(&self) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>
Pin current head for repeatable async reads.
Sourcepub async fn snapshot_at(
&self,
id: &MapVersionId,
) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>
pub async fn snapshot_at( &self, id: &MapVersionId, ) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>
Pin one cataloged historical version for repeatable async reads.
Sourcepub async fn subscribe(
&self,
) -> Result<AsyncMapChangeSubscription<'a, S>, Error>
pub async fn subscribe( &self, ) -> Result<AsyncMapChangeSubscription<'a, S>, Error>
Start observing future async head transitions from the current head.
Sourcepub fn subscribe_from(
&self,
last_seen: Option<MapVersionId>,
) -> AsyncMapChangeSubscription<'a, S>
pub fn subscribe_from( &self, last_seen: Option<MapVersionId>, ) -> AsyncMapChangeSubscription<'a, S>
Resume async observation from a previously persisted version.
Source§impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncManifestStoreScan,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncManifestStoreScan,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
Sourcepub async fn versions_page(
&self,
cursor: Option<&MapVersionCursor>,
limit: usize,
) -> Result<MapVersionPage, Error>
pub async fn versions_page( &self, cursor: Option<&MapVersionCursor>, limit: usize, ) -> Result<MapVersionPage, Error>
List a bounded page of cataloged versions in stable version-ID order.
Unlike Self::versions, this method never needs to enumerate other
maps’ roots. Cloud backends can implement it as one bounded range query.
Source§impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
Sourcepub async fn diff(
&self,
base: &MapVersionId,
target: &MapVersionId,
) -> Result<Vec<Diff>, Error>
pub async fn diff( &self, base: &MapVersionId, target: &MapVersionId, ) -> Result<Vec<Diff>, Error>
Diff two cataloged immutable versions.
Sourcepub async fn diff_page(
&self,
base: &MapVersionId,
target: &MapVersionId,
cursor: &RangeCursor,
end: Option<&[u8]>,
limit: usize,
) -> Result<DiffPage, Error>
pub async fn diff_page( &self, base: &MapVersionId, target: &MapVersionId, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<DiffPage, Error>
Read one resumable key-cursor page between cataloged versions.
Sourcepub async fn structural_diff_page(
&self,
base: &MapVersionId,
target: &MapVersionId,
cursor: Option<&StructuralDiffCursor>,
limit: usize,
) -> Result<StructuralDiffPage, Error>
pub async fn structural_diff_page( &self, base: &MapVersionId, target: &MapVersionId, cursor: Option<&StructuralDiffCursor>, limit: usize, ) -> Result<StructuralDiffPage, Error>
Read one resumable structural page between cataloged versions.
Sourcepub async fn changes_since(
&self,
base: &MapVersionId,
) -> Result<Vec<Diff>, Error>
pub async fn changes_since( &self, base: &MapVersionId, ) -> Result<Vec<Diff>, Error>
Diff one cataloged version against current head.
Sourcepub async fn apply(&self, mutations: Vec<Mutation>) -> Result<MapVersion, Error>
pub async fn apply(&self, mutations: Vec<Mutation>) -> Result<MapVersion, Error>
Atomically apply a batch and retry optimistic head conflicts.
Sourcepub async fn apply_at_millis(
&self,
mutations: Vec<Mutation>,
timestamp_millis: u64,
) -> Result<MapVersion, Error>
pub async fn apply_at_millis( &self, mutations: Vec<Mutation>, timestamp_millis: u64, ) -> Result<MapVersion, Error>
Atomically apply a batch with an explicit catalog timestamp.
Sourcepub async fn apply_if(
&self,
expected: Option<&MapVersionId>,
mutations: Vec<Mutation>,
) -> Result<VersionedMapUpdate, Error>
pub async fn apply_if( &self, expected: Option<&MapVersionId>, mutations: Vec<Mutation>, ) -> Result<VersionedMapUpdate, Error>
Apply a batch only when expected is still the current version.
Sourcepub async fn apply_if_at_millis(
&self,
expected: Option<&MapVersionId>,
mutations: Vec<Mutation>,
timestamp_millis: u64,
) -> Result<VersionedMapUpdate, Error>
pub async fn apply_if_at_millis( &self, expected: Option<&MapVersionId>, mutations: Vec<Mutation>, timestamp_millis: u64, ) -> Result<VersionedMapUpdate, Error>
Apply a batch only when expected is still the current version, with
an explicit catalog timestamp.
Sourcepub async fn restore_if(
&self,
expected: Option<&MapVersionId>,
target: &MapVersionId,
) -> Result<VersionedMapUpdate, Error>
pub async fn restore_if( &self, expected: Option<&MapVersionId>, target: &MapVersionId, ) -> Result<VersionedMapUpdate, Error>
Move head to an existing version when expected is still current.
The target must remain in the immutable version catalog. A concurrent
head movement is reported as VersionedMapUpdate::Conflict.
Sourcepub async fn put(
&self,
key: impl Into<Vec<u8>>,
value: impl Into<Vec<u8>>,
) -> Result<MapVersion, Error>
pub async fn put( &self, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, ) -> Result<MapVersion, Error>
Put one key asynchronously.
Sourcepub async fn put_large_value<B>(
&self,
blob_store: &B,
key: impl Into<Vec<u8>>,
value: impl Into<Vec<u8>>,
config: LargeValueConfig,
) -> Result<MapVersion, Error>
pub async fn put_large_value<B>( &self, blob_store: &B, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, config: LargeValueConfig, ) -> Result<MapVersion, Error>
Put one value, offloading large bytes, and retry head conflicts.
Sourcepub async fn delete(&self, key: impl Into<Vec<u8>>) -> Result<MapVersion, Error>
pub async fn delete(&self, key: impl Into<Vec<u8>>) -> Result<MapVersion, Error>
Delete one key asynchronously.
Sourcepub async fn edit(
&self,
edit: impl FnOnce(&mut VersionedMapEditor),
) -> Result<MapVersion, Error>
pub async fn edit( &self, edit: impl FnOnce(&mut VersionedMapEditor), ) -> Result<MapVersion, Error>
Collect and apply several asynchronous managed-map edits.
Source§impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncManifestStoreScan + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
impl<S> AsyncVersionedMap<'_, S>where
S: AsyncStore + AsyncManifestStore + AsyncManifestStoreScan + AsyncTransactionalStore,
<S as AsyncStore>::Error: Send + Sync,
<S as AsyncManifestStore>::Error: Send + Sync,
Sourcepub async fn prune_versions(
&self,
keep_latest: usize,
) -> Result<VersionPruneResult, Error>
pub async fn prune_versions( &self, keep_latest: usize, ) -> Result<VersionPruneResult, Error>
Keep the newest keep_latest versions plus the current head.
Sourcepub async fn keep_last(&self, count: usize) -> Result<VersionPruneResult, Error>
pub async fn keep_last(&self, count: usize) -> Result<VersionPruneResult, Error>
Retain the newest count versions plus the current head.
Sourcepub async fn keep_for(
&self,
max_age: Duration,
) -> Result<VersionPruneResult, Error>
pub async fn keep_for( &self, max_age: Duration, ) -> Result<VersionPruneResult, Error>
Retain versions newer than max_age plus the current head.
Sourcepub async fn keep_for_at(
&self,
now_millis: u64,
max_age: Duration,
) -> Result<VersionPruneResult, Error>
pub async fn keep_for_at( &self, now_millis: u64, max_age: Duration, ) -> Result<VersionPruneResult, Error>
Deterministic form of AsyncVersionedMap::keep_for with an explicit clock.
Sourcepub async fn keep_versions<I, V>(
&self,
ids: I,
) -> Result<VersionPruneResult, Error>
pub async fn keep_versions<I, V>( &self, ids: I, ) -> Result<VersionPruneResult, Error>
Retain an explicit version set plus the current head.
Missing requested IDs are rejected so a typo cannot silently discard more history than intended.
Auto Trait Implementations§
impl<'a, S> Freeze for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: Freeze,
impl<'a, S> RefUnwindSafe for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: RefUnwindSafe,
impl<'a, S> Send for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: Send,
impl<'a, S> Sync for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: Sync,
impl<'a, S> Unpin for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: Unpin,
impl<'a, S> UnsafeUnpin for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: UnsafeUnpin,
impl<'a, S> UnwindSafe for AsyncVersionedMap<'a, S>where
&'a ProllyEngine<S>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more