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/core/Stoppable.h>
25 #include <ripple/protocol/RippleLedgerHash.h>
26 #include <memory>
27 
28 namespace ripple {
29 
35 {
36 public:
38 
39  virtual ~InboundLedgers() = default;
40 
41  // VFALCO TODO Should this be called findOrAdd ?
42  //
44  acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason) = 0;
45 
47  find(LedgerHash const& hash) = 0;
48 
49  // VFALCO TODO Remove the dependency on the Peer object.
50  //
51  virtual bool
53  LedgerHash const& ledgerHash,
56 
57  virtual void
59 
60  virtual void
61  logFailure(uint256 const& h, std::uint32_t seq) = 0;
62 
63  virtual bool
64  isFailure(uint256 const& h) = 0;
65 
66  virtual void
67  clearFailures() = 0;
68 
69  virtual Json::Value
70  getInfo() = 0;
71 
73  virtual std::size_t
74  fetchRate() = 0;
75 
77  virtual void
78  onLedgerFetched() = 0;
79 
80  virtual void
81  gotFetchPack() = 0;
82  virtual void
83  sweep() = 0;
84 
85  virtual void
86  onStop() = 0;
87 };
88 
91  Application& app,
93  Stoppable& parent,
94  beast::insight::Collector::ptr const& collector);
95 
96 } // namespace ripple
97 
98 #endif
ripple::Application
Definition: Application.h:101
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::InboundLedgers::sweep
virtual void sweep()=0
ripple::make_InboundLedgers
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector)
Definition: InboundLedgers.cpp:412
ripple::base_uint< 256 >
ripple::Stoppable
Provides an interface for starting and stopping.
Definition: Stoppable.h:201
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:34
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:45
std::unique_ptr
STL class.
ripple::InboundLedgers::isFailure
virtual bool isFailure(uint256 const &h)=0
ripple::InboundLedgers::onStop
virtual void onStop()=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