RBitSet cardinality and length type replaced to long

pull/365/head
Nikita 9 years ago
parent dcab532b84
commit 7c4bbd6c02

@ -437,7 +437,7 @@ public class Redisson implements RedissonClient {
public NodesGroup<ClusterNode> getClusterNodesGroup() {
if (!config.isClusterConfig()) {
throw new IllegalStateException("Redisson not in cluster mode!");
throw new IllegalStateException("Redisson is not in cluster mode!");
}
return new RedisNodes<ClusterNode>(connectionManager);
}

@ -36,7 +36,7 @@ public class RedissonBitSet extends RedissonExpirable implements RBitSet {
}
@Override
public int length() {
public long length() {
return get(lengthAsync());
}
@ -91,7 +91,7 @@ public class RedissonBitSet extends RedissonExpirable implements RBitSet {
}
@Override
public int cardinality() {
public long cardinality() {
return get(cardinalityAsync());
}
@ -178,8 +178,8 @@ public class RedissonBitSet extends RedissonExpirable implements RBitSet {
}
@Override
public Future<Integer> lengthAsync() {
return commandExecutor.evalReadAsync(getName(), codec, RedisCommands.EVAL_INTEGER,
public Future<Long> lengthAsync() {
return commandExecutor.evalReadAsync(getName(), codec, RedisCommands.EVAL_LONG,
"local fromBit = redis.call('bitpos', KEYS[1], 1, -1);"
+ "local toBit = 8*(fromBit/8 + 1) - fromBit % 8;"
+ "for i = toBit, fromBit, -1 do "
@ -238,7 +238,7 @@ public class RedissonBitSet extends RedissonExpirable implements RBitSet {
}
@Override
public Future<Integer> cardinalityAsync() {
public Future<Long> cardinalityAsync() {
return commandExecutor.readAsync(getName(), codec, RedisCommands.BITCOUNT, getName());
}

@ -24,7 +24,7 @@ import java.util.BitSet;
*/
public interface RBitSet extends RExpirable, RBitSetAsync {
int length();
long length();
void set(long fromIndex, long toIndex, boolean value);
@ -46,7 +46,7 @@ public interface RBitSet extends RExpirable, RBitSetAsync {
byte[] toByteArray();
int cardinality();
long cardinality();
void clear(long bitIndex);

@ -28,7 +28,7 @@ public interface RBitSetAsync extends RExpirableAsync {
Future<byte[]> toByteArrayAsync();
Future<Integer> lengthAsync();
Future<Long> lengthAsync();
Future<Void> setAsync(long fromIndex, long toIndex, boolean value);
@ -48,7 +48,7 @@ public interface RBitSetAsync extends RExpirableAsync {
Future<Void> setAsync(long bitIndex, boolean value);
Future<Integer> cardinalityAsync();
Future<Long> cardinalityAsync();
Future<Void> clearAsync(long bitIndex);

Loading…
Cancel
Save