/// Adds a timeseries to a Bitmap based on it's timestamp.
/// # Arguments
/// * `timeseries_id` - The segment timeseries id for the timeseries.
/// * `timestamp` - The timestamp for the timeseries
Adds a timeseries to a Bitmap based on it's timestamp.
Adds a timeseries to a Bitmap based on it ' s timestamp .
pub fn add_timeseries(&mut self, timeseries_id: u32, timestamp: u64) -> Result<()> {
        if timestamp < self.start_epoch {
            return Err(MystError::new_write_error(
                "Timestamp cannot be before epoch of segment",
            ));
        }
        let mut last_epoch = self.start_epoch;
        for (epoch, bitmap) in &mut self.epoch_bitmap {
            last_epoch = *epoch;
            if timestamp < epoch + EPOCH_DURATION {
                bitmap.add(timeseries_id);
                return Ok(());
            }
        }
        let next_epoch = last_epoch + EPOCH_DURATION;
        self.epoch_bitmap.insert(next_epoch, Bitmap::create());
        self.epoch_bitmap
            .get_mut(&next_epoch)
            .unwrap()
            .add(timeseries_id);
        Ok(())
    }
pub fn add_timeseries ( & mut self , timeseries_id : u32 , timestamp : u64 ) -> Result < ( ) > { if timestamp < self . start_epoch { return Err ( MystError :: new_write_error ( " " , ) ) ; } let mut last_epoch = self . start_epoch ; for ( epoch , bitmap ) in & mut self . epoch_bitmap { last_epoch = * epoch ; if timestamp < epoch + EPOCH_DURATION { bitmap . add ( timeseries_id ) ; return Ok ( ( ) ) ; } } let next_epoch = last_epoch + EPOCH_DURATION ; self . epoch_bitmap . insert ( next_epoch , Bitmap :: create ( ) ) ; self . epoch_bitmap . get_mut ( & next_epoch ) . unwrap ( ) . add ( timeseries_id ) ; Ok ( ( ) ) }
Adds a timeseries to a Bitmap based on it's timestamp.
Adds a timeseries to a Bitmap based on it ' s timestamp .
&mut self
timeseries_id
u32
timestamp
u64