xrpld
Loading...
Searching...
No Matches
SHAMap.h
1#pragma once
2
3#include <xrpl/basics/IntrusivePointer.h>
4#include <xrpl/basics/UnorderedContainers.h>
5#include <xrpl/beast/utility/Journal.h>
6#include <xrpl/beast/utility/instrumentation.h>
7#include <xrpl/nodestore/Database.h>
8#include <xrpl/nodestore/NodeObject.h>
9#include <xrpl/shamap/Family.h>
10#include <xrpl/shamap/SHAMapAddNode.h>
11#include <xrpl/shamap/SHAMapInnerNode.h>
12#include <xrpl/shamap/SHAMapItem.h>
13#include <xrpl/shamap/SHAMapLeafNode.h>
14#include <xrpl/shamap/SHAMapMissingNode.h>
15#include <xrpl/shamap/SHAMapTreeNode.h>
16
17#include <set>
18#include <stack>
19#include <vector>
20
21namespace xrpl {
22
23class SHAMapNodeID;
25
27enum class SHAMapState {
33
39
45
51};
52
76class SHAMap
77{
78private:
81
84
87
91 bool backed_ = true; // Map is backed by the database
92 mutable bool full_ = false; // Map is believed complete in database
93
94public:
97 static constexpr unsigned int kBranchFactor = SHAMapInnerNode::kBranchFactor;
98
100 static constexpr unsigned int kLeafDepth = 64;
101
102 using DeltaItem =
103 std::pair<boost::intrusive_ptr<SHAMapItem const>, boost::intrusive_ptr<SHAMapItem const>>;
105
106 SHAMap() = delete;
107 SHAMap(SHAMap const&) = delete;
108 SHAMap&
109 operator=(SHAMap const&) = delete;
110
111 // Take a snapshot of the given map:
112 SHAMap(SHAMap const& other, bool isMutable);
113
114 // build new map
115 SHAMap(SHAMapType t, Family& f);
116
117 SHAMap(SHAMapType t, uint256 const& hash, Family& f);
118
119 ~SHAMap() = default;
120
121 Family const&
122 family() const
123 {
124 return f_;
125 }
126
127 Family&
129 {
130 return f_;
131 }
132
133 //--------------------------------------------------------------------------
134
139 class ConstIterator;
140
141 ConstIterator
142 begin() const;
143 ConstIterator
144 end() const;
145
146 //--------------------------------------------------------------------------
147
148 // Returns a new map that's a snapshot of this one.
149 // Handles copy on write for mutable snapshots.
151 snapShot(bool isMutable) const;
152
153 /* Mark this SHAMap as "should be full", indicating
154 that the local server wants all the corresponding nodes
155 in durable storage.
156 */
157 void
158 setFull();
159
160 void
162
163 bool
164 fetchRoot(SHAMapHash const& hash, SHAMapSyncFilter const* filter);
165
166 // normal hash access functions
167
169 bool
170 hasItem(uint256 const& id) const;
171
172 bool
173 delItem(uint256 const& id);
174
175 bool
176 addItem(SHAMapNodeType type, boost::intrusive_ptr<SHAMapItem const> item);
177
179 getHash() const;
180
181 // save a copy if you have a temporary anyway
182 bool
183 updateGiveItem(SHAMapNodeType type, boost::intrusive_ptr<SHAMapItem const> item);
184
185 bool
186 addGiveItem(SHAMapNodeType type, boost::intrusive_ptr<SHAMapItem const> item);
187
188 // Save a copy if you need to extend the life
189 // of the SHAMapItem beyond this SHAMap
190 boost::intrusive_ptr<SHAMapItem const> const&
191 peekItem(uint256 const& id) const;
192 boost::intrusive_ptr<SHAMapItem const> const&
193 peekItem(uint256 const& id, SHAMapHash& hash) const;
194
195 // traverse functions
202 ConstIterator
203 upperBound(uint256 const& id) const;
204
211 ConstIterator
212 lowerBound(uint256 const& id) const;
213
219 void
220 visitNodes(std::function<bool(SHAMapTreeNode&)> const& function) const;
221
228 void
229 visitDifferences(SHAMap const* have, std::function<bool(SHAMapTreeNode const&)> const&) const;
230
235 void
236 visitLeaves(std::function<void(boost::intrusive_ptr<SHAMapItem const> const&)> const&) const;
237
238 // comparison/sync functions
239
251 getMissingNodes(int maxNodes, SHAMapSyncFilter const* filter);
252
253 bool
255 SHAMapNodeID const& wanted,
257 bool fatLeaves,
258 std::uint32_t depth) const;
259
267 getProofPath(uint256 const& key) const;
268
276 static bool
277 verifyProofPath(uint256 const& rootHash, uint256 const& key, std::vector<Blob> const& path);
278
280 void
281 serializeRoot(Serializer& s) const;
282
284 addRootNode(SHAMapHash const& hash, Slice const& rootNode, SHAMapSyncFilter const* filter);
286 addKnownNode(SHAMapNodeID const& nodeID, Slice const& rawNode, SHAMapSyncFilter const* filter);
287
288 // status functions
289 void
290 setImmutable();
291 bool
292 isSynching() const;
293 void
294 setSynching();
295 void
297 bool
298 isValid() const;
299
300 // caution: otherMap must be accessed only by this function
301 // return value: true=successfully completed, false=too different
302 bool
303 compare(SHAMap const& otherMap, Delta& differences, int maxCount) const;
304
306 int
307 unshare();
308
310 int
312
313 void
314 walkMap(std::vector<SHAMapMissingNode>& missingNodes, int maxMissing) const;
315 bool
316 walkMapParallel(std::vector<SHAMapMissingNode>& missingNodes, int maxMissing) const;
317 bool
318 deepCompare(SHAMap& other) const; // Intended for debug/test only
319
320 void
321 setUnbacked();
322
323 void
324 dump(bool withHashes = false) const;
325 void
326 invariants() const;
327
328private:
330 using DeltaRef =
331 std::pair<boost::intrusive_ptr<SHAMapItem const>, boost::intrusive_ptr<SHAMapItem const>>;
332
333 // tree node cache operations
335 cacheLookup(SHAMapHash const& hash) const;
336
337 void
338 canonicalize(SHAMapHash const& hash, SHAMapTreeNodePtr&) const;
339
340 // database operations
342 fetchNodeFromDB(SHAMapHash const& hash) const;
344 fetchNodeNT(SHAMapHash const& hash) const;
346 fetchNodeNT(SHAMapHash const& hash, SHAMapSyncFilter const* filter) const;
348 fetchNode(SHAMapHash const& hash) const;
350 checkFilter(SHAMapHash const& hash, SHAMapSyncFilter const* filter) const;
351
353 void
354 dirtyUp(SharedPtrNodeStack& stack, uint256 const& target, SHAMapTreeNodePtr terminal);
355
360 walkTowardsKey(uint256 const& id, SharedPtrNodeStack* stack = nullptr) const;
363 findKey(uint256 const& id) const;
364
366 template <class Node>
369
371 template <class Node>
374
378
379 // returns the first item at or below this node
381 firstBelow(SHAMapTreeNodePtr node, SharedPtrNodeStack& stack, int branch = 0) const;
382
383 // returns the last item at or below this node
385 lastBelow(SHAMapTreeNodePtr node, SharedPtrNodeStack& stack, int branch = kBranchFactor) const;
386
387 // helper function for firstBelow and lastBelow
391 SharedPtrNodeStack& stack,
392 int branch,
393 std::tuple<int, std::function<bool(int)>, std::function<void(int&)>> const& loopParams)
394 const;
395
396 // Simple descent
397 // Get a child of the specified node
399 descend(SHAMapInnerNode*, int branch) const;
401 descendThrow(SHAMapInnerNode*, int branch) const;
403 descend(SHAMapInnerNode&, int branch) const;
405 descendThrow(SHAMapInnerNode&, int branch) const;
406
407 // Descend with filter
408 // If pending, callback is called as if it called fetchNodeNT
412 SHAMapInnerNode* parent,
413 int branch,
414 SHAMapSyncFilter const* filter,
415 bool& pending,
416 descendCallback&&) const;
417
419 descend(
420 SHAMapInnerNode* parent,
421 SHAMapNodeID const& parentID,
422 int branch,
423 SHAMapSyncFilter const* filter) const;
424
425 // Non-storing
426 // Does not hook the returned node to its parent
428 descendNoStore(SHAMapInnerNode&, int branch) const;
429
431 boost::intrusive_ptr<SHAMapItem const> const&
433
434 bool
435 hasInnerNode(SHAMapNodeID const& nodeID, SHAMapHash const& hash) const;
436 bool
437 hasLeafNode(uint256 const& tag, SHAMapHash const& hash) const;
438
439 SHAMapLeafNode const*
440 peekFirstItem(SharedPtrNodeStack& stack) const;
441 SHAMapLeafNode const*
442 peekNextItem(uint256 const& id, SharedPtrNodeStack& stack) const;
443 bool
445 SHAMapTreeNode* node,
446 boost::intrusive_ptr<SHAMapItem const> const& otherMapItem,
447 bool isFirstMap,
448 Delta& differences,
449 int& maxCount) const;
450 int
451 walkSubTree(bool doWrite, NodeObjectType t);
452
453 // Structure to track information about call to
454 // getMissingNodes while it's in progress
456 {
457 MissingNodes() = delete;
458 MissingNodes(MissingNodes const&) = delete;
460 operator=(MissingNodes const&) = delete;
461
462 // basic parameters
463 int max;
465 int const maxDefer;
467
468 // nodes we have discovered to be missing
471
472 // nodes we are in the process of traversing
474 SHAMapInnerNode*, // pointer to the node
475 SHAMapNodeID, // the node's ID
476 int, // while child we check first
477 int, // which child we check next
478 bool>; // whether we've found any missing children yet
479
480 // We explicitly choose to specify the use of std::deque here, because
481 // we need to ensure that pointers and/or references to existing
482 // elements will not be invalidated during the course of element
483 // insertion and removal. Containers that do not offer this guarantee,
484 // such as std::vector, can't be used here.
486
487 // nodes we may have acquired from deferred reads
489 SHAMapInnerNode*, // parent node
490 SHAMapNodeID, // parent node ID
491 int, // branch
492 SHAMapTreeNodePtr>; // node
493
498
499 // nodes we need to resume after we get their children from deferred
500 // reads
502
504 int max,
506 int maxDefer,
509 {
510 missingNodes.reserve(max);
511 finishedReads.reserve(maxDefer);
512 }
513 };
514
515 // getMissingNodes helper functions
516 void
517 gmnProcessNodes(MissingNodes&, MissingNodes::StackEntry& node);
518 static void
519 gmnProcessDeferredReads(MissingNodes&);
520
521 // fetch from DB helper function
523 finishFetch(SHAMapHash const& hash, std::shared_ptr<NodeObject> const& object) const;
524};
525
526inline void
528{
529 full_ = true;
530}
531
532inline void
537
538inline void
540{
541 XRPL_ASSERT(state_ != SHAMapState::Invalid, "xrpl::SHAMap::setImmutable : state is valid");
543}
544
545inline bool
547{
549}
550
551inline void
556
557inline void
562
563inline bool
565{
567}
568
569inline void
571{
572 backed_ = false;
573}
574
575//------------------------------------------------------------------------------
576
578{
579public:
583 using reference = value_type const&;
584 using pointer = value_type const*;
585
586private:
588 SHAMap const* map_ = nullptr;
589 pointer item_ = nullptr;
590
591public:
592 ConstIterator() = delete;
593
594 ConstIterator(ConstIterator const& other) = default;
596 operator=(ConstIterator const& other) = default;
597
598 ~ConstIterator() = default;
599
601 operator*() const;
602 pointer
603 operator->() const;
604
606 operator++();
608 operator++(int);
609
610private:
611 explicit ConstIterator(SHAMap const* map);
613 ConstIterator(SHAMap const* map, pointer item, SharedPtrNodeStack&& stack);
614
615 friend bool
616 operator==(ConstIterator const& x, ConstIterator const& y);
617 friend class SHAMap;
618};
619
621{
622 XRPL_ASSERT(map_, "xrpl::SHAMap::ConstIterator::ConstIterator : non-null input");
623
624 if (auto temp = map_->peekFirstItem(stack_))
625 item_ = temp->peekItem().get();
626}
627
631
633 SHAMap const* map,
634 pointer item,
635 SharedPtrNodeStack&& stack)
636 : stack_(std::move(stack)), map_(map), item_(item)
637{
638}
639
642{
643 return *item_;
644}
645
648{
649 return item_;
650}
651
654{
655 if (auto temp = map_->peekNextItem(item_->key(), stack_))
656 {
657 item_ = temp->peekItem().get();
658 }
659 else
660 {
661 item_ = nullptr;
662 }
663 return *this;
664}
665
668{
669 auto tmp = *this;
670 ++(*this);
671 return tmp;
672}
673
674inline bool
676{
677 XRPL_ASSERT(
678 x.map_ == y.map_,
679 "xrpl::operator==(SHAMap::const_iterator, SHAMap::const_iterator) : "
680 "inputs map do match");
681 return x.item_ == y.item_;
682}
683
684inline bool
686{
687 return !(x == y);
688}
689
690inline SHAMap::ConstIterator
692{
693 return ConstIterator(this);
694}
695
698{
699 return ConstIterator(this, nullptr);
700}
701
702} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:38
static constexpr unsigned int kBranchFactor
Each inner node has 16 children (the 'radix tree' part of the map).
Identifies a node inside a SHAMap.
pointer operator->() const
Definition SHAMap.h:647
ConstIterator(ConstIterator const &other)=default
SharedPtrNodeStack stack_
Definition SHAMap.h:587
value_type const & reference
Definition SHAMap.h:583
ConstIterator & operator=(ConstIterator const &other)=default
friend bool operator==(ConstIterator const &x, ConstIterator const &y)
Definition SHAMap.h:675
SHAMap const * map_
Definition SHAMap.h:588
std::forward_iterator_tag iterator_category
Definition SHAMap.h:580
ConstIterator & operator++()
Definition SHAMap.h:653
value_type const * pointer
Definition SHAMap.h:584
reference operator*() const
Definition SHAMap.h:641
std::ptrdiff_t difference_type
Definition SHAMap.h:581
A SHAMap is both a radix tree with a fan-out of 16 and a Merkle tree.
Definition SHAMap.h:77
SHAMapTreeNode * descend(SHAMapInnerNode *, int branch) const
Definition SHAMap.cpp:303
SHAMapLeafNode * walkTowardsKey(uint256 const &id, SharedPtrNodeStack *stack=nullptr) const
Walk towards the specified id, returning the node.
Definition SHAMap.cpp:130
bool fetchRoot(SHAMapHash const &hash, SHAMapSyncFilter const *filter)
Definition SHAMap.cpp:888
bool addItem(SHAMapNodeType type, boost::intrusive_ptr< SHAMapItem const > item)
Definition SHAMap.cpp:830
Family const & family() const
Definition SHAMap.h:122
static bool verifyProofPath(uint256 const &rootHash, uint256 const &key, std::vector< Blob > const &path)
Verify the proof path.
ConstIterator lowerBound(uint256 const &id) const
Find the object with the greatest object id smaller than the input id.
Definition SHAMap.cpp:637
SHAMapState state_
Definition SHAMap.h:89
bool full_
Definition SHAMap.h:92
std::optional< std::vector< Blob > > getProofPath(uint256 const &key) const
Get the proof path of the key.
SHAMapLeafNode * belowHelper(SHAMapTreeNodePtr node, SharedPtrNodeStack &stack, int branch, std::tuple< int, std::function< bool(int)>, std::function< void(int &)> > const &loopParams) const
Definition SHAMap.cpp:433
std::uint32_t cowid_
ID to distinguish this map for all others we're sharing nodes with.
Definition SHAMap.h:83
SHAMapTreeNodePtr finishFetch(SHAMapHash const &hash, std::shared_ptr< NodeObject > const &object) const
Definition SHAMap.cpp:174
void setLedgerSeq(std::uint32_t lseq)
Definition SHAMap.h:533
static constexpr unsigned int kLeafDepth
The depth of the hash map: data is only present in the leaves.
Definition SHAMap.h:100
SHAMapTreeNodePtr fetchNodeFromDB(SHAMapHash const &hash) const
Definition SHAMap.cpp:166
Family & f_
Definition SHAMap.h:79
std::map< uint256, DeltaItem > Delta
Definition SHAMap.h:104
std::pair< boost::intrusive_ptr< SHAMapItem const >, boost::intrusive_ptr< SHAMapItem const > > DeltaItem
Definition SHAMap.h:102
SHAMapTreeNodePtr cacheLookup(SHAMapHash const &hash) const
Definition SHAMap.cpp:1152
Family & family()
Definition SHAMap.h:128
boost::intrusive_ptr< SHAMapItem const > const & peekItem(uint256 const &id) const
Definition SHAMap.cpp:581
std::vector< std::pair< SHAMapNodeID, uint256 > > getMissingNodes(int maxNodes, SHAMapSyncFilter const *filter)
Check for nodes in the SHAMap not available.
~SHAMap()=default
int flushDirty(NodeObjectType t)
Flush modified nodes to the nodestore and convert them to shared.
Definition SHAMap.cpp:975
static void gmnProcessDeferredReads(MissingNodes &)
static constexpr unsigned int kBranchFactor
Number of children each non-leaf node has (the 'radix tree' part of the map).
Definition SHAMap.h:97
std::pair< boost::intrusive_ptr< SHAMapItem const >, boost::intrusive_ptr< SHAMapItem const > > DeltaRef
Definition SHAMap.h:330
void visitDifferences(SHAMap const *have, std::function< bool(SHAMapTreeNode const &)> const &) const
Visit every node in this SHAMap that is not present in the specified SHAMap.
SHAMapTreeNodePtr fetchNode(SHAMapHash const &hash) const
Definition SHAMap.cpp:270
void setUnbacked()
Definition SHAMap.h:570
bool walkMapParallel(std::vector< SHAMapMissingNode > &missingNodes, int maxMissing) const
void walkMap(std::vector< SHAMapMissingNode > &missingNodes, int maxMissing) const
SHAMapLeafNode * firstBelow(SHAMapTreeNodePtr node, SharedPtrNodeStack &stack, int branch=0) const
Definition SHAMap.cpp:488
void setSynching()
Definition SHAMap.h:552
bool hasInnerNode(SHAMapNodeID const &nodeID, SHAMapHash const &hash) const
Does this map have this inner node?
SHAMap(SHAMap const &)=delete
bool isSynching() const
Definition SHAMap.h:546
SHAMapLeafNode const * peekNextItem(uint256 const &id, SharedPtrNodeStack &stack) const
Definition SHAMap.cpp:552
bool deepCompare(SHAMap &other) const
void gmnProcessNodes(MissingNodes &, MissingNodes::StackEntry &node)
SHAMap & operator=(SHAMap const &)=delete
void dump(bool withHashes=false) const
Definition SHAMap.cpp:1105
beast::Journal journal_
Definition SHAMap.h:80
bool compare(SHAMap const &otherMap, Delta &differences, int maxCount) const
void setFull()
Definition SHAMap.h:527
void serializeRoot(Serializer &s) const
Serializes the root in a format appropriate for sending over the wire.
SHAMapLeafNode * lastBelow(SHAMapTreeNodePtr node, SharedPtrNodeStack &stack, int branch=kBranchFactor) const
Definition SHAMap.cpp:479
bool backed_
Definition SHAMap.h:91
bool isValid() const
Definition SHAMap.h:564
std::shared_ptr< SHAMap > snapShot(bool isMutable) const
Definition SHAMap.cpp:94
bool hasItem(uint256 const &id) const
Does the tree have an item with the given ID?
Definition SHAMap.cpp:672
int unshare()
Convert any modified nodes to shared.
Definition SHAMap.cpp:968
void visitLeaves(std::function< void(boost::intrusive_ptr< SHAMapItem const > const &)> const &) const
Visit every leaf node in this SHAMap.
bool updateGiveItem(SHAMapNodeType type, boost::intrusive_ptr< SHAMapItem const > item)
Definition SHAMap.cpp:848
SHAMapType const type_
Definition SHAMap.h:90
SHAMapTreeNode * descendAsync(SHAMapInnerNode *parent, int branch, SHAMapSyncFilter const *filter, bool &pending, descendCallback &&) const
Definition SHAMap.cpp:374
SHAMap()=delete
void dirtyUp(SharedPtrNodeStack &stack, uint256 const &target, SHAMapTreeNodePtr terminal)
Update hashes up to the root.
Definition SHAMap.cpp:100
SHAMapAddNode addKnownNode(SHAMapNodeID const &nodeID, Slice const &rawNode, SHAMapSyncFilter const *filter)
std::stack< std::pair< SHAMapTreeNodePtr, SHAMapNodeID > > SharedPtrNodeStack
Definition SHAMap.h:329
ConstIterator upperBound(uint256 const &id) const
Find the first item after the given item.
Definition SHAMap.cpp:604
void canonicalize(SHAMapHash const &hash, SHAMapTreeNodePtr &) const
Definition SHAMap.cpp:1160
bool hasLeafNode(uint256 const &tag, SHAMapHash const &hash) const
Does this map have this leaf node?
void setImmutable()
Definition SHAMap.h:539
SHAMapTreeNodePtr fetchNodeNT(SHAMapHash const &hash) const
Definition SHAMap.cpp:258
void clearSynching()
Definition SHAMap.h:558
bool getNodeFat(SHAMapNodeID const &wanted, std::vector< std::pair< SHAMapNodeID, Blob > > &data, bool fatLeaves, std::uint32_t depth) const
SHAMapAddNode addRootNode(SHAMapHash const &hash, Slice const &rootNode, SHAMapSyncFilter const *filter)
SHAMapTreeNodePtr descendNoStore(SHAMapInnerNode &, int branch) const
Definition SHAMap.cpp:335
SHAMapTreeNodePtr checkFilter(SHAMapHash const &hash, SHAMapSyncFilter const *filter) const
Definition SHAMap.cpp:209
void invariants() const
Definition SHAMap.cpp:1170
SHAMapLeafNode * findKey(uint256 const &id) const
Return nullptr if key not found.
Definition SHAMap.cpp:157
bool addGiveItem(SHAMapNodeType type, boost::intrusive_ptr< SHAMapItem const > item)
Definition SHAMap.cpp:761
SHAMapTreeNodePtr root_
Definition SHAMap.h:88
ConstIterator end() const
Definition SHAMap.h:697
SHAMapTreeNodePtr writeNode(NodeObjectType t, SHAMapTreeNodePtr node) const
write and canonicalize modified node
Definition SHAMap.cpp:934
std::function< void(SHAMapTreeNodePtr, SHAMapHash const &)> descendCallback
Definition SHAMap.h:409
intr_ptr::SharedPtr< Node > preFlushNode(intr_ptr::SharedPtr< Node > node) const
prepare a node to be modified before flushing
Definition SHAMap.cpp:952
intr_ptr::SharedPtr< Node > unshareNode(intr_ptr::SharedPtr< Node >, SHAMapNodeID const &nodeID)
Unshare the node, allowing it to be modified.
Definition SHAMap.cpp:417
boost::intrusive_ptr< SHAMapItem const > const & onlyBelow(SHAMapTreeNode *) const
If there is only one leaf below this node, get its contents.
Definition SHAMap.cpp:499
std::uint32_t ledgerSeq_
The sequence of the ledger that this map references, if any.
Definition SHAMap.h:86
int walkSubTree(bool doWrite, NodeObjectType t)
Definition SHAMap.cpp:982
SHAMapHash getHash() const
Definition SHAMap.cpp:836
ConstIterator begin() const
Definition SHAMap.h:691
void visitNodes(std::function< bool(SHAMapTreeNode &)> const &function) const
Visit every node in this SHAMap.
bool delItem(uint256 const &id)
Definition SHAMap.cpp:678
SHAMapTreeNode * descendThrow(SHAMapInnerNode *, int branch) const
Definition SHAMap.cpp:281
bool walkBranch(SHAMapTreeNode *node, boost::intrusive_ptr< SHAMapItem const > const &otherMapItem, bool isFirstMap, Delta &differences, int &maxCount) const
SHAMapLeafNode const * peekFirstItem(SharedPtrNodeStack &stack) const
Definition SHAMap.cpp:538
An immutable linear range of bytes.
Definition Slice.h:26
STL namespace.
SharedIntrusive< T > SharedPtr
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
intr_ptr::SharedPtr< SHAMapTreeNode > SHAMapTreeNodePtr
constexpr bool operator==(BaseUInt< Bits, Tag > const &lhs, BaseUInt< Bits, Tag > const &rhs)
Definition base_uint.h:588
NodeObjectType
The types of node objects.
Definition NodeObject.h:12
bool operator!=(Buffer const &lhs, Buffer const &rhs) noexcept
Definition Buffer.h:210
SHAMapState
Describes the current state of a given SHAMap.
Definition SHAMap.h:27
@ Immutable
The map is set in stone and cannot be changed.
Definition SHAMap.h:38
@ Invalid
The map is known to not be valid.
Definition SHAMap.h:50
@ Synching
The map's hash is fixed but valid nodes may be missing and can be added.
Definition SHAMap.h:44
@ Modifying
The map is in flux and objects can be added and removed.
Definition SHAMap.h:32
BaseUInt< 256 > uint256
Definition base_uint.h:562
@ Invalid
Timely, but invalid signature.
Definition Manifest.h:209
std::set< SHAMapHash > missingHashes
Definition SHAMap.h:470
std::vector< DeferredNode > finishedReads
Definition SHAMap.h:497
MissingNodes & operator=(MissingNodes const &)=delete
std::vector< std::pair< SHAMapNodeID, uint256 > > missingNodes
Definition SHAMap.h:469
MissingNodes(int max, SHAMapSyncFilter const *filter, int maxDefer, std::uint32_t generation)
Definition SHAMap.h:503
std::uint32_t generation
Definition SHAMap.h:466
MissingNodes(MissingNodes const &)=delete
SHAMapSyncFilter const * filter
Definition SHAMap.h:464
std::map< SHAMapInnerNode *, SHAMapNodeID > resumes
Definition SHAMap.h:501
std::tuple< SHAMapInnerNode *, SHAMapNodeID, int, int, bool > StackEntry
Definition SHAMap.h:473
std::stack< StackEntry, std::deque< StackEntry > > stack
Definition SHAMap.h:485
std::tuple< SHAMapInnerNode *, SHAMapNodeID, int, SHAMapTreeNodePtr > DeferredNode
Definition SHAMap.h:488
std::condition_variable deferCondVar
Definition SHAMap.h:496