refactoring

pull/5004/merge
Nikita Koksharov 2 years ago
parent 708d7879f8
commit d7deba6728

@ -78,26 +78,13 @@ public class ClusterPartition {
return masterFail; return masterFail;
} }
public void addSlots(BitSet slots) {
this.slots.or(slots);
}
public void removeSlots(BitSet slots) {
this.slots.andNot(slots);
}
public void addSlotRanges(Set<ClusterSlotRange> ranges) { public void addSlotRanges(Set<ClusterSlotRange> ranges) {
for (ClusterSlotRange clusterSlotRange : ranges) { for (ClusterSlotRange clusterSlotRange : ranges) {
slots.set(clusterSlotRange.getStartSlot(), clusterSlotRange.getEndSlot() + 1); slots.set(clusterSlotRange.getStartSlot(), clusterSlotRange.getEndSlot() + 1);
} }
slotRanges.addAll(ranges); slotRanges.addAll(ranges);
} }
public void removeSlotRanges(Set<ClusterSlotRange> ranges) {
for (ClusterSlotRange clusterSlotRange : ranges) {
slots.clear(clusterSlotRange.getStartSlot(), clusterSlotRange.getEndSlot() + 1);
}
slotRanges.removeAll(ranges);
}
public Set<ClusterSlotRange> getSlotRanges() { public Set<ClusterSlotRange> getSlotRanges() {
return slotRanges; return slotRanges;
} }

Loading…
Cancel
Save