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