rippled
Loading...
Searching...
No Matches
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 <xrpld/app/ledger/InboundLedger.h>
24#include <xrpl/protocol/RippleLedgerHash.h>
25#include <memory>
26#include <set>
27
28namespace ripple {
29
35{
36public:
38
39 virtual ~InboundLedgers() = default;
40
41 // Callers should use this if they possibly need an authoritative
42 // response immediately.
45
46 // Callers should use this if they are known to be executing on the Job
47 // Queue. TODO review whether all callers of acquire() can use this
48 // instead. Inbound ledger acquisition is asynchronous anyway.
49 virtual void
51 uint256 const& hash,
52 std::uint32_t seq,
53 InboundLedger::Reason reason) = 0;
54
56 find(LedgerHash const& hash) = 0;
57
58 // VFALCO TODO Remove the dependency on the Peer object.
59 //
60 virtual bool
62 LedgerHash const& ledgerHash,
65
66 virtual void
68
69 virtual void
70 logFailure(uint256 const& h, std::uint32_t seq) = 0;
71
72 virtual bool
73 isFailure(uint256 const& h) = 0;
74
75 virtual void
77
78 virtual Json::Value
79 getInfo() = 0;
80
82 virtual std::size_t
83 fetchRate() = 0;
84
86 virtual void
88
89 virtual void
91 virtual void
92 sweep() = 0;
93
94 virtual void
95 stop() = 0;
96
97 virtual std::size_t
98 cacheSize() = 0;
99};
100
103 Application& app,
105 beast::insight::Collector::ptr const& collector);
106
107} // namespace ripple
108
109#endif
Represents a JSON value.
Definition: json_value.h:147
Manages the lifetime of inbound ledgers.
virtual void clearFailures()=0
virtual void sweep()=0
virtual void acquireAsync(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason reason)=0
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
virtual Json::Value getInfo()=0
virtual void stop()=0
virtual void logFailure(uint256 const &h, std::uint32_t seq)=0
virtual bool gotLedgerData(LedgerHash const &ledgerHash, std::shared_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData >)=0
virtual std::size_t cacheSize()=0
virtual ~InboundLedgers()=default
virtual std::shared_ptr< InboundLedger > find(LedgerHash const &hash)=0
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
virtual bool isFailure(uint256 const &h)=0
virtual void gotFetchPack()=0
virtual void gotStaleData(std::shared_ptr< protocol::TMLedgerData > packet)=0
virtual void onLedgerFetched()=0
Called when a complete ledger is obtained.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
std::unique_ptr< InboundLedgers > make_InboundLedgers(Application &app, InboundLedgers::clock_type &clock, beast::insight::Collector::ptr const &collector)