Crashpad
 
Loading...
Searching...
No Matches
crashpad::RingBufferData< Capacity > Struct Template Referencefinal

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"

Collaboration diagram for crashpad::RingBufferData< Capacity >:
[legend]

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
 
RingBufferDataoperator= (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.
 

Detailed Description

template<RingBufferCapacity Capacity>
struct crashpad::RingBufferData< Capacity >

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.

Member Function Documentation

◆ DeserializeFromBuffer()

template<RingBufferCapacity Capacity>
bool crashpad::RingBufferData< Capacity >::DeserializeFromBuffer ( const void * buffer,
SizeType length )
inline

Attempts to overwrite the contents of this object by deserializing the buffer into this object.

Parameters
[in]bufferThe bytes to deserialize into this object.
[in]lengthThe length in bytes of buffer.
Returns
true if the buffer was a valid RingBufferData and this object has enough capacity to store its bytes, false otherwise.

◆ GetRingBufferLength()

template<RingBufferCapacity Capacity>
SizeType crashpad::RingBufferData< Capacity >::GetRingBufferLength ( ) const
inline
Returns
The current length in bytes of the data written to the ring buffer.

The documentation for this struct was generated from the following file: