Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
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
13
namespace
etl::impl {
14
15
class
CacheUpdater :
public
CacheUpdaterInterface
{
16
std::reference_wrapper<data::LedgerCacheInterface> cache_;
17
18
util::Logger
log_{
"ETL"
};
19
20
public
:
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
data::LedgerCacheInterface
Cache for an entire ledger.
Definition
LedgerCacheInterface.hpp:21
etl::impl::CacheUpdater::update
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
etl::impl::CacheUpdater::setFull
void setFull() override
Mark the cache as fully loaded.
Definition
CacheUpdater.hpp:44
etl::impl::CacheUpdater::update
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
etl::impl::CacheUpdater::update
void update(model::LedgerData const &data) override
Update the cache with ledger data.
Definition
CacheUpdater.hpp:26
util::Logger
A simple thread-safe logger for the channel specified in the constructor.
Definition
Logger.hpp:110
data
This namespace implements the data access layer and related components.
Definition
AmendmentCenter.cpp:56
etl::CacheUpdaterInterface
An interface for the Cache Updater.
Definition
CacheUpdaterInterface.hpp:14
etl::model::LedgerData
Represents an entire ledger diff worth of transactions and objects.
Definition
Models.hpp:129
src
etl
impl
CacheUpdater.hpp
Generated by
1.17.0