pub trait ChainHeadCoordinator {
    type Item: ChainItem;

    fn head<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ChcResult<Option<ChainItemHash<Self::Item>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn add_actions<'life0, 'async_trait>(
        &'life0 self,
        actions: Vec<Self::Item>
    ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn add_entries<'life0, 'async_trait>(
        &'life0 self,
        entries: Vec<EntryHashed>
    ) -> Pin<Box<dyn Future<Output = ChcResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        Self: '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
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: '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

The item which the chain is made of.

Required Methods

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

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

Add entries to the entry storage service.

Get actions including and beyond the given hash.

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