Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
kernel
notifications_interface.h
Go to the documentation of this file.
1
// Copyright (c) 2023-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
6
#define BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
7
8
#include <cstdint>
9
#include <variant>
10
11
class
CBlockIndex
;
12
enum class
SynchronizationState
;
13
struct
bilingual_str
;
14
15
namespace
kernel
{
16
18
struct
Interrupted
{};
19
enum class
Warning
;
20
21
23
using
InterruptResult
= std::variant<std::monostate, Interrupted>;
24
25
template
<
typename
T>
26
bool
IsInterrupted
(
const
T
& result)
27
{
28
return
std::holds_alternative<kernel::Interrupted>(result);
29
}
30
35
class
Notifications
36
{
37
public
:
38
virtual
~Notifications
() =
default
;
39
40
[[nodiscard]]
virtual
InterruptResult
blockTip
(
SynchronizationState
state,
const
CBlockIndex
& index,
double
verification_progress) {
return
{}; }
41
virtual
void
headerTip
(
SynchronizationState
state, int64_t height, int64_t timestamp,
bool
presync) {}
42
virtual
void
progress
(
const
bilingual_str
& title,
int
progress_percent,
bool
resume_possible) {}
43
virtual
void
warningSet
(
Warning
id
,
const
bilingual_str
& message) {}
44
virtual
void
warningUnset
(
Warning
id
) {}
45
52
virtual
void
flushError
(
const
bilingual_str
& message) {}
53
61
virtual
void
fatalError
(
const
bilingual_str
& message) {}
62
};
63
}
// namespace kernel
64
65
#endif
// BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition
chain.h:94
kernel::Notifications
A base class defining functions for notifying about certain kernel events.
Definition
notifications_interface.h:36
kernel::Notifications::headerTip
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync)
Definition
notifications_interface.h:41
kernel::Notifications::~Notifications
virtual ~Notifications()=default
kernel::Notifications::fatalError
virtual void fatalError(const bilingual_str &message)
Definition
notifications_interface.h:61
kernel::Notifications::warningSet
virtual void warningSet(Warning id, const bilingual_str &message)
Definition
notifications_interface.h:43
kernel::Notifications::progress
virtual void progress(const bilingual_str &title, int progress_percent, bool resume_possible)
Definition
notifications_interface.h:42
kernel::Notifications::blockTip
virtual InterruptResult blockTip(SynchronizationState state, const CBlockIndex &index, double verification_progress)
Definition
notifications_interface.h:40
kernel::Notifications::flushError
virtual void flushError(const bilingual_str &message)
Definition
notifications_interface.h:52
kernel::Notifications::warningUnset
virtual void warningUnset(Warning id)
Definition
notifications_interface.h:44
T
#define T(expected, seed, data)
kernel
Definition
coinstatsindex.h:21
kernel::IsInterrupted
bool IsInterrupted(const T &result)
Definition
notifications_interface.h:26
kernel::Warning
Warning
Definition
warning.h:9
kernel::InterruptResult
std::variant< std::monostate, Interrupted > InterruptResult
Simple result type for functions that need to propagate an interrupt status and don't have other retu...
Definition
notifications_interface.h:23
bilingual_str
Bilingual messages:
Definition
translation.h:24
kernel::Interrupted
Result type for use with std::variant to indicate that an operation should be interrupted.
Definition
notifications_interface.h:18
SynchronizationState
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition
validation.h:93
Generated on
for Bitcoin Core by
1.17.0