mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
* Remove extraneous passing of transaction set hashes * Remove recentPositions_. InboundTXs does the job now * Move responsibility for sending "have TX set" out of consensus
88 lines
2.7 KiB
C++
88 lines
2.7 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012-2015 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#ifndef RIPPLE_APP_LEDGER_INBOUNDTRANSACTIONS_H_INCLUDED
|
|
#define RIPPLE_APP_LEDGER_INBOUNDTRANSACTIONS_H_INCLUDED
|
|
|
|
#include <ripple/overlay/Peer.h>
|
|
#include <ripple/shamap/SHAMap.h>
|
|
#include <ripple/beast/clock/abstract_clock.h>
|
|
#include <ripple/core/Stoppable.h>
|
|
#include <memory>
|
|
|
|
namespace ripple {
|
|
|
|
class Application;
|
|
|
|
/** Manages the acquisition and lifetime of transaction sets.
|
|
*/
|
|
|
|
class InboundTransactions
|
|
{
|
|
public:
|
|
using clock_type = beast::abstract_clock <std::chrono::steady_clock>;
|
|
|
|
InboundTransactions() = default;
|
|
InboundTransactions(InboundTransactions const&) = delete;
|
|
InboundTransactions& operator=(InboundTransactions const&) = delete;
|
|
|
|
virtual ~InboundTransactions() = 0;
|
|
|
|
/** Retrieves a transaction set by hash
|
|
*/
|
|
virtual std::shared_ptr <SHAMap> getSet (
|
|
uint256 const& setHash,
|
|
bool acquire) = 0;
|
|
|
|
/** Gives data to an inbound transaction set
|
|
*/
|
|
virtual void gotData (uint256 const& setHash,
|
|
std::shared_ptr <Peer>,
|
|
std::shared_ptr <protocol::TMLedgerData>) = 0;
|
|
|
|
/** Gives set to the container
|
|
*/
|
|
virtual void giveSet (uint256 const& setHash,
|
|
std::shared_ptr <SHAMap> const& set,
|
|
bool acquired) = 0;
|
|
|
|
/** Informs the container if a new consensus round
|
|
*/
|
|
virtual void newRound (std::uint32_t seq) = 0;
|
|
|
|
virtual Json::Value getInfo() = 0;
|
|
|
|
virtual void onStop() = 0;
|
|
};
|
|
|
|
std::unique_ptr <InboundTransactions>
|
|
make_InboundTransactions (
|
|
Application& app,
|
|
InboundTransactions::clock_type& clock,
|
|
Stoppable& parent,
|
|
beast::insight::Collector::ptr const& collector,
|
|
std::function
|
|
<void (std::shared_ptr <SHAMap> const&,
|
|
bool)> gotSet);
|
|
|
|
|
|
} // ripple
|
|
|
|
#endif
|