mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-12 03:28:13 -07:00
global: snapshot
This commit is contained in:
@@ -53,14 +53,14 @@ impl AsyncQuery {
|
||||
// metric: &str,
|
||||
// index: Index,
|
||||
// // params: &Params,
|
||||
// ) -> Result<Vec<(String, &&dyn AnyWritableVec)>> {
|
||||
// ) -> Result<Vec<(String, &&dyn AnyExportableVec)>> {
|
||||
// let query = self.0.clone();
|
||||
// spawn_blocking(move || query.search_metric_with_index(metric, index)).await?
|
||||
// }
|
||||
|
||||
// pub async fn format(
|
||||
// &self,
|
||||
// metrics: Vec<(String, &&dyn AnyWritableVec)>,
|
||||
// metrics: Vec<(String, &&dyn AnyExportableVec)>,
|
||||
// params: &ParamsOpt,
|
||||
// ) -> Result<Output> {
|
||||
// let query = self.0.clone();
|
||||
|
||||
@@ -11,7 +11,7 @@ use brk_types::{
|
||||
Address, AddressStats, Format, Height, Index, IndexInfo, Limit, Metric, MetricCount,
|
||||
Transaction, TxidPath,
|
||||
};
|
||||
use vecdb::{AnyStoredVec, AnyWritableVec};
|
||||
use vecdb::{AnyExportableVec, AnyStoredVec};
|
||||
|
||||
mod r#async;
|
||||
mod chain;
|
||||
@@ -77,7 +77,7 @@ impl Query {
|
||||
metric: &str,
|
||||
index: Index,
|
||||
// params: &Params,
|
||||
) -> Result<Vec<(String, &&dyn AnyWritableVec)>> {
|
||||
) -> Result<Vec<(String, &&dyn AnyExportableVec)>> {
|
||||
todo!();
|
||||
|
||||
// let all_metrics = &self.vecs.metrics;
|
||||
@@ -121,7 +121,7 @@ impl Query {
|
||||
}
|
||||
|
||||
fn columns_to_csv(
|
||||
columns: &[&&dyn AnyWritableVec],
|
||||
columns: &[&&dyn AnyExportableVec],
|
||||
from: Option<i64>,
|
||||
to: Option<i64>,
|
||||
) -> Result<String> {
|
||||
@@ -163,7 +163,11 @@ impl Query {
|
||||
Ok(csv)
|
||||
}
|
||||
|
||||
pub fn format(&self, metrics: Vec<&&dyn AnyWritableVec>, params: &ParamsOpt) -> Result<Output> {
|
||||
pub fn format(
|
||||
&self,
|
||||
metrics: Vec<&&dyn AnyExportableVec>,
|
||||
params: &ParamsOpt,
|
||||
) -> Result<Output> {
|
||||
let from = params.from().map(|from| {
|
||||
metrics
|
||||
.iter()
|
||||
|
||||
@@ -6,7 +6,7 @@ use brk_traversable::{Traversable, TreeNode};
|
||||
use brk_types::{Index, IndexInfo, Limit, Metric};
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use quickmatch::{QuickMatch, QuickMatchConfig};
|
||||
use vecdb::AnyWritableVec;
|
||||
use vecdb::AnyExportableVec;
|
||||
|
||||
use crate::pagination::{PaginatedIndexParam, PaginatedMetrics, PaginationParam};
|
||||
|
||||
@@ -31,11 +31,11 @@ impl<'a> Vecs<'a> {
|
||||
|
||||
indexer
|
||||
.vecs
|
||||
.iter_any_writable()
|
||||
.iter_any_exportable()
|
||||
.for_each(|vec| this.insert(vec));
|
||||
|
||||
computer
|
||||
.iter_any_writable()
|
||||
.iter_any_exportable()
|
||||
.for_each(|vec| this.insert(vec));
|
||||
|
||||
let mut ids = this
|
||||
@@ -108,7 +108,7 @@ impl<'a> Vecs<'a> {
|
||||
}
|
||||
|
||||
// Not the most performant or type safe but only built once so that's okay
|
||||
fn insert(&mut self, vec: &'a dyn AnyWritableVec) {
|
||||
fn insert(&mut self, vec: &'a dyn AnyExportableVec) {
|
||||
let name = vec.name();
|
||||
let serialized_index = vec.index_type_to_string();
|
||||
let index = Index::try_from(serialized_index)
|
||||
@@ -181,7 +181,7 @@ impl<'a> Vecs<'a> {
|
||||
}
|
||||
|
||||
#[derive(Default, Deref, DerefMut)]
|
||||
pub struct IndexToVec<'a>(BTreeMap<Index, &'a dyn AnyWritableVec>);
|
||||
pub struct IndexToVec<'a>(BTreeMap<Index, &'a dyn AnyExportableVec>);
|
||||
|
||||
#[derive(Default, Deref, DerefMut)]
|
||||
pub struct MetricToVec<'a>(BTreeMap<&'a str, &'a dyn AnyWritableVec>);
|
||||
pub struct MetricToVec<'a>(BTreeMap<&'a str, &'a dyn AnyExportableVec>);
|
||||
|
||||
Reference in New Issue
Block a user