Package org.apache.cassandra.dht
Class OrderPreservingPartitioner.StringToken
java.lang.Object
org.apache.cassandra.dht.Token
org.apache.cassandra.dht.OrderPreservingPartitioner.StringToken
- All Implemented Interfaces:
Serializable,Comparable<Token>,RingPosition<Token>
- Enclosing class:
- OrderPreservingPartitioner
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.dht.Token
Token.KeyBound, Token.TokenFactory, Token.TokenSerializer -
Field Summary
Fields inherited from class org.apache.cassandra.dht.Token
serializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasComparableBytes(ByteComparable.Version version) Produce a weakly prefix-free byte-comparable representation of the token, i.e.intbooleanlonginthashCode()Returns the next possible token in the token space, one that compares greater than this and such that there is no other token that sits between this token and it in the token order.doubleReturns a measure for the token space covered between this token and next.toString()Methods inherited from class org.apache.cassandra.dht.Token
getLongValue, getToken, isMinimum, maxKeyBound, minKeyBound, minValue
-
Constructor Details
-
StringToken
-
-
Method Details
-
getPartitioner
- Specified by:
getPartitionerin interfaceRingPosition<Token>- Specified by:
getPartitionerin classToken
-
getHeapSize
public long getHeapSize()- Specified by:
getHeapSizein classToken
-
asComparableBytes
Description copied from class:TokenProduce a weakly prefix-free byte-comparable representation of the token, i.e. such a sequence of bytes that any pair x, y of valid tokens of this type and any bytes b1, b2 between 0x10 and 0xEF, (+ stands for concatenation) compare(x, y) == compareLexicographicallyUnsigned(asByteComparable(x)+b1, asByteComparable(y)+b2) (i.e. the values compare like the original type, and an added 0x10-0xEF byte at the end does not change that) and: asByteComparable(x)+b1 is not a prefix of asByteComparable(y) (weakly prefix free) (i.e. a valid representation of a value may be a prefix of another valid representation of a value only if the following byte in the latter is smaller than 0x10 or larger than 0xEF). These properties are trivially true if the encoding compares correctly and is prefix free, but also permits a little more freedom that enables somewhat more efficient encoding of arbitrary-length byte-comparable blobs.- Specified by:
asComparableBytesin classToken
-
getTokenValue
- Specified by:
getTokenValuein classToken
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
-
size
Description copied from class:TokenReturns a measure for the token space covered between this token and next. Used by the token allocation algorithm (see CASSANDRA-7032). -
nextValidToken
Description copied from class:TokenReturns the next possible token in the token space, one that compares greater than this and such that there is no other token that sits between this token and it in the token order. This is not possible for all token types, esp. for comparison-based tokens such as the LocalPartioner used for classic secondary indexes. Used to avoid clashes between nodes in separate datacentres trying to use the same token via the token allocation algorithm, as well as in constructing token ranges for sstables.- Specified by:
nextValidTokenin classToken
-