mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-28 16:49:58 -07:00
server: mcp + global: refactor
This commit is contained in:
33
crates/brk_interface/examples/main.rs
Normal file
33
crates/brk_interface/examples/main.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_computer::Computer;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_interface::{Index, Interface, Params, ParamsOpt};
|
||||
use brk_vec::{Computation, Format};
|
||||
|
||||
pub fn main() -> color_eyre::Result<()> {
|
||||
color_eyre::install()?;
|
||||
|
||||
let outputs_dir = Path::new("../../_outputs");
|
||||
|
||||
let format = Format::Compressed;
|
||||
|
||||
let indexer = Indexer::forced_import(outputs_dir)?;
|
||||
|
||||
let computer = Computer::forced_import(outputs_dir, &indexer, Computation::Lazy, None, format)?;
|
||||
|
||||
let interface = Interface::build(&indexer, &computer);
|
||||
|
||||
dbg!(interface.search_and_format(Params {
|
||||
index: Index::Height,
|
||||
ids: vec!["date"].into(),
|
||||
rest: ParamsOpt::default().set_from(-1),
|
||||
})?);
|
||||
dbg!(interface.search_and_format(Params {
|
||||
index: Index::Height,
|
||||
ids: vec!["date", "timestamp"].into(),
|
||||
rest: ParamsOpt::default().set_from(-10).set_count(5),
|
||||
})?);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user