com.bigdata.btree.proc
Class BatchInsert

java.lang.Object
  extended by com.bigdata.btree.proc.AbstractIndexProcedure
      extended by com.bigdata.btree.proc.AbstractKeyArrayIndexProcedure
          extended by com.bigdata.btree.proc.BatchInsert
All Implemented Interfaces:
IIndexProcedure, IKeyArrayIndexProcedure, IParallelizableIndexProcedure, Externalizable, Serializable

public class BatchInsert
extends AbstractKeyArrayIndexProcedure
implements IParallelizableIndexProcedure

Batch insert operation.

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

Nested Class Summary
static class BatchInsert.BatchInsertConstructor
          Factory for BatchInsert procedures.
 
Nested classes/interfaces inherited from class com.bigdata.btree.proc.AbstractKeyArrayIndexProcedure
AbstractKeyArrayIndexProcedure.ResultBitBuffer, AbstractKeyArrayIndexProcedure.ResultBitBufferCounter, AbstractKeyArrayIndexProcedure.ResultBitBufferHandler, AbstractKeyArrayIndexProcedure.ResultBuffer, AbstractKeyArrayIndexProcedure.ResultBufferHandler
 
Field Summary
 
Fields inherited from class com.bigdata.btree.proc.AbstractKeyArrayIndexProcedure
DEBUG, log
 
Constructor Summary
  BatchInsert()
          De-serialization ctor.
protected BatchInsert(IRabaCoder keysCoder, IRabaCoder valsCoder, int fromIndex, int toIndex, byte[][] keys, byte[][] vals, boolean returnOldValues)
          Create a batch insert operation.
 
Method Summary
 AbstractKeyArrayIndexProcedure.ResultBuffer apply(IIndex ndx)
          Applies the operator using ISimpleBTree#insert(Object, Object)
 boolean getReturnOldValues()
          True iff the old values stored under the keys will be returned by apply(IIndex).
 boolean isReadOnly()
          Return true iff the procedure asserts that it will not write on the index.
protected  void readMetadata(ObjectInput in)
          Reads metadata written by AbstractKeyArrayIndexProcedure.writeMetadata(ObjectOutput).
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.AbstractKeyArrayIndexProcedure
getKey, getKeyCount, getKeys, getValue, getValues, readExternal, writeExternal
 
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
 

Constructor Detail

BatchInsert

public BatchInsert()
De-serialization ctor.


BatchInsert

protected BatchInsert(IRabaCoder keysCoder,
                      IRabaCoder valsCoder,
                      int fromIndex,
                      int toIndex,
                      byte[][] keys,
                      byte[][] vals,
                      boolean returnOldValues)
Create a batch insert operation.

Batch insert operation of N tuples presented in sorted order. This operation can be very efficient if the tuples are presented sorted by key order.

Parameters:
keys - A series of keys paired to values. Each key is an variable length unsigned byte[]. The keys MUST be presented in sorted order.
vals - An array of values corresponding to those keys. Null elements are allowed.
returnOldValues - When true the old values for those keys will be returned by apply(IIndex).
See Also:
BatchInsert.BatchInsertConstructor
Method Detail

getReturnOldValues

public boolean getReturnOldValues()
True iff the old values stored under the keys will be returned by apply(IIndex).


isReadOnly

public final boolean isReadOnly()
Description copied from interface: IIndexProcedure
Return true iff the procedure asserts that it will not write on the index. When true, the procedure may be run against a view of the index that is read-only or which allows concurrent processes to read on the same index object. When false the procedure will be run against a mutable view of the index (assuming that the procedure is executed in a context that has access to a mutable index view).

Specified by:
isReadOnly in interface IIndexProcedure

apply

public AbstractKeyArrayIndexProcedure.ResultBuffer apply(IIndex ndx)
Applies the operator using ISimpleBTree#insert(Object, Object)

Specified by:
apply in interface IIndexProcedure
Parameters:
ndx -
Returns:
Either null if the old values were not requested or a ResultBuffer containing the old values.

readMetadata

protected void readMetadata(ObjectInput in)
                     throws IOException,
                            ClassNotFoundException
Description copied from class: AbstractKeyArrayIndexProcedure
Reads metadata written by AbstractKeyArrayIndexProcedure.writeMetadata(ObjectOutput).

Overrides:
readMetadata in class AbstractKeyArrayIndexProcedure
Throws:
IOException
ClassNotFoundException

writeMetadata

protected void writeMetadata(ObjectOutput out)
                      throws IOException
Description copied from class: AbstractKeyArrayIndexProcedure
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().

Overrides:
writeMetadata in class AbstractKeyArrayIndexProcedure
Throws:
IOException


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