mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
* feat(cluster): #2448 add new DFLYMIGRATE ACK cmd
This commit is contained in:
parent
07a8411ee7
commit
491538e170
10 changed files with 128 additions and 42 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue