Package org.apache.accumulo.core.client
Class ClientSideIteratorScanner
- java.lang.Object
-
- org.apache.accumulo.core.clientImpl.ScannerOptions
-
- org.apache.accumulo.core.client.ClientSideIteratorScanner
-
- All Implemented Interfaces:
AutoCloseable,Iterable<Map.Entry<Key,Value>>,Scanner,ScannerBase
public class ClientSideIteratorScanner extends ScannerOptions implements Scanner
A scanner that instantiates iterators on the client side instead of on the tablet server. This can be useful for testing iterators or in cases where you don't want iterators affecting the performance of tablet servers.Suggested usage:
Scanner scanner = client.createScanner(tableName, authorizations); scanner = new ClientSideIteratorScanner(scanner);Iterators added to this scanner will be run in the client JVM. Separate scan iterators can be run on the server side and client side by adding iterators to the source scanner (which will execute server side) and to the client side scanner (which will execute client side).
-
-
Field Summary
-
Fields inherited from class org.apache.accumulo.core.clientImpl.ScannerOptions
batchTimeOut, classLoaderContext, executionHints, fetchedColumns, serverSideIteratorList, serverSideIteratorOptions, timeOut
-
-
Constructor Summary
Constructors Constructor Description ClientSideIteratorScanner(Scanner scanner)Constructs a scanner that can execute client-side iterators.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearIteratorSamplerConfiguration()Clear any iterator sampler configuration.voidclose()Closes any underlying connections on the scanner.voiddisableIsolation()Disables row isolation.voidenableIsolation()Enables row isolation.AuthorizationsgetAuthorizations()Returns the authorizations that have been set on the scannerintgetBatchSize()Returns the batch size (number of Key/Value pairs) that will be fetched at a time from a tablet server.SamplerConfigurationgetIteratorSamplerConfiguration()RangegetRange()Returns the range of keys to scan over.longgetReadaheadThreshold()The number of batches of Key/Value pairs returned before theScannerwill begin to prefetch the next batchIterator<Map.Entry<Key,Value>>iterator()Returns an iterator over an accumulo table.voidsetBatchSize(int size)Sets the number of Key/Value pairs that will be fetched at a time from a tablet server.voidsetIteratorSamplerConfiguration(SamplerConfiguration sc)This is provided for the case where no sampler configuration is set on the scanner, but there is a need to create iterator deep copies that have sampling enabled.voidsetRange(Range range)Sets the range of keys to scan over.voidsetReadaheadThreshold(long batches)Sets the number of batches of Key/Value pairs returned before theScannerwill begin to prefetch the next batchvoidsetSource(Scanner scanner)Sets the source Scanner.-
Methods inherited from class org.apache.accumulo.core.clientImpl.ScannerOptions
addScanIterator, clearClassLoaderContext, clearColumns, clearSamplerConfiguration, clearScanIterators, fetchColumn, fetchColumn, fetchColumnFamily, getBatchTimeout, getClassLoaderContext, getFetchedColumns, getSamplerConfiguration, getTimeout, removeScanIterator, setBatchTimeout, setClassLoaderContext, setExecutionHints, setOptions, setSamplerConfiguration, setTimeout, updateScanIteratorOption
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.apache.accumulo.core.client.ScannerBase
addScanIterator, clearClassLoaderContext, clearColumns, clearSamplerConfiguration, clearScanIterators, fetchColumn, fetchColumn, fetchColumn, fetchColumnFamily, fetchColumnFamily, getBatchTimeout, getClassLoaderContext, getSamplerConfiguration, getTimeout, removeScanIterator, setBatchTimeout, setClassLoaderContext, setExecutionHints, setSamplerConfiguration, setTimeout, updateScanIteratorOption
-
-
-
-
Constructor Detail
-
ClientSideIteratorScanner
public ClientSideIteratorScanner(Scanner scanner)
Constructs a scanner that can execute client-side iterators.- Parameters:
scanner- the source scanner
-
-
Method Detail
-
setSource
public void setSource(Scanner scanner)
Sets the source Scanner.
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator()
Description copied from interface:ScannerBaseReturns an iterator over an accumulo table. This iterator uses the options that are currently set for its lifetime, so setting options will have no effect on existing iterators.Keys returned by the iterator are not guaranteed to be in sorted order.
- Specified by:
iteratorin interfaceIterable<Map.Entry<Key,Value>>- Specified by:
iteratorin interfaceScannerBase- Overrides:
iteratorin classScannerOptions- Returns:
- an iterator over Key,Value pairs which meet the restrictions set on the scanner
-
getAuthorizations
public Authorizations getAuthorizations()
Description copied from interface:ScannerBaseReturns the authorizations that have been set on the scanner- Specified by:
getAuthorizationsin interfaceScannerBase- Overrides:
getAuthorizationsin classScannerOptions- Returns:
- The authorizations set on the scanner instance
-
setRange
public void setRange(Range range)
Description copied from interface:ScannerSets the range of keys to scan over.
-
getRange
public Range getRange()
Description copied from interface:ScannerReturns the range of keys to scan over.
-
setBatchSize
public void setBatchSize(int size)
Description copied from interface:ScannerSets the number of Key/Value pairs that will be fetched at a time from a tablet server.- Specified by:
setBatchSizein interfaceScanner- Parameters:
size- the number of Key/Value pairs to fetch per call to Accumulo
-
getBatchSize
public int getBatchSize()
Description copied from interface:ScannerReturns the batch size (number of Key/Value pairs) that will be fetched at a time from a tablet server.- Specified by:
getBatchSizein interfaceScanner- Returns:
- the batch size configured for this scanner
-
enableIsolation
public void enableIsolation()
Description copied from interface:ScannerEnables row isolation. Writes that occur to a row after a scan of that row has begun will not be seen if this option is enabled.- Specified by:
enableIsolationin interfaceScanner
-
disableIsolation
public void disableIsolation()
Description copied from interface:ScannerDisables row isolation. Writes that occur to a row after a scan of that row has begun may be seen if this option is enabled.- Specified by:
disableIsolationin interfaceScanner
-
getReadaheadThreshold
public long getReadaheadThreshold()
Description copied from interface:ScannerThe number of batches of Key/Value pairs returned before theScannerwill begin to prefetch the next batch- Specified by:
getReadaheadThresholdin interfaceScanner- Returns:
- Number of batches before read-ahead begins
-
setReadaheadThreshold
public void setReadaheadThreshold(long batches)
Description copied from interface:ScannerSets the number of batches of Key/Value pairs returned before theScannerwill begin to prefetch the next batch- Specified by:
setReadaheadThresholdin interfaceScanner- Parameters:
batches- Non-negative number of batches
-
setIteratorSamplerConfiguration
public void setIteratorSamplerConfiguration(SamplerConfiguration sc)
This is provided for the case where no sampler configuration is set on the scanner, but there is a need to create iterator deep copies that have sampling enabled. If sampler configuration is set on the scanner, then this method does not need to be called inorder to create deep copies with sampling.Setting this differently than the scanners sampler configuration may cause exceptions.
- Since:
- 1.8.0
-
clearIteratorSamplerConfiguration
public void clearIteratorSamplerConfiguration()
Clear any iterator sampler configuration.- Since:
- 1.8.0
-
getIteratorSamplerConfiguration
public SamplerConfiguration getIteratorSamplerConfiguration()
- Returns:
- currently set iterator sampler configuration.
- Since:
- 1.8.0
-
close
public void close()
Description copied from interface:ScannerBaseCloses any underlying connections on the scanner. This may invalidate any iterators derived from the Scanner, causing them to throw exceptions.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceScannerBase- Overrides:
closein classScannerOptions
-
-