public final class Value extends Iced implements ForkJoinPool.ManagedBlocker
MemoryManager, which is the Iced serialized version of the POJO,
and a cached copy of the POJO itself.
Requests to extract the POJO from the Value object first try to return the
cached POJO. If that is missing, then they will re-inflate the POJO from
the Iced byte[]. If that is missing it is only because the byte[]
was swapped to disk by the Cleaner. It will be reloaded from disk
and then inflated as normal.
The H2O DKV supports the full Java Memory Model coherency
but only with Gets and Puts. Normal Java updates to the cached POJO are
local-node visible (due to X86 and Java coherency rules) but NOT cluster-wide
visible until a Put completes after the update.
By the same token, updates ot the POJO are not reflected in the serialized form nor the disk-spill copy unless a Put is triggered. As long as a local thread keeps a pointer to the POJO, they can update it at will. If they wish to recover the POJO from the DKV at a later time with all updates intact, they must do a final Put after all updates.
Value objects maintain the needed coherency state, as well as any cached copies, plus a bunch of utility and convenience functions.
| Modifier and Type | Field and Description |
|---|---|
Key |
_key
The Key part of a Key/Value store.
|
int |
_max
Size of the serialized wad of bits.
|
static byte |
GCS |
static byte |
HDFS |
static byte |
HTTP |
static byte |
ICE |
static int |
MAX |
static byte |
NFS |
static byte |
S3 |
static byte |
TCP |
| Constructor and Description |
|---|
Value(Key k,
byte[] mem) |
Value(Key k,
Freezable pojo)
Standard constructor to build a Value from a POJO and a Key.
|
Value(Key k,
Freezable pojo,
int pojoByteSz,
byte be) |
Value(Key k,
int max,
byte[] mem,
short type,
byte be)
Construct a Value from all parts; not needed for most uses.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
block()
Possibly blocks the current thread.
|
java.lang.String |
className()
Class name of the embedded POJO, without needing an actual POJO.
|
void |
freeMem()
Invalidate byte[] cache.
|
void |
freePOJO()
Invalidate POJO cache.
|
<T extends Iced> |
get()
The FAST path get-POJO as an
Iced subclass - final method for
speed. |
<T extends Freezable> |
get(java.lang.Class<T> fc)
The FAST path get-POJO as a
Freezable - final method for speed. |
<T extends Freezable> |
getFreezable()
The FAST path get-POJO as a
Freezable - final method for speed. |
boolean |
isDeleted() |
boolean |
isESPCGroup()
Check if the Value's POJO is a
Vec.ESPC subtype. |
boolean |
isFrame()
Check if the Value's POJO is a
Frame subtype. |
boolean |
isJob()
Check if the Value's POJO is a
Job subtype. |
boolean |
isKey()
Check if the Value's POJO is a
Key subtype. |
boolean |
isLockable()
Check if the Value's POJO is a
Lockable subtype. |
boolean |
isModel()
Check if the Value's POJO is a
Model subtype. |
boolean |
isPersisted()
Check if the backing byte[] has been saved-to-disk
|
boolean |
isReleasable()
Return true if blocking is unnecessary.
|
static boolean |
isSubclassOf(int type,
java.lang.Class clz)
Check if the Value's POJO is a subtype of given type integer.
|
boolean |
isVec()
Check if the Value's POJO is a
Vec subtype. |
boolean |
isVecGroup()
Check if the Value's POJO is a
Vec.VectorGroup subtype. |
byte[] |
memOrLoad()
The FAST path get-byte-array - final method for speed.
|
static java.lang.String |
nameOfPersist(int x)
One of ICE, HDFS, S3, GCS, NFS or TCP, according to where this Value is persisted.
|
Value |
read_impl(AutoBuffer bb) |
void |
removePersist()
Remove dead Values from disk
|
void |
setDel() |
void |
setDsk() |
static Value |
STORE_get(Key key) |
java.lang.Class<? extends Freezable> |
theFreezableClass() |
int |
type() |
AutoBuffer |
write_impl(AutoBuffer ab) |
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonString, write, writeExternal, writeJSONpublic transient Key _key
Should not be set by any user code.
public static final int MAX
public int _max
public static final byte ICE
public static final byte HDFS
public static final byte S3
public static final byte NFS
public static final byte GCS
public static final byte HTTP
public static final byte TCP
public Value(Key k, int max, byte[] mem, short type, byte be)
water.fvec to build Value objects over
already-existing Files, so that the File contents will be lazily
swapped-in as the Values are first used.public Value(Key k, byte[] mem)
public int type()
public java.lang.String className()
public final void freeMem()
public final void freePOJO()
public final byte[] memOrLoad()
public final <T extends Iced> T get()
Iced subclass - final method for
speed. Will (re)build the POJO from the _mem array. Never returns NULL.public final <T extends Freezable> T get(java.lang.Class<T> fc)
Freezable - final method for speed.
Will (re)build the POJO from the _mem array. Never returns NULL. This
version has more type-checking.public final <T extends Freezable> T getFreezable()
Freezable - final method for speed.
Will (re)build the POJO from the _mem array. Never returns NULL.public final boolean isPersisted()
public final void setDsk()
public final boolean isDeleted()
public final void setDel()
public void removePersist()
public static java.lang.String nameOfPersist(int x)
public static boolean isSubclassOf(int type,
java.lang.Class clz)
public boolean isKey()
Key subtype. Does not require the POJO.Key subtype.public boolean isFrame()
Frame subtype. Does not require the POJO.Frame subtype.public boolean isVecGroup()
Vec.VectorGroup subtype. Does not require the POJO.Vec.VectorGroup subtype.public boolean isESPCGroup()
Vec.ESPC subtype. Does not require the POJO.Vec.ESPC subtype.public boolean isLockable()
Lockable subtype. Does not require the POJO.Lockable subtype.public boolean isVec()
Vec subtype. Does not require the POJO.Vec subtype.public boolean isModel()
Model subtype. Does not require the POJO.Model subtype.public boolean isJob()
Job subtype. Does not require the POJO.Job subtype.public java.lang.Class<? extends Freezable> theFreezableClass()
public final AutoBuffer write_impl(AutoBuffer ab)
public final Value read_impl(AutoBuffer bb)
public boolean isReleasable()
isReleasable in interface ForkJoinPool.ManagedBlockerpublic boolean block()
block in interface ForkJoinPool.ManagedBlockertrue if no additional blocking is necessary
(i.e., if isReleasable would return true)