Package org.apache.cassandra.utils
Class CounterId
- java.lang.Object
-
- org.apache.cassandra.utils.CounterId
-
-
Field Summary
Fields Modifier and Type Field Description static int
LENGTH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
bytes()
int
compareTo(CounterId o)
boolean
equals(java.lang.Object o)
static CounterId
fromInt(int n)
Pack an int in a valid CounterId so that the resulting ids respects the numerical ordering.static CounterId
generate()
static CounterId
getLocalId()
int
hashCode()
boolean
isLocalId()
java.lang.String
toString()
static CounterId
wrap(java.nio.ByteBuffer id)
static CounterId
wrap(java.nio.ByteBuffer bb, int offset)
-
-
-
Field Detail
-
LENGTH
public static final int LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocalId
public static CounterId getLocalId()
-
fromInt
public static CounterId fromInt(int n)
Pack an int in a valid CounterId so that the resulting ids respects the numerical ordering. Used for creating handcrafted but easy to understand contexts in unit tests (see CounterContextTest). Also used to generate a special ID for special-case update contexts (see CounterContext.createUpdate()).
-
wrap
public static CounterId wrap(java.nio.ByteBuffer id)
-
wrap
public static CounterId wrap(java.nio.ByteBuffer bb, int offset)
-
generate
public static CounterId generate()
-
bytes
public java.nio.ByteBuffer bytes()
-
isLocalId
public boolean isLocalId()
-
compareTo
public int compareTo(CounterId o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<CounterId>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-