generated from okp4/template-rust
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cognitarium): define query engine structure
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
pub mod contract; | ||
mod error; | ||
pub mod msg; | ||
mod querier; | ||
mod rdf; | ||
pub mod state; | ||
mod storer; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::querier::plan::{PatternValue, QueryNode, QueryPlan}; | ||
use crate::state::{triples, Object, Predicate, Subject, Triple}; | ||
use cosmwasm_std::{Order, StdError, StdResult, Storage}; | ||
use cw_storage_plus::IndexList; | ||
use std::collections::VecDeque; | ||
use std::iter; | ||
|
||
pub struct QueryEngine<'a> { | ||
storage: &'a dyn Storage, | ||
} | ||
|
||
impl<'a> QueryEngine<'a> { | ||
pub fn new(storage: &'a dyn Storage) -> Self { | ||
Self { storage } | ||
} | ||
|
||
pub fn eval_plan(&self, plan: QueryPlan) -> ResolvedVariablesIterator { | ||
Box::new(iter::empty()) | ||
} | ||
} | ||
|
||
type ResolvedVariablesIterator = Box<dyn Iterator<Item = StdResult<ResolvedVariables>>>; | ||
|
||
pub enum ResolvedVariable { | ||
Subject(Subject), | ||
Predicate(Predicate), | ||
Object(Object), | ||
} | ||
|
||
pub struct ResolvedVariables { | ||
pub variables: Vec<Option<ResolvedVariable>>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod engine; | ||
mod plan; | ||
mod plan_builder; |