Clio
develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
Cache.hpp
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of clio: https://github.com/XRPLF/clio
4
Copyright (c) 2025, the clio developers.
5
6
Permission to use, copy, modify, and distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#pragma once
21
22
#include "etlng/CacheUpdaterInterface.hpp"
23
#include "etlng/Models.hpp"
24
#include "etlng/impl/CacheUpdater.hpp"
25
#include "util/log/Logger.hpp"
26
27
#include <cstdint>
28
#include <memory>
29
#include <string>
30
#include <vector>
31
32
namespace
etlng::impl {
33
34
class
CacheExt
{
35
std::shared_ptr<CacheUpdaterInterface> cacheUpdater_;
36
37
util::Logger
log_{
"ETL"
};
38
39
public
:
40
CacheExt
(std::shared_ptr<CacheUpdaterInterface> cacheUpdater);
41
42
void
43
onLedgerData(
model::LedgerData
const
&
data
);
44
45
void
46
onInitialData(
model::LedgerData
const
&
data
);
47
48
void
49
onInitialObjects(uint32_t seq, std::vector<model::Object>
const
& objs, [[maybe_unused]] std::string lastKey);
50
51
// We want cache updates through ETL if we are a potential writer but currently are not writing to DB
52
static
bool
53
allowInReadonly()
54
{
55
return
true
;
56
}
57
};
58
59
}
// namespace etlng::impl
etlng::impl::CacheExt
Definition
Cache.hpp:34
util::Logger
A simple thread-safe logger for the channel specified in the constructor.
Definition
Logger.hpp:111
data
This namespace implements the data access layer and related components.
Definition
AmendmentCenter.cpp:70
etlng::model::LedgerData
Represents an entire ledger diff worth of transactions and objects.
Definition
Models.hpp:143
src
etlng
impl
ext
Cache.hpp
Generated by
1.12.0