Collected json result test passes

This commit is contained in:
Dominik Werder
2021-06-09 20:03:58 +02:00
parent 1df36f3aeb
commit 28b4bb3e04
4 changed files with 252 additions and 78 deletions
+15 -4
View File
@@ -17,20 +17,29 @@ pub enum StreamItem<T> {
Stats(StatsItem),
}
// TODO remove in favor of WithLen:
pub trait Bins {
fn bin_count(&self) -> u32;
}
// TODO this is meant for bins, count them, collect range-complete, and deliver these
// information also to the client.
// TODO remove:
pub trait Collected {
fn new(bin_count_exp: u32) -> Self;
fn timed_out(&mut self, k: bool);
}
pub trait Collector {
type Input: Collectable;
type Output: Serialize;
fn ingest(&mut self, src: &Self::Input);
fn set_range_complete(&mut self);
fn set_timed_out(&mut self);
fn result(self) -> Result<Self::Output, Error>;
}
pub trait Collectable {
type Collected: Collected;
fn append_to(&self, collected: &mut Self::Collected);
type Collector: Collector<Input = Self>;
fn new_collector(bin_count_exp: u32) -> Self::Collector;
}
// TODO can be removed?
@@ -39,12 +48,14 @@ pub trait Collectable2: Any {
fn append(&mut self, src: &dyn Any);
}
// TODO remove
pub trait CollectionSpec2 {
// TODO Can I use here associated types and return concrete types?
// Probably not object safe.
fn empty(&self) -> Box<dyn Collectable2>;
}
// TODO rmove
pub trait CollectionSpecMaker2 {
fn spec(bin_count_exp: u32) -> Box<dyn CollectionSpec2>;
}