Skip to main content

IndependentConsumerEngine

Struct IndependentConsumerEngine 

Source
pub struct IndependentConsumerEngine { /* private fields */ }
Expand description

Minimal independent PlanEngine implementation used for the Phase 3 interoperability proof example. This is intentionally narrow and only supports the read operators exercised by the checked-in proof corpus subset.

Implementations§

Source§

impl IndependentConsumerEngine

Source

pub fn new(graph: Graph) -> Self

Examples found in repository?
examples/independent_consumer_proof.rs (line 47)
40fn main() -> Result<(), String> {
41    let case_paths = proof_case_paths();
42    let cases = proof_cases();
43
44    let mut reports = Vec::with_capacity(cases.len());
45    let mut passed = 0usize;
46    for case in cases {
47        let mut engine = IndependentConsumerEngine::new(proof_fixture_graph());
48        let outcome = engine
49            .execute_plan(&case.plan)
50            .map_err(|err| err.to_string());
51        let assertion = match outcome {
52            Ok(result) if result.rows == case.expected_rows => Ok(()),
53            Ok(result) => Err(format!(
54                "row mismatch: expected {:?}, got {:?}",
55                case.expected_rows, result.rows
56            )),
57            Err(err) => Err(err),
58        };
59        if assertion.is_ok() {
60            passed += 1;
61        }
62        reports.push(IndependentConsumerProofCase {
63            case: case.name,
64            passed: assertion.is_ok(),
65            error: assertion.err(),
66        });
67    }
68
69    let report = IndependentConsumerProofReport {
70        proof_id: "plexus-independent-consumer-proof-v1".to_string(),
71        consumer: "independent-consumer-example".to_string(),
72        implementation: "independent PlanEngine implementation with a private flat graph store"
73            .to_string(),
74        supported_subset: SupportedSubset {
75            ops: vec![
76                "ScanNodes",
77                "Expand",
78                "OptionalExpand",
79                "Filter",
80                "Project",
81                "Sort",
82                "Return",
83            ],
84            exprs: vec![
85                "ColRef",
86                "PropAccess",
87                "IntLiteral",
88                "FloatLiteral",
89                "BoolLiteral",
90                "StringLiteral",
91                "NullLiteral",
92                "Cmp",
93            ],
94            notes: vec![
95                "This proof intentionally covers a bounded core-read subset only.",
96                "The example does not reuse the reference engine execution path.",
97                "The checked-in JSON artifact is produced by running this example.",
98            ],
99        },
100        reference_contract: flagship_graph_rag_reference_contract(),
101        case_sources: case_paths
102            .iter()
103            .map(|path| path.display().to_string())
104            .collect(),
105        total: reports.len(),
106        passed,
107        failed: reports.len().saturating_sub(passed),
108        cases: reports,
109    };
110
111    println!(
112        "{}",
113        serde_json::to_string_pretty(&report).map_err(|err| err.to_string())?
114    );
115    Ok(())
116}

Trait Implementations§

Source§

impl Clone for IndependentConsumerEngine

Source§

fn clone(&self) -> IndependentConsumerEngine

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IndependentConsumerEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PlanEngine for IndependentConsumerEngine

Source§

type Error = ExecutionError

Source§

fn execute_plan(&mut self, plan: &Plan) -> Result<QueryResult, Self::Error>

Execute a deserialized plan.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.