Trait aleph_bft::DataIO[][src]

pub trait DataIO<Data> {
    type Error: Debug + 'static;
    fn get_data(&self) -> Data;
fn check_availability(
        &self,
        data: &Data
    ) -> Option<Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>>>;
fn send_ordered_batch(
        &mut self,
        data: OrderedBatch<Data>
    ) -> Result<(), Self::Error>; }
Expand description

The source of data items that consensus should order.

AlephBFT internally calls DataIO::get_data whenever a new unit is created and data needs to be placed inside. The DataIO::send_ordered_batch method is called whenever a new round has been decided and thus a new batch of units (or more precisely the data they carry) is available. Finally, [DataIO::check_availability is used to validate and check availability of data. The meaning of the latter might be unclear if we think of Data` as being the actual data that is being ordered, but in applications one often wants to use hashes of data (for instance block hashes) in which case it is crucial for security that there is access to the actual data, cryptographically represented by a hash. It is assumed that the implementation of DataIO makes best effort of fetch the data in case it is unavailable.

Associated Types

Required methods

Outputs a new data item to be ordered

Returns future that indicates when the data becomes available or None if the data is already available. For applications where Data is actually a real data and not some reprentation of it, this may be trivially implemented to return always None.

Takes a new ordered batch of data item.

Implementors