rippled
InboundLedgers.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 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_APP_LEDGER_INBOUNDLEDGERS_H_INCLUDED
21 #define RIPPLE_APP_LEDGER_INBOUNDLEDGERS_H_INCLUDED
22 
23 #include <ripple/app/ledger/InboundLedger.h>
24 #include <ripple/protocol/RippleLedgerHash.h>
25 #include <memory>
26 
27 namespace ripple {
28 
34 {
35 public:
37 
38  virtual ~InboundLedgers() = default;
39 
40  // VFALCO TODO Should this be called findOrAdd ?
41  //
43  acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason) = 0;
44 
46  find(LedgerHash const& hash) = 0;
47 
48  // VFALCO TODO Remove the dependency on the Peer object.
49  //
50  virtual bool
52  LedgerHash const& ledgerHash,
55 
56  virtual void
58 
59  virtual void
60  logFailure(uint256 const& h, std::uint32_t seq) = 0;
61 
62  virtual bool
63  isFailure(uint256 const& h) = 0;
64 
65  virtual void
66  clearFailures() = 0;
67 
68  virtual Json::Value
69  getInfo() = 0;
70 
72  virtual std::size_t
73  fetchRate() = 0;
74 
76  virtual void
77  onLedgerFetched() = 0;
78 
79  virtual void
80  gotFetchPack() = 0;
81  virtual void
82  sweep() = 0;
83 
84  virtual void
85  stop() = 0;
86 };
87 
90  Application& app,
92  beast::insight::Collector::ptr const& collector);
93 
94 } // namespace ripple
95 
96 #endif
ripple::Application
Definition: Application.h:115
ripple::InboundLedgers::stop
virtual void stop()=0
ripple::InboundLedgers::getInfo
virtual Json::Value getInfo()=0
std::shared_ptr
STL class.
ripple::InboundLedgers::fetchRate
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
ripple::make_InboundLedgers
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, beast::insight::Collector::ptr const &collector)
Definition: InboundLedgers.cpp:434
ripple::InboundLedgers::sweep
virtual void sweep()=0
ripple::base_uint< 256 >
ripple::InboundLedgers::gotFetchPack
virtual void gotFetchPack()=0
ripple::InboundLedgers::~InboundLedgers
virtual ~InboundLedgers()=default
ripple::InboundLedgers::acquire
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
ripple::InboundLedgers::gotStaleData
virtual void gotStaleData(std::shared_ptr< protocol::TMLedgerData > packet)=0
ripple::InboundLedgers::onLedgerFetched
virtual void onLedgerFetched()=0
Called when a complete ledger is obtained.
ripple::InboundLedgers::logFailure
virtual void logFailure(uint256 const &h, std::uint32_t seq)=0
std::uint32_t
beast::abstract_clock< std::chrono::steady_clock >
memory
ripple::InboundLedgers
Manages the lifetime of inbound ledgers.
Definition: InboundLedgers.h:33
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::InboundLedgers::gotLedgerData
virtual bool gotLedgerData(LedgerHash const &ledgerHash, std::shared_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData >)=0
ripple::InboundLedgers::clearFailures
virtual void clearFailures()=0
std::size_t
ripple::InboundLedger::Reason
Reason
Definition: InboundLedger.h:43
std::unique_ptr
STL class.
ripple::InboundLedgers::isFailure
virtual bool isFailure(uint256 const &h)=0
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::InboundLedgers::find
virtual std::shared_ptr< InboundLedger > find(LedgerHash const &hash)=0