com.bigdata.service.ndx
Class DataServiceTupleIterator<E>

java.lang.Object
  extended by com.bigdata.btree.AbstractChunkedTupleIterator<E>
      extended by com.bigdata.service.ndx.RawDataServiceTupleIterator<E>
          extended by com.bigdata.service.ndx.DataServiceTupleIterator<E>
All Implemented Interfaces:
ITupleIterator<E>, Iterator<ITuple<E>>

public class DataServiceTupleIterator<E>
extends RawDataServiceTupleIterator<E>

Class supports range query across against an unpartitioned index on an IDataService.

Version:
$Id: DataServiceTupleIterator.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected  IScaleOutClientIndex ndx
          Used to submit delete requests to the scale-out index in a robust manner.
 
Fields inherited from class com.bigdata.service.ndx.RawDataServiceTupleIterator
dataService, ERR_NO_KEYS, ERR_NO_VALS, name
 
Fields inherited from class com.bigdata.btree.AbstractChunkedTupleIterator
capacity, DEBUG, exhausted, filter, flags, fromKey, INFO, lastVisited, lastVisitedKeyInPriorResultSet, log, nqueries, nvisited, rset, toKey
 
Constructor Summary
DataServiceTupleIterator(IScaleOutClientIndex ndx, IDataService dataService, String name, long timestamp, byte[] fromKey, byte[] toKey, int capacity, int flags, IFilterConstructor filter)
           
 
Method Summary
protected  void deleteBehind(int n, Iterator<byte[]> itr)
          Batch delete the index entries identified by keys and clear the list.
protected  void deleteLast(byte[] key)
          Delete the index entry identified by key.
 boolean hasNext()
          This method (and no other method on this class) will throw a (possibly wrapped) StaleLocatorException if an index partition is split, joined or moved during traversal.
 
Methods inherited from class com.bigdata.service.ndx.RawDataServiceTupleIterator
getReadConsistent, getResultSet, getTimestamp, readBlock
 
Methods inherited from class com.bigdata.btree.AbstractChunkedTupleIterator
continuationQuery, deleteBehind, flush, getCommitTime, getDefaultCapacity, getQueryCount, getReadTime, getVisitedCount, next, rangeQuery, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ndx

protected final IScaleOutClientIndex ndx
Used to submit delete requests to the scale-out index in a robust manner.

Constructor Detail

DataServiceTupleIterator

public DataServiceTupleIterator(IScaleOutClientIndex ndx,
                                IDataService dataService,
                                String name,
                                long timestamp,
                                byte[] fromKey,
                                byte[] toKey,
                                int capacity,
                                int flags,
                                IFilterConstructor filter)
Parameters:
ndx - The scale-out index view.
dataService - The data service to be queried.
name - The name of an index partition of that scale-out index on the data service.
timestamp - The timestamp used for the reads. If ITx.READ_COMMITTED, then each read will be against the most recent commit point on the database. If you want read-consistent, then use IIndexStore.getLastCommitTime() rather than ITx.READ_COMMITTED.
fromKey -
toKey -
capacity -
flags -
filter -
Method Detail

hasNext

public boolean hasNext()
This method (and no other method on this class) will throw a (possibly wrapped) StaleLocatorException if an index partition is split, joined or moved during traversal.

The caller MUST test any thrown exception. If the exception is, or wraps, a StaleLocatorException, then the caller MUST refresh its locator for the key range of the index partition that it thought it was traversing, and then continue traversal based on the revised locators(s).

Note: The StaleLocatorException CAN NOT arise from any other method since only #getResultSet(byte[], byte[], int, int, IFilterConstructor) actually reads from the IDataService and ALL calls to that method are driven by hasNext().

Note: The methods that handle delete-behind use the ClientIndexView to be robust and therefore will never throw a StaleLocatorException.

Specified by:
hasNext in interface Iterator<ITuple<E>>
Overrides:
hasNext in class AbstractChunkedTupleIterator<E>
Returns:
True iff the iterator is not exhausted.

deleteBehind

protected void deleteBehind(int n,
                            Iterator<byte[]> itr)
Description copied from class: AbstractChunkedTupleIterator
Batch delete the index entries identified by keys and clear the list.

Overrides:
deleteBehind in class RawDataServiceTupleIterator<E>
Parameters:
n - The #of keys to be deleted.
itr - The keys to be deleted.

deleteLast

protected void deleteLast(byte[] key)
Description copied from class: AbstractChunkedTupleIterator
Delete the index entry identified by key.

Overrides:
deleteLast in class RawDataServiceTupleIterator<E>
Parameters:
key - A key.


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