|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.raba.ConditionalRabaCoder
public class ConditionalRabaCoder
Coder conditionally applies other IRabaCoders based on a condition,
typically the branching factor or the #of elements in the IRaba.
| Constructor Summary | |
|---|---|
ConditionalRabaCoder()
De-serialization ctor. |
|
ConditionalRabaCoder(IRabaCoder smallCoder,
IRabaCoder bigCoder,
int bigSize)
|
|
| Method Summary | |
|---|---|
ICodedRaba |
decode(AbstractFixedByteArrayBuffer data)
Return an IRaba which can access the coded data. |
AbstractFixedByteArrayBuffer |
encode(IRaba raba,
DataOutputBuffer buf)
Encode the data. |
ICodedRaba |
encodeLive(IRaba raba,
DataOutputBuffer buf)
Encode the data, returning an ICodedRaba. |
boolean |
isKeyCoder()
Return true if this implementation can code B+Tree keys
(supports search on the coded representation). |
protected boolean |
isSmall(int size)
Return true iff the "small" IRabaCoder should be
applied. |
boolean |
isValueCoder()
Return true if this implementation can code B+Tree values
(allows nulls). |
void |
readExternal(ObjectInput in)
|
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConditionalRabaCoder()
public ConditionalRabaCoder(IRabaCoder smallCoder,
IRabaCoder bigCoder,
int bigSize)
smallCoder - The coder for a small IRaba.bigCoder - The coder for a large IRaba.bigSize - An IRaba with this many elements will be coded using
the bigCoder.| Method Detail |
|---|
protected boolean isSmall(int size)
true iff the "small" IRabaCoder should be
applied.
size - The size of the IRaba to be coded.
public final boolean isKeyCoder()
IRabaCodertrue if this implementation can code B+Tree keys
(supports search on the coded representation). Note that some
implementations can code either keys or values.
isKeyCoder in interface IRabaCoderpublic final boolean isValueCoder()
IRabaCodertrue if this implementation can code B+Tree values
(allows nulls). Note that some implementations can code
either keys or values.
isValueCoder in interface IRabaCoderpublic ICodedRaba decode(AbstractFixedByteArrayBuffer data)
IRabaCoderIRaba which can access the coded data. In general,
implementations SHOULD NOT materialize a backing byte[][]. Instead, the
implementation should access the data in place within the caller's
buffer. Frequently used fields MAY be cached, but the whole point of the
IRabaCoder is to minimize the in-memory footprint for the B+Tree
by using a coded (aka compressed) representation of the keys and values
whenever possible.
decode in interface IRabaCoderdata - The record containing the coded data.
public ICodedRaba encodeLive(IRaba raba,
DataOutputBuffer buf)
IRabaCoderICodedRaba. Implementations of this
method should be optimized for the very common use case where the caller
requires immediate access to the coded data record. In that case, many of
the IRabaCoder implementations can be optimized by passing the
underlying decoding object directly into an alternative constructor for
the ICodedRaba. The byte[] slice for the coded data record is
available from ICodedRaba.data().
This method covers the vast major of the use cases for coding data, which
is to code B+Tree keys or values for a node or leaf that has been evicted
from the AbstractBTree's write retention queue. The common use
case is to wrap a coded record that was read from an IRawStore.
The IndexSegmentBuilder is a special case, since the coded record
will not be used other than to write it on the disk.
encodeLive in interface IRabaCoder
public AbstractFixedByteArrayBuffer encode(IRaba raba,
DataOutputBuffer buf)
IRabaCoder
Note: Implementations of this method are typically heavy. While it is
always valid to IRabaCoder.encode(IRaba, DataOutputBuffer) an IRaba
, DO NOT invoke this arbitrarily on data which may already be
coded. The ICodedRaba interface will always be implemented for
coded data.
encode in interface IRabaCoderraba - The data.buf - A buffer on which the coded data will be written.
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||