WIP
This commit is contained in:
42
crates/items_2/src/binning/container_events.rs
Normal file
42
crates/items_2/src/binning/container_events.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
use super::___;
|
||||
use netpod::TsNano;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_init { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
|
||||
pub trait Container: Clone {}
|
||||
|
||||
impl<T> Container for VecDeque<T> where T: EventValueType {}
|
||||
|
||||
pub trait EventValueType: Clone {
|
||||
type Container: Container;
|
||||
}
|
||||
|
||||
impl EventValueType for f32 {
|
||||
type Container = VecDeque<Self>;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ContainerEvents<EVT>
|
||||
where
|
||||
EVT: EventValueType,
|
||||
{
|
||||
tss: VecDeque<TsNano>,
|
||||
// vals: VecDeque<EVT>,
|
||||
vals: VecDeque<<EVT as EventValueType>::Container>,
|
||||
}
|
||||
|
||||
// TODO why does this already impl Serialize even though there is no bound for EVT?
|
||||
// TODO try to actually instantiate and serialize in a test.
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct ContainerEvents2<EVT>
|
||||
where
|
||||
EVT: EventValueType,
|
||||
{
|
||||
tss: VecDeque<TsNano>,
|
||||
vals: VecDeque<EVT>,
|
||||
}
|
||||
2
crates/items_2/src/binning/test.rs
Normal file
2
crates/items_2/src/binning/test.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
use super::___;
|
||||
use netpod::log::*;
|
||||
14
crates/items_2/src/binning/timeweight.rs
Normal file
14
crates/items_2/src/binning/timeweight.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
pub mod timeweight_bins;
|
||||
pub mod timeweight_events;
|
||||
|
||||
use super::___;
|
||||
use netpod::log::*;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_init { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_ingest { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_ingest_detail { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
5
crates/items_2/src/binning/timeweight/timeweight_bins.rs
Normal file
5
crates/items_2/src/binning/timeweight/timeweight_bins.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use super::___;
|
||||
use netpod::log::*;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_init { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
31
crates/items_2/src/binning/timeweight/timeweight_events.rs
Normal file
31
crates/items_2/src/binning/timeweight/timeweight_events.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use super::super::container_events::EventValueType;
|
||||
use super::___;
|
||||
use futures_util::Stream;
|
||||
use netpod::log::*;
|
||||
use std::collections::VecDeque;
|
||||
use std::marker::PhantomData;
|
||||
use std::pin::Pin;
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_init { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }
|
||||
|
||||
pub struct BinnedEventsTimeweight<EVT>
|
||||
where
|
||||
EVT: EventValueType,
|
||||
{
|
||||
_evt: PhantomData<EVT>,
|
||||
}
|
||||
|
||||
impl<EVT> BinnedEventsTimeweight<EVT> where EVT: EventValueType {}
|
||||
|
||||
pub struct BinnedEventsTimeweightStream {}
|
||||
|
||||
impl Stream for BinnedEventsTimeweightStream {
|
||||
type Item = ();
|
||||
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user