Remove MinMaxAvgScalarEventBatchGen

This commit is contained in:
Dominik Werder
2021-06-09 21:04:56 +02:00
parent 3e45dca6e7
commit 5fddfad249
5 changed files with 8 additions and 202 deletions

View File

@@ -6,7 +6,7 @@ use crate::binned::{
FilterFittingInside, MinMaxAvgAggregator, MinMaxAvgBins, NumOps, RangeCompletableItem, RangeOverlapInfo, ReadPbv,
ReadableFromFile, SingleXBinAggregator,
};
use crate::decode::{EventValues, MinMaxAvgScalarEventBatchGen};
use crate::decode::EventValues;
use crate::frame::makeframe::Framable;
use crate::Sitemty;
use err::Error;
@@ -25,11 +25,6 @@ pub struct DefaultBinsTimeBinner<NTY> {
_m1: PhantomData<NTY>,
}
pub trait Aggregator3Tdim {
type InputValue;
type OutputValue;
}
pub trait TimeBinnableTypeAggregator: Send {
type Input: TimeBinnableType;
type Output: TimeBinnableType;
@@ -218,57 +213,3 @@ where
}
}
}
pub struct MinMaxAvgScalarEventBatchGenAggregator<NTY>
where
NTY: NumOps,
{
_m1: PhantomData<NTY>,
}
impl<NTY> TimeBinnableTypeAggregator for MinMaxAvgScalarEventBatchGenAggregator<NTY>
where
NTY: NumOps,
{
type Input = MinMaxAvgScalarEventBatchGen<NTY>;
type Output = MinMaxAvgScalarEventBatchGen<NTY>;
fn range(&self) -> &NanoRange {
todo!()
}
fn ingest(&mut self, item: &Self::Input) {
todo!()
}
fn result(self) -> Self::Output {
todo!()
}
}
impl<NTY> ReadableFromFile for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn read_from_file(file: File) -> Result<ReadPbv<Self>, Error> {
todo!()
}
fn from_buf(buf: &[u8]) -> Result<Self, Error> {
todo!()
}
}
// TODO this is just dummy, do I use this in the refactored code?
impl<NTY> TimeBinnableType for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
// TODO Output is just dummy, because this type is probably unused anyways.
type Output = MinMaxAvgScalarEventBatchGen<NTY>;
type Aggregator = MinMaxAvgScalarEventBatchGenAggregator<NTY>;
fn aggregator(range: NanoRange) -> Self::Aggregator {
todo!()
}
}

View File

@@ -4,7 +4,7 @@ use crate::binned::{
EventsNodeProcessor, FilterFittingInside, MinMaxAvgBins, NumOps, PushableIndex, RangeOverlapInfo, ReadPbv,
ReadableFromFile, WithLen, WithTimestamps,
};
use crate::decode::{EventValues, MinMaxAvgScalarEventBatchGen};
use crate::decode::EventValues;
use err::Error;
use netpod::NanoRange;
use serde::de::DeserializeOwned;

View File

