WIP on time weight bins

This commit is contained in:
Dominik Werder
2021-09-08 13:45:46 +02:00
parent 0a05082da8
commit 75abb4140a
20 changed files with 357 additions and 268 deletions

View File

@@ -21,9 +21,12 @@ where
S: Stream<Item = Sitemty<TBT>>,
TBT: TimeBinnableType,
{
#[allow(unused)]
inp: Pin<Box<S>>,
#[allow(unused)]
left: Option<Poll<Option<Sitemty<TBT>>>>,
//aggtor: Option<<TBT as TimeBinnableType>::Aggregator>,
#[allow(unused)]
a: Option<TBT>,
}
@@ -34,7 +37,6 @@ where
{
inp: Pin<Box<S>>,
spec: BinnedRange,
x_bin_count: usize,
curbin: u32,
left: Option<Poll<Option<Sitemty<TBT>>>>,
aggtor: Option<<TBT as TimeBinnableType>::Aggregator>,
@@ -45,7 +47,6 @@ where
range_complete_emitted: bool,
errored: bool,
completed: bool,
do_time_weight: bool,
}
impl<S, TBT> TBinnerStream<S, TBT>
@@ -58,7 +59,6 @@ where
Self {
inp: Box::pin(inp),
spec,
x_bin_count,
curbin: 0,
left: None,
aggtor: Some(<TBT as TimeBinnableType>::aggregator(
@@ -73,7 +73,6 @@ where
range_complete_emitted: false,
errored: false,
completed: false,
do_time_weight,
}
}

View File

@@ -5,8 +5,8 @@ use err::Error;
use futures_core::Stream;
use futures_util::StreamExt;
use items::{LogItem, RangeCompletableItem, StreamItem};
use netpod::log::*;
use netpod::timeunits::SEC;
use netpod::{log::*, ByteSize};
use netpod::{ChannelConfig, NanoRange, Node};
use std::pin::Pin;
use std::sync::atomic::AtomicU64;
@@ -69,6 +69,10 @@ impl EventChunkerMultifile {
self.seen_before_range_count
}
pub fn seen_after_range_count(&self) -> usize {
self.seen_after_range_count
}
pub fn close(&mut self) {
if let Some(evs) = &mut self.evs {
self.seen_before_range_count += evs.seen_before_range_count();
@@ -153,9 +157,10 @@ impl Stream for EventChunkerMultifile {
}
}
#[cfg(test)]
fn read_expanded_for_range(range: netpod::NanoRange) -> Result<(usize, usize), Error> {
use netpod::timeunits::*;
use netpod::Nanos;
use netpod::{ByteSize, Nanos};
let chn = netpod::Channel {
backend: "testbackend".into(),
name: "scalar-i32-be".into(),