Skip to main content

HypothesisStorage

Trait HypothesisStorage 

Source
pub trait HypothesisStorage: Send + Sync {
    // Required methods
    fn create_hypothesis<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hypothesis: &'life1 Hypothesis,
    ) -> Pin<Box<dyn Future<Output = Result<HypothesisId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_hypothesis<'life0, 'async_trait>(
        &'life0 self,
        id: HypothesisId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Hypothesis>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_confidence<'life0, 'async_trait>(
        &'life0 self,
        id: HypothesisId,
        posterior: Confidence,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_status<'life0, 'async_trait>(
        &'life0 self,
        id: HypothesisId,
        status: HypothesisStatus,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_hypotheses<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Hypothesis>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_hypothesis<'life0, 'async_trait>(
        &'life0 self,
        id: HypothesisId,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn attach_evidence<'life0, 'life1, 'async_trait>(
        &'life0 self,
        evidence: &'life1 Evidence,
    ) -> Pin<Box<dyn Future<Output = Result<EvidenceId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_evidence<'life0, 'async_trait>(
        &'life0 self,
        id: EvidenceId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Evidence>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_evidence_for_hypothesis<'life0, 'async_trait>(
        &'life0 self,
        hypothesis_id: HypothesisId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Evidence>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_all_evidence<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Evidence>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_evidence<'life0, 'async_trait>(
        &'life0 self,
        id: EvidenceId,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Storage trait for hypotheses (allows test mocks)

Required Methods§

Source

fn create_hypothesis<'life0, 'life1, 'async_trait>( &'life0 self, hypothesis: &'life1 Hypothesis, ) -> Pin<Box<dyn Future<Output = Result<HypothesisId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new hypothesis

Source

fn get_hypothesis<'life0, 'async_trait>( &'life0 self, id: HypothesisId, ) -> Pin<Box<dyn Future<Output = Result<Option<Hypothesis>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a hypothesis by ID

Source

fn update_confidence<'life0, 'async_trait>( &'life0 self, id: HypothesisId, posterior: Confidence, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update hypothesis confidence

Source

fn set_status<'life0, 'async_trait>( &'life0 self, id: HypothesisId, status: HypothesisStatus, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set hypothesis status

Source

fn list_hypotheses<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Hypothesis>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all hypotheses

Source

fn delete_hypothesis<'life0, 'async_trait>( &'life0 self, id: HypothesisId, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a hypothesis

Source

fn attach_evidence<'life0, 'life1, 'async_trait>( &'life0 self, evidence: &'life1 Evidence, ) -> Pin<Box<dyn Future<Output = Result<EvidenceId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attach evidence to a hypothesis

Source

fn get_evidence<'life0, 'async_trait>( &'life0 self, id: EvidenceId, ) -> Pin<Box<dyn Future<Output = Result<Option<Evidence>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get evidence by ID

Source

fn list_evidence_for_hypothesis<'life0, 'async_trait>( &'life0 self, hypothesis_id: HypothesisId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Evidence>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all evidence for a hypothesis

Source

fn list_all_evidence<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Evidence>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all evidence

Source

fn delete_evidence<'life0, 'async_trait>( &'life0 self, id: EvidenceId, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete evidence

Implementors§