service: raft: add support for topology_change command into raft_group0_client

Extend raft_group0_client::prepare_command with support of
topology_change type of command.
This commit is contained in:
Gleb Natapov
2022-05-31 10:33:52 +03:00
parent 16d61e791f
commit fc84c69b7e
2 changed files with 9 additions and 2 deletions

View File

@@ -283,7 +283,9 @@ future<group0_guard> raft_group0_client::start_operation(seastar::abort_source*
}
}
group0_command raft_group0_client::prepare_command(schema_change change, group0_guard& guard, std::string_view description) {
template<typename Command>
requires std::same_as<Command, schema_change> || std::same_as<Command, topology_change>
group0_command raft_group0_client::prepare_command(Command change, group0_guard& guard, std::string_view description) {
group0_command group0_cmd {
.change{std::move(change)},
.history_append{db::system_keyspace::make_group0_history_state_id_mutation(
@@ -411,4 +413,7 @@ void raft_group0_client::set_query_result(utils::UUID query_id, service::broadca
}
}
template group0_command raft_group0_client::prepare_command(schema_change change, group0_guard& guard, std::string_view description);
template group0_command raft_group0_client::prepare_command(topology_change change, group0_guard& guard, std::string_view description);
}

View File

@@ -127,8 +127,10 @@ public:
// and add_entry would again forward to shard 0.
future<group0_guard> start_operation(seastar::abort_source* as = nullptr);
group0_command prepare_command(schema_change change, group0_guard& guard, std::string_view description);
group0_command prepare_command(broadcast_table_query query);
template<typename Command>
requires std::same_as<Command, schema_change> || std::same_as<Command, topology_change>
group0_command prepare_command(Command change, group0_guard& guard, std::string_view description);
// Returns the current group 0 upgrade state.
//