com.bigdata.btree.proc
Class AbstractKeyArrayIndexProcedure

java.lang.Object
  extended by com.bigdata.btree.proc.AbstractIndexProcedure
      extended by com.bigdata.btree.proc.AbstractKeyArrayIndexProcedure
All Implemented Interfaces:
IIndexProcedure, IKeyArrayIndexProcedure, Externalizable, Serializable
Direct Known Subclasses:
BatchContains, BatchInsert, BatchLookup, BatchRemove, Id2TermWriteProc, JustIndexWriteProc, MagicIndexWriteProc, SPOIndexWriteProc, Term2IdWriteProc, TextIndexWriteProc

public abstract class AbstractKeyArrayIndexProcedure
extends AbstractIndexProcedure
implements IKeyArrayIndexProcedure, Externalizable

Abstract base class supports compact serialization and compression for remote IKeyArrayIndexProcedure execution (procedures may be executed on a local index, but they are only (de-)serialized when executed on a remote index).

Version:
$Id: AbstractKeyArrayIndexProcedure.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Nested Class Summary
static class AbstractKeyArrayIndexProcedure.ResultBitBuffer
          A class useful for sending a logical boolean[] back from a remote procedure call.
static class AbstractKeyArrayIndexProcedure.ResultBitBufferCounter
          Counts the #of true bits in the AbstractKeyArrayIndexProcedure.ResultBitBuffer(s).
static class AbstractKeyArrayIndexProcedure.ResultBitBufferHandler
          Knows how to aggregate AbstractKeyArrayIndexProcedure.ResultBitBuffer objects.
static class AbstractKeyArrayIndexProcedure.ResultBuffer
          A class useful for sending some kinds of data back from a remote procedure call (those readily expressed as a byte[][]).
static class AbstractKeyArrayIndexProcedure.ResultBufferHandler
          Knows how to aggregate AbstractKeyArrayIndexProcedure.ResultBuffer objects.
 
Field Summary
protected  boolean DEBUG
          True iff the log level is DEBUG or less.
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
protected AbstractKeyArrayIndexProcedure()
          De-serialization constructor.
protected AbstractKeyArrayIndexProcedure(IRabaCoder keysCoder, IRabaCoder valsCoder, int fromIndex, int toIndex, byte[][] keys, byte[][] vals)
           
 
Method Summary
 byte[] getKey(int i)
          Return the key at the given index.
 int getKeyCount()
          The #of keys/tuples
 IRaba getKeys()
          The keys.
 byte[] getValue(int i)
          Return the value at the given index.
 IRaba getValues()
          The values.
 void readExternal(ObjectInput in)
           
protected  void readMetadata(ObjectInput in)
          Reads metadata written by writeMetadata(ObjectOutput).
 void writeExternal(ObjectOutput out)
           
protected  void writeMetadata(ObjectOutput out)
          Writes metadata (not the keys or values, but just other metadata used by the procedure).
 
Methods inherited from class com.bigdata.btree.proc.AbstractIndexProcedure
getKeyBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.btree.proc.IIndexProcedure
apply, isReadOnly
 

Field Detail

log

protected static final org.apache.log4j.Logger log

DEBUG

protected final boolean DEBUG
True iff the log level is DEBUG or less.

Constructor Detail

AbstractKeyArrayIndexProcedure

protected AbstractKeyArrayIndexProcedure()
De-serialization constructor.


AbstractKeyArrayIndexProcedure

protected AbstractKeyArrayIndexProcedure(IRabaCoder keysCoder,
                                         IRabaCoder valsCoder,
                                         int fromIndex,
                                         int toIndex,
                                         byte[][] keys,
                                         byte[][] vals)
Parameters:
keySer - The object used to serialize the keys.
valSer - The object used to serialize the vals (optional IFF vals is null).
fromIndex - The index of the first key in keys to be processed (inclusive).
toIndex - The index of the last key in keys to be processed.
keys - The keys (unsigned variable length byte[]s) MUST be in sorted order (the logic to split procedures across partitioned indices depends on this, plus ordered reads and writes on indices are MUCH more efficient).
vals - The values (optional, must be co-indexed with keys when non-null).
Method Detail

getKeys

public final IRaba getKeys()
Description copied from interface: IKeyArrayIndexProcedure
The keys.

Specified by:
getKeys in interface IKeyArrayIndexProcedure
Returns:
The keys and never null.

getValues

public final IRaba getValues()
Description copied from interface: IKeyArrayIndexProcedure
The values.

Specified by:
getValues in interface IKeyArrayIndexProcedure
Returns:
The values -or- null if no values were associated with the IIndexProcedure.

getKeyCount

public final int getKeyCount()
Description copied from interface: IKeyArrayIndexProcedure
The #of keys/tuples

Specified by:
getKeyCount in interface IKeyArrayIndexProcedure

getKey

public final byte[] getKey(int i)
Description copied from interface: IKeyArrayIndexProcedure
Return the key at the given index.

Specified by:
getKey in interface IKeyArrayIndexProcedure
Parameters:
i - The index (origin zero).
Returns:
The key at that index.

getValue

public final byte[] getValue(int i)
Description copied from interface: IKeyArrayIndexProcedure
Return the value at the given index.

Specified by:
getValue in interface IKeyArrayIndexProcedure
Parameters:
i - The index (origin zero).
Returns:
The value at that index.

readExternal

public final void readExternal(ObjectInput in)
                        throws IOException,
                               ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public final void writeExternal(ObjectOutput out)
                         throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readMetadata

protected void readMetadata(ObjectInput in)
                     throws IOException,
                            ClassNotFoundException
Reads metadata written by writeMetadata(ObjectOutput).

Parameters:
in -
Throws:
IOException
ClassNotFoundException

writeMetadata

protected void writeMetadata(ObjectOutput out)
                      throws IOException
Writes metadata (not the keys or values, but just other metadata used by the procedure).

The default implementation writes out the #getKeysCoder() and the #getValuesCoder().

Parameters:
out -
Throws:
IOException


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.