Class ScannerImpl
- java.lang.Object
-
- org.apache.accumulo.core.clientImpl.ScannerOptions
-
- org.apache.accumulo.core.clientImpl.ScannerImpl
-
- All Implemented Interfaces:
AutoCloseable
,Iterable<Map.Entry<Key,Value>>
,Scanner
,ScannerBase
public class ScannerImpl extends ScannerOptions implements Scanner
provides scanner functionality "Clients can iterate over multiple column families, and there are several mechanisms for limiting the rows, columns, and timestamps traversed by a scan. For example, we could restrict [a] scan ... to only produce anchors whose columns match [a] regular expression ..., or to only produce anchors whose timestamps fall within ten days of the current time."
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.accumulo.core.client.ScannerBase
ScannerBase.ConsistencyLevel
-
-
Field Summary
-
Fields inherited from class org.apache.accumulo.core.clientImpl.ScannerOptions
batchTimeout, classLoaderContext, executionHints, fetchedColumns, retryTimeout, serverSideIteratorList, serverSideIteratorOptions
-
-
Constructor Summary
Constructors Constructor Description ScannerImpl(ClientContext context, TableId tableId, Authorizations authorizations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes any underlying connections on the scanner.void
disableIsolation()
Disables row isolation.void
enableIsolation()
Enables row isolation.Authorizations
getAuthorizations()
Returns the authorizations that have been set on the scannerint
getBatchSize()
Returns the batch size (number of Key/Value pairs) that will be fetched at a time from a tablet server.Range
getRange()
Returns the range of keys to scan over.long
getReadaheadThreshold()
The number of batches of Key/Value pairs returned before theScanner
will begin to prefetch the next batchIterator<Map.Entry<Key,Value>>
iterator()
Returns an iterator over an accumulo table.void
setBatchSize(int size)
Sets the number of Key/Value pairs that will be fetched at a time from a tablet server.void
setRange(Range range)
Sets the range of keys to scan over.void
setReadaheadThreshold(long batches)
Sets the number of batches of Key/Value pairs returned before theScanner
will begin to prefetch the next batch-
Methods inherited from class org.apache.accumulo.core.clientImpl.ScannerOptions
addScanIterator, clearClassLoaderContext, clearColumns, clearSamplerConfiguration, clearScanIterators, fetchColumn, fetchColumn, fetchColumnFamily, getBatchTimeout, getClassLoaderContext, getConsistencyLevel, getFetchedColumns, getSamplerConfiguration, getTimeout, removeScanIterator, setBatchTimeout, setClassLoaderContext, setConsistencyLevel, 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, forEach, getBatchTimeout, getClassLoaderContext, getConsistencyLevel, getSamplerConfiguration, getTimeout, removeScanIterator, setBatchTimeout, setClassLoaderContext, setConsistencyLevel, setExecutionHints, setSamplerConfiguration, setTimeout, stream, updateScanIteratorOption
-
-
-
-
Constructor Detail
-
ScannerImpl
public ScannerImpl(ClientContext context, TableId tableId, Authorizations authorizations)
-
-
Method Detail
-
setRange
public void setRange(Range range)
Description copied from interface:Scanner
Sets the range of keys to scan over.
-
getRange
public Range getRange()
Description copied from interface:Scanner
Returns the range of keys to scan over.
-
setBatchSize
public void setBatchSize(int size)
Description copied from interface:Scanner
Sets the number of Key/Value pairs that will be fetched at a time from a tablet server.- Specified by:
setBatchSize
in interfaceScanner
- Parameters:
size
- the number of Key/Value pairs to fetch per call to Accumulo
-
getBatchSize
public int getBatchSize()
Description copied from interface:Scanner
Returns the batch size (number of Key/Value pairs) that will be fetched at a time from a tablet server.- Specified by:
getBatchSize
in interfaceScanner
- Returns:
- the batch size configured for this scanner
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator()
Description copied from interface:ScannerBase
Returns 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:
iterator
in interfaceIterable<Map.Entry<Key,Value>>
- Specified by:
iterator
in interfaceScannerBase
- Overrides:
iterator
in classScannerOptions
- Returns:
- an iterator over Key,Value pairs which meet the restrictions set on the scanner
-
getAuthorizations
public Authorizations getAuthorizations()
Description copied from interface:ScannerBase
Returns the authorizations that have been set on the scanner- Specified by:
getAuthorizations
in interfaceScannerBase
- Overrides:
getAuthorizations
in classScannerOptions
- Returns:
- The authorizations set on the scanner instance
-
enableIsolation
public void enableIsolation()
Description copied from interface:Scanner
Enables 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:
enableIsolation
in interfaceScanner
-
disableIsolation
public void disableIsolation()
Description copied from interface:Scanner
Disables 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:
disableIsolation
in interfaceScanner
-
setReadaheadThreshold
public void setReadaheadThreshold(long batches)
Description copied from interface:Scanner
Sets the number of batches of Key/Value pairs returned before theScanner
will begin to prefetch the next batch- Specified by:
setReadaheadThreshold
in interfaceScanner
- Parameters:
batches
- Non-negative number of batches
-
getReadaheadThreshold
public long getReadaheadThreshold()
Description copied from interface:Scanner
The number of batches of Key/Value pairs returned before theScanner
will begin to prefetch the next batch- Specified by:
getReadaheadThreshold
in interfaceScanner
- Returns:
- Number of batches before read-ahead begins
-
close
public void close()
Description copied from interface:ScannerBase
Closes any underlying connections on the scanner. This may invalidate any iterators derived from the Scanner, causing them to throw exceptions.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceScannerBase
- Overrides:
close
in classScannerOptions
-
-