Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
Successor.hpp
1#pragma once
2
3#include "data/BackendInterface.hpp"
4#include "data/LedgerCacheInterface.hpp"
5#include "data/Types.hpp"
6#include "etl/Models.hpp"
7#include "util/log/Logger.hpp"
8
9#include <xrpl/basics/base_uint.h>
10#include <xrpl/basics/strHex.h>
11
12#include <cstdint>
13#include <functional>
14#include <memory>
15#include <optional>
16#include <string>
17#include <vector>
18
19namespace etl::impl {
20
21class SuccessorExt {
22 std::shared_ptr<BackendInterface> backend_;
23 std::reference_wrapper<data::LedgerCacheInterface> cache_;
24
25 util::Logger log_{"ETL"};
26
27public:
28 SuccessorExt(std::shared_ptr<BackendInterface> backend, data::LedgerCacheInterface& cache);
29
30 void
31 onInitialData(model::LedgerData const& data) const;
32
33 void
34 onInitialObjects(
35 uint32_t seq,
36 [[maybe_unused]] std::vector<model::Object> const& objs,
37 std::string lastKey
38 ) const;
39
40 void
41 onLedgerData(model::LedgerData const& data) const;
42
43private:
44 void
45 writeIncludedSuccessor(uint32_t seq, model::BookSuccessor const& succ) const;
46
47 void
48 writeIncludedSuccessor(uint32_t seq, model::Object const& obj) const;
49
50 void
51 updateSuccessorFromCache(uint32_t seq, model::Object const& obj) const;
52
53 void
54 updateBookSuccessor(
55 std::optional<data::LedgerObject> const& maybeSuccessor,
56 auto seq,
57 ripple::uint256 const& bookBase
58 ) const;
59
60 void
61 writeSuccessors(uint32_t seq) const;
62
63 void
64 writeEdgeKeys(std::uint32_t seq, auto const& edgeKeys) const;
65};
66
67} // namespace etl::impl
Cache for an entire ledger.
Definition LedgerCacheInterface.hpp:21
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:77
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:56
Represents a book successor.
Definition Models.hpp:113
Represents an entire ledger diff worth of transactions and objects.
Definition Models.hpp:124
Represents a single object on the ledger.
Definition Models.hpp:86