feat: move core to tui and begin grpc work
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
39
crates/hyperlog-tui/src/querier.rs
Normal file
39
crates/hyperlog-tui/src/querier.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
use hyperlog_core::log::GraphItem;
|
||||
|
||||
use crate::shared_engine::SharedEngine;
|
||||
|
||||
pub struct Querier {
|
||||
engine: SharedEngine,
|
||||
}
|
||||
|
||||
impl Querier {
|
||||
pub fn new(engine: SharedEngine) -> Self {
|
||||
Self { engine }
|
||||
}
|
||||
|
||||
pub fn get_available_roots(&self) -> Option<Vec<String>> {
|
||||
self.engine.get_roots()
|
||||
}
|
||||
|
||||
pub fn get(
|
||||
&self,
|
||||
root: &str,
|
||||
path: impl IntoIterator<Item = impl Into<String>>,
|
||||
) -> Option<GraphItem> {
|
||||
let path = path
|
||||
.into_iter()
|
||||
.map(|i| i.into())
|
||||
.filter(|i| !i.is_empty())
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
tracing::debug!(
|
||||
"quering: root:({}), path:({}), len: ({}))",
|
||||
root,
|
||||
path.join("."),
|
||||
path.len()
|
||||
);
|
||||
|
||||
self.engine
|
||||
.get(root, &path.iter().map(|i| i.as_str()).collect::<Vec<_>>())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user