water
Class Value

java.lang.Object
  extended by water.Iced
      extended by water.Value
All Implemented Interfaces:
java.lang.Cloneable, jsr166y.ForkJoinPool.ManagedBlocker, Freezable

public class Value
extends Iced
implements jsr166y.ForkJoinPool.ManagedBlocker

The core Value stored in the distributed K/V store. It contains an underlying byte[] which may be spilled to disk and freed by the MemoryManager.


Field Summary
 Key _key
           
 int _max
           
 byte _persist
           
static byte BACKEND_MASK
           
static byte HDFS
           
static byte ICE
           
static int MAX
           
static byte NFS
           
static byte NOTdsk
           
static byte ON_dsk
           
static byte S3
           
static byte TCP
           
 
Constructor Summary
Value()
           
Value(Key k, byte[] mem)
           
Value(Key k, Freezable pojo)
           
Value(Key k, Iced pojo)
           
Value(Key k, Iced pojo, byte be)
           
Value(Key k, int max)
           
Value(Key k, int max, byte be)
           
Value(Key k, int max, byte[] mem, short type, byte be)
           
Value(Key k, java.lang.String s)
           
 
Method Summary
 boolean block()
          Possibly blocks the current thread.
 java.lang.String className()
           
 void clrdsk()
           
 void freeMem()
           
 void freePOJO()
           
<T extends Iced>
T
get()
           
<T> T
get(java.lang.Class<T> fc)
           
 byte[] getBytes()
           
 byte[] getFirstBytes()
           
 Freezable getFreezable()
           
 java.lang.StringBuilder getString(int len, java.lang.StringBuilder sb)
           
 boolean isArray()
           
 boolean isBitIdentical(Value v)
           
 boolean isByteVec()
           
 boolean isFrame()
           
 boolean isHex()
           
 boolean isPersisted()
           
 boolean isRawData()
           
 boolean isReleasable()
          Return true if blocking is unnecessary.
 boolean isRemotePutInFlight()
           
 boolean isVec()
           
static Value lazyArrayChunk(Key key)
          Lazily manifest data chunks on demand.
 long length()
           
 byte[] memOrLoad()
           
 java.lang.String nameOfPersist()
           
static java.lang.String nameOfPersist(int x)
           
 int numReplicas()
           
 boolean onHDFS()
           
 boolean onICE()
           
 boolean onNFS()
           
 boolean onS3()
           
 java.io.InputStream openStream()
           
 java.io.InputStream openStream(Job.ProgressMonitor p)
          Creates a Stream for reading bytes
 byte[] rawMem()
           
 Freezable rawPOJO()
           
 Value read(AutoBuffer bb)
          Deserialize from the AutoBuffer into a pre-existing 'this' object.
 void setdsk()
           
 void setHdfs()
          Set persistence to HDFS from ICE
 void touch()
           
 int type()
           
 AutoBuffer write(AutoBuffer bb)
          Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.
 
Methods inherited from class water.Iced
clone, frozenType, init, newInstance, toDocField, writeJSON, writeJSONFields
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX

public static final int MAX
See Also:
Constant Field Values

_max

public int _max

_key

public transient Key _key

_persist

public volatile byte _persist

ICE

public static final byte ICE
See Also:
Constant Field Values

HDFS

public static final byte HDFS
See Also:
Constant Field Values

S3

public static final byte S3
See Also:
Constant Field Values

NFS

public static final byte NFS
See Also:
Constant Field Values

TCP

public static final byte TCP
See Also:
Constant Field Values

BACKEND_MASK

public static final byte BACKEND_MASK
See Also:
Constant Field Values

NOTdsk

public static final byte NOTdsk
See Also:
Constant Field Values

ON_dsk

public static final byte ON_dsk
See Also:
Constant Field Values
Constructor Detail

Value

public Value(Key k,
             int max,
             byte[] mem,
             short type,
             byte be)

Value

public Value(Key k,
             byte[] mem)

Value

public Value(Key k,
             int max)

Value

public Value(Key k,
             int max,
             byte be)

Value

public Value(Key k,
             java.lang.String s)

Value

public Value(Key k,
             Iced pojo)

Value

public Value(Key k,
             Iced pojo,
             byte be)

Value

public Value(Key k,
             Freezable pojo)

Value

public Value()
Method Detail

type

public int type()

className

public java.lang.String className()

rawMem

public final byte[] rawMem()

rawPOJO

public Freezable rawPOJO()

freeMem

public final void freeMem()

freePOJO

public final void freePOJO()

memOrLoad

public final byte[] memOrLoad()

getBytes

public final byte[] getBytes()

get

public <T extends Iced> T get()

get

public <T> T get(java.lang.Class<T> fc)

getFreezable

public Freezable getFreezable()

touch

public final void touch()

clrdsk

public final void clrdsk()

setdsk

public final void setdsk()

isPersisted

public final boolean isPersisted()

onICE

public boolean onICE()

onHDFS

public boolean onHDFS()

onNFS

public boolean onNFS()

onS3

public boolean onS3()

nameOfPersist

public java.lang.String nameOfPersist()

nameOfPersist

public static java.lang.String nameOfPersist(int x)

setHdfs

public void setHdfs()
Set persistence to HDFS from ICE


getString

public java.lang.StringBuilder getString(int len,
                                         java.lang.StringBuilder sb)

isArray

public boolean isArray()

isFrame

public boolean isFrame()

isVec

public boolean isVec()

isByteVec

public boolean isByteVec()

isRawData

public boolean isRawData()

getFirstBytes

public byte[] getFirstBytes()

length

public long length()

openStream

public java.io.InputStream openStream()
                               throws java.io.IOException
Throws:
java.io.IOException

openStream

public java.io.InputStream openStream(Job.ProgressMonitor p)
                               throws java.io.IOException
Creates a Stream for reading bytes

Throws:
java.io.IOException

isHex

public boolean isHex()

isBitIdentical

public boolean isBitIdentical(Value v)

write

public 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

read

public Value 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

lazyArrayChunk

public static Value lazyArrayChunk(Key key)
Lazily manifest data chunks on demand. Requires a pre-existing ValueArray. Probably should be moved into HDFS-land, except that the same logic applies to all stores providing large-file access by default including S3.


numReplicas

public int numReplicas()

isRemotePutInFlight

public boolean isRemotePutInFlight()

isReleasable

public boolean isReleasable()
Return true if blocking is unnecessary. Alas, used in TWO places and the blocking API forces them to share here.

Specified by:
isReleasable in interface jsr166y.ForkJoinPool.ManagedBlocker

block

public boolean block()
Possibly blocks the current thread. Returns true if isReleasable would return true. Used by the FJ Pool management to spawn threads to prevent deadlock is otherwise all threads would block on waits.

Specified by:
block in interface jsr166y.ForkJoinPool.ManagedBlocker
Returns:
true if no additional blocking is necessary (i.e., if isReleasable would return true)