public class ShardBoundaries
extends java.lang.Object
Keyspace
.
Technically, if we use n
shards, this is a list of n-1
tokens and each token tk
gets assigned
to the shard ID corresponding to the slot of the smallest token in the list that is greater to tk
, or n
if tk
is bigger than any token in the list.
Modifier and Type | Field and Description |
---|---|
static ShardBoundaries |
NONE |
long |
ringVersion |
Constructor and Description |
---|
ShardBoundaries(java.util.List<Token> boundaries,
long ringVersion) |
ShardBoundaries(Token[] boundaries,
long ringVersion) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
getShardForKey(PartitionPosition key)
Computes the shard to use for the provided key.
|
int |
getShardForToken(Token tk)
Computes the shard to use for the provided token.
|
int |
hashCode() |
int |
shardCount()
The number of shards that this boundaries support, that is how many different shard ids
getShardForToken(org.apache.cassandra.dht.Token) might
possibly return. |
java.lang.String |
toString() |
public static final ShardBoundaries NONE
public final long ringVersion
public ShardBoundaries(Token[] boundaries, long ringVersion)
public ShardBoundaries(java.util.List<Token> boundaries, long ringVersion)
public int getShardForToken(Token tk)
public int getShardForKey(PartitionPosition key)
public int shardCount()
getShardForToken(org.apache.cassandra.dht.Token)
might
possibly return.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2009-2022 The Apache Software Foundation