pub trait ChainHeadCoordinator {
    type Item: ChainItem;

    // Required methods
    fn head<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ChcResult<Option<ChainItemHash<Self::Item>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_actions<'life0, 'async_trait>(
        &'life0 self,
        actions: Vec<Self::Item>
    ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_entries<'life0, 'async_trait>(
        &'life0 self,
        entries: Vec<EntryHashed>
    ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_actions_since_hash<'life0, 'async_trait>(
        &'life0 self,
        hash: Option<ChainItemHash<Self::Item>>
    ) -> Pin<Box<dyn Future<Output = ChcResult<Vec<Self::Item>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_entries<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hashes: HashSet<&'life1 EntryHash>
    ) -> Pin<Box<dyn Future<Output = ChcResult<HashMap<EntryHash, Entry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The API which a Chain Head Coordinator service must implement.

NOTE this API is currently loosely defined and will certainly change in the future. Do not write a real CHC according to this spec!

Required Associated Types§

source

type Item: ChainItem

The item which the chain is made of.

Required Methods§

source

fn head<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ChcResult<Option<ChainItemHash<Self::Item>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Get just the head of the chain as recorded by the CHC.

source

fn add_actions<'life0, 'async_trait>( &'life0 self, actions: Vec<Self::Item> ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Add items to be appended to the CHC’s chain.

source

fn add_entries<'life0, 'async_trait>( &'life0 self, entries: Vec<EntryHashed> ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Add entries to the entry storage service.

source

fn get_actions_since_hash<'life0, 'async_trait>( &'life0 self, hash: Option<ChainItemHash<Self::Item>> ) -> Pin<Box<dyn Future<Output = ChcResult<Vec<Self::Item>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Get actions including and beyond the given hash.

source

fn get_entries<'life0, 'life1, 'async_trait>( &'life0 self, hashes: HashSet<&'life1 EntryHash> ) -> Pin<Box<dyn Future<Output = ChcResult<HashMap<EntryHash, Entry>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get entries with the given hashes. If any entries cannot be retrieved, an error will be returned. Otherwise, the hashmap will pair Entries with each hash requested.

Implementors§