Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
BookChangesFeed.hpp
1#pragma once
2
3#include "data/Types.hpp"
4#include "feed/impl/SingleFeedBase.hpp"
6#include "util/async/AnyExecutionContext.hpp"
7
8#include <boost/asio/io_context.hpp>
9#include <boost/json/serialize.hpp>
10#include <xrpl/protocol/LedgerHeader.h>
11
12#include <vector>
13
14namespace feed::impl {
15
22struct BookChangesFeed : public SingleFeedBase {
23 BookChangesFeed(util::async::AnyExecutionContext& executionCtx)
24 : SingleFeedBase(executionCtx, "book_changes")
25 {
26 }
27
33 void
34 pub(ripple::LedgerHeader const& lgrInfo,
35 std::vector<data::TransactionAndMetadata> const& transactions)
36 {
37 SingleFeedBase::pub(boost::json::serialize(rpc::computeBookChanges(lgrInfo, transactions)));
38 }
39};
40} // namespace feed::impl
void pub(std::string msg)
Publishes the feed in strand.
Definition SingleFeedBase.cpp:51
SingleFeedBase(util::async::AnyExecutionContext &executionCtx, std::string const &name)
Construct a new Single Feed Base object.
Definition SingleFeedBase.cpp:16
A type-erased execution context.
Definition AnyExecutionContext.hpp:22
boost::json::object computeBookChanges(ripple::LedgerHeader const &lgrInfo, std::vector< data::TransactionAndMetadata > const &transactions)
Computes all book changes for the given ledger header and transactions.
Definition BookChanges.cpp:89
void pub(ripple::LedgerHeader const &lgrInfo, std::vector< data::TransactionAndMetadata > const &transactions)
Publishes the book changes.
Definition BookChangesFeed.hpp:34