Struct PortableStorage
pub struct PortableStorage { /* private fields */ }Expand description
Clone one cache throughout a browser host. Hydrate before opening its owners; only acknowledge writes after the external storage transaction commits.
Implementations§
§impl PortableStorage
impl PortableStorage
pub fn new(profile: &str, device: &str) -> Result<PortableStorage, String>
pub fn namespace(&self) -> &ProfileNamespace
pub fn get(&self, key: &StorageKey) -> Option<CachedBytes>
pub fn committed_document_heads(
&self,
key: &StorageKey,
) -> Option<Result<Vec<ChangeHash>, ()>>
pub fn committed_document_heads( &self, key: &StorageKey, ) -> Option<Result<Vec<ChangeHash>, ()>>
Heads of the exact acknowledged snapshot, never a newer queued value. Reuses canonical save metadata only when the committed bytes match it.
pub fn hydrate(
&self,
key: StorageKey,
bytes: Vec<u8>,
actor: Option<Vec<u8>>,
) -> Result<(), String>
pub fn hydrate( &self, key: StorageKey, bytes: Vec<u8>, actor: Option<Vec<u8>>, ) -> Result<(), String>
Initial durable bytes. Existing entries may never be replaced through hydration.
pub fn put( &self, key: StorageKey, bytes: Vec<u8>, actor: Option<Vec<u8>>, ) -> Result<(), String>
pub fn put_document(
&self,
key: StorageKey,
doc: &mut AutoCommit,
actor: Option<Vec<u8>>,
) -> Result<(), String>
pub fn put_document( &self, key: StorageKey, doc: &mut AutoCommit, actor: Option<Vec<u8>>, ) -> Result<(), String>
Serialize a canonical document and queue its bytes through the ordinary persistence path. Callers cannot supply detached or unverified heads.
pub fn has_pending_writes(&self) -> bool
pub fn has_pending_writes(&self) -> bool
Whether any value awaits host acknowledgement, without copying the
queued values (pending_writes copies every queued document).
pub fn pending_write_sizes(&self) -> Vec<(StorageKey, usize)>
pub fn pending_write_sizes(&self) -> Vec<(StorageKey, usize)>
Key and byte length of every queued value, without copying the bytes.
pub fn pending_writes(&self) -> Vec<PendingWrite>
pub fn acknowledge(
&self,
write: &PendingWrite,
result: Result<(), String>,
) -> Result<(), String>
pub fn acknowledge( &self, write: &PendingWrite, result: Result<(), String>, ) -> Result<(), String>
Acknowledging an old revision never makes newer bytes durable.
pub fn status_meta(&self, key: &StorageKey) -> Option<StorageMeta>
pub fn status_meta(&self, key: &StorageKey) -> Option<StorageMeta>
Self::status without copying the committed bytes: hot readers
(health reports, delivery checks) run several times per frame and the
admission journal grows with the session.
pub fn with_committed<R>(
&self,
key: &StorageKey,
read: impl FnOnce(u64, &CachedBytes) -> R,
) -> Option<R>
pub fn with_committed<R>( &self, key: &StorageKey, read: impl FnOnce(u64, &CachedBytes) -> R, ) -> Option<R>
Borrow the committed value (revision and bytes) without copying it. The closure must not re-enter this storage.
pub fn status(&self, key: &StorageKey) -> Option<StorageStatus>
pub fn flush(&self, key: &StorageKey) -> Result<(), String>
Trait Implementations§
§impl Clone for PortableStorage
impl Clone for PortableStorage
§fn clone(&self) -> PortableStorage
fn clone(&self) -> PortableStorage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PortableStorage
impl !RefUnwindSafe for PortableStorage
impl !Send for PortableStorage
impl !Sync for PortableStorage
impl Unpin for PortableStorage
impl UnsafeUnpin for PortableStorage
impl !UnwindSafe for PortableStorage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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