pub struct Backend { /* private fields */ }Expand description
Backend wrapper for Instance operations
This struct wraps a BackendImpl and provides methods for backend operations.
Currently it’s a thin wrapper that delegates all calls to the underlying BackendImpl.
In the future, this will be converted to an enum to support both local and remote (RPC-based) backends, allowing for transparent local/remote dispatch.
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn new(backend_impl: Arc<dyn BackendImpl>) -> Self
pub fn new(backend_impl: Arc<dyn BackendImpl>) -> Self
Create a new Backend wrapping a BackendImpl
Sourcepub async fn get_verification_status(
&self,
id: &ID,
) -> Result<VerificationStatus>
pub async fn get_verification_status( &self, id: &ID, ) -> Result<VerificationStatus>
Get verification status of an entry
Sourcepub async fn put(
&self,
verification: VerificationStatus,
entry: Entry,
) -> Result<()>
pub async fn put( &self, verification: VerificationStatus, entry: Entry, ) -> Result<()>
Put an entry into the backend with verification status
Sourcepub async fn put_verified(&self, entry: Entry) -> Result<()>
pub async fn put_verified(&self, entry: Entry) -> Result<()>
Put a verified entry (convenience method)
Sourcepub async fn put_unverified(&self, entry: Entry) -> Result<()>
pub async fn put_unverified(&self, entry: Entry) -> Result<()>
Put an unverified entry (convenience method)
Sourcepub async fn update_verification_status(
&self,
id: &ID,
status: VerificationStatus,
) -> Result<()>
pub async fn update_verification_status( &self, id: &ID, status: VerificationStatus, ) -> Result<()>
Update verification status of an entry
Sourcepub async fn get_entries_by_verification_status(
&self,
status: VerificationStatus,
) -> Result<Vec<ID>>
pub async fn get_entries_by_verification_status( &self, status: VerificationStatus, ) -> Result<Vec<ID>>
Get entries by verification status
Sourcepub async fn get_store_tips(&self, tree: &ID, store: &str) -> Result<Vec<ID>>
pub async fn get_store_tips(&self, tree: &ID, store: &str) -> Result<Vec<ID>>
Get tips for a specific store within a tree
Sourcepub async fn get_store_tips_up_to_entries(
&self,
tree: &ID,
store: &str,
up_to: &[ID],
) -> Result<Vec<ID>>
pub async fn get_store_tips_up_to_entries( &self, tree: &ID, store: &str, up_to: &[ID], ) -> Result<Vec<ID>>
Get store tips up to specific entries
Sourcepub async fn find_merge_base(
&self,
tree: &ID,
store: &str,
entry_ids: &[ID],
) -> Result<ID>
pub async fn find_merge_base( &self, tree: &ID, store: &str, entry_ids: &[ID], ) -> Result<ID>
Find merge base (common dominator) of entries
Sourcepub async fn collect_root_to_target(
&self,
tree: &ID,
store: &str,
target: &ID,
) -> Result<Vec<ID>>
pub async fn collect_root_to_target( &self, tree: &ID, store: &str, target: &ID, ) -> Result<Vec<ID>>
Collect root to target path
Sourcepub async fn get_store(&self, tree: &ID, store: &str) -> Result<Vec<Entry>>
pub async fn get_store(&self, tree: &ID, store: &str) -> Result<Vec<Entry>>
Get all entries in a store
Sourcepub async fn get_tree_from_tips(
&self,
tree: &ID,
tips: &[ID],
) -> Result<Vec<Entry>>
pub async fn get_tree_from_tips( &self, tree: &ID, tips: &[ID], ) -> Result<Vec<Entry>>
Get tree entries from tips
Sourcepub async fn get_store_from_tips(
&self,
tree: &ID,
store: &str,
tips: &[ID],
) -> Result<Vec<Entry>>
pub async fn get_store_from_tips( &self, tree: &ID, store: &str, tips: &[ID], ) -> Result<Vec<Entry>>
Get store entries from tips
Sourcepub async fn get_cached_crdt_state(
&self,
entry_id: &ID,
store: &str,
) -> Result<Option<String>>
pub async fn get_cached_crdt_state( &self, entry_id: &ID, store: &str, ) -> Result<Option<String>>
Get cached CRDT state
Sourcepub async fn cache_crdt_state(
&self,
entry_id: &ID,
store: &str,
state: String,
) -> Result<()>
pub async fn cache_crdt_state( &self, entry_id: &ID, store: &str, state: String, ) -> Result<()>
Cache CRDT state
Sourcepub async fn clear_crdt_cache(&self) -> Result<()>
pub async fn clear_crdt_cache(&self) -> Result<()>
Clear CRDT cache
Sourcepub async fn get_sorted_store_parents(
&self,
tree_id: &ID,
entry_id: &ID,
store: &str,
) -> Result<Vec<ID>>
pub async fn get_sorted_store_parents( &self, tree_id: &ID, entry_id: &ID, store: &str, ) -> Result<Vec<ID>>
Get sorted store parents
Sourcepub async fn get_path_from_to(
&self,
tree_id: &ID,
store: &str,
from_id: &ID,
to_ids: &[ID],
) -> Result<Vec<ID>>
pub async fn get_path_from_to( &self, tree_id: &ID, store: &str, from_id: &ID, to_ids: &[ID], ) -> Result<Vec<ID>>
Get path from one entry to others
Sourcepub async fn get_instance_metadata(&self) -> Result<Option<InstanceMetadata>>
pub async fn get_instance_metadata(&self) -> Result<Option<InstanceMetadata>>
Get instance metadata
Sourcepub async fn set_instance_metadata(
&self,
metadata: &InstanceMetadata,
) -> Result<()>
pub async fn set_instance_metadata( &self, metadata: &InstanceMetadata, ) -> Result<()>
Set instance metadata
Sourcepub fn as_backend_impl(&self) -> &dyn BackendImpl
pub fn as_backend_impl(&self) -> &dyn BackendImpl
Get access to the underlying BackendImpl
This is provided for special operations like downcasting to concrete backend types (e.g., for save/load operations on InMemory). Use with caution.
Sourcepub fn as_arc_backend_impl(&self) -> &Arc<dyn BackendImpl>
pub fn as_arc_backend_impl(&self) -> &Arc<dyn BackendImpl>
Get access to the underlying Arc<dyn BackendImpl>
This is needed for validation functions and other code that expects the Arc wrapper. Returns a reference to the Arc.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Backend
impl !RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl !UnwindSafe for Backend
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> 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>
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