nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer

#include <src/lib/profiles/data-management/Current/LoggingManagement.h>

Internal event buffer, built around the nl::Weave::TLV::WeaveCircularTLVBuffer.

Summary

Constructors and Destructors

CircularEventBuffer(uint8_t *inBuffer, size_t inBufferLength, CircularEventBuffer *inPrev, CircularEventBuffer *inNext)
A constructor for the CircularEventBuffer (internal API).

Public attributes

mBuffer
The underlying TLV buffer storing the events in a TLV representation.
mEventIdCounter
mFirstEventID
First event ID stored in the logging subsystem for this importance.
mFirstEventTimestamp
The timestamp of the first event in this buffer.
mFirstEventUTCTimestamp
The UTC timestamp of the first event in this buffer.
mImportance
The buffer is the final bucket for events of this importance.
mLastEventID
Last event ID vended for this importance.
mLastEventTimestamp
The timestamp of the last event in this buffer.
mLastEventUTCTimestamp
The UTC timestamp of the last event in this buffer.
mNext
A pointer CircularEventBuffer storing events more important events.
mNonPersistedCounter
mPrev
A pointer CircularEventBuffer storing events less important events.
mUTCInitialized
bool
Indicates whether UTC timestamps are initialized in this buffer.

Public functions

AddEvent(timestamp_t inEventTimestamp)
void
Given a timestamp of an event, compute the delta time to store in the log.
AddEventUTC(utc_timestamp_t inEventTimestamp)
void
Given a timestamp of an event, compute the delta utc time to store in the log.
IsFinalDestinationForImportance(ImportanceType inImportance) const
bool
A helper function that determines whether the event of specified importance is dropped from this buffer.
LoadEvents(TLVReader & reader)
RemoveEvent(size_t aNumEvents)
void
SerializeEvents(TLVWriter & writer)
VendEventID(void)
Allocate a new event ID based on the event importance, and advance the counter if we have one.

Public static functions

GetNextBufferFunct(nl::Weave::TLV::TLVReader & ioReader, uintptr_t & inBufHandle, const uint8_t *& outBufStart, uint32_t & outBufLen)

Public attributes

mBuffer

nl::Weave::TLV::WeaveCircularTLVBuffer nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mBuffer

The underlying TLV buffer storing the events in a TLV representation.

mEventIdCounter

nl::Weave::MonotonicallyIncreasingCounter * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mEventIdCounter

mFirstEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventID

First event ID stored in the logging subsystem for this importance.

mFirstEventTimestamp

timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventTimestamp

The timestamp of the first event in this buffer.

mFirstEventUTCTimestamp

utc_timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mFirstEventUTCTimestamp

The UTC timestamp of the first event in this buffer.

mImportance

ImportanceType nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mImportance

The buffer is the final bucket for events of this importance.

Events of lesser importance are dropped when they get bumped out of this buffer

mLastEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventID

Last event ID vended for this importance.

mLastEventTimestamp

timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventTimestamp

The timestamp of the last event in this buffer.

mLastEventUTCTimestamp

utc_timestamp_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mLastEventUTCTimestamp

The UTC timestamp of the last event in this buffer.

mNext

CircularEventBuffer * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mNext

A pointer CircularEventBuffer storing events more important events.

mNonPersistedCounter

nl::Weave::MonotonicallyIncreasingCounter nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mNonPersistedCounter

mPrev

CircularEventBuffer * nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mPrev

A pointer CircularEventBuffer storing events less important events.

mUTCInitialized

bool nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::mUTCInitialized

Indicates whether UTC timestamps are initialized in this buffer.

Public functions

AddEvent

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::AddEvent(
  timestamp_t inEventTimestamp
)

Given a timestamp of an event, compute the delta time to store in the log.

Details
Parameters
inEventTimestamp
The event timestamp.
Returns
int32_t Time delta to encode for the event.

AddEventUTC

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::AddEventUTC(
  utc_timestamp_t inEventTimestamp
)

Given a timestamp of an event, compute the delta utc time to store in the log.

Details
Parameters
inEventTimestamp
The event's utc timestamp
Returns
int64_t Time delta to encode for the event.

CircularEventBuffer

 nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::CircularEventBuffer(
  uint8_t *inBuffer,
  size_t inBufferLength,
  CircularEventBuffer *inPrev,
  CircularEventBuffer *inNext
)

A constructor for the CircularEventBuffer (internal API).

Details
Parameters
[in] inBuffer
The actual storage to use for event storage.
[in] inBufferLength
The length of the inBuffer in bytes.
[in] inPrev
The pointer to CircularEventBuffer storing events of lesser priority.
[in] inNext
The pointer to CircularEventBuffer storing events of greater priority.
Returns

IsFinalDestinationForImportance

bool nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::IsFinalDestinationForImportance(
  ImportanceType inImportance
) const 

A helper function that determines whether the event of specified importance is dropped from this buffer.

Details
Parameters
[in] inImportance
Importance of the event.
Return Values
true
The event will be dropped from this buffer as a result of queue overflow.
false
The event will be bumped to the next queue.

LoadEvents

WEAVE_ERROR nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::LoadEvents(
  TLVReader & reader
)

RemoveEvent

void nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::RemoveEvent(
  size_t aNumEvents
)

SerializeEvents

WEAVE_ERROR nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::SerializeEvents(
  TLVWriter & writer
)

VendEventID

event_id_t nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::VendEventID(
  void
)

Allocate a new event ID based on the event importance, and advance the counter if we have one.

Details
Returns
event_id_t Event ID for this importance.

Public static functions

GetNextBufferFunct

WEAVE_ERROR nl::Weave::Profiles::DataManagement_Current::CircularEventBuffer::GetNextBufferFunct(
  nl::Weave::TLV::TLVReader & ioReader,
  uintptr_t & inBufHandle,
  const uint8_t *& outBufStart,
  uint32_t & outBufLen
)