|
rippled
|
Convert a NodeObject from in-memory to database format. More...
#include <EncodedBlob.h>

Public Member Functions | |
| EncodedBlob (std::shared_ptr< NodeObject > const &obj) | |
| ~EncodedBlob () | |
| void const * | getKey () const noexcept |
| std::size_t | getSize () const noexcept |
| void const * | getData () const noexcept |
Private Attributes | |
| std::array< std::uint8_t, 32 > | key_ |
| The 32-byte key of the serialized object. | |
| std::array< std::uint8_t, boost::alignment::align_up(9+1024, alignof(std::uint32_t))> | payload_ |
| A pre-allocated buffer for the serialized object. | |
| std::uint32_t | size_ |
| The size of the serialized data. | |
| std::uint8_t *const | ptr_ |
| A pointer to the serialized data. | |
Convert a NodeObject from in-memory to database format.
The (suboptimal) database format consists of:
We leverage that fact to preallocate enough memory to handle most payloads as part of this object, eliminating the need for dynamic allocation. As of this writing ~94% of objects require fewer than 1024 payload bytes.
Definition at line 36 of file EncodedBlob.h.
|
explicit |
Definition at line 63 of file EncodedBlob.h.
| ripple::NodeStore::EncodedBlob::~EncodedBlob | ( | ) |
Definition at line 85 of file EncodedBlob.h.
|
noexcept |
Definition at line 98 of file EncodedBlob.h.
|
noexcept |
Definition at line 104 of file EncodedBlob.h.
|
noexcept |
Definition at line 110 of file EncodedBlob.h.
|
private |
The 32-byte key of the serialized object.
Definition at line 39 of file EncodedBlob.h.
|
private |
A pre-allocated buffer for the serialized object.
The buffer is large enough for the 9 byte prefix and at least 1024 more bytes. The precise size is calculated automatically at compile time so as to avoid wasting space on padding bytes.
Definition at line 50 of file EncodedBlob.h.
|
private |
The size of the serialized data.
Definition at line 53 of file EncodedBlob.h.
|
private |
A pointer to the serialized data.
This may point to the pre-allocated buffer (if it is sufficiently large) or to a dynamically allocated buffer.
Definition at line 60 of file EncodedBlob.h.