Storage for a ring buffer which can hold up to RingBufferCapacity bytes of Base 128-varint delimited variable-length items.
More...
#include "client/length_delimited_ring_buffer.h"
Classes | |
| struct | Header |
| A header containing metadata preceding the ring buffer data. More... | |
Public Types | |
| using | RingBufferArrayType = internal::RingBufferArray<Capacity> |
| The type of the array holding the data in this object. | |
| using | SizeType = internal::Range::Length |
| The type of the size in bytes of operations on this object. | |
Public Member Functions | |
| RingBufferData (RingBufferData &)=delete | |
| RingBufferData & | operator= (RingBufferData &)=delete |
| bool | DeserializeFromBuffer (const void *buffer, SizeType length) |
| Attempts to overwrite the contents of this object by deserializing the buffer into this object. | |
| SizeType | GetRingBufferLength () const |
| void | ResetForTesting () |
| Resets the state of the ring buffer (e.g., for testing). | |
Public Attributes | |
| Header | header |
| The header containing ring buffer metadata. | |
| RingBufferArrayType | data |
| The bytes of the ring buffer data. | |
Static Public Attributes | |
| static constexpr uint32_t | kMagic = 0xcab00d1e |
| The magic signature of the ring buffer. | |
| static constexpr uint32_t | kVersion = 1 |
| The version of the ring buffer. | |
Storage for a ring buffer which can hold up to RingBufferCapacity bytes of Base 128-varint delimited variable-length items.
This struct contains a header immediately followed by the ring buffer data. The current read offset and length are stored in header.data_range.
The structure of this object is:
|magic|version|data_offset|data_length|ring_buffer_data|
To write data to this object, see LengthDelimitedRingBufferWriter. To read data from this object, see LengthDelimitedRingBufferReader.
The bytes of this structure are suitable for direct serialization from memory to disk, e.g. as a crashpad::Annotation.
|
inline |
Attempts to overwrite the contents of this object by deserializing the buffer into this object.
| [in] | buffer | The bytes to deserialize into this object. |
| [in] | length | The length in bytes of buffer. |
true if the buffer was a valid RingBufferData and this object has enough capacity to store its bytes, false otherwise.
|
inline |