Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
feed::SubscriptionManager Class Reference

A subscription manager is responsible for managing the subscriptions and publishing the feeds. More...

#include <SubscriptionManager.hpp>

Inheritance diagram for feed::SubscriptionManager:
Collaboration diagram for feed::SubscriptionManager:

Public Member Functions

 SubscriptionManager (util::async::AnyExecutionContext &&executor, std::shared_ptr< data::BackendInterface const > const &backend)
 Construct a new Subscription Manager object.
 
 ~SubscriptionManager () override
 Destructor of the SubscriptionManager object. It will block until all running jobs finished.
 
void stop () override
 Stop the SubscriptionManager and wait for all jobs to finish.
 
void subBookChanges (SubscriberSharedPtr const &subscriber) final
 Subscribe to the book changes feed.
 
void unsubBookChanges (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the book changes feed.
 
void pubBookChanges (ripple::LedgerHeader const &lgrInfo, std::vector< data::TransactionAndMetadata > const &transactions) final
 Publish the book changes feed.
 
void subProposedTransactions (SubscriberSharedPtr const &subscriber) final
 Subscribe to the proposed transactions feed.
 
void unsubProposedTransactions (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the proposed transactions feed.
 
void subProposedAccount (ripple::AccountID const &account, SubscriberSharedPtr const &subscriber) final
 Subscribe to the proposed transactions feed, only receive the feed when particular account is affected.
 
void unsubProposedAccount (ripple::AccountID const &account, SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the proposed transactions feed for particular account.
 
void forwardProposedTransaction (boost::json::object const &receivedTxJson) final
 Forward the proposed transactions feed.
 
boost::json::object subLedger (boost::asio::yield_context yield, SubscriberSharedPtr const &subscriber) final
 Subscribe to the ledger feed.
 
void unsubLedger (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the ledger feed.
 
void pubLedger (ripple::LedgerHeader const &lgrInfo, ripple::Fees const &fees, std::string const &ledgerRange, std::uint32_t txnCount) final
 Publish the ledger feed.
 
void subManifest (SubscriberSharedPtr const &subscriber) final
 Subscribe to the manifest feed.
 
void unsubManifest (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the manifest feed.
 
void forwardManifest (boost::json::object const &manifestJson) final
 Forward the manifest feed.
 
void subValidation (SubscriberSharedPtr const &subscriber) final
 Subscribe to the validation feed.
 
void unsubValidation (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the validation feed.
 
void forwardValidation (boost::json::object const &validationJson) final
 Forward the validation feed.
 
void subTransactions (SubscriberSharedPtr const &subscriber) final
 Subscribe to the transactions feed.
 
void unsubTransactions (SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the transactions feed.
 
void subAccount (ripple::AccountID const &account, SubscriberSharedPtr const &subscriber) final
 Subscribe to the transactions feed, only receive the feed when particular account is affected.
 
void unsubAccount (ripple::AccountID const &account, SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the transactions feed for particular account.
 
void subBook (ripple::Book const &book, SubscriberSharedPtr const &subscriber) final
 Subscribe to the transactions feed, only receive feed when particular order book is affected.
 
void unsubBook (ripple::Book const &book, SubscriberSharedPtr const &subscriber) final
 Unsubscribe to the transactions feed for particular order book.
 
void pubTransaction (data::TransactionAndMetadata const &txMeta, ripple::LedgerHeader const &lgrInfo) final
 Forward the transactions feed.
 
boost::json::object report () const final
 Get the number of subscribers.
 
- Public Member Functions inherited from feed::SubscriptionManagerInterface

Static Public Member Functions

static std::shared_ptr< SubscriptionManagermakeSubscriptionManager (util::config::ClioConfigDefinition const &config, std::shared_ptr< data::BackendInterface const > const &backend)
 Factory function to create a new SubscriptionManager with a PoolExecutionContext.
 

Detailed Description

A subscription manager is responsible for managing the subscriptions and publishing the feeds.

Constructor & Destructor Documentation

◆ SubscriptionManager()

feed::SubscriptionManager::SubscriptionManager ( util::async::AnyExecutionContext && executor,
std::shared_ptr< data::BackendInterface const > const & backend )
inline

Construct a new Subscription Manager object.

Parameters
executorThe executor to use to publish the feeds
backendThe backend to use

Member Function Documentation

◆ forwardManifest()

void feed::SubscriptionManager::forwardManifest ( boost::json::object const & manifestJson)
finalvirtual

Forward the manifest feed.

Parameters
manifestJsonThe manifest json to forward.

Implements feed::SubscriptionManagerInterface.

◆ forwardProposedTransaction()

void feed::SubscriptionManager::forwardProposedTransaction ( boost::json::object const & receivedTxJson)
finalvirtual

Forward the proposed transactions feed.

Parameters
receivedTxJsonThe proposed transaction json.

Implements feed::SubscriptionManagerInterface.

◆ forwardValidation()

void feed::SubscriptionManager::forwardValidation ( boost::json::object const & validationJson)
finalvirtual

Forward the validation feed.

Parameters
validationJsonThe validation feed json to forward.

Implements feed::SubscriptionManagerInterface.

◆ makeSubscriptionManager()

static std::shared_ptr< SubscriptionManager > feed::SubscriptionManager::makeSubscriptionManager ( util::config::ClioConfigDefinition const & config,
std::shared_ptr< data::BackendInterface const > const & backend )
inlinestatic

Factory function to create a new SubscriptionManager with a PoolExecutionContext.

Parameters
configThe configuration to use
backendThe backend to use
Returns
A shared pointer to a new instance of SubscriptionManager

◆ pubBookChanges()

void feed::SubscriptionManager::pubBookChanges ( ripple::LedgerHeader const & lgrInfo,
std::vector< data::TransactionAndMetadata > const & transactions )
finalvirtual

Publish the book changes feed.

Parameters
lgrInfoThe current ledger header.
transactionsThe transactions in the current ledger.

Implements feed::SubscriptionManagerInterface.

◆ pubLedger()

void feed::SubscriptionManager::pubLedger ( ripple::LedgerHeader const & lgrInfo,
ripple::Fees const & fees,
std::string const & ledgerRange,
std::uint32_t txnCount )
finalvirtual

Publish the ledger feed.

Parameters
lgrInfoThe ledger header.
feesThe fees.
ledgerRangeThe ledger range.
txnCountThe transaction count.

Implements feed::SubscriptionManagerInterface.

◆ pubTransaction()

void feed::SubscriptionManager::pubTransaction ( data::TransactionAndMetadata const & txMeta,
ripple::LedgerHeader const & lgrInfo )
finalvirtual

Forward the transactions feed.

Parameters
txMetaThe transaction and metadata.
lgrInfoThe ledger header.

Implements feed::SubscriptionManagerInterface.

◆ report()

boost::json::object feed::SubscriptionManager::report ( ) const
finalvirtual

Get the number of subscribers.

Returns
The report of the number of subscribers

Implements feed::SubscriptionManagerInterface.

◆ stop()

void feed::SubscriptionManager::stop ( )
inlineoverridevirtual

Stop the SubscriptionManager and wait for all jobs to finish.

Implements feed::SubscriptionManagerInterface.

◆ subAccount()

void feed::SubscriptionManager::subAccount ( ripple::AccountID const & account,
SubscriberSharedPtr const & subscriber )
finalvirtual

Subscribe to the transactions feed, only receive the feed when particular account is affected.

Parameters
accountThe account to watch.
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subBook()

void feed::SubscriptionManager::subBook ( ripple::Book const & book,
SubscriberSharedPtr const & subscriber )
finalvirtual

Subscribe to the transactions feed, only receive feed when particular order book is affected.

Parameters
bookThe book to watch.
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subBookChanges()

void feed::SubscriptionManager::subBookChanges ( SubscriberSharedPtr const & subscriber)
finalvirtual

Subscribe to the book changes feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subLedger()

boost::json::object feed::SubscriptionManager::subLedger ( boost::asio::yield_context yield,
SubscriberSharedPtr const & subscriber )
finalvirtual

Subscribe to the ledger feed.

Parameters
yieldThe coroutine context
subscriberThe subscriber to the ledger feed
Returns
The ledger feed

Implements feed::SubscriptionManagerInterface.

◆ subManifest()

void feed::SubscriptionManager::subManifest ( SubscriberSharedPtr const & subscriber)
finalvirtual

Subscribe to the manifest feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subProposedAccount()

void feed::SubscriptionManager::subProposedAccount ( ripple::AccountID const & account,
SubscriberSharedPtr const & subscriber )
finalvirtual

Subscribe to the proposed transactions feed, only receive the feed when particular account is affected.

Parameters
accountThe account to watch.
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subProposedTransactions()

void feed::SubscriptionManager::subProposedTransactions ( SubscriberSharedPtr const & subscriber)
finalvirtual

Subscribe to the proposed transactions feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subTransactions()

void feed::SubscriptionManager::subTransactions ( SubscriberSharedPtr const & subscriber)
finalvirtual

Subscribe to the transactions feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ subValidation()

void feed::SubscriptionManager::subValidation ( SubscriberSharedPtr const & subscriber)
finalvirtual

Subscribe to the validation feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubAccount()

void feed::SubscriptionManager::unsubAccount ( ripple::AccountID const & account,
SubscriberSharedPtr const & subscriber )
finalvirtual

Unsubscribe to the transactions feed for particular account.

Parameters
accountThe account to stop watching
subscriberThe subscriber to unsubscribe

Implements feed::SubscriptionManagerInterface.

◆ unsubBook()

void feed::SubscriptionManager::unsubBook ( ripple::Book const & book,
SubscriberSharedPtr const & subscriber )
finalvirtual

Unsubscribe to the transactions feed for particular order book.

Parameters
bookThe book to watch.
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubBookChanges()

void feed::SubscriptionManager::unsubBookChanges ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the book changes feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubLedger()

void feed::SubscriptionManager::unsubLedger ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the ledger feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubManifest()

void feed::SubscriptionManager::unsubManifest ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the manifest feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubProposedAccount()

void feed::SubscriptionManager::unsubProposedAccount ( ripple::AccountID const & account,
SubscriberSharedPtr const & subscriber )
finalvirtual

Unsubscribe to the proposed transactions feed for particular account.

Parameters
accountThe account to stop watching.
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubProposedTransactions()

void feed::SubscriptionManager::unsubProposedTransactions ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the proposed transactions feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubTransactions()

void feed::SubscriptionManager::unsubTransactions ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the transactions feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.

◆ unsubValidation()

void feed::SubscriptionManager::unsubValidation ( SubscriberSharedPtr const & subscriber)
finalvirtual

Unsubscribe to the validation feed.

Parameters
subscriber

Implements feed::SubscriptionManagerInterface.


The documentation for this class was generated from the following files: