|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.AbstractTuple<E>
public abstract class AbstractTuple<E>
Abstract base class with much of the functionality of ITuple.
| Field Summary | |
|---|---|
protected int |
flags
|
protected boolean |
needKeys
|
protected boolean |
needVals
|
| Constructor Summary | |
|---|---|
AbstractTuple(int flags)
|
|
| Method Summary | |
|---|---|
protected void |
clear()
Clears the buffered data copied into the AbstractTuple from the
source btree. |
void |
copy(int index,
ILeafData leaf)
Copy data and metadata for the index entry from the Leaf into the
Tuple and increment the counter of the #of visited entries. |
void |
copyTuple(byte[] key,
byte[] val)
Assumes that the tuple is not deleted and that timestamp information is not available. |
void |
copyTuple(byte[] key,
byte[] val,
boolean deleted,
long timestamp)
Sets all fields on the tuple and increments the tuple visited counter. |
void |
copyTuple(ITuple t)
Sets all fields and increments the tuple visited counter. |
int |
flags()
The IRangeQuery flags |
static String |
flagString(int flags)
Externalizes the flags as a list of symbolic constants. |
byte[] |
getKey()
Returns a copy of the current key. |
ByteArrayBuffer |
getKeyBuffer()
The buffer into which the keys are being copied. |
boolean |
getKeysRequested()
True iff IRangeQuery.KEYS was specified. |
DataInputBuffer |
getKeyStream()
Return a stream from which the key may be read. |
E |
getObject()
De-serializes the object from the key and/or value. |
byte[] |
getValue()
The value in the index under the key. |
ByteArrayBuffer |
getValueBuffer()
The buffer into which the values are being copied. |
boolean |
getValuesRequested()
True iff IRangeQuery.VALS was specified. |
DataInputBuffer |
getValueStream()
Return a stream from which the value may be read. |
long |
getVersionTimestamp()
Return the timestamp associated with the index entry -or- 0L
IFF the index does not support transactional isolation. |
long |
getVisitCount()
The #of entries that have been visited so far and ZERO (0) until the first entry has been visited. |
boolean |
isDeletedVersion()
Return true iff the index entry was marked as deleted. |
boolean |
isNull()
true iff the value stored under the index entry is
null. |
IBlock |
readBlock(long addr)
Return an object that may be used to perform a streaming read of a large record from the IRawStore that provided this tuple. |
String |
toString()
Note: A de-serialization problem thrown out of toString() MAY
indicate that the ITupleSerializer was not overriden and a raw
byte[] was stored as the tuple's value. |
static String |
toString(ITuple tuple)
Utility method returns a String representation of an
ITuple. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.bigdata.btree.ITuple |
|---|
getSourceIndex, getTupleSerializer |
| Field Detail |
|---|
protected final int flags
protected final boolean needKeys
protected final boolean needVals
| Constructor Detail |
|---|
public AbstractTuple(int flags)
| Method Detail |
|---|
public final int flags()
ITupleIRangeQuery flags
if ((flags & IRangeQuery.KEYS) != 0) {
// keys requested.
}
Note: the IRangeQuery.DELETED flag state is a property of the
iterator NOT the tuple. Whether or not a tuple is deleted is detected
using ITuple.isDeletedVersion().
flags in interface ITuple<E>public final boolean getKeysRequested()
ITupleIRangeQuery.KEYS was specified.
getKeysRequested in interface ITuple<E>public final boolean getValuesRequested()
ITupleIRangeQuery.VALS was specified.
getValuesRequested in interface ITuple<E>public final ByteArrayBuffer getKeyBuffer()
ITuple
getKeyBuffer in interface ITuple<E>public final DataInputBuffer getKeyStream()
getKeyStream in interface ITuple<E>UnsupportedOperationException - if the keys were not requested.public final DataInputBuffer getValueStream()
getValueStream in interface ITuple<E>UnsupportedOperationException - if the values were not requested.public long getVisitCount()
getVisitCount in interface ITuple<E>public final byte[] getKey()
ITuple
Note: This can cause a heap allocation depending on how the keys are
buffered. See ITuple.getKeyBuffer() to avoid that allocation.
getKey in interface ITuple<E>public final boolean isNull()
ITupletrue iff the value stored under the index entry is
null.
isNull in interface ITuple<E>public final byte[] getValue()
ITuple
Note: This causes a heap allocation. See ITuple.getValueBuffer() to
avoid that allocation.
getValue in interface ITuple<E>null if
version metadata is being maintained and the the index entry is
marked as deleted.public final ByteArrayBuffer getValueBuffer()
ITuple
Note: If the index supports delete markers then you MUST test
ITuple.isDeletedVersion() in order to determine whether or not the
value buffer contains data for the current index entry.
getValueBuffer in interface ITuple<E>public final E getObject()
ITuple
getObject in interface ITuple<E>ITupleSerializer.deserialize(ITuple)public final long getVersionTimestamp()
ITuple0L
IFF the index does not support transactional isolation.
getVersionTimestamp in interface ITuple<E>public final boolean isDeletedVersion()
ITupletrue iff the index entry was marked as deleted.
Note: If the index does not support deletion markers then this method
MUST return false.
Note: the IRangeQuery.DELETED flag state is a property of the
iterator NOT the tuple. Whether or not a tuple is deleted is detected
using ITuple.isDeletedVersion().
isDeletedVersion in interface ITuple<E>public IBlock readBlock(long addr)
ITupleIRawStore that provided this tuple.
readBlock in interface ITuple<E>addr - The address of the record.
Consider the notion of leases for the read back from a data service. If you do not read on the block soon enough the lease is gone and you will get an error if you try to read on the block. The lease can be used to limit the time that an index partition is locked to a data service.
public void copy(int index,
ILeafData leaf)
Leaf into the
Tuple and increment the counter of the #of visited entries.
index - The index entry.leaf - The leaf. If a raw record must be materialized, it will be
read from the backing store for the Leaf.ITuple.getSourceIndex() should be implemented by this
class (or maybe add a setSourceIndex() to be more flexible).
public void copyTuple(byte[] key,
byte[] val)
key - val -
public void copyTuple(byte[] key,
byte[] val,
boolean deleted,
long timestamp)
key - val - deleted - timestamp - public void copyTuple(ITuple t)
t - Some tuple.protected void clear()
AbstractTuple from the
source btree.
public String toString()
toString() MAY
indicate that the ITupleSerializer was not overriden and a raw
byte[] was stored as the tuple's value. In this case,
getObject() will attempt to use Java standard de-serialization
on the byte[] value, which will, of course, fail. The fix for this
problem is to specify the NOPTupleSerializer for the index. This
problem may still show up in some of the test suites when the trace level
is turned up since many of the tests were written before the
ITupleSerializer abstraction was addeded.
toString in class Objectpublic static String toString(ITuple tuple)
String representation of an
ITuple.
tuple - The ITuple.
String representation of that ITuple.public static String flagString(int flags)
flags - The IRangeQuery flags.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||