Skip to main content

AsyncVersionedMap

Struct AsyncVersionedMap 

Source
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>

Source

pub fn new(prolly: &'a AsyncProlly<S>, id: impl AsRef<[u8]>) -> Self

Create an async managed-map handle.

Source

pub fn id(&self) -> &[u8]

Application map identifier.

Source§

impl<'a, S> AsyncVersionedMap<'a, S>

Source

pub async fn head(&self) -> Result<Option<MapVersion>, Error>

Load current async head.

Source

pub async fn version( &self, id: &MapVersionId, ) -> Result<Option<MapVersion>, Error>

Load a cataloged immutable version.

Source

pub async fn snapshot(&self) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>

Pin current head for repeatable async reads.

Source

pub async fn snapshot_at( &self, id: &MapVersionId, ) -> Result<Option<AsyncMapSnapshot<'a, S>>, Error>

Pin one cataloged historical version for repeatable async reads.

Source

pub async fn subscribe( &self, ) -> Result<AsyncMapChangeSubscription<'a, S>, Error>

Start observing future async head transitions from the current head.

Source

pub fn subscribe_from( &self, last_seen: Option<MapVersionId>, ) -> AsyncMapChangeSubscription<'a, S>

Resume async observation from a previously persisted version.

Source

pub async fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>

Read one key from current head.

Source§

impl<S> AsyncVersionedMap<'_, S>

Source

pub async fn apply(&self, mutations: Vec<Mutation>) -> Result<MapVersion, Error>

Atomically apply a batch and retry optimistic head conflicts.

Source

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.

Source

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.

Source

pub async fn put( &self, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, ) -> Result<MapVersion, Error>

Put one key asynchronously.

Source

pub async fn delete(&self, key: impl Into<Vec<u8>>) -> Result<MapVersion, Error>

Delete one key asynchronously.

Source

pub async fn edit( &self, edit: impl FnOnce(&mut VersionedMapEditor), ) -> Result<MapVersion, Error>

Collect and apply several asynchronous managed-map edits.

Auto Trait Implementations§

§

impl<'a, S> Freeze for AsyncVersionedMap<'a, S>

§

impl<'a, S> RefUnwindSafe for AsyncVersionedMap<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for AsyncVersionedMap<'a, S>
where S: Sync,

§

impl<'a, S> Sync for AsyncVersionedMap<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for AsyncVersionedMap<'a, S>

§

impl<'a, S> UnsafeUnpin for AsyncVersionedMap<'a, S>

§

impl<'a, S> UnwindSafe for AsyncVersionedMap<'a, S>
where S: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.