pub trait ImmutableDigester: Sync + Send {
    // Required method
    fn compute_digest<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        dirpath: &'life1 Path,
        beacon: &'life2 CardanoDbBeacon
    ) -> Pin<Box<dyn Future<Output = Result<String, ImmutableDigesterError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

A digester than can compute the digest used for mithril signatures

If you want to mock it using mockall:

mod test {
    use async_trait::async_trait;
    use mithril_common::digesters::{ImmutableDigester, ImmutableDigesterError};
    use mithril_common::entities::CardanoDbBeacon;
    use mockall::mock;
    use std::path::Path;

    mock! {
        pub ImmutableDigesterImpl { }

        #[async_trait]
        impl ImmutableDigester for ImmutableDigesterImpl {
            async fn compute_digest(
              &self,
              dirpath: &Path,
              beacon: &CardanoDbBeacon,
            ) -> Result<String, ImmutableDigesterError>;
        }
    }

    #[test]
    fn test_mock() {
        let mut mock = MockDigesterImpl::new();
        mock.expect_compute_digest().return_once(|_, _| {
            Err(ImmutableDigesterError::NotEnoughImmutable {
                expected_number: 3,
                found_number: None,
                db_dir: PathBuff::new(),
            })
        });
    }
}

Required Methods§

source

fn compute_digest<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dirpath: &'life1 Path, beacon: &'life2 CardanoDbBeacon ) -> Pin<Box<dyn Future<Output = Result<String, ImmutableDigesterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Compute the digest

Implementors§