pub trait BackendImpl:
Send
+ Sync
+ Any {
Show 25 methods
// Required methods
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_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<VerificationStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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;
fn update_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
verification_status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_entries_by_verification_status<'life0, 'async_trait>(
&'life0 self,
status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
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_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 all_roots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
fn collect_root_to_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
target_entry: &'life3 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;
fn as_any(&self) -> &dyn Any;
fn get_tree<'life0, 'life1, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_tree_from_tips<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
tips: &'life2 [ID],
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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;
fn get_cached_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 CacheScope,
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 cache_crdt_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: CacheScope,
entry_id: &'life1 ID,
store: &'life2 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;
fn clear_crdt_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_sorted_store_parents<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree_id: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
) -> 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;
fn get_path_from_to<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tree_id: &'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_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 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 get_instance_secrets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InstanceSecrets>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_instance_secrets<'life0, 'life1, 'async_trait>(
&'life0 self,
secrets: &'life1 InstanceSecrets,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
BackendImpl trait abstracting the underlying storage mechanism for Eidetica entries.
This trait defines the essential operations required for storing, retrieving, and querying entries and their relationships within databases and stores. Implementations of this trait handle the specifics of how data is persisted (e.g., in memory, on disk, in a remote database).
Much of the performance-critical logic, particularly concerning tree traversal
and tip calculation, resides within BackendImpl implementations, as the optimal
approach often depends heavily on the underlying storage characteristics.
All backend implementations must be Send and Sync to allow sharing across threads,
and implement Any to allow for downcasting if needed.
Instance wraps BackendImpl in a Backend struct that provides additional coordination
and will enable future development.
§Verification Status
The backend stores a verification status for each entry, indicating whether the entry has been authenticated by the higher-level authentication system. The backend itself does not perform verification - it only stores the status set by the calling code (typically Database/Transaction implementations).
Required Methods§
Sourcefn 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,
Sourcefn get_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<VerificationStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<VerificationStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn 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,
Stores an entry.
A new entry is stored as VerificationStatus::Unverified. The
storage API deliberately does not accept a verification status: no
caller may assert that an entry is verified. Verified is reached
only by this node’s local validation pass, which stores via put and
then promotes the entry with
update_verification_status.
If an entry with the same ID already exists, put is a no-op:
entries are content-addressed and immutable, so the content is
identical, and the existing verification status is left untouched.
A re-put therefore never demotes a prior local promotion — routine
on overlapping/bootstrap sync, where an already-Verified entry is
commonly re-received. Status transitions go only through
update_verification_status.
§Arguments
entry- TheEntryto store.
§Returns
A Result indicating success or an error during storage.
Sourcefn update_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
verification_status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_verification_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ID,
verification_status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Updates the verification status of an existing entry.
This is the only way an entry becomes Verified, and it is
reserved for this node’s local validation pass (and a future
re-verification pass). It is local-only — never reachable over the
service wire — so a peer can never assert verification for us.
§Arguments
id- The ID of the entry to updateverification_status- The new verification status
§Returns
A Result indicating success or Error::NotFound if the entry doesn’t exist.
Sourcefn get_entries_by_verification_status<'life0, 'async_trait>(
&'life0 self,
status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_entries_by_verification_status<'life0, 'async_trait>(
&'life0 self,
status: VerificationStatus,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn 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,
Sourcefn 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,
Returns the snapshot of a specific store within a given tree.
Store tips are entries within the store that have no children within
that same store. An entry is a child of another within a store if it
lists the other entry in its store_parents list for that store name.
§Arguments
tree- The root ID of the parent tree.store- The name of the store for which to find tips.
Sourcefn 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,
Returns the store snapshot as of a specific main-tree snapshot.
Finds all store entries reachable from the boundary’s tips, then filters to the ones that are tips within the store.
§Arguments
tree- The root ID of the parent tree.store- The name of the store for which to find tips.main_snapshot- Snapshot of the parent tree defining the boundary.
Sourcefn all_roots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn all_roots<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ID>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the IDs of all top-level root entries stored in the backend.
Top-level roots are entries that are themselves roots of a tree
(i.e., entry.is_root() is true) and are not part of a larger tree structure
tracked by the backend (conceptually, their tree.root field is empty or refers to themselves,
though the implementation detail might vary). These represent the starting points
of distinct trees managed by the database.
§Returns
A Result containing a vector of top-level root entry IDs or an error.
Sourcefn 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,
Finds the merge base (common dominator) of the given entry IDs within a store.
The merge base is the lowest ancestor that ALL paths from ALL entries must pass through. This is different from the traditional LCA - if there are parallel paths that bypass a common ancestor, that ancestor is not the merge base. This is used to determine optimal computation boundaries for CRDT state calculation.
§Arguments
tree- The root ID of the treestore- The name of the store contextentry_ids- The entry IDs to find the merge base for
§Returns
A Result containing the merge base entry ID, or an error if no common ancestor exists
Sourcefn collect_root_to_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
target_entry: &'life3 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,
fn collect_root_to_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
target_entry: &'life3 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,
Collects all entries from the tree root down to the target entry within a store.
This method performs a complete traversal from the tree root to the target entry, collecting all entries that are ancestors of the target within the specified store. The result includes the tree root and the target entry itself.
§Arguments
tree- The root ID of the treestore- The name of the store contexttarget_entry- The target entry to collect ancestors for
§Returns
A Result containing a vector of entry IDs from root to target, sorted by height
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Returns a reference to the backend instance as a dynamic Any type.
This allows for downcasting to a concrete backend implementation if necessary, enabling access to implementation-specific methods. Use with caution.
Sourcefn get_tree<'life0, 'life1, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tree<'life0, 'life1, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves all entries belonging to a specific tree, sorted topologically.
The entries are sorted primarily by their height (distance from the root) and secondarily by their ID to ensure a consistent, deterministic order suitable for reconstructing the tree’s history.
Note: This potentially loads the entire history of the tree. Use cautiously, especially with large trees, as it can be memory-intensive.
§Arguments
tree- The root ID of the tree to retrieve.
§Returns
A Result containing a vector of all Entry objects in the tree,
sorted topologically, or an error.
Sourcefn get_store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
store: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieves all entries belonging to a specific store within a tree, sorted topologically.
Similar to get_tree, but limited to entries that are part of the specified store.
The entries are sorted primarily by their height within the store (distance
from the store’s initial entry/entries) and secondarily by their ID.
Note: This potentially loads the entire history of the store. Use with caution.
§Arguments
tree- The root ID of the parent tree.store- The name of the store to retrieve.
§Returns
A Result containing a vector of all Entry objects in the store,
sorted topologically according to their position within the store, or an error.
Sourcefn get_tree_from_tips<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
tips: &'life2 [ID],
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_tree_from_tips<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
tips: &'life2 [ID],
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieves all entries belonging to a specific tree up to the given tips, sorted topologically.
Similar to get_tree, but only includes entries that are ancestors of the provided tips.
This allows reading from a specific state of the tree defined by those tips.
§Arguments
tree- The root ID of the tree to retrieve.tips- The tip IDs defining the state to read from.
§Returns
A Result containing a vector of Entry objects in the tree up to the given tips,
sorted topologically, or an error.
§Errors
EntryNotFoundif any tip doesn’t exist locallyEntryNotInTreeif any tip belongs to a different tree
Sourcefn 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,
Retrieves all entries belonging to a specific store at the given snapshot, sorted topologically.
Returns entries that are ancestors of the provided store snapshot’s tips.
§Arguments
tree- The root ID of the parent tree.store- The name of the store to retrieve.snapshot- The store snapshot defining the state to read from.
Sourcefn get_cached_crdt_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 CacheScope,
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,
scope: &'life1 CacheScope,
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,
Get cached CRDT state for a store at a specific entry within a scope.
§Arguments
scope- Trust scope:CacheScope::Sharedfor daemon-computed entries (visible to all users),CacheScope::Userfor client-uploaded entries scoped to that user.entry_id- The entry ID where the state is cached.store- The name of the store.
§Returns
A Result containing an Option<Vec<u8>>. Returns None if not cached.
The bytes are the serialized CRDT state in the store’s chosen format
(plaintext for Shared; ciphertext or plaintext for User, decided
client-side by the Transaction’s encryptor map).
Sourcefn cache_crdt_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: CacheScope,
entry_id: &'life1 ID,
store: &'life2 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,
fn cache_crdt_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: CacheScope,
entry_id: &'life1 ID,
store: &'life2 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,
Cache CRDT state for a store at a specific entry within a scope.
§Arguments
scope- Trust scope:CacheScope::Sharedfor daemon-computed entries,CacheScope::Userfor client-uploaded entries.entry_id- The entry ID where the state should be cached.store- The name of the store.state- The serialized CRDT state to cache (opaque bytes).
§Returns
A Result indicating success or an error during storage.
Sourcefn clear_crdt_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_crdt_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all cached CRDT states.
This is used when the CRDT computation algorithm changes and existing cached states may have been computed incorrectly.
§Returns
A Result indicating success or an error during the clear operation.
Sourcefn get_sorted_store_parents<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree_id: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
) -> 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,
fn get_sorted_store_parents<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree_id: &'life1 ID,
entry_id: &'life2 ID,
store: &'life3 str,
) -> 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,
Get the store parent IDs for a specific entry and store, sorted by height then ID.
This method retrieves the parent entry IDs for a given entry in a specific store context, sorted using the same deterministic ordering used throughout the system (height ascending, then ID ascending for ties).
§Arguments
tree_id- The ID of the tree containing the entryentry_id- The ID of the entry to get parents forstore- The name of the store context
§Returns
A Result containing a Vec<ID> of parent entry IDs sorted by (height, ID).
Returns empty vec if the entry has no parents in the store.
Sourcefn get_path_from_to<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tree_id: &'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_id: &'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,
Gets all entries between one entry and multiple target entries (exclusive of start, inclusive of targets).
This function correctly handles diamond patterns by finding ALL entries that are reachable from any of the to_ids by following parents back to from_id, not just single paths. The results are deduplicated and sorted by height then ID for deterministic CRDT merge ordering.
§Arguments
tree_id- The ID of the tree containing the entriesstore- The name of the store contextfrom_id- The starting entry ID (not included in result)to_ids- The target entry IDs (all included in result)
§Returns
A Result<Vec<ID>> containing all entry IDs between from and any of the targets, deduplicated and sorted by height then ID
Sourcefn 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,
Get the instance metadata.
Returns None for a fresh/uninitialized backend, Some(metadata) for an
initialized instance. This is used during Instance::open_backend() to determine
whether to create a new instance or load an existing one.
§Returns
A Result containing Option<InstanceMetadata>:
Some(metadata)if the instance has been initializedNoneif the backend is fresh/uninitialized
Sourcefn 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,
Set the instance metadata.
This is called during instance creation to persist the device public key and
system database IDs. It may also be called when enabling sync to update
the sync_db field.
§Arguments
metadata- The instance metadata to persist
§Returns
A Result indicating success or an error during storage.
Sourcefn get_instance_secrets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InstanceSecrets>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instance_secrets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<InstanceSecrets>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the instance secrets (private key material).
Returns None if no secrets have been saved.