pub struct RuntimeDataStore<A> { /* private fields */ }Implementations§
Source§impl<A: DataStore> RuntimeDataStore<A>
impl<A: DataStore> RuntimeDataStore<A>
pub fn new(adapter: A, writer_id: impl Into<String>) -> Self
pub fn with_clock(adapter: A, clock: LamportClock) -> Self
Sourcepub fn read(
&self,
contract: &CapabilityContract,
key: &str,
) -> Result<Option<Value>, DataStoreError>
pub fn read( &self, contract: &CapabilityContract, key: &str, ) -> Result<Option<Value>, DataStoreError>
Reads and validates a state value by key.
§Errors
Returns DataStoreError when the key is invalid, the adapter cannot
read the key, or the stored value violates the contract state schema.
Sourcepub fn write(
&mut self,
contract: &CapabilityContract,
key: &str,
value: Value,
) -> Result<StateRecord, DataStoreError>
pub fn write( &mut self, contract: &CapabilityContract, key: &str, value: Value, ) -> Result<StateRecord, DataStoreError>
Validates, stamps, and writes a state value for a capability contract.
§Errors
Returns DataStoreError when the key is invalid, no state schema is
declared, schema validation fails, the Lamport clock overflows, or the
adapter cannot persist the stamped record.
Sourcepub fn delete(&mut self, key: &str) -> Result<(), DataStoreError>
pub fn delete(&mut self, key: &str) -> Result<(), DataStoreError>
Deletes a state value by key.
§Errors
Returns DataStoreError when the adapter cannot delete the key.
Sourcepub fn sync_on_reconnect(
&mut self,
remote: &mut dyn DataStore,
) -> Result<SyncReport, DataStoreError>
pub fn sync_on_reconnect( &mut self, remote: &mut dyn DataStore, ) -> Result<SyncReport, DataStoreError>
Triggers explicit sync after a reconnect event.
§Errors
Returns DataStoreError when either adapter cannot read, write, list,
or restore state during sync.
pub fn into_inner(self) -> A
Auto Trait Implementations§
impl<A> Freeze for RuntimeDataStore<A>where
A: Freeze,
impl<A> RefUnwindSafe for RuntimeDataStore<A>where
A: RefUnwindSafe,
impl<A> Send for RuntimeDataStore<A>where
A: Send,
impl<A> Sync for RuntimeDataStore<A>where
A: Sync,
impl<A> Unpin for RuntimeDataStore<A>where
A: Unpin,
impl<A> UnsafeUnpin for RuntimeDataStore<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for RuntimeDataStore<A>where
A: 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
Mutably borrows from an owned value. Read more
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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 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> ⓘ
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