rippled
NodeFamily.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2020 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_SHAMAP_NODEFAMILY_H_INCLUDED
21 #define RIPPLE_SHAMAP_NODEFAMILY_H_INCLUDED
22 
23 #include <ripple/app/main/CollectorManager.h>
24 #include <ripple/shamap/Family.h>
25 
26 namespace ripple {
27 
28 class Application;
29 
30 class NodeFamily : public Family
31 {
32 public:
33  NodeFamily() = delete;
34  NodeFamily(NodeFamily const&) = delete;
35  NodeFamily(NodeFamily&&) = delete;
36 
37  NodeFamily&
38  operator=(NodeFamily const&) = delete;
39 
40  NodeFamily&
41  operator=(NodeFamily&&) = delete;
42 
44 
46  db() override
47  {
48  return db_;
49  }
50 
51  NodeStore::Database const&
52  db() const override
53  {
54  return db_;
55  }
56 
57  beast::Journal const&
58  journal() override
59  {
60  return j_;
61  }
62 
63  bool
64  isShardBacked() const override
65  {
66  return false;
67  }
68 
70  {
71  return fbCache_;
72  }
73 
75  {
76  return tnCache_;
77  }
78 
79  void
80  sweep() override;
81 
82  void
83  reset() override;
84 
85  void
86  missingNodeAcquireBySeq(std::uint32_t seq, uint256 const& hash) override;
87 
88  void
89  missingNodeAcquireByHash(uint256 const& hash, std::uint32_t seq) override
90  {
91  acquire(hash, seq);
92  }
93 
94 private:
98 
101 
102  // Missing node handler
105 
106  void
107  acquire(uint256 const& hash, std::uint32_t seq);
108 };
109 
110 } // namespace ripple
111 
112 #endif
ripple::Application
Definition: Application.h:115
ripple::NodeFamily::app_
Application & app_
Definition: NodeFamily.h:95
ripple::NodeFamily::sweep
void sweep() override
Definition: NodeFamily.cpp:50
ripple::NodeStore::Database
Persistency layer for NodeObject.
Definition: Database.h:51
std::shared_ptr
STL class.
ripple::CollectorManager
Provides the beast::insight::Collector service.
Definition: CollectorManager.h:29
ripple::NodeFamily
Definition: NodeFamily.h:30
ripple::NodeFamily::reset
void reset() override
Definition: NodeFamily.cpp:57
ripple::NodeFamily::db_
NodeStore::Database & db_
Definition: NodeFamily.h:96
ripple::base_uint< 256 >
ripple::NodeFamily::j_
const beast::Journal j_
Definition: NodeFamily.h:97
ripple::NodeFamily::maxSeq_
LedgerIndex maxSeq_
Definition: NodeFamily.h:103
ripple::NodeFamily::acquire
void acquire(uint256 const &hash, std::uint32_t seq)
Definition: NodeFamily.cpp:106
ripple::Family
Definition: Family.h:32
ripple::NodeFamily::NodeFamily
NodeFamily()=delete
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::NodeFamily::journal
beast::Journal const & journal() override
Definition: NodeFamily.h:58
ripple::NodeFamily::operator=
NodeFamily & operator=(NodeFamily const &)=delete
ripple::NodeFamily::maxSeqMutex_
std::mutex maxSeqMutex_
Definition: NodeFamily.h:104
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeFamily::tnCache_
std::shared_ptr< TreeNodeCache > tnCache_
Definition: NodeFamily.h:100
ripple::NodeFamily::missingNodeAcquireByHash
void missingNodeAcquireByHash(uint256 const &hash, std::uint32_t seq) override
Acquire ledger that has a missing node by ledger hash.
Definition: NodeFamily.h:89
ripple::NodeFamily::db
NodeStore::Database const & db() const override
Definition: NodeFamily.h:52
ripple::NodeFamily::db
NodeStore::Database & db() override
Definition: NodeFamily.h:46
ripple::NodeFamily::missingNodeAcquireBySeq
void missingNodeAcquireBySeq(std::uint32_t seq, uint256 const &hash) override
Acquire ledger that has a missing node by ledger sequence.
Definition: NodeFamily.cpp:69
std::mutex
STL class.
ripple::NodeFamily::getFullBelowCache
std::shared_ptr< FullBelowCache > getFullBelowCache(std::uint32_t) override
Return a pointer to the Family Full Below Cache.
Definition: NodeFamily.h:69
ripple::NodeFamily::fbCache_
std::shared_ptr< FullBelowCache > fbCache_
Definition: NodeFamily.h:99
ripple::NodeFamily::getTreeNodeCache
std::shared_ptr< TreeNodeCache > getTreeNodeCache(std::uint32_t) override
Return a pointer to the Family Tree Node Cache.
Definition: NodeFamily.h:74
ripple::NodeFamily::isShardBacked
bool isShardBacked() const override
Definition: NodeFamily.h:64