Trait holochain::prelude::ChainHeadCoordinator
source · pub trait ChainHeadCoordinator {
type Item: ChainItem;
// Required methods
fn head<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<<Self::Item as ChainItem>::Hash>, ChcError>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn add_actions<'life0, 'async_trait>(
&'life0 self,
actions: Vec<Self::Item, Global>
) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn add_entries<'life0, 'async_trait>(
&'life0 self,
entries: Vec<HoloHashed<Entry>, Global>
) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_actions_since_hash<'life0, 'async_trait>(
&'life0 self,
hash: Option<<Self::Item as ChainItem>::Hash>
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Item, Global>, ChcError>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_entries<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: HashSet<&'life1 HoloHash<Entry>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<HashMap<HoloHash<Entry>, Entry, RandomState>, ChcError>> + Send + 'async_trait, Global>>
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§
Required Methods§
sourcefn head<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<<Self::Item as ChainItem>::Hash>, ChcError>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn head<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Option<<Self::Item as ChainItem>::Hash>, ChcError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Get just the head of the chain as recorded by the CHC.
sourcefn add_actions<'life0, 'async_trait>(
&'life0 self,
actions: Vec<Self::Item, Global>
) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn add_actions<'life0, 'async_trait>( &'life0 self, actions: Vec<Self::Item, Global> ) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Add items to be appended to the CHC’s chain.
sourcefn add_entries<'life0, 'async_trait>(
&'life0 self,
entries: Vec<HoloHashed<Entry>, Global>
) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn add_entries<'life0, 'async_trait>( &'life0 self, entries: Vec<HoloHashed<Entry>, Global> ) -> Pin<Box<dyn Future<Output = Result<(), ChcError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Add entries to the entry storage service.
sourcefn get_actions_since_hash<'life0, 'async_trait>(
&'life0 self,
hash: Option<<Self::Item as ChainItem>::Hash>
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Item, Global>, ChcError>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_actions_since_hash<'life0, 'async_trait>( &'life0 self, hash: Option<<Self::Item as ChainItem>::Hash> ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Item, Global>, ChcError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Get actions including and beyond the given hash.
sourcefn get_entries<'life0, 'life1, 'async_trait>(
&'life0 self,
hashes: HashSet<&'life1 HoloHash<Entry>, RandomState>
) -> Pin<Box<dyn Future<Output = Result<HashMap<HoloHash<Entry>, Entry, RandomState>, ChcError>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_entries<'life0, 'life1, 'async_trait>( &'life0 self, hashes: HashSet<&'life1 HoloHash<Entry>, RandomState> ) -> Pin<Box<dyn Future<Output = Result<HashMap<HoloHash<Entry>, Entry, RandomState>, ChcError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: '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.