3#include "feed/Types.hpp"
4#include "feed/impl/TrackableSignal.hpp"
5#include "feed/impl/TrackableSignalMap.hpp"
6#include "feed/impl/Util.hpp"
7#include "util/async/AnyExecutionContext.hpp"
8#include "util/async/AnyStrand.hpp"
9#include "util/log/Logger.hpp"
10#include "util/prometheus/Gauge.hpp"
12#include <boost/asio/io_context.hpp>
13#include <boost/asio/strand.hpp>
14#include <boost/json/object.hpp>
15#include <fmt/format.h>
16#include <xrpl/protocol/AccountID.h>
17#include <xrpl/protocol/Book.h>
18#include <xrpl/protocol/LedgerHeader.h>
24#include <unordered_set>
33 struct AllVersionMsgsType {
38 using AllVersionsMsgsPtrType = std::shared_ptr<AllVersionMsgsType>;
40 class ProposedTransactionSlot {
41 std::reference_wrapper<ProposedTransactionFeed> feed_;
42 std::weak_ptr<Subscriber> subscriptionContextWeakPtr_;
45 ProposedTransactionSlot(
47 SubscriberSharedPtr
const& connection
49 : feed_(
feed), subscriptionContextWeakPtr_(connection)
54 operator()(AllVersionsMsgsPtrType
const& allVersionMsgs)
const;
59 std::unordered_set<SubscriberPtr> notified_;
62 std::reference_wrapper<util::prometheus::GaugeInt> subAllCount_;
63 std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_;
80 : strand_(executionCtx.makeStrand())
81 , subAllCount_(getSubscriptionsGaugeInt(
"tx_proposed"))
82 , subAccountCount_(getSubscriptionsGaugeInt(
"account_proposed"))
92 sub(SubscriberSharedPtr
const& subscriber);
101 sub(ripple::AccountID
const& account, SubscriberSharedPtr
const& subscriber);
108 unsub(SubscriberSharedPtr
const& subscriber);
116 unsub(ripple::AccountID
const& account, SubscriberSharedPtr
const& subscriber);
123 pub(boost::json::object
const& receivedTxJson);
139 unsubInternal(SubscriberPtr subscriber);
142 unsubInternal(ripple::AccountID
const& account, SubscriberPtr subscriber);
ProposedTransactionFeed(ProposedTransactionFeed &&)=delete
Move constructor is deleted because ProposedTransactionSlot takes ProposedTransactionFeed by referenc...
std::uint64_t accountSubCount() const
Get the number of accounts subscribers.
Definition ProposedTransactionFeed.cpp:142
std::uint64_t transactionSubcount() const
Get the number of subscribers of the proposed transaction feed.
Definition ProposedTransactionFeed.cpp:136
ProposedTransactionFeed(util::async::AnyExecutionContext &executionCtx)
Construct a Proposed Transaction Feed object.
Definition ProposedTransactionFeed.hpp:79
void sub(SubscriberSharedPtr const &subscriber)
Subscribe to the proposed transaction feed.
Definition ProposedTransactionFeed.cpp:42
void unsub(SubscriberSharedPtr const &subscriber)
Unsubscribe to the proposed transaction feed.
Definition ProposedTransactionFeed.cpp:74
void pub(boost::json::object const &receivedTxJson)
Publishes the proposed transaction feed.
Definition ProposedTransactionFeed.cpp:89
Class to manage a map of key and its associative signal.
Definition TrackableSignalMap.hpp:30
A thread-safe class to manage a signal and its tracking connections.
Definition TrackableSignal.hpp:26
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:77
A type-erased execution context.
Definition AnyExecutionContext.hpp:22
A type-erased execution context.
Definition AnyStrand.hpp:21
This namespace implements everything related to subscriptions.
Definition BookChangesFeed.hpp:14