Class TimeUUID

java.lang.Object
org.apache.cassandra.utils.TimeUUID
All Implemented Interfaces:
Serializable, Comparable<TimeUUID>
Direct Known Subclasses:
Ballot, SSTableReader.UniqueIdentifier

public class TimeUUID extends Object implements Serializable, Comparable<TimeUUID>
See Also:
  • Field Details

    • serialVersionUID

      public static final long serialVersionUID
      See Also:
    • UUID_EPOCH_UNIX_MILLIS

      public static final long UUID_EPOCH_UNIX_MILLIS
      See Also:
    • TIMESTAMP_UUID_VERSION_IN_MSB

      protected static final long TIMESTAMP_UUID_VERSION_IN_MSB
      See Also:
    • UUID_VERSION_BITS_IN_MSB

      protected static final long UUID_VERSION_BITS_IN_MSB
      See Also:
    • MIN_CLOCK_SEQ_AND_NODE

      public static final long MIN_CLOCK_SEQ_AND_NODE
      See Also:
    • TIMEUUID_SIZE

      public static final long TIMEUUID_SIZE
  • Constructor Details

    • TimeUUID

      public TimeUUID(long uuidTimestamp, long lsb)
  • Method Details

    • atUnixMicrosWithLsb

      public static TimeUUID atUnixMicrosWithLsb(long unixMicros, long uniqueLsb)
    • atUnixMicrosWithLsbAsUUID

      public static UUID atUnixMicrosWithLsbAsUUID(long unixMicros, long uniqueLsb)
    • minAtUnixMillis

      public static TimeUUID minAtUnixMillis(long unixMillis)
      Returns the smaller possible type 1 UUID having the provided timestamp. Warning: this method should only be used for querying as this doesn't at all guarantee the uniqueness of the resulting UUID.
    • maxAtUnixMillis

      public static TimeUUID maxAtUnixMillis(long unixMillis)
      Returns the biggest possible type 1 UUID having the provided timestamp. Warning: this method should only be used for querying as this doesn't at all guarantee the uniqueness of the resulting UUID.
    • fromString

      public static TimeUUID fromString(String uuidString)
    • fromUuid

      public static TimeUUID fromUuid(UUID uuid)
    • fromBytes

      public static TimeUUID fromBytes(long msb, long lsb)
    • deserialize

      public static TimeUUID deserialize(ByteBuffer buffer)
    • deserialize

      public static TimeUUID deserialize(DataInput in) throws IOException
      Throws:
      IOException
    • serialize

      public void serialize(DataOutput out) throws IOException
      Throws:
      IOException
    • toBytes

      public ByteBuffer toBytes()
    • toBytes

      public static byte[] toBytes(long msb, long lsb)
    • sizeInBytes

      public static long sizeInBytes()
    • asUUID

      public UUID asUUID()
    • unix

      public long unix(TimeUnit units)
      The Cassandra internal micros-resolution timestamp of the TimeUUID, as of unix epoch
    • unixMicros

      public long unixMicros()
      The Cassandra internal micros-resolution timestamp of the TimeUUID, as of unix epoch
    • uuidTimestamp

      public long uuidTimestamp()
      The UUID-format timestamp, i.e. 10x micros-resolution, as of UUIDGen.UUID_EPOCH_UNIX_MILLIS The tenths of a microsecond are used to store a flag value.
    • msb

      public long msb()
    • lsb

      public long lsb()
    • rawTimestampToUnixMicros

      public static long rawTimestampToUnixMicros(long rawTimestamp)
    • unixMillisToRawTimestamp

      public static long unixMillisToRawTimestamp(long unixMillis, long tenthsOfAMicro)
    • unixMicrosToRawTimestamp

      public static long unixMicrosToRawTimestamp(long unixMicros)
    • msbToRawTimestamp

      public static long msbToRawTimestamp(long msb)
    • rawTimestampToMsb

      public static long rawTimestampToMsb(long rawTimestamp)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(TimeUUID that)
    • equals

      public boolean equals(UUID that)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public static String toString(TimeUUID ballot)
    • toString

      public static String toString(TimeUUID ballot, String kind)
    • compareTo

      public int compareTo(TimeUUID that)
      Specified by:
      compareTo in interface Comparable<TimeUUID>