pub trait StorageBackend:
Send
+ Sync
+ Debug {
// Required methods
fn save_fingerprint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
fingerprint: &'life2 AnalysisDefFingerprint,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn load_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Option<AnalysisDefFingerprint>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_edge<'life0, 'life1, 'async_trait>(
&'life0 self,
edge: &'life1 DependencyEdge,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_edges_from<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_edges_to<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_edges_for<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<usize, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_full_graph<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DependencyGraph, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_full_graph<'life0, 'life1, 'async_trait>(
&'life0 self,
graph: &'life1 DependencyGraph,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn name(&self) -> &'static str;
}Expand description
Abstract storage backend for the incremental update system.
Provides async persistence for fingerprints and dependency edges. Implementations must support both read and write operations, as well as transactional consistency for batch updates.
§Implementors
PostgresStorage(Phase 2): Full Postgres backend for CLI deploymentD1Storage(Phase 2): Cloudflare D1 backend for edge deployment
§Examples
use thread_flow::incremental::storage::StorageBackend;
async fn example(storage: &dyn StorageBackend) {
let fp = storage.load_fingerprint(Path::new("src/main.rs")).await;
}Required Methods§
Sourcefn save_fingerprint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
fingerprint: &'life2 AnalysisDefFingerprint,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_fingerprint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
fingerprint: &'life2 AnalysisDefFingerprint,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persists a fingerprint for the given file path.
Uses upsert semantics: creates a new entry or updates an existing one.
§Arguments
file_path- The file this fingerprint belongs to.fingerprint- The fingerprint data to persist.
Sourcefn load_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Option<AnalysisDefFingerprint>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Option<AnalysisDefFingerprint>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn delete_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_fingerprint<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes the fingerprint for a file.
Returns Ok(true) if a fingerprint was deleted, Ok(false) if
no fingerprint existed for the path.
Sourcefn save_edge<'life0, 'life1, 'async_trait>(
&'life0 self,
edge: &'life1 DependencyEdge,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_edge<'life0, 'life1, 'async_trait>(
&'life0 self,
edge: &'life1 DependencyEdge,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persists a dependency edge.
Uses upsert semantics based on the composite key (from, to, from_symbol, to_symbol, dep_type).
Sourcefn load_edges_from<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_edges_from<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads all dependency edges originating from a file.
Sourcefn load_edges_to<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_edges_to<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DependencyEdge>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads all dependency edges targeting a file.
Sourcefn delete_edges_for<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<usize, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_edges_for<'life0, 'life1, 'async_trait>(
&'life0 self,
file_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<usize, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes all dependency edges involving a file (as source or target).
Sourcefn load_full_graph<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DependencyGraph, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_full_graph<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DependencyGraph, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads the complete dependency graph from storage.
This is used during initialization to restore the graph state from the previous session.
Sourcefn save_full_graph<'life0, 'life1, 'async_trait>(
&'life0 self,
graph: &'life1 DependencyGraph,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_full_graph<'life0, 'life1, 'async_trait>(
&'life0 self,
graph: &'life1 DependencyGraph,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persists the complete dependency graph to storage.
This performs a full replacement of the stored graph. Used after graph rebuilds or major updates.