class UndatedEventManager
Defined at line 41 of file ../../third_party/cobalt/src/logger/undated_event_manager.h
UndatedEventManager manages events without timestamps while the clock is inaccurate.
While the system clock is unreliable, Cobalt Loggers will pass incoming Events to the
UndatedEventManager for interim storage. No locally aggregated observations will be generated
during this time. Buffered events will be stored in memory with the boot time they occurred at,
and dropped if a reboot occurs before a clock sync or if a storage quota is reached.
When the UndatedEventManager is notified that the system clock is reliable, it will use the
current offset between the (now accurate) system clock and the boot clock to assign a date to
each buffered event. The events will then moved back into the main logging path, to be either
aggregated on-device or formed into observations.
There should be one instance of UndatedEventManager across all Loggers.
Public Methods
void UndatedEventManager (local_aggregation::LocalAggregation & local_aggregation, ObservationWriter & observation_writer, system_data::SystemDataInterface & system_data, util::CivilTimeConverterInterface & civil_time_converter, std::unique_ptr<util::BootClockInterface> boot_clock, int32_t max_saved_events)
Constructor
The non-optional parameters are needed to be able to construct EventLoggers.
See the EventLogger constructor for their use.
|max_saved_events| The maximum number of saved events. When this limit is reached, old events
are dropped to make room for new events.
Status Save (std::unique_ptr<EventRecord> event_record)
Saves the fact that an event has occurred.
|event_record| The event that occurred.
Status Flush (util::SystemClockInterface * system_clock, InternalMetrics * internal_metrics)
Flush all the saved events now that the system clock is accurate.
|system_clock| The system clock that can now be used to log events.
|internal_metrics| A (possible nullptr) instance of InternalMetrics.
int NumSavedEvents ()
Get the current number of events that are being saved.
Friends
class UndatedEventManagerTest