org.apache.accumulo.core.client
Interface ScannerBase

All Superinterfaces:
Iterable<Map.Entry<Key,Value>>
All Known Subinterfaces:
BatchDeleter, BatchScanner, Scanner
All Known Implementing Classes:
ClientSideIteratorScanner, IsolatedScanner, MockBatchDeleter, MockBatchScanner, MockScanner, MockScannerBase, OfflineScanner, ScannerImpl, ScannerOptions, TabletServerBatchDeleter, TabletServerBatchReader

public interface ScannerBase
extends Iterable<Map.Entry<Key,Value>>

This class hosts configuration methods that are shared between different types of scanners.


Method Summary
 void addScanIterator(IteratorSetting cfg)
          Add a server-side scan iterator.
 void clearColumns()
          Clears the columns to be fetched (useful for resetting the scanner for reuse).
 void clearScanIterators()
          Clears scan iterators prior to returning a scanner to the pool.
 void fetchColumn(org.apache.hadoop.io.Text colFam, org.apache.hadoop.io.Text colQual)
          Adds a column to the list of columns that will be fetched by this scanner.
 void fetchColumnFamily(org.apache.hadoop.io.Text col)
          Adds a column family to the list of columns that will be fetched by this scanner.
 Iterator<Map.Entry<Key,Value>> iterator()
          Returns an iterator over an accumulo table.
 void removeScanIterator(String iteratorName)
          Remove an iterator from the list of iterators.
 void setColumnFamilyRegex(String regex)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 void setColumnQualifierRegex(String regex)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 void setRowRegex(String regex)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 // Use the more flexible addScanIterator method:
 ScanIterator cfg = new ScanIterator("regex", RegexIterator.class);
 RegexIterator.setRegexs(cfg, row, null, null, null, false);
 scanner.addScanIterator(priority, cfg);
 
 void setScanIteratorOption(String iteratorName, String key, String value)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting).
 void setScanIterators(int priority, String iteratorClass, String iteratorName)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting).
 void setupRegex(String iteratorName, int iteratorPriority)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 void setValueRegex(String regex)
          Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 void updateScanIteratorOption(String iteratorName, String key, String value)
          Update the options for an iterator.
 

Method Detail

addScanIterator

void addScanIterator(IteratorSetting cfg)
Add a server-side scan iterator.

Parameters:
cfg - fully specified scan-time iterator, including all options for the iterator. Any changes to the iterator setting after this call are not propagated to the stored iterator.
Throws:
IllegalArgumentException - if the setting conflicts with existing iterators

removeScanIterator

void removeScanIterator(String iteratorName)
Remove an iterator from the list of iterators.

Parameters:
iteratorName - nickname used for the iterator

updateScanIteratorOption

void updateScanIteratorOption(String iteratorName,
                              String key,
                              String value)
Update the options for an iterator. Note that this does not change the iterator options during a scan, it just replaces the given option on a configured iterator before a scan is started.

Parameters:
iteratorName - the name of the iterator to change
key - the name of the option
value - the new value for the named option

setScanIterators

@Deprecated
void setScanIterators(int priority,
                                 String iteratorClass,
                                 String iteratorName)
                      throws IOException
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting).

Throws:
IOException

setScanIteratorOption

@Deprecated
void setScanIteratorOption(String iteratorName,
                                      String key,
                                      String value)
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting).


setupRegex

@Deprecated
void setupRegex(String iteratorName,
                           int iteratorPriority)
                throws IOException
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter

Call this method to initialize regular expressions on a scanner. If it is not called, reasonable defaults will be used.

Parameters:
iteratorName - a nickname for the iterator
iteratorPriority - determines the order in which iterators are applied (system iterators are always applied first, then per-table and scan-time, lowest first)
Throws:
IOException - if an exception occurs reading from the iterator stack

setRowRegex

@Deprecated
void setRowRegex(String regex)
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter
 // Use the more flexible addScanIterator method:
 ScanIterator cfg = new ScanIterator("regex", RegexIterator.class);
 RegexIterator.setRegexs(cfg, row, null, null, null, false);
 scanner.addScanIterator(priority, cfg);
 

Set a row regular expression that filters non matching entries server side.

Parameters:
regex - java regular expression to match

setColumnFamilyRegex

@Deprecated
void setColumnFamilyRegex(String regex)
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter

Set a column family regular expression that filters non matching entries server side.

Parameters:
regex - java regular expression to match

setColumnQualifierRegex

@Deprecated
void setColumnQualifierRegex(String regex)
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter

Use addScanIterator(int, ScanIterator); Set a column qualifier regular expression that filters non matching entries server side.

Parameters:
regex - java regular expression to match

setValueRegex

@Deprecated
void setValueRegex(String regex)
Deprecated. Since 1.4, use addScanIterator(org.apache.accumulo.core.client.IteratorSetting) and RegExFilter

Set a value regular expression that filters non matching entries server side.

Parameters:
regex - java regular expression to match

fetchColumnFamily

void fetchColumnFamily(org.apache.hadoop.io.Text col)
Adds a column family to the list of columns that will be fetched by this scanner. By default when no columns have been added the scanner fetches all columns.

Parameters:
col - the column family to be fetched

fetchColumn

void fetchColumn(org.apache.hadoop.io.Text colFam,
                 org.apache.hadoop.io.Text colQual)
Adds a column to the list of columns that will be fetched by this scanner. The column is identified by family and qualifier. By default when no columns have been added the scanner fetches all columns.

Parameters:
colFam - the column family of the column to be fetched
colQual - the column qualifier of the column to be fetched

clearColumns

void clearColumns()
Clears the columns to be fetched (useful for resetting the scanner for reuse). Once cleared, the scanner will fetch all columns.


clearScanIterators

void clearScanIterators()
Clears scan iterators prior to returning a scanner to the pool.


iterator

Iterator<Map.Entry<Key,Value>> iterator()
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 interface Iterable<Map.Entry<Key,Value>>
Returns:
an iterator over Key,Value pairs which meet the restrictions set on the scanner


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.