tablets: Add formatter for resize_decision::way_type
This commit is contained in:
@@ -633,13 +633,7 @@ resize_decision::resize_decision(sstring decision, uint64_t seq_number)
|
||||
}
|
||||
|
||||
sstring resize_decision::type_name() const {
|
||||
static const std::array<sstring, 3> index_to_string = {
|
||||
"none",
|
||||
"split",
|
||||
"merge",
|
||||
};
|
||||
static_assert(std::variant_size_v<decltype(way)> == index_to_string.size());
|
||||
return index_to_string[way.index()];
|
||||
return fmt::format("{}", way);
|
||||
}
|
||||
|
||||
resize_decision::seq_number_t resize_decision::next_sequence_number() const {
|
||||
@@ -1031,6 +1025,17 @@ void tablet_metadata_guard::subscribe() {
|
||||
|
||||
}
|
||||
|
||||
auto fmt::formatter<locator::resize_decision_way>::format(const locator::resize_decision_way& way, fmt::format_context& ctx) const
|
||||
-> decltype(ctx.out()) {
|
||||
static const std::array<sstring, 3> index_to_string = {
|
||||
"none",
|
||||
"split",
|
||||
"merge",
|
||||
};
|
||||
static_assert(std::variant_size_v<locator::resize_decision_way> == index_to_string.size());
|
||||
return fmt::format_to(ctx.out(), "{}", index_to_string[way.index()]);
|
||||
}
|
||||
|
||||
auto fmt::formatter<locator::global_tablet_id>::format(const locator::global_tablet_id& id, fmt::format_context& ctx) const
|
||||
-> decltype(ctx.out()) {
|
||||
return fmt::format_to(ctx.out(), "{}:{}", id.table, id.tablet);
|
||||
|
||||
@@ -354,6 +354,8 @@ struct resize_decision {
|
||||
seq_number_t next_sequence_number() const;
|
||||
};
|
||||
|
||||
using resize_decision_way = resize_decision::way_type;
|
||||
|
||||
struct table_load_stats {
|
||||
uint64_t size_in_bytes = 0;
|
||||
// Stores the minimum seq number among all replicas, as coordinator wants to know if
|
||||
@@ -668,6 +670,11 @@ struct tablet_metadata_change_hint {
|
||||
|
||||
}
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<locator::resize_decision_way> : fmt::formatter<string_view> {
|
||||
auto format(const locator::resize_decision_way&, fmt::format_context& ctx) const -> decltype(ctx.out());
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<locator::tablet_transition_stage> : fmt::formatter<string_view> {
|
||||
auto format(const locator::tablet_transition_stage&, fmt::format_context& ctx) const -> decltype(ctx.out());
|
||||
|
||||
Reference in New Issue
Block a user