Trait libp2p_networking::network::behaviours::dht::store::persistent::DhtPersistentStorage
source · pub trait DhtPersistentStorage:
Send
+ Sync
+ 'static
+ Clone {
// Required methods
fn save<'life0, 'async_trait>(
&'life0 self,
_records: Vec<SerializableRecord>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A trait that we use to save and load the DHT to a file on disk or other storage medium
Required Methods§
sourcefn save<'life0, 'async_trait>(
&'life0 self,
_records: Vec<SerializableRecord>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
_records: Vec<SerializableRecord>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Save the DHT (as a list of serializable records) to the persistent storage
§Errors
- If we fail to save the DHT to the persistent storage provider
sourcefn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load the DHT (as a list of serializable records) from the persistent storage
§Errors
- If we fail to load the DHT from the persistent storage provider
Object Safety§
This trait is not object safe.