downsample 0.0.4

keep downsampled history of data over long period of time
Documentation
use crate::{
    aggregatable::{Aggregatable, Algorithm},
    time_based::storage::{Storage},
};
use std::marker::PhantomData;

#[derive(Debug)]
struct LevelInfo<D> {
    barrier:   D,
    algorithm: Algorithm,
}

#[derive(Default, Debug)]
pub struct Builder<T, D> {
    level: Vec<LevelInfo<D>>,
    _data: PhantomData<T>,
}

impl<T, D> Builder<T, D> {
    pub fn build() -> Storage<T, D> {
        Storage {
            _data:  Default::default(),
            _level: Vec::new(),
        }
    }

    pub fn add_level<const A: Algorithm>(mut self, barrier: D) -> Self
    where
        (D, T): Aggregatable<{ A }>,
    {
        self.level.push(LevelInfo { barrier, algorithm: A });
        self
    }
}