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 <ripple/core/Stoppable.h>
26 #include <memory>
27 
28 namespace ripple {
29 
35 {
36 public:
38 
39  virtual ~InboundLedgers() = 0;
40 
41  // VFALCO TODO Should this be called findOrAdd ?
42  //
43  virtual
45  acquire (uint256 const& hash,
47 
48  virtual std::shared_ptr<InboundLedger> find (LedgerHash const& hash) = 0;
49 
50  // VFALCO TODO Remove the dependency on the Peer object.
51  //
52  virtual bool gotLedgerData (LedgerHash const& ledgerHash,
55 
56  virtual void doLedgerData (LedgerHash hash) = 0;
57 
58  virtual void gotStaleData (
60 
61  virtual int getFetchCount (int& timeoutCount) = 0;
62 
63  virtual void logFailure (uint256 const& h, std::uint32_t seq) = 0;
64 
65  virtual bool isFailure (uint256 const& h) = 0;
66 
67  virtual void clearFailures() = 0;
68 
69  virtual Json::Value getInfo() = 0;
70 
72  virtual std::size_t fetchRate() = 0;
73 
75  virtual void onLedgerFetched() = 0;
76 
77  virtual void gotFetchPack () = 0;
78  virtual void sweep () = 0;
79 
80  virtual void onStop() = 0;
81 };
82 
85  InboundLedgers::clock_type& clock, Stoppable& parent,
86  beast::insight::Collector::ptr const& collector);
87 
88 
89 } // ripple
90 
91 #endif
ripple::Application
Definition: Application.h:85
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::doLedgerData
virtual void doLedgerData(LedgerHash hash)=0
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:446
ripple::base_uint< 256 >
ripple::Stoppable
Provides an interface for starting and stopping.
Definition: Stoppable.h:200
ripple::InboundLedgers::gotFetchPack
virtual void gotFetchPack()=0
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:47
ripple::InboundLedgers::getFetchCount
virtual int getFetchCount(int &timeoutCount)=0
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:141
ripple::InboundLedgers::find
virtual std::shared_ptr< InboundLedger > find(LedgerHash const &hash)=0
ripple::InboundLedgers::~InboundLedgers
virtual ~InboundLedgers()=0