diff --git a/src/main/java/io/appform/dropwizard/sharding/utils/ShardCalculator.java b/src/main/java/io/appform/dropwizard/sharding/utils/ShardCalculator.java index 96cfd1cb..69b136fb 100644 --- a/src/main/java/io/appform/dropwizard/sharding/utils/ShardCalculator.java +++ b/src/main/java/io/appform/dropwizard/sharding/utils/ShardCalculator.java @@ -39,17 +39,17 @@ public int getBucketId(T key) { return extractor.bucketId(key); } - public int getBucketCount() { - return shardManager.numBuckets(); - } - public int shardId(T key) { int bucketId = getBucketId(key); return shardManager.shardForBucket(bucketId); } + public boolean isBucketValid(int bucketId) { + return shardManager.isMappedToValidShard(bucketId); + } + public boolean isOnValidShard(T key) { int bucketId = extractor.bucketId(key); - return shardManager.isMappedToValidShard(bucketId); + return isBucketValid(bucketId); } }