private SlotRange parseSlotRange(String[] args) { Set<Integer> slots = new LinkedHashSet<>(); for (int i = SLOTS_INDEX; i < args.length; i++) { String raw = args[i]; if (raw.startsWith("[")) { continue; } if (raw.contains("-")) { String[] slotRange = StringUtils.split(raw, "-"); if (slotRange != null) { int from = Integer.valueOf(slotRange[0]); int to = Integer.valueOf(slotRange[1]); for (int slot = from; slot <= to; slot++) { slots.add(slot); } } } else { slots.add(Integer.valueOf(raw)); } } return new SlotRange(slots); }
@Override public void clusterDeleteSlotsInRange(RedisClusterNode node, SlotRange range) { Assert.notNull(range, "Range must not be null."); clusterDeleteSlots(node, range.getSlotsArray()); }
/** * Creates new {@link RedisClusterNode} with an id and empty {@link SlotRange}. * * @param id must not be {@literal null}. */ public RedisClusterNode(String id) { this(SlotRange.empty()); Assert.notNull(id, "Id must not be null!"); this.id = id; }
private SlotRange parseSlotRange(String[] args) { Set<Integer> slots = new LinkedHashSet<>(); for (int i = SLOTS_INDEX; i < args.length; i++) { String raw = args[i]; if (raw.startsWith("[")) { continue; } if (raw.contains("-")) { String[] slotRange = StringUtils.split(raw, "-"); if (slotRange != null) { int from = Integer.valueOf(slotRange[0]); int to = Integer.valueOf(slotRange[1]); for (int slot = from; slot <= to; slot++) { slots.add(slot); } } } else { slots.add(Integer.valueOf(raw)); } } return new SlotRange(slots); }
private SlotRange parseSlotRange(String[] args) { Set<Integer> slots = new LinkedHashSet<>(); for (int i = SLOTS_INDEX; i < args.length; i++) { String raw = args[i]; if (raw.startsWith("[")) { continue; } if (raw.contains("-")) { String[] slotRange = StringUtils.split(raw, "-"); if (slotRange != null) { int from = Integer.valueOf(slotRange[0]); int to = Integer.valueOf(slotRange[1]); for (int slot = from; slot <= to; slot++) { slots.add(slot); } } } else { slots.add(Integer.valueOf(raw)); } } return new SlotRange(slots); }
public RedisClusterNodeBuilder() { this.slotRange = SlotRange.empty(); }
public RedisClusterNodeBuilder() { this.slotRange = SlotRange.empty(); }
public static SlotRange empty() { return new SlotRange(Collections.emptySet()); } }
/** * Creates new {@link RedisClusterNode} with an id and empty {@link SlotRange}. * * @param id must not be {@literal null}. */ public RedisClusterNode(String id) { this(SlotRange.empty()); Assert.notNull(id, "Id must not be null!"); this.id = id; }
/** * Creates new {@link RedisClusterNode} with empty {@link SlotRange}. * * @param host must not be {@literal null}. * @param port */ public RedisClusterNode(String host, int port) { this(host, port, SlotRange.empty()); }
public static SlotRange empty() { return new SlotRange(Collections.emptySet()); } }
@Override public void clusterDeleteSlotsInRange(RedisClusterNode node, SlotRange range) { Assert.notNull(range, "Range must not be null."); clusterDeleteSlots(node, range.getSlotsArray()); }
@Override public void addSlots(RedisClusterNode node, SlotRange range) { Assert.notNull(node, "ClusterNode must not be null."); Assert.notNull(range, "Range must not be null."); addSlots(node, range.getSlotsArray()); }
@Override public void clusterAddSlots(RedisClusterNode node, SlotRange range) { Assert.notNull(range, "Range must not be null."); clusterAddSlots(node, range.getSlotsArray()); }
/** * @param slot * @return true if slot is covered. */ public boolean servesSlot(int slot) { return slotRange.contains(slot); }
/** * Creates new {@link RedisClusterNode} with an id and empty {@link SlotRange}. * * @param id must not be {@literal null}. */ public RedisClusterNode(String id) { this(SlotRange.empty()); Assert.notNull(id, "Id must not be null!"); this.id = id; }
@Override public void addSlots(RedisClusterNode node, SlotRange range) { Assert.notNull(node, "ClusterNode must not be null."); Assert.notNull(range, "Range must not be null."); addSlots(node, range.getSlotsArray()); }
/** * @param slot * @return true if slot is covered. */ public boolean servesSlot(int slot) { return slotRange.contains(slot); }
@Override public void clusterAddSlots(RedisClusterNode node, SlotRange range) { Assert.notNull(range, "Range must not be null."); clusterAddSlots(node, range.getSlotsArray()); }
@Override public void clusterDeleteSlotsInRange(RedisClusterNode node, SlotRange range) { Assert.notNull(range, "Range must not be null."); clusterDeleteSlots(node, range.getSlotsArray()); }