MobileCounterStore

Struct MobileCounterStore 

Source
pub struct MobileCounterStore { /* private fields */ }
Expand description

Durable adapter used by the iOS umsh_hal::CounterStore boundary.

Each commit writes and synchronizes a temporary record, atomically renames it over the previous boundary, then synchronizes the containing directory. An error at any stage is treated as ambiguous by the caller and therefore cannot release a prepared authenticated frame for transmission.

Implementations§

Source§

impl MobileCounterStore

Source

pub fn new(root_directory: String) -> Result<Arc<Self>, CounterStoreError>

Source

pub fn load_boundary(&self, context: Vec<u8>) -> Result<u32, CounterStoreError>

Source

pub fn commit_boundary( &self, context: Vec<u8>, boundary: u32, ) -> Result<(), CounterStoreError>

Trait Implementations§

Source§

impl CounterStore for MobileCounterStore

Source§

type Error = CounterStoreError

Source§

async fn load(&self, context: &[u8]) -> Result<u32, Self::Error>

Load the stored counter for context, or 0 if missing.
Source§

async fn store(&self, context: &[u8], value: u32) -> Result<(), Self::Error>

Persist a counter value for context.
Source§

async fn flush(&self) -> Result<(), Self::Error>

Flush any buffered state to durable storage.
Source§

impl<UT> LiftRef<UT> for MobileCounterStore

Source§

impl<UT> LowerError<UT> for MobileCounterStore

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for MobileCounterStore

Source§

type ReturnType = <Arc<MobileCounterStore> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for MobileCounterStore

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.