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 record_owner<Owner>(
&self,
package: &str,
workspace: &str,
) -> Option<Rc<Owner>>where
Owner: 'static,
pub fn record_owner<Owner>(
&self,
package: &str,
workspace: &str,
) -> Option<Rc<Owner>>where
Owner: 'static,
The live record store registered for package in workspace, if it
is an Owner.
pub fn register_record_owner<Owner>(
&self,
package: &str,
workspace: &str,
owner: &Rc<Owner>,
)where
Owner: 'static,
pub fn register_record_owner<Owner>(
&self,
package: &str,
workspace: &str,
owner: &Rc<Owner>,
)where
Owner: 'static,
Register owner as the record store of package in workspace
while it lives.
pub fn namespace(&self) -> &ProfileNamespace
pub fn records(&self, package: &str, workspace: &str) -> Vec<String>
pub fn records(&self, package: &str, workspace: &str) -> Vec<String>
The record component of every cached record of package in
workspace, sorted, as durable_store::DurableStore::records
lists a store’s.
pub fn get(&self, key: &StorageKey) -> Option<CachedBytes>
pub fn document_heads(
&self,
key: &StorageKey,
) -> Option<Result<Vec<ChangeHash>, ()>>
pub fn document_heads( &self, key: &StorageKey, ) -> Option<Result<Vec<ChangeHash>, ()>>
Decode the current cached document without asserting that it is durable.
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 claim(&self, key: &StorageKey, actor: Vec<u8>) -> Result<(), String>
pub fn claim(&self, key: &StorageKey, actor: Vec<u8>) -> Result<(), String>
Write key’s document under actor from now on, replacing the writer
its last save was made by.
A writer identity belongs to one live writer: two pages that each write a row saved by the other would write its sequences twice. The page that opens a row writes it under an actor it minted itself, and claims the row here, so a save, its acknowledgement and the next hydration all see that actor.
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 pending_writes(&self) -> Vec<PendingWrite>
pub fn watch_durability(
&self,
key: &StorageKey,
wake: Arc<dyn Fn() + Send + Sync>,
)
pub fn watch_durability( &self, key: &StorageKey, wake: Arc<dyn Fn() + Send + Sync>, )
Call wake each time what Self::flush says of key may have
changed without input: when the host acknowledges its current bytes,
or new bytes are durable at once (Self::durability_changed). How a
window showing “Saving…” hears it saved; the same wake
(durable_store::waiting::same_wake) given again is kept once.
pub fn durability_changed(&self, key: &StorageKey)
pub fn durability_changed(&self, key: &StorageKey)
Call everyone watching key’s durability.
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(&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> 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>, which can then be
downcast into Box<dyn 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>, which 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