This commit is contained in:
Dominik Werder
2024-09-18 23:59:03 +02:00
parent e4f8ad1e91
commit 049266bfe5
14 changed files with 211 additions and 65 deletions

View 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>,
}

View File

@@ -0,0 +1,2 @@
use super::___;
use netpod::log::*;

View 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)*); }) }

View File

@@ -0,0 +1,5 @@
use super::___;
use netpod::log::*;
#[allow(unused)]
macro_rules! trace_init { ($($arg:tt)*) => ( if true { trace!($($arg)*); }) }

View 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!()
}
}