Trait ExternalPersist

Source
pub trait ExternalPersist: Send + Sync {
    // Required methods
    fn put<'life0, 'life1, 'async_trait>(
        &'life0 self,
        mutations: Mutations,
        client_hmac: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key_prefix: String,
        nonce: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(Mutations, Vec<u8>), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Info, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

External persister.

This trait is used to store the mutations in one or more external storage backends. The backend can be, for example, an LSS implementation (see lightning-storage-server).

Required Methods§

Source

fn put<'life0, 'life1, 'async_trait>( &'life0 self, mutations: Mutations, client_hmac: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store the mutations.

Returns the server hmac, proving that the mutation was persisted.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key_prefix: String, nonce: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(Mutations, Vec<u8>), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the full state.

In the future, there will be multiple server support, and if there is no consensus among the servers, an error will be returned.

Source

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

Return server information, including public key and version.

Implementors§