Package org.apache.cassandra.schema
Class TableId
- java.lang.Object
-
- org.apache.cassandra.schema.TableId
-
public class TableId extends java.lang.Object
The unique identifier of a table.This is essentially a UUID, but we wrap it as it's used quite a bit in the code and having a nicely named class make the code more readable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.UUID
asUUID()
static TableId
deserialize(java.io.DataInput in)
boolean
equals(java.lang.Object o)
static TableId
forSystemTable(java.lang.String keyspace, java.lang.String table)
Creates the UUID of a system table.static TableId
fromString(java.lang.String idString)
static TableId
fromUUID(java.util.UUID id)
static TableId
generate()
int
hashCode()
void
serialize(java.io.DataOutput out)
int
serializedSize()
static Pair<java.lang.String,TableId>
tableNameAndIdFromFilename(java.lang.String filename)
java.lang.String
toHexString()
java.lang.String
toString()
static TableId
unsafeDeterministic(java.lang.String keyspace, java.lang.String table)
-
-
-
Method Detail
-
fromUUID
public static TableId fromUUID(java.util.UUID id)
-
generate
public static TableId generate()
-
fromString
public static TableId fromString(java.lang.String idString)
-
tableNameAndIdFromFilename
@Nullable public static Pair<java.lang.String,TableId> tableNameAndIdFromFilename(java.lang.String filename)
-
forSystemTable
public static TableId forSystemTable(java.lang.String keyspace, java.lang.String table)
Creates the UUID of a system table. This is deterministically based on the table name as system tables are hardcoded and initialized independently on each node (they don't go through a CREATE), but we still want them to have the same ID everywhere. We shouldn't use this for any other table.
-
unsafeDeterministic
public static TableId unsafeDeterministic(java.lang.String keyspace, java.lang.String table)
-
toHexString
public java.lang.String toHexString()
-
asUUID
public java.util.UUID asUUID()
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
serialize
public void serialize(java.io.DataOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
serializedSize
public int serializedSize()
-
deserialize
public static TableId deserialize(java.io.DataInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-