water
Class Key
java.lang.Object
water.Iced
water.Key
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, Freezable
public final class Key
- extends Iced
- implements java.lang.Comparable
Keys
This class defines:
- A Key's bytes (name) & hash
- Known Disk & memory replicas.
- A cache of somewhat expensive to compute stuff related to the current
Cloud, plus a byte of the desired replication factor.
Keys are expected to be a high-count item, hence the care about size.
Keys are *interned* in the local K/V store, a non-blocking hash set and are
kept pointer equivalent (via the interning) for cheap compares. The
interning only happens after a successful insert in the local H2O.STORE via
H2O.put_if_later.
Nested Class Summary |
static class |
Key.Ary
|
Method Summary |
long |
cloud_info(H2O cloud)
|
int |
compareTo(java.lang.Object o)
|
int |
desired()
|
boolean |
equals(java.lang.Object o)
|
static int |
hash(byte[] bits,
int from,
int to)
|
int |
hashCode()
|
H2ONode |
home_node()
|
boolean |
home()
|
int |
home(H2O cloud)
|
static Key |
make()
|
static Key |
make(byte[] kb)
|
static Key |
make(byte[] kb,
byte rf)
|
static Key |
make(byte[] kb,
byte rf,
byte systemType,
H2ONode... replicas)
|
static Key |
make(java.lang.String s)
|
static Key |
make(java.lang.String s,
byte rf)
|
static Key |
make(java.lang.String s,
byte rf,
byte systemType,
H2ONode... replicas)
|
Key |
read(AutoBuffer bb)
Deserialize from the AutoBuffer into a pre-existing 'this' object. |
int |
replica(H2O cloud)
|
java.lang.String |
toString()
Converts the key to HTML displayable string. |
int |
type()
|
boolean |
user_allowed()
|
AutoBuffer |
write(AutoBuffer bb)
Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer. |
AutoBuffer |
writeJSON(AutoBuffer bb)
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
KEY_LENGTH
public static final int KEY_LENGTH
- See Also:
- Constant Field Values
_kb
public byte[] _kb
ARRAYLET_CHUNK
public static final byte ARRAYLET_CHUNK
- See Also:
- Constant Field Values
BUILT_IN_KEY
public static final byte BUILT_IN_KEY
- See Also:
- Constant Field Values
JOB
public static final byte JOB
- See Also:
- Constant Field Values
VEC
public static final byte VEC
- See Also:
- Constant Field Values
DVEC
public static final byte DVEC
- See Also:
- Constant Field Values
VGROUP
public static final byte VGROUP
- See Also:
- Constant Field Values
HDFS_INTERNAL_BLOCK
public static final byte HDFS_INTERNAL_BLOCK
- See Also:
- Constant Field Values
HDFS_INODE
public static final byte HDFS_INODE
- See Also:
- Constant Field Values
HDFS_BLOCK_INFO
public static final byte HDFS_BLOCK_INFO
- See Also:
- Constant Field Values
HDFS_BLOCK_SHADOW
public static final byte HDFS_BLOCK_SHADOW
- See Also:
- Constant Field Values
DFJ_INTERNAL_USER
public static final byte DFJ_INTERNAL_USER
- See Also:
- Constant Field Values
USER_KEY
public static final byte USER_KEY
- See Also:
- Constant Field Values
DEFAULT_DESIRED_REPLICA_FACTOR
public static final byte DEFAULT_DESIRED_REPLICA_FACTOR
- See Also:
- Constant Field Values
MAGIC_CHAR
public static final char MAGIC_CHAR
- See Also:
- Constant Field Values
home
public int home(H2O cloud)
replica
public int replica(H2O cloud)
desired
public int desired()
home
public boolean home()
home_node
public H2ONode home_node()
cloud_info
public long cloud_info(H2O cloud)
hash
public static int hash(byte[] bits,
int from,
int to)
make
public static Key make(byte[] kb,
byte rf)
make
public static Key make(byte[] kb)
make
public static Key make(java.lang.String s)
make
public static Key make(java.lang.String s,
byte rf)
make
public static Key make()
make
public static Key make(java.lang.String s,
byte rf,
byte systemType,
H2ONode... replicas)
make
public static Key make(byte[] kb,
byte rf,
byte systemType,
H2ONode... replicas)
read
public final Key read(AutoBuffer bb)
- Description copied from interface:
Freezable
- Deserialize from the AutoBuffer into a pre-existing 'this' object.
- Specified by:
read
in interface Freezable
- Overrides:
read
in class Iced
write
public final AutoBuffer write(AutoBuffer bb)
- Description copied from interface:
Freezable
- Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.
- Specified by:
write
in interface Freezable
- Overrides:
write
in class Iced
writeJSON
public final AutoBuffer writeJSON(AutoBuffer bb)
- Overrides:
writeJSON
in class Iced
user_allowed
public boolean user_allowed()
type
public int type()
toString
public java.lang.String toString()
- Converts the key to HTML displayable string.
For user keys returns the key itself, for system keys returns their
hexadecimal values.
- Overrides:
toString
in class java.lang.Object
- Returns:
- key as a printable string
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interface java.lang.Comparable