pub trait BackendImpl:
Send
+ Sync
+ Any {
Show 31 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<Option<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_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: Option<&'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;
// Provided methods
fn resolve_store_state<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordView>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn begin_store_state_staging<'life0, 'async_trait>(
&'life0 self,
_request: StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<StagingToken>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn stage_store_state_records<'life0, 'life1, 'async_trait>(
&'life0 self,
_token: &'life1 StagingToken,
_records: RecordMutations,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn publish_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<RecordView>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn abort_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn store_state_record_get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_key: &'life2 [u8],
) -> 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 { ... }
fn store_state_record_scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_range: &'life2 RecordRange,
_after: Option<&'life3 [u8]>,
_limit: usize,
) -> Pin<Box<dyn Future<Output = Result<RecordPage>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn clear_derived_store_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn reset_local_verification<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn check_targets_reachable_from<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
from: &'life2 [ID],
targets: &'life3 [ID],
) -> Pin<Box<dyn Future<Output = Result<Reachability>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: '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<Option<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<Option<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 Some(id) for the merge base, or None when the
entries share no common ancestor.
None is a valid result, not an error. A store created independently on
two peers — it did not exist at the point they forked, so neither side’s
first write has a store parent in common — has two roots and no shared
ancestor. Those histories merge from the empty base, the same way the
main tree already merges two disjoint roots into a diamond. Callers
materialize from a default state and fold the full ancestry.
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_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: Option<&'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: Option<&'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), orNoneto walk the full ancestry ofto_ids— the empty-base case, where the targets share no common ancestorto_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.
Sourcefn 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,
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,
Provided Methods§
Sourcefn resolve_store_state<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordView>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_store_state<'life0, 'life1, 'async_trait>(
&'life0 self,
_request: &'life1 StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordView>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up the published cached state for an exact request. Private builds are never returned.
Sourcefn begin_store_state_staging<'life0, 'async_trait>(
&'life0 self,
_request: StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<StagingToken>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_store_state_staging<'life0, 'async_trait>(
&'life0 self,
_request: StoreStateRequest,
) -> Pin<Box<dyn Future<Output = Result<StagingToken>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start a private build for a later atomic publish. The build is invisible to readers until published.
Sourcefn stage_store_state_records<'life0, 'life1, 'async_trait>(
&'life0 self,
_token: &'life1 StagingToken,
_records: RecordMutations,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stage_store_state_records<'life0, 'life1, 'async_trait>(
&'life0 self,
_token: &'life1 StagingToken,
_records: RecordMutations,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add a chunk of records to a private build.
Sourcefn publish_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<RecordView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<RecordView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically publish a finished build as the cached state for its target.
Returns the published record set. When a concurrent materializer published
that same target first, its record set is adopted and this build is
discarded — publishing the same state twice is a race, not an error.
Repeating a publish with the same token is idempotent and must never
remove the published state. Rejects a build holding a None-valued
record, since staged deletes cannot be published yet.
Sourcefn abort_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn abort_store_state<'life0, 'async_trait>(
&'life0 self,
_token: StagingToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Discard a private build. Aborting an already-published token is harmless.
Sourcefn store_state_record_get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_key: &'life2 [u8],
) -> 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,
fn store_state_record_get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_key: &'life2 [u8],
) -> 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,
Read one exact record from published records. A missing key reads as
None, never an error.
Sourcefn store_state_record_scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_range: &'life2 RecordRange,
_after: Option<&'life3 [u8]>,
_limit: usize,
) -> Pin<Box<dyn Future<Output = Result<RecordPage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_state_record_scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_view: &'life1 RecordView,
_range: &'life2 RecordRange,
_after: Option<&'life3 [u8]>,
_limit: usize,
) -> Pin<Box<dyn Future<Output = Result<RecordPage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Read one ordered page of records. A limit of zero yields an empty page
with no continuation. A view that no longer identifies published
records errors with InvalidStoreStateView, never an empty page.
Sourcefn clear_derived_store_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_derived_store_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear cached derived state. Authoritative state and private builds are untouched.
Sourcefn reset_local_verification<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset_local_verification<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Explicit offline reset of local trust decisions and disposable Store state. Preserves immutable Entries and authoritative Store state. Unsupported backends fail without a partial reset.
Sourcefn check_targets_reachable_from<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
from: &'life2 [ID],
targets: &'life3 [ID],
) -> Pin<Box<dyn Future<Output = Result<Reachability>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn check_targets_reachable_from<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tree: &'life1 ID,
from: &'life2 [ID],
targets: &'life3 [ID],
) -> Pin<Box<dyn Future<Output = Result<Reachability>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Within tree, decide whether every entry in targets is an
ancestor-or-equal of some entry in from — i.e. whether the from
snapshot is at-or-ahead-of the targets snapshot.
Returns a three-state Reachability rather than a bare bool so a
proven negative is distinguishable from “not enough local history to
decide” (see Reachability::Indeterminate). This is the cheap
counterpart to get_tree_from_tips when only
an at-or-ahead-of answer is needed, not the materialised ancestor set.
Bounded by the target floor. The walk never descends below the
minimum target height: an entry below every remaining target cannot be
one, nor reach one through still-lower parents (parent heights strictly
decrease). Cost therefore tracks the height gap between from and
targets on both the reachable and unreachable paths, not the size of
the tree — which matters because this runs on every delegated-entry
validation (and re-validation).
Validation is symmetric. Both from and targets are checked to be
real entries of tree. An entry that exists but belongs to another tree
is a from/target integrity violation and errors. An entry that is
missing locally is not a negative: it makes the verdict
Indeterminate and is reported in
missing, so a partially-synced history is never mistaken for a
regression. Membership is presence in the tree, not
VerificationStatus::Verified.
A target equal to a from entry is reached; an empty targets is
vacuously Reachable.
§Errors
EntryNotInTreeif anyfromortargetsentry exists but belongs to a different tree
The default implementation performs the walk via get; a
backend may override it with a single-query traversal.