Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
CacheUpdater.hpp
1#pragma once
2
3#include "data/LedgerCacheInterface.hpp"
4#include "data/Types.hpp"
5#include "etl/CacheUpdaterInterface.hpp"
6#include "etl/Models.hpp"
7#include "util/log/Logger.hpp"
8
9#include <cstdint>
10#include <functional>
11#include <vector>
12
13namespace etl::impl {
14
15class CacheUpdater : public CacheUpdaterInterface {
16 std::reference_wrapper<data::LedgerCacheInterface> cache_;
17
18 util::Logger log_{"ETL"};
19
20public:
21 CacheUpdater(data::LedgerCacheInterface& cache) : cache_{cache}
22 {
23 }
24
25 void
26 update(model::LedgerData const& data) override
27 {
28 cache_.get().update(data.objects, data.seq);
29 }
30
31 void
32 update(uint32_t seq, std::vector<data::LedgerObject> const& objs) override
33 {
34 cache_.get().update(objs, seq);
35 }
36
37 void
38 update(uint32_t seq, std::vector<model::Object> const& objs) override
39 {
40 cache_.get().update(objs, seq);
41 }
42
43 void
44 setFull() override
45 {
46 cache_.get().setFull();
47 }
48};
49
50} // namespace etl::impl
Cache for an entire ledger.
Definition LedgerCacheInterface.hpp:21
void update(uint32_t seq, std::vector< data::LedgerObject > const &objs) override
Update the cache with ledger objects at a specific sequence.
Definition CacheUpdater.hpp:32
void setFull() override
Mark the cache as fully loaded.
Definition CacheUpdater.hpp:44
void update(uint32_t seq, std::vector< model::Object > const &objs) override
Update the cache with model objects at a specific sequence.
Definition CacheUpdater.hpp:38
void update(model::LedgerData const &data) override
Update the cache with ledger data.
Definition CacheUpdater.hpp:26
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
An interface for the Cache Updater.
Definition CacheUpdaterInterface.hpp:14
Represents an entire ledger diff worth of transactions and objects.
Definition Models.hpp:124