Files
scylladb/streaming/stream_reason.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

59 lines
1.6 KiB
C++

/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#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,
tablet_migration,
tablet_rebuild,
};
}
template <>
struct fmt::formatter<streaming::stream_reason> : fmt::formatter<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<string_view>::format("unspecified", ctx);
case bootstrap:
return formatter<string_view>::format("bootstrap", ctx);
case decommission:
return formatter<string_view>::format("decommission", ctx);
case removenode:
return formatter<string_view>::format("removenode", ctx);
case rebuild:
return formatter<string_view>::format("rebuild", ctx);
case repair:
return formatter<string_view>::format("repair", ctx);
case replace:
return formatter<string_view>::format("replace", ctx);
case tablet_migration:
return formatter<string_view>::format("tablet migration", ctx);
case tablet_rebuild:
return formatter<string_view>::format("tablet rebuild", ctx);
}
std::abort();
}
};