Trait StateStore

Source
pub trait StateStore: Send + Sync {
Show 17 methods // Required methods fn save_vertex<'life0, 'life1, 'async_trait>( &'life0 self, vertex: &'life1 Vertex, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<Option<Vertex>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn save_peer<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer_id: &'life1 PeerId, info: &'life2 PeerInfo, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn load_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(PeerId, PeerInfo)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_dark_record<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 DarkDomainRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_dark_records<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DarkDomainRecord>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn remove_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_peer<'life0, 'life1, 'async_trait>( &'life0 self, peer_id: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_dark_record<'life0, 'life1, 'async_trait>( &'life0 self, owner_id: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn vertex_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn peer_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn dark_record_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_state<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 PersistedDagState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn recover_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<PersistedDagState>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn create_backup<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 PathBuf, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn restore_backup<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 PathBuf, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

Abstract storage trait for different persistence backends

Required Methods§

Source

fn save_vertex<'life0, 'life1, 'async_trait>( &'life0 self, vertex: &'life1 Vertex, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a DAG vertex to storage

Source

fn load_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<Option<Vertex>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load a DAG vertex from storage by ID

Source

fn save_peer<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer_id: &'life1 PeerId, info: &'life2 PeerInfo, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Save peer information to storage

Source

fn load_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(PeerId, PeerInfo)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all peers from storage

Source

fn save_dark_record<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 DarkDomainRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save a dark domain record to storage

Source

fn load_dark_records<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DarkDomainRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all dark domain records from storage

Source

fn remove_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a vertex from storage

Source

fn remove_peer<'life0, 'life1, 'async_trait>( &'life0 self, peer_id: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a peer from storage

Source

fn remove_dark_record<'life0, 'life1, 'async_trait>( &'life0 self, owner_id: &'life1 PeerId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a dark domain record from storage by owner ID

Source

fn vertex_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total number of stored vertices

Source

fn peer_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total number of stored peers

Source

fn dark_record_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total number of stored dark records

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if storage is healthy

Source

fn save_state<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 PersistedDagState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save complete persisted state

Source

fn recover_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<PersistedDagState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Recover complete persisted state

Source

fn create_backup<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 PathBuf, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create backup of the entire state

Source

fn restore_backup<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 PathBuf, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore from backup

Implementors§