rippled
Loading...
Searching...
No Matches
NodeObject.h
1#ifndef XRPL_NODESTORE_NODEOBJECT_H_INCLUDED
2#define XRPL_NODESTORE_NODEOBJECT_H_INCLUDED
3
4#include <xrpl/basics/Blob.h>
5#include <xrpl/basics/CountedObject.h>
6#include <xrpl/basics/base_uint.h>
7
8// VFALCO NOTE Intentionally not in the NodeStore namespace
9
10namespace ripple {
11
18 hotDUMMY = 512 // an invalid or missing object
19};
20
30class NodeObject : public CountedObject<NodeObject>
31{
32public:
33 static constexpr std::size_t keyBytes = 32;
34
35private:
36 // This hack is used to make the constructor effectively private
37 // except for when we use it in the call to make_shared.
38 // There's no portable way to make make_shared<> a friend work.
40 {
41 explicit PrivateAccess() = default;
42 };
43
44public:
45 // This constructor is private, use createObject instead.
47 NodeObjectType type,
48 Blob&& data,
49 uint256 const& hash,
51
64 createObject(NodeObjectType type, Blob&& data, uint256 const& hash);
65
68 getType() const;
69
71 uint256 const&
72 getHash() const;
73
75 Blob const&
76 getData() const;
77
78private:
81 Blob const mData;
82};
83
84} // namespace ripple
85
86#endif
Tracks the number of instances of an object.
A simple object that the Ledger uses to store entries.
Definition NodeObject.h:31
static constexpr std::size_t keyBytes
Definition NodeObject.h:33
uint256 const & getHash() const
Returns the hash of the data.
Blob const mData
Definition NodeObject.h:81
NodeObjectType const mType
Definition NodeObject.h:79
uint256 const mHash
Definition NodeObject.h:80
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
Blob const & getData() const
Returns the underlying data.
NodeObjectType getType() const
Returns the type of this object.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
NodeObjectType
The types of node objects.
Definition NodeObject.h:13
@ hotACCOUNT_NODE
Definition NodeObject.h:16
@ hotTRANSACTION_NODE
Definition NodeObject.h:17
@ hotUNKNOWN
Definition NodeObject.h:14
@ hotLEDGER
Definition NodeObject.h:15
@ hotDUMMY
Definition NodeObject.h:18