pub fn publish_batch(&mut self, time: &Duration, data: &mut Vec<(Duration, E, T)>) {
        let new_time_ms =
            (((time.as_millis() as Timestamp) / self.granularity_ms) + 1) * self.granularity_ms;
        if !data.is_empty() {
            // If we don't need to grow our buffer, move
            if data.len() > self.buffer.capacity() - self.buffer.len() {
                self.event_pusher.push(Event::Messages(
                    self.time_ms as Timestamp,
                    self.buffer.drain(..).collect(),
                ));
            }

            self.buffer.append(data);
        }
        if self.time_ms < new_time_ms {
            // Flush buffered events that may need to advance.
            self.event_pusher.push(Event::Messages(
                self.time_ms as Timestamp,
                self.buffer.drain(..).collect(),
            ));
            if self.buffer.capacity() > Self::buffer_capacity() {
                self.buffer = Vec::with_capacity(Self::buffer_capacity())
            }

            // In principle we can buffer up until this point, if that is appealing to us.
            // We could buffer more aggressively if the logging granularity were exposed
            // here, as the forward ticks would be that much less frequent.
            self.event_pusher
                .push(Event::Progress(vec![(new_time_ms, 1), (self.time_ms, -1)]));
        }
        self.time_ms = new_time_ms;
    }
/// Publishes a batch of logged events and advances the capability.
Publishes a batch of logged events and advances the capability.
Publishes a batch of logged events and advances the capability .
pub fn publish_batch(&mut self, time: &Duration, data: &mut Vec<(Duration, E, T)>) {
        let new_time_ms =
            (((time.as_millis() as Timestamp) / self.granularity_ms) + 1) * self.granularity_ms;
        if !data.is_empty() {
            // If we don't need to grow our buffer, move
            if data.len() > self.buffer.capacity() - self.buffer.len() {
                self.event_pusher.push(Event::Messages(
                    self.time_ms as Timestamp,
                    self.buffer.drain(..).collect(),
                ));
            }
            self.buffer.append(data);
        }
        if self.time_ms < new_time_ms {
            // Flush buffered events that may need to advance.
            self.event_pusher.push(Event::Messages(
                self.time_ms as Timestamp,
                self.buffer.drain(..).collect(),
            ));
            if self.buffer.capacity() > Self::buffer_capacity() {
                self.buffer = Vec::with_capacity(Self::buffer_capacity())
            }
            // In principle we can buffer up until this point, if that is appealing to us.
            // We could buffer more aggressively if the logging granularity were exposed
            // here, as the forward ticks would be that much less frequent.
            self.event_pusher
                .push(Event::Progress(vec![(new_time_ms, 1), (self.time_ms, -1)]));
        }
        self.time_ms = new_time_ms;
    }
pub fn publish_batch ( & mut self , time : & Duration , data : & mut Vec < ( Duration , E , T ) > ) { let new_time_ms = ( ( ( time . as_millis ( ) as Timestamp ) / self . granularity_ms ) + 1 ) * self . granularity_ms ; if ! data . is_empty ( ) { // If we don't need to grow our buffer, move if data . len ( ) > self . buffer . capacity ( ) - self . buffer . len ( ) { self . event_pusher . push ( Event :: Messages ( self . time_ms as Timestamp , self . buffer . drain ( .. ) . collect ( ) , ) ) ; } self . buffer . append ( data ) ; } if self . time_ms < new_time_ms { // Flush buffered events that may need to advance. self . event_pusher . push ( Event :: Messages ( self . time_ms as Timestamp , self . buffer . drain ( .. ) . collect ( ) , ) ) ; if self . buffer . capacity ( ) > Self :: buffer_capacity ( ) { self . buffer = Vec :: with_capacity ( Self :: buffer_capacity ( ) ) } // In principle we can buffer up until this point, if that is appealing to us. // We could buffer more aggressively if the logging granularity were exposed // here, as the forward ticks would be that much less frequent. self . event_pusher . push ( Event :: Progress ( vec ! [ ( new_time_ms 1 ) ( self time_ms 1 ) ] ) ) ; } self . time_ms = new_time_ms ; }
Publishes a batch of logged events and advances the capability.
Publishes a batch of logged events and advances the capability .
&mut self
time
&Duration
data
&mut Vec<(Duration, E, T)>
&mut self
time
&Duration
data
&mut Vec<(Duration, E, T)>