Trait 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§

Source

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
Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<D: DhtPersistentStorage> DhtPersistentStorage for Arc<D>

Source§

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,

Source§

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,

Implementors§