xrpld
Loading...
Searching...
No Matches
xrpl::NodeObject Class Reference

A simple object that the Ledger uses to store entries. More...

#include <NodeObject.h>

Inheritance diagram for xrpl::NodeObject:
Collaboration diagram for xrpl::NodeObject:

Classes

struct  PrivateAccess

Public Member Functions

 NodeObject (NodeObjectType type, Blob &&data, uint256 const &hash, PrivateAccess)
NodeObjectType getType () const
 Returns the type of this object.
uint256 const & getHash () const
 Returns the hash of the data.
Blob const & getData () const
 Returns the underlying data.

Static Public Member Functions

static std::shared_ptr< NodeObjectcreateObject (NodeObjectType type, Blob &&data, uint256 const &hash)
 Create an object from fields.

Public Attributes

friend Object

Static Public Attributes

static constexpr std::size_t kKeyBytes = 32

Static Private Member Functions

static auto & getCounter () noexcept

Private Attributes

NodeObjectType const type_
uint256 const hash_
Blob const data_

Detailed Description

A simple object that the Ledger uses to store entries.

NodeObjects are comprised of a type, a hash, and a blob. They can be uniquely identified by the hash, which is a half-SHA512 of the blob. The blob is a variable length block of serialized data. The type identifies what the blob contains.

Note
No checking is performed to make sure the hash matches the data.
See also
SHAMap

Definition at line 29 of file NodeObject.h.

Constructor & Destructor Documentation

◆ NodeObject()

xrpl::NodeObject::NodeObject ( NodeObjectType type,
Blob && data,
uint256 const & hash,
PrivateAccess  )

Definition at line 13 of file NodeObject.cpp.

Member Function Documentation

◆ createObject()

std::shared_ptr< NodeObject > xrpl::NodeObject::createObject ( NodeObjectType type,
Blob && data,
uint256 const & hash )
static

Create an object from fields.

The caller's variable is modified during this call. The underlying storage for the Blob is taken over by the NodeObject.

Parameters
typeThe type of object.
ledgerIndexThe ledger in which this object appears.
dataA buffer containing the payload. The caller's variable is overwritten.
hashThe 256-bit hash of the payload data.

Definition at line 19 of file NodeObject.cpp.

◆ getType()

NodeObjectType xrpl::NodeObject::getType ( ) const
nodiscard

Returns the type of this object.

Definition at line 25 of file NodeObject.cpp.

◆ getHash()

uint256 const & xrpl::NodeObject::getHash ( ) const
nodiscard

Returns the hash of the data.

Definition at line 31 of file NodeObject.cpp.

◆ getData()

Blob const & xrpl::NodeObject::getData ( ) const
nodiscard

Returns the underlying data.

Definition at line 37 of file NodeObject.cpp.

◆ getCounter()

auto & xrpl::CountedObject< NodeObject >::getCounter ( )
staticprivatenoexceptinherited

Definition at line 109 of file CountedObject.h.

Member Data Documentation

◆ kKeyBytes

std::size_t xrpl::NodeObject::kKeyBytes = 32
staticconstexpr

Definition at line 32 of file NodeObject.h.

◆ type_

NodeObjectType const xrpl::NodeObject::type_
private

Definition at line 74 of file NodeObject.h.

◆ hash_

uint256 const xrpl::NodeObject::hash_
private

Definition at line 75 of file NodeObject.h.

◆ data_

Blob const xrpl::NodeObject::data_
private

Definition at line 76 of file NodeObject.h.

◆ Object

Definition at line 134 of file CountedObject.h.