1#include <xrpl/server/InfoSub.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/protocol/AccountID.h>
7#include <xrpl/protocol/Book.h>
8#include <xrpl/resource/Consumer.h>
27safeUnsub(std::uint64_t seq, F&& f, beast::Journal j)
noexcept
33 catch (std::exception
const& e)
35 JLOG(j.warn()) <<
"~InfoSub[seq=" << seq <<
"]: cleanup step failed: " << e.
what();
39 JLOG(j.warn()) <<
"~InfoSub[seq=" << seq <<
"]: cleanup step failed: unknown exception";
71 auto const& j =
source_.journal();
98 safeUnsub(
seq_, [&] {
source_.unsubAccountHistoryInternal(
seq_, account,
false); }, j);
209 XRPL_ASSERT(
apiVersion_ > 0,
"xrpl::InfoSub::getApiVersion : valid API version");
Abstracts the source of subscription data.
void setRequest(std::shared_ptr< InfoSubRequest > const &req)
void insertBookSubscription(Book const &book)
Record that this subscriber is following book.
Resource::Consumer Consumer
bool insertSubAccountHistory(AccountID const &account)
void setApiVersion(unsigned int apiVersion)
std::uint64_t getSeq() const
void insertSubAccountInfo(AccountID const &account, bool rt)
void deleteBookSubscription(Book const &book)
Stop tracking book for this subscriber.
hash_set< AccountID > accountHistorySubscriptions_
hash_set< AccountID > normalSubscriptions_
hash_set< Book > bookSubscriptions_
hash_set< AccountID > realTimeSubscriptions_
void deleteSubAccountInfo(AccountID const &account, bool rt)
void deleteSubAccountHistory(AccountID const &account)
unsigned int getApiVersion() const noexcept
std::shared_ptr< InfoSubRequest > const & getRequest()
std::shared_ptr< InfoSubRequest > request_
An endpoint that consumes resources.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.