Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
CorruptionDetector.hpp
1
#pragma once
2
3
#include "data/LedgerCacheInterface.hpp"
4
#include "etl/SystemState.hpp"
5
#include "util/log/Logger.hpp"
6
7
#include <functional>
8
9
namespace
etl {
10
16
class
CorruptionDetector
{
17
std::reference_wrapper<SystemState> state_;
18
std::reference_wrapper<data::LedgerCacheInterface> cache_;
19
20
util::Logger
log_{
"ETL"
};
21
22
public
:
29
CorruptionDetector
(
SystemState
& state,
data::LedgerCacheInterface
& cache)
30
: state_{std::ref(state)}, cache_{std::ref(cache)}
31
{
32
}
33
37
void
38
onCorruptionDetected
()
39
{
40
if
(not state_.get().isCorruptionDetected) {
41
state_.get().isCorruptionDetected =
true
;
42
43
LOG(
44
log_.error()
45
) <<
"Disabling the cache to avoid corrupting the DB further. Please investigate."
;
46
cache_.get().setDisabled();
47
}
48
}
49
};
50
51
}
// namespace etl
data::LedgerCacheInterface
Cache for an entire ledger.
Definition
LedgerCacheInterface.hpp:21
etl::CorruptionDetector::onCorruptionDetected
void onCorruptionDetected()
Notify the operator about a corruption in the DB.
Definition
CorruptionDetector.hpp:38
etl::CorruptionDetector::CorruptionDetector
CorruptionDetector(SystemState &state, data::LedgerCacheInterface &cache)
Construct a new Corruption Detector object.
Definition
CorruptionDetector.hpp:29
util::Logger
A simple thread-safe logger for the channel specified in the constructor.
Definition
Logger.hpp:78
etl::SystemState
Represents the state of the ETL subsystem.
Definition
SystemState.hpp:20
src
etl
CorruptionDetector.hpp
Generated by
1.17.0