pub trait SolutionDataProvider {
type Solution;
// Required methods
fn get_page(page: PageIndex) -> Self::Solution;
fn get_score() -> ElectionScore;
fn report_result(result: VerificationResult);
}
Expand description
Something that can provide candidate solutions to the verifier.
In reality, this can be implemented by the crate::signed::Pallet
, where signed solutions are
queued and sorted based on claimed score, and they are put forth one by one, from best to worse.
Required Associated Types§
Required Methods§
Sourcefn get_page(page: PageIndex) -> Self::Solution
fn get_page(page: PageIndex) -> Self::Solution
Return the page
th page of the current best solution that the data provider has in store.
If no candidate solutions are available, an empty page is returned (i.e., a page that contains no solutions and contributes zero to the final score).
Sourcefn get_score() -> ElectionScore
fn get_score() -> ElectionScore
Get the claimed score of the current best solution.
If no score is available, a default/zero score should be returned defensively.
Sourcefn report_result(result: VerificationResult)
fn report_result(result: VerificationResult)
Hook to report back the results of the verification of the current candidate solution that
is being exposed via Self::get_page
and Self::get_score
.
Every time that this is called, the verifier AsynchronousVerifier
goes back to the
Status::Nothing
state, and it is the responsibility of Self
to call start
again,
if desired.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.