Package org.apache.cassandra.db.memtable
Class ShardBoundaries
java.lang.Object
org.apache.cassandra.db.memtable.ShardBoundaries
Holds boundaries (tokens) used to map a particular token (so partition key) to a shard id.
In practice, each keyspace has its associated boundaries, see
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionShardBoundaries(List<Token> boundaries, long ringVersion) ShardBoundaries(Token[] boundaries, long ringVersion) -
Method Summary
Modifier and TypeMethodDescriptionbooleanintComputes the shard to use for the provided key.intComputes the shard to use for the provided token.inthashCode()intThe number of shards that this boundaries support, that is how many different shard idsgetShardForToken(org.apache.cassandra.dht.Token)might possibly return.toString()
-
Field Details
-
NONE
-
ringVersion
public final long ringVersion
-
-
Constructor Details
-
ShardBoundaries
-
ShardBoundaries
-
-
Method Details
-
getShardForToken
Computes the shard to use for the provided token. -
getShardForKey
Computes the shard to use for the provided key. -
shardCount
public int shardCount()The number of shards that this boundaries support, that is how many different shard idsgetShardForToken(org.apache.cassandra.dht.Token)might possibly return.- Returns:
- the number of shards supported by theses boundaries.
-
toString
-
equals
-
hashCode
public int hashCode()
-