pub struct LocalBackend(/* private fields */);Expand description
A Backend backed by a local BackendImpl (e.g. InMemory, SQLx).
Seam methods forward directly to the engine. The CRDT-state cache serves the
trusted CacheScope::Shared scope (the daemon’s own in-process path); the
scope-keyed variants used by the service handlers reach the engine directly
via Backend::local_engine.
Implementations§
Source§impl LocalBackend
impl LocalBackend
pub fn new(engine: Arc<dyn BackendImpl>) -> Self
Trait Implementations§
Source§impl Backend for LocalBackend
impl Backend for LocalBackend
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Entry>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Entry>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve an entry by ID.
Source§fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn store_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn store_snapshot_at<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
main_snapshot: &'life3 Snapshot,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_snapshot_at<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
main_snapshot: &'life3 Snapshot,
) -> Pin<Box<dyn Future<Output = Result<Snapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store snapshot reachable as of a specific main-tree snapshot.
Source§fn store_at<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
snapshot: &'life3 Snapshot,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_at<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
snapshot: &'life3 Snapshot,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Every entry of
store reachable from snapshot.Source§fn find_merge_base<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
entry_ids: &'life3 [ID],
) -> Pin<Box<dyn Future<Output = Result<ID>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn find_merge_base<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
entry_ids: &'life3 [ID],
) -> Pin<Box<dyn Future<Output = Result<ID>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Lowest common ancestor of
entry_ids within store.Source§fn get_path_from_to<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
from_id: &'life3 ID,
to_ids: &'life4 [ID],
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn get_path_from_to<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
from_id: &'life3 ID,
to_ids: &'life4 [ID],
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Every entry on the path from
from_id to each of to_ids within
store.Source§fn get_cached_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tree: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_cached_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tree: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Cached materialized CRDT state for
(entry_id, store) within tree, if
present. tree keys the daemon-side cache and gates the wire RPC; the
local engine ignores it (it serves the trusted shared scope).Source§fn cache_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tree: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
state: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn cache_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tree: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
state: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Cache materialized CRDT state for
(entry_id, store) within tree.Source§fn put<'life0, 'async_trait>(
&'life0 self,
entry: Entry,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
entry: Entry,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist an entry. Local stores it directly; remote submits it via
DatabaseOp::SubmitSignedEntry (stored Unverified, server-verified).Source§fn write_entry<'life0, 'async_trait>(
&'life0 self,
verification: VerificationStatus,
entry: Entry,
_source: WriteSource,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_entry<'life0, 'async_trait>(
&'life0 self,
verification: VerificationStatus,
entry: Entry,
_source: WriteSource,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Durably persist a signed entry, applying
verification locally or
submitting it over the wire. source informs local callback dispatch
(handled by Instance::put_entry) and is unused on remote.Source§fn get_instance_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InstanceMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instance_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InstanceMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Public instance metadata (device identity, system database IDs).
Source§fn set_instance_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
metadata: &'life1 InstanceMetadata,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_instance_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
metadata: &'life1 InstanceMetadata,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist public instance metadata.
Source§fn local_engine(&self) -> Option<Arc<dyn BackendImpl>>
fn local_engine(&self) -> Option<Arc<dyn BackendImpl>>
The concrete in-process storage engine, if this is a local backend. Read more
Source§fn remote_connection(&self) -> Option<RemoteConnection>
fn remote_connection(&self) -> Option<RemoteConnection>
The remote connection, if this is a remote backend. Returns
None for
local backends.Source§impl Clone for LocalBackend
impl Clone for LocalBackend
Source§fn clone(&self) -> LocalBackend
fn clone(&self) -> LocalBackend
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LocalBackend
impl !RefUnwindSafe for LocalBackend
impl Send for LocalBackend
impl Sync for LocalBackend
impl Unpin for LocalBackend
impl UnsafeUnpin for LocalBackend
impl !UnwindSafe for LocalBackend
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§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>
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