@@ -10,7 +10,7 @@ use crate::binned::{EventsNodeProcessor, NumOps, PushableIndex, RangeCompletable
use crate::cache::node_ix_for_patch;
use crate::decode::{
BigEndian, Endianness, EventValueFromBytes, EventValueShape, EventValuesDim0Case, EventValuesDim1Case,
LittleEndian, NumFromBytes, ProcAA, ProcBB,
LittleEndian, NumFromBytes,
};
use crate::frame::makeframe::{Framable, FrameType};
use crate::Sitemty;

View File

@@ -119,36 +119,13 @@ impl<NTY> EventValuesDim0Case<NTY> {
}
}
// TODO get rid of this dummy:
pub struct ProcAA<NTY> {
_m1: PhantomData<NTY>,
}
impl<NTY> EventsNodeProcessor for ProcAA<NTY>
where
NTY: NumOps,
{
type Input = NTY;
type Output = EventValues<NTY>;
fn process(_inp: EventValues<Self::Input>) -> Self::Output {
todo!()
}
}
impl<NTY, END> EventValueShape<NTY, END> for EventValuesDim0Case<NTY>
where
NTY: NumOps + NumFromBytes<NTY, END>,
{
type NumXAggToSingleBin = Identity<NTY>;
// TODO:
type NumXAggToNBins = ProcAA<NTY>;
}
impl<NTY> WithTimestamps for ProcAA<NTY> {
fn ts(&self, ix: usize) -> u64 {
todo!()
}
// TODO is this sufficient?
type NumXAggToNBins = Identity<NTY>;
}
pub struct EventValuesDim1Case<NTY> {
@@ -162,118 +139,13 @@ impl<NTY> EventValuesDim1Case<NTY> {
}
}
pub struct ProcBB<NTY> {
_m1: PhantomData<NTY>,
}
// TODO still in use or can go away?
#[derive(Serialize, Deserialize)]
pub struct MinMaxAvgScalarEventBatchGen<NTY> {
pub tss: Vec<u64>,
pub mins: Vec<Option<NTY>>,
pub maxs: Vec<Option<NTY>>,
pub avgs: Vec<Option<f32>>,
}
impl<NTY> MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
pub fn empty() -> Self {
Self {
tss: vec![],
mins: vec![],
maxs: vec![],
avgs: vec![],
}
}
}
impl<NTY> WithTimestamps for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn ts(&self, ix: usize) -> u64 {
self.tss[ix]
}
}
impl<NTY> FilterFittingInside for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn filter_fitting_inside(self, fit_range: NanoRange) -> Option<Self> {
todo!()
}
}
impl<NTY> WithLen for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn len(&self) -> usize {
todo!()
}
}
impl<NTY> Appendable for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn empty() -> Self {
todo!()
}
fn append(&mut self, src: &Self) {
todo!()
}
}
impl<NTY> RangeOverlapInfo for MinMaxAvgScalarEventBatchGen<NTY>
where
NTY: NumOps,
{
fn ends_before(&self, range: NanoRange) -> bool {
todo!()
}
fn ends_after(&self, range: NanoRange) -> bool {
todo!()
}
fn starts_after(&self, range: NanoRange) -> bool {
todo!()
}
}
impl<NTY> Framable for Result<StreamItem<RangeCompletableItem<MinMaxAvgScalarEventBatchGen<NTY>>>, Error>
where
NTY: NumOps + Serialize,
{
fn make_frame(&self) -> Result<BytesMut, Error> {
make_frame(self)
}
}
impl<NTY> EventsNodeProcessor for ProcBB<NTY>
where
NTY: NumOps,
{
type Input = Vec<NTY>;
type Output = MinMaxAvgScalarEventBatchGen<NTY>;
fn process(inp: EventValues<Self::Input>) -> Self::Output {
err::todoval()
}
}
impl<NTY, END> EventValueShape<NTY, END> for EventValuesDim1Case<NTY>
where
NTY: NumOps + NumFromBytes<NTY, END>,
{
type NumXAggToSingleBin = WaveXBinner<NTY>;
// TODO:
type NumXAggToNBins = ProcBB<NTY>;
// TODO implement this method:
type NumXAggToNBins = WaveXBinner<NTY>;
}
// TODO add pulse.

View File

@@ -3,7 +3,7 @@ use crate::agg::eventbatch::MinMaxAvgScalarEventBatch;
use crate::agg::scalarbinbatch::MinMaxAvgScalarBinBatch;
use crate::agg::streams::StreamItem;
use crate::binned::{MinMaxAvgBins, NumOps, RangeCompletableItem};
use crate::decode::{EventValues, MinMaxAvgScalarEventBatchGen};
use crate::decode::EventValues;
use crate::frame::inmem::InMemoryFrame;
use crate::raw::EventQueryJsonStringFrame;
use crate::Sitemty;
@@ -76,13 +76,6 @@ impl FrameType for Sitemty<MinMaxAvgScalarEventBatch> {
const FRAME_TYPE_ID: u32 = 0x300;
}
impl<NTY> FrameType for Sitemty<MinMaxAvgScalarEventBatchGen<NTY>>
where
NTY: NumOps,
{
const FRAME_TYPE_ID: u32 = 0x400 + NTY::SUB;
}
impl<NTY> FrameType for Sitemty<EventValues<NTY>>
where
NTY: NumOps,