rippled
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...

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. More...
 
uint256 const & getHash () const
 Returns the hash of the data. More...
 
Blob const & getData () const
 Returns the underlying data. More...
 

Static Public Member Functions

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

Static Public Attributes

static constexpr std::size_t keyBytes = 32
 

Static Private Member Functions

static auto & getCounter () noexcept
 

Private Attributes

const NodeObjectType mType
 
const uint256 mHash
 
const Blob 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 27 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 37 of file NodeObject.cpp.

◆ getType()

NodeObjectType ripple::NodeObject::getType ( ) const

Returns the type of this object.

Definition at line 44 of file NodeObject.cpp.

◆ getHash()

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

Returns the hash of the data.

Definition at line 50 of file NodeObject.cpp.

◆ getData()

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

Returns the underlying data.

Definition at line 56 of file NodeObject.cpp.

◆ getCounter()

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

Definition at line 128 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

const NodeObjectType ripple::NodeObject::mType
private

Definition at line 98 of file NodeObject.h.

◆ mHash

const uint256 ripple::NodeObject::mHash
private

Definition at line 99 of file NodeObject.h.

◆ mData

const Blob ripple::NodeObject::mData
private

Definition at line 100 of file NodeObject.h.