forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream_reason.hh
52 lines (45 loc) · 1.33 KB
/
stream_reason.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <cstdint>
#include <string_view>
#include <fmt/format.h>
namespace streaming {
enum class stream_reason : uint8_t {
unspecified,
bootstrap,
decommission,
removenode,
rebuild,
repair,
replace,
};
}
template <>
struct fmt::formatter<streaming::stream_reason> : fmt::formatter<std::string_view> {
template <typename FormatContext>
auto format(const streaming::stream_reason& r, FormatContext& ctx) const {
using enum streaming::stream_reason;
switch (r) {
case unspecified:
return formatter<std::string_view>::format("unspecified", ctx);
case bootstrap:
return formatter<std::string_view>::format("bootstrap", ctx);
case decommission:
return formatter<std::string_view>::format("decommission", ctx);
case removenode:
return formatter<std::string_view>::format("removenode", ctx);
case rebuild:
return formatter<std::string_view>::format("rebuild", ctx);
case repair:
return formatter<std::string_view>::format("repair", ctx);
case replace:
return formatter<std::string_view>::format("replace", ctx);
}
std::abort();
}
};