Skip to main content

Checker

Trait Checker 

Source
pub trait Checker:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> CheckerId;
    fn judge<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        order: &'life1 WorkOrder,
        condensate: &'life2 Condensate,
    ) -> Pin<Box<dyn Future<Output = Judgement> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn grants(&self) -> GrantSet { ... }
    fn check<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        order: &'life1 WorkOrder,
        condensate: &'life2 Condensate,
        signer: &'life3 dyn Sign,
    ) -> Pin<Box<dyn Future<Output = Result<Evidence, CheckError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Layer 5: turns a proposal and a result into a signed verdict.

Implement id and judge, and declare grants if the checker needs any. Do not implement check — it is what enforces the contract, and the design of this module is that an implementation cannot opt out of it.

Required Methods§

Source

fn id(&self) -> CheckerId

Which checker this is, and at what version.

Recorded into every piece of evidence. The version is not decoration: a verdict is only meaningful against a specific checker, and “the tests passed” means nothing without knowing which runner said so.

Source

fn judge<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, order: &'life1 WorkOrder, condensate: &'life2 Condensate, ) -> Pin<Box<dyn Future<Output = Judgement> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Decide. The part an implementation writes.

Must be a pure function of its two arguments — see the module documentation on determinism. There is no error return: a checker that could not decide returns Judgement::inconclusive, which never commits.

Provided Methods§

Source

fn grants(&self) -> GrantSet

The authority this checker needs.

Nothing, by default. Checked against checker_ceiling before the checker runs, so a declaration wide enough to reach a model is refused rather than trusted.

Source

fn check<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, order: &'life1 WorkOrder, condensate: &'life2 Condensate, signer: &'life3 dyn Sign, ) -> Pin<Box<dyn Future<Output = Result<Evidence, CheckError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Check the authority, decide, bind the verdict to its inputs, and sign.

In that order, and the order matters. The ceiling is enforced before judge runs, so an over-authorised checker never executes; the inputs are bound by this method rather than by the implementation, so a checker cannot produce a verdict that omits what it judged.

The evidence is always EvidenceKind::Deterministic. That is not a parameter because this trait is the model-free checker: quorum evidence comes from the quorum combinator (US-1403) and human evidence from a gate, and neither of those is a Checker.

§Errors

CheckError::Overreach or CheckError::UndecidableGrants if the checker may not hold what it declared, CheckError::Address if the inputs could not be digested, or CheckError::Sign if the verdict could not be signed. In every case there is no evidence, and so no commit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§