WIP but checks

This commit is contained in:
Dominik Werder
2023-04-05 15:51:10 +02:00
parent 81298b16df
commit 32efc693f5
12 changed files with 188 additions and 28 deletions

View File

@@ -141,16 +141,16 @@ impl BinnedCollected {
self.range_final = true;
}
RangeCompletableItem::Data(k) => match k {
ChannelEvents::Events(events) => {
ChannelEvents::Events(mut events) => {
if self.binner.is_none() {
let bb = events
.as_time_binnable()
.as_time_binnable_mut()
.time_binner_new(self.binrange.clone(), self.do_time_weight);
self.binner = Some(bb);
}
let binner = self.binner.as_mut().unwrap();
trace!("handle_item call binner.ingest");
binner.ingest(events.as_time_binnable());
binner.ingest(events.as_time_binnable_mut());
flush_binned(binner, &mut self.coll, false)?;
}
ChannelEvents::Status(item) => {

View File

@@ -10,6 +10,7 @@ use items_0::collect_s::CollectorType;
use items_0::collect_s::ToJsonResult;
use items_0::scalar_ops::ScalarOps;
use items_0::timebin::TimeBinnable;
use items_0::timebin::TimeBinned;
use items_0::timebin::TimeBinner;
use items_0::timebin::TimeBins;
use items_0::AppendEmptyBin;
@@ -31,7 +32,6 @@ use std::any;
use std::any::Any;
use std::collections::VecDeque;
use std::fmt;
use items_0::timebin::TimeBinned;
#[allow(unused)]
macro_rules! trace4 {
@@ -520,6 +520,7 @@ impl<NTY: ScalarOps> CollectableType for BinsDim0<NTY> {
}
}
#[derive(Debug)]
pub struct BinsDim0Aggregator<NTY> {
range: SeriesRange,
count: u64,
@@ -611,6 +612,7 @@ impl<NTY: ScalarOps> TimeBinnable for BinsDim0<NTY> {
}
}
#[derive(Debug)]
pub struct BinsDim0TimeBinner<NTY: ScalarOps> {
binrange: BinnedRangeEnum,
do_time_weight: bool,
@@ -646,7 +648,7 @@ impl<NTY: ScalarOps> BinsDim0TimeBinner<NTY> {
}
impl<NTY: ScalarOps> TimeBinner for BinsDim0TimeBinner<NTY> {
fn ingest(&mut self, item: &dyn TimeBinnable) {
fn ingest(&mut self, item: &mut dyn TimeBinnable) {
/*let self_name = any::type_name::<Self>();
if item.len() == 0 {
// Return already here, RangeOverlapInfo would not give much sense.

View File

@@ -476,6 +476,7 @@ impl<NTY: ScalarOps> CollectableType for BinsXbinDim0<NTY> {
}
}
#[derive(Debug)]
pub struct BinsXbinDim0Aggregator<NTY> {
range: SeriesRange,
count: u64,
@@ -567,6 +568,7 @@ impl<NTY: ScalarOps> TimeBinnable for BinsXbinDim0<NTY> {
}
}
#[derive(Debug)]
pub struct BinsXbinDim0TimeBinner<NTY: ScalarOps> {
binrange: BinnedRangeEnum,
do_time_weight: bool,
@@ -601,7 +603,7 @@ impl<NTY: ScalarOps> BinsXbinDim0TimeBinner<NTY> {
}
impl<NTY: ScalarOps> TimeBinner for BinsXbinDim0TimeBinner<NTY> {
fn ingest(&mut self, item: &dyn TimeBinnable) {
fn ingest(&mut self, item: &mut dyn TimeBinnable) {
/*let self_name = std::any::type_name::<Self>();
if item.len() == 0 {
// Return already here, RangeOverlapInfo would not give much sense.

View File

@@ -656,7 +656,8 @@ impl RangeOverlapInfo for ChannelEvents {
impl TimeBinnable for ChannelEvents {
fn time_binner_new(&self, binrange: BinnedRangeEnum, do_time_weight: bool) -> Box<dyn TimeBinner> {
todo!()
let ret = <ChannelEvents as TimeBinnableTy>::time_binner_new(&self, binrange, do_time_weight);
Box::new(ret)
}
fn to_box_to_json_result(&self) -> Box<dyn items_0::collect_s::ToJsonResult> {
@@ -671,7 +672,7 @@ impl EventsNonObj for ChannelEvents {
}
impl Events for ChannelEvents {
fn as_time_binnable(&self) -> &dyn TimeBinnable {
fn as_time_binnable_mut(&mut self) -> &mut dyn TimeBinnable {
todo!()
}
@@ -787,7 +788,7 @@ impl TimeBinnerTy for ChannelEventsTimeBinner {
self.binner = Some(binner);
}
match self.binner.as_mut() {
Some(binner) => binner.ingest(item.as_time_binnable()),
Some(binner) => binner.ingest(item.as_time_binnable_mut()),
None => {
error!("ingest without active binner item {item:?}");
()
@@ -842,6 +843,40 @@ impl TimeBinnerTy for ChannelEventsTimeBinner {
}
}
impl TimeBinner for ChannelEventsTimeBinner {
fn ingest(&mut self, item: &mut dyn TimeBinnable) {
if let Some(item) = item.as_any_mut().downcast_mut::<ChannelEvents>() {
TimeBinnerTy::ingest(self, item)
} else {
panic!()
}
}
fn bins_ready_count(&self) -> usize {
todo!()
}
fn bins_ready(&mut self) -> Option<Box<dyn TimeBinned>> {
todo!()
}
fn push_in_progress(&mut self, push_empty: bool) {
todo!()
}
fn cycle(&mut self) {
todo!()
}
fn set_range_complete(&mut self) {
todo!()
}
fn empty(&self) -> Box<dyn TimeBinned> {
todo!()
}
}
impl TimeBinnableTy for ChannelEvents {
type TimeBinner = ChannelEventsTimeBinner;

View File

@@ -444,6 +444,7 @@ impl<NTY: ScalarOps> items_0::collect_s::CollectableType for EventsDim0<NTY> {
}
}
#[derive(Debug)]
pub struct EventsDim0Aggregator<NTY> {
range: SeriesRange,
count: u64,
@@ -768,8 +769,8 @@ impl<STY: ScalarOps> EventsNonObj for EventsDim0<STY> {
}
impl<STY: ScalarOps> Events for EventsDim0<STY> {
fn as_time_binnable(&self) -> &dyn TimeBinnable {
self as &dyn TimeBinnable
fn as_time_binnable_mut(&mut self) -> &mut dyn TimeBinnable {
self as &mut dyn TimeBinnable
}
fn verify(&self) -> bool {
@@ -913,6 +914,7 @@ impl<STY: ScalarOps> Events for EventsDim0<STY> {
}
}
#[derive(Debug)]
pub struct EventsDim0TimeBinner<NTY: ScalarOps> {
binrange: BinnedRangeEnum,
rix: usize,
@@ -972,7 +974,7 @@ impl<NTY: ScalarOps> TimeBinner for EventsDim0TimeBinner<NTY> {
}
}
fn ingest(&mut self, item: &dyn TimeBinnable) {
fn ingest(&mut self, item: &mut dyn TimeBinnable) {
let self_name = any::type_name::<Self>();
trace2!(
"TimeBinner for {self_name} ingest agg.range {:?} item {:?}",

View File

@@ -354,6 +354,7 @@ impl<NTY: ScalarOps> CollectableType for EventsDim1<NTY> {
}
}
#[derive(Debug)]
pub struct EventsDim1Aggregator<NTY> {
range: SeriesRange,
count: u64,
@@ -667,8 +668,8 @@ impl<STY: ScalarOps> EventsNonObj for EventsDim1<STY> {
}
impl<STY: ScalarOps> Events for EventsDim1<STY> {
fn as_time_binnable(&self) -> &dyn TimeBinnable {
self as &dyn TimeBinnable
fn as_time_binnable_mut(&mut self) -> &mut dyn TimeBinnable {
self as &mut dyn TimeBinnable
}
fn verify(&self) -> bool {
@@ -812,6 +813,7 @@ impl<STY: ScalarOps> Events for EventsDim1<STY> {
}
}
#[derive(Debug)]
pub struct EventsDim1TimeBinner<NTY: ScalarOps> {
edges: VecDeque<u64>,
agg: EventsDim1Aggregator<NTY>,
@@ -877,7 +879,7 @@ impl<NTY: ScalarOps> TimeBinner for EventsDim1TimeBinner<NTY> {
}
}
fn ingest(&mut self, item: &dyn TimeBinnable) {
fn ingest(&mut self, item: &mut dyn TimeBinnable) {
/*let self_name = std::any::type_name::<Self>();
trace2!(
"TimeBinner for EventsDim1TimeBinner {:?}\n{:?}\n------------------------------------",