feat(cluster): #2448 add new DFLYMIGRATE ACK cmd (#2582)

* feat(cluster): #2448 add new DFLYMIGRATE ACK cmd
This commit is contained in:
Borys 2024-02-19 19:21:14 +02:00 committed by GitHub
parent 07a8411ee7
commit 491538e170
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 128 additions and 42 deletions

View file

@ -298,6 +298,18 @@ shared_ptr<ClusterConfig> ClusterConfig::CreateFromConfig(string_view my_id,
return CreateFromConfig(my_id, config.value());
}
std::shared_ptr<ClusterConfig> ClusterConfig::CloneWithChanges(const std::vector<SlotRange>& slots,
bool enable) const {
auto new_config = std::make_shared<ClusterConfig>(*this);
auto slot_set = ToSlotSet(slots);
for (const auto s : slot_set) {
new_config->my_slots_.set(s, enable);
}
return new_config;
}
bool ClusterConfig::IsMySlot(SlotId id) const {
if (id >= my_slots_.size()) {
DCHECK(false) << "Requesting a non-existing slot id " << id;
@ -311,12 +323,6 @@ bool ClusterConfig::IsMySlot(std::string_view key) const {
return IsMySlot(KeySlot(key));
}
void ClusterConfig::RemoveSlots(SlotSet slots) {
for (const auto s : slots) {
my_slots_.set(s, false);
}
}
ClusterConfig::Node ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
CHECK_LT(id, my_slots_.size()) << "Requesting a non-existing slot id " << id;