rippled
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | List of all members
ripple::NodeObject Class Reference

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

#include <NodeObject.h>

Inheritance diagram for ripple::NodeObject:
Inheritance graph
[legend]
Collaboration diagram for ripple::NodeObject:
Collaboration graph
[legend]

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.
 

Static Public Attributes

static constexpr std::size_t keyBytes = 32
 

Static Private Member Functions

static auto & getCounter () noexcept
 

Private Attributes

NodeObjectType const mType
 
uint256 const mHash
 
Blob const mData
 

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 49 of file NodeObject.h.

Constructor & Destructor Documentation

◆ NodeObject()

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

Definition at line 28 of file NodeObject.cpp.

Member Function Documentation

◆ createObject()

std::shared_ptr< NodeObject > ripple::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 38 of file NodeObject.cpp.

◆ getType()

NodeObjectType ripple::NodeObject::getType ( ) const

Returns the type of this object.

Definition at line 45 of file NodeObject.cpp.

◆ getHash()

uint256 const & ripple::NodeObject::getHash ( ) const

Returns the hash of the data.

Definition at line 51 of file NodeObject.cpp.

◆ getData()

Blob const & ripple::NodeObject::getData ( ) const

Returns the underlying data.

Definition at line 57 of file NodeObject.cpp.

◆ getCounter()

static auto & ripple::CountedObject< NodeObject >::getCounter ( )
staticprivatenoexceptinherited

Definition at line 129 of file CountedObject.h.

Member Data Documentation

◆ keyBytes

constexpr std::size_t ripple::NodeObject::keyBytes = 32
staticconstexpr

Definition at line 52 of file NodeObject.h.

◆ mType

NodeObjectType const ripple::NodeObject::mType
private

Definition at line 98 of file NodeObject.h.

◆ mHash

uint256 const ripple::NodeObject::mHash
private

Definition at line 99 of file NodeObject.h.

◆ mData

Blob const ripple::NodeObject::mData
private

Definition at line 100 of file NodeObject.h.