Rename modules
This commit is contained in:
@@ -7,7 +7,7 @@ use err::Error;
|
||||
use futures_util::{StreamExt, TryStreamExt};
|
||||
use http::StatusCode;
|
||||
use hyper::Body;
|
||||
use items::minmaxavgbins::MinMaxAvgBins;
|
||||
use items::binsdim0::MinMaxAvgDim0Bins;
|
||||
use items::{FrameType, RangeCompletableItem, Sitemty, StatsItem, StreamItem, SubFrId, WithLen};
|
||||
use netpod::query::{BinnedQuery, CacheUsage};
|
||||
use netpod::{log::*, AppendToUrl};
|
||||
@@ -102,7 +102,7 @@ where
|
||||
let channel = Channel {
|
||||
backend: channel_backend.into(),
|
||||
name: channel_name.into(),
|
||||
series:None,
|
||||
series: None,
|
||||
};
|
||||
let range = NanoRange::from_date_time(beg_date, end_date);
|
||||
let mut query = BinnedQuery::new(channel, range, bin_count, agg_kind);
|
||||
@@ -195,10 +195,10 @@ where
|
||||
None
|
||||
}
|
||||
StreamItem::DataItem(frame) => {
|
||||
if frame.tyid() != <Sitemty<MinMaxAvgBins<NTY>> as FrameType>::FRAME_TYPE_ID {
|
||||
if frame.tyid() != <Sitemty<MinMaxAvgDim0Bins<NTY>> as FrameType>::FRAME_TYPE_ID {
|
||||
error!("test receives unexpected tyid {:x}", frame.tyid());
|
||||
}
|
||||
match bincode::deserialize::<Sitemty<MinMaxAvgBins<NTY>>>(frame.buf()) {
|
||||
match bincode::deserialize::<Sitemty<MinMaxAvgDim0Bins<NTY>>>(frame.buf()) {
|
||||
Ok(item) => match item {
|
||||
Ok(item) => match item {
|
||||
StreamItem::Log(item) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ use std::marker::PhantomData;
|
||||
use tokio::fs::File;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct MinMaxAvgBins<NTY> {
|
||||
pub struct MinMaxAvgDim0Bins<NTY> {
|
||||
pub ts1s: Vec<u64>,
|
||||
pub ts2s: Vec<u64>,
|
||||
pub counts: Vec<u64>,
|
||||
@@ -27,14 +27,14 @@ pub struct MinMaxAvgBins<NTY> {
|
||||
pub avgs: Vec<Option<f32>>,
|
||||
}
|
||||
|
||||
impl<NTY> SitemtyFrameType for MinMaxAvgBins<NTY>
|
||||
impl<NTY> SitemtyFrameType for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: SubFrId,
|
||||
{
|
||||
const FRAME_TYPE_ID: u32 = crate::MIN_MAX_AVG_BINS + NTY::SUB;
|
||||
}
|
||||
|
||||
impl<NTY> fmt::Debug for MinMaxAvgBins<NTY>
|
||||
impl<NTY> fmt::Debug for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: fmt::Debug,
|
||||
{
|
||||
@@ -53,7 +53,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> MinMaxAvgBins<NTY> {
|
||||
impl<NTY> MinMaxAvgDim0Bins<NTY> {
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
ts1s: vec![],
|
||||
@@ -66,7 +66,7 @@ impl<NTY> MinMaxAvgBins<NTY> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> FitsInside for MinMaxAvgBins<NTY> {
|
||||
impl<NTY> FitsInside for MinMaxAvgDim0Bins<NTY> {
|
||||
fn fits_inside(&self, range: NanoRange) -> Fits {
|
||||
if self.ts1s.is_empty() {
|
||||
Fits::Empty
|
||||
@@ -90,7 +90,7 @@ impl<NTY> FitsInside for MinMaxAvgBins<NTY> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> FilterFittingInside for MinMaxAvgBins<NTY> {
|
||||
impl<NTY> FilterFittingInside for MinMaxAvgDim0Bins<NTY> {
|
||||
fn filter_fitting_inside(self, fit_range: NanoRange) -> Option<Self> {
|
||||
match self.fits_inside(fit_range) {
|
||||
Fits::Inside | Fits::PartlyGreater | Fits::PartlyLower | Fits::PartlyLowerAndGreater => Some(self),
|
||||
@@ -99,7 +99,7 @@ impl<NTY> FilterFittingInside for MinMaxAvgBins<NTY> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> RangeOverlapInfo for MinMaxAvgBins<NTY> {
|
||||
impl<NTY> RangeOverlapInfo for MinMaxAvgDim0Bins<NTY> {
|
||||
fn ends_before(&self, range: NanoRange) -> bool {
|
||||
match self.ts2s.last() {
|
||||
Some(&ts) => ts <= range.beg,
|
||||
@@ -122,7 +122,7 @@ impl<NTY> RangeOverlapInfo for MinMaxAvgBins<NTY> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> TimeBins for MinMaxAvgBins<NTY>
|
||||
impl<NTY> TimeBins for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
@@ -135,13 +135,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> WithLen for MinMaxAvgBins<NTY> {
|
||||
impl<NTY> WithLen for MinMaxAvgDim0Bins<NTY> {
|
||||
fn len(&self) -> usize {
|
||||
self.ts1s.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> Appendable for MinMaxAvgBins<NTY>
|
||||
impl<NTY> Appendable for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
@@ -159,7 +159,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> ReadableFromFile for MinMaxAvgBins<NTY>
|
||||
impl<NTY> ReadableFromFile for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
@@ -174,11 +174,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> TimeBinnableType for MinMaxAvgBins<NTY>
|
||||
impl<NTY> TimeBinnableType for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
type Aggregator = MinMaxAvgBinsAggregator<NTY>;
|
||||
|
||||
fn aggregator(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
|
||||
@@ -190,7 +190,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> ToJsonResult for Sitemty<MinMaxAvgBins<NTY>>
|
||||
impl<NTY> ToJsonResult for Sitemty<MinMaxAvgDim0Bins<NTY>>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
@@ -236,7 +236,7 @@ pub struct MinMaxAvgBinsCollector<NTY> {
|
||||
bin_count_exp: u32,
|
||||
timed_out: bool,
|
||||
range_complete: bool,
|
||||
vals: MinMaxAvgBins<NTY>,
|
||||
vals: MinMaxAvgDim0Bins<NTY>,
|
||||
_m1: PhantomData<NTY>,
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ impl<NTY> MinMaxAvgBinsCollector<NTY> {
|
||||
bin_count_exp,
|
||||
timed_out: false,
|
||||
range_complete: false,
|
||||
vals: MinMaxAvgBins::<NTY>::empty(),
|
||||
vals: MinMaxAvgDim0Bins::<NTY>::empty(),
|
||||
_m1: PhantomData,
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ impl<NTY> Collector for MinMaxAvgBinsCollector<NTY>
|
||||
where
|
||||
NTY: NumOps + Serialize,
|
||||
{
|
||||
type Input = MinMaxAvgBins<NTY>;
|
||||
type Input = MinMaxAvgDim0Bins<NTY>;
|
||||
type Output = MinMaxAvgBinsCollectedResult<NTY>;
|
||||
|
||||
fn ingest(&mut self, src: &Self::Input) {
|
||||
@@ -315,7 +315,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<NTY> Collectable for MinMaxAvgBins<NTY>
|
||||
impl<NTY> Collectable for MinMaxAvgDim0Bins<NTY>
|
||||
where
|
||||
NTY: NumOps + Serialize,
|
||||
{
|
||||
@@ -352,8 +352,8 @@ impl<NTY> TimeBinnableTypeAggregator for MinMaxAvgBinsAggregator<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Input = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Input = MinMaxAvgDim0Bins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
|
||||
fn range(&self) -> &NanoRange {
|
||||
&self.range
|
||||
@@ -1,9 +1,9 @@
|
||||
pub mod binnedevents;
|
||||
pub mod binsdim0;
|
||||
pub mod binsdim1;
|
||||
pub mod eventsitem;
|
||||
pub mod frame;
|
||||
pub mod inmem;
|
||||
pub mod minmaxavgbins;
|
||||
pub mod minmaxavgdim1bins;
|
||||
pub mod numops;
|
||||
pub mod plainevents;
|
||||
pub mod scalarevents;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::minmaxavgbins::MinMaxAvgBins;
|
||||
use crate::binsdim0::MinMaxAvgDim0Bins;
|
||||
use crate::numops::NumOps;
|
||||
use crate::streams::{Collectable, Collector};
|
||||
use crate::{
|
||||
@@ -217,7 +217,7 @@ impl<NTY> TimeBinnableType for ScalarEvents<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
type Aggregator = EventValuesAggregator<NTY>;
|
||||
|
||||
fn aggregator(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
|
||||
@@ -442,13 +442,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn result_reset_unweight(&mut self, range: NanoRange, _expand: bool) -> MinMaxAvgBins<NTY> {
|
||||
fn result_reset_unweight(&mut self, range: NanoRange, _expand: bool) -> MinMaxAvgDim0Bins<NTY> {
|
||||
let avg = if self.sumc == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(self.sum / self.sumc as f32)
|
||||
};
|
||||
let ret = MinMaxAvgBins {
|
||||
let ret = MinMaxAvgDim0Bins {
|
||||
ts1s: vec![self.range.beg],
|
||||
ts2s: vec![self.range.end],
|
||||
counts: vec![self.count],
|
||||
@@ -466,7 +466,7 @@ where
|
||||
ret
|
||||
}
|
||||
|
||||
fn result_reset_time_weight(&mut self, range: NanoRange, expand: bool) -> MinMaxAvgBins<NTY> {
|
||||
fn result_reset_time_weight(&mut self, range: NanoRange, expand: bool) -> MinMaxAvgDim0Bins<NTY> {
|
||||
// TODO check callsite for correct expand status.
|
||||
if true || expand {
|
||||
debug!("result_reset_time_weight calls apply_event_time_weight");
|
||||
@@ -478,7 +478,7 @@ where
|
||||
let sc = self.range.delta() as f32 * 1e-9;
|
||||
Some(self.sum / sc)
|
||||
};
|
||||
let ret = MinMaxAvgBins {
|
||||
let ret = MinMaxAvgDim0Bins {
|
||||
ts1s: vec![self.range.beg],
|
||||
ts2s: vec![self.range.end],
|
||||
counts: vec![self.count],
|
||||
@@ -502,7 +502,7 @@ where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Input = ScalarEvents<NTY>;
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
|
||||
fn range(&self) -> &NanoRange {
|
||||
&self.range
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::minmaxavgdim1bins::MinMaxAvgDim1Bins;
|
||||
use crate::binsdim1::MinMaxAvgDim1Bins;
|
||||
use crate::numops::NumOps;
|
||||
use crate::xbinnedscalarevents::XBinnedScalarEvents;
|
||||
use crate::xbinnedwaveevents::XBinnedWaveEvents;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::minmaxavgbins::MinMaxAvgBins;
|
||||
use crate::binsdim0::MinMaxAvgDim0Bins;
|
||||
use crate::numops::NumOps;
|
||||
use crate::streams::{Collectable, Collector};
|
||||
use crate::{
|
||||
@@ -175,7 +175,7 @@ impl<NTY> TimeBinnableType for XBinnedScalarEvents<NTY>
|
||||
where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
type Aggregator = XBinnedScalarEventsAggregator<NTY>;
|
||||
|
||||
fn aggregator(range: NanoRange, x_bin_count: usize, do_time_weight: bool) -> Self::Aggregator {
|
||||
@@ -315,13 +315,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn result_reset_unweight(&mut self, range: NanoRange, _expand: bool) -> MinMaxAvgBins<NTY> {
|
||||
fn result_reset_unweight(&mut self, range: NanoRange, _expand: bool) -> MinMaxAvgDim0Bins<NTY> {
|
||||
let avg = if self.sumc == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(self.sum / self.sumc as f32)
|
||||
};
|
||||
let ret = MinMaxAvgBins {
|
||||
let ret = MinMaxAvgDim0Bins {
|
||||
ts1s: vec![self.range.beg],
|
||||
ts2s: vec![self.range.end],
|
||||
counts: vec![self.count],
|
||||
@@ -339,7 +339,7 @@ where
|
||||
ret
|
||||
}
|
||||
|
||||
fn result_reset_time_weight(&mut self, range: NanoRange, expand: bool) -> MinMaxAvgBins<NTY> {
|
||||
fn result_reset_time_weight(&mut self, range: NanoRange, expand: bool) -> MinMaxAvgDim0Bins<NTY> {
|
||||
// TODO check callsite for correct expand status.
|
||||
if true || expand {
|
||||
self.apply_event_time_weight(self.range.end);
|
||||
@@ -348,7 +348,7 @@ where
|
||||
let sc = self.range.delta() as f32 * 1e-9;
|
||||
Some(self.sum / sc)
|
||||
};
|
||||
let ret = MinMaxAvgBins {
|
||||
let ret = MinMaxAvgDim0Bins {
|
||||
ts1s: vec![self.range.beg],
|
||||
ts2s: vec![self.range.end],
|
||||
counts: vec![self.count],
|
||||
@@ -372,7 +372,7 @@ where
|
||||
NTY: NumOps,
|
||||
{
|
||||
type Input = XBinnedScalarEvents<NTY>;
|
||||
type Output = MinMaxAvgBins<NTY>;
|
||||
type Output = MinMaxAvgDim0Bins<NTY>;
|
||||
|
||||
fn range(&self) -> &NanoRange {
|
||||
&self.range
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::minmaxavgdim1bins::MinMaxAvgDim1Bins;
|
||||
use crate::binsdim1::MinMaxAvgDim1Bins;
|
||||
use crate::numops::NumOps;
|
||||
use crate::streams::{Collectable, Collector};
|
||||
use crate::{
|
||||
|
||||
Reference in New Issue
Block a user