@InterfaceAudience.Private public class ScannerModel extends Object implements ProtobufMessageHandler, Serializable
<complexType name="Scanner"> <sequence> <element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"/> <element name="filter" type="string" minOccurs="0" maxOccurs="1"></element> </sequence> <attribute name="startRow" type="base64Binary"></attribute> <attribute name="endRow" type="base64Binary"></attribute> <attribute name="batch" type="int"></attribute> <attribute name="caching" type="int"></attribute> <attribute name="startTime" type="int"></attribute> <attribute name="endTime" type="int"></attribute> <attribute name="maxVersions" type="int"></attribute> </complexType>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ScannerModel.FilterModel |
private static class |
ScannerModel.JaxbJsonProviderHolder
Implement lazily-instantiated singleton as per recipe here:
http://literatejava.com/jvm/fastest-threadsafe-singleton-jvm/
|
Modifier and Type | Field and Description |
---|---|
private int |
batch |
private boolean |
cacheBlocks |
private int |
caching |
private static byte[] |
COLUMN_DIVIDER |
private List<byte[]> |
columns |
private byte[] |
endRow |
private long |
endTime |
private String |
filter |
private List<String> |
labels |
private int |
maxVersions |
private static long |
serialVersionUID |
private byte[] |
startRow |
private long |
startTime |
Constructor and Description |
---|
ScannerModel()
Default constructor
|
ScannerModel(byte[] startRow,
byte[] endRow,
List<byte[]> columns,
int batch,
int caching,
long endTime,
int maxVersions,
String filter)
Constructor
|
ScannerModel(byte[] startRow,
byte[] endRow,
List<byte[]> columns,
int batch,
int caching,
long startTime,
long endTime,
String filter)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(byte[] column)
Add a column to the column set
|
void |
addLabel(String label)
Add a visibility label to the scan
|
static Filter |
buildFilter(String s) |
byte[] |
createProtobufOutput()
Returns the protobuf represention of the model
|
static ScannerModel |
fromScan(Scan scan) |
int |
getBatch()
Returns the number of cells to return in batch
|
boolean |
getCacheBlocks()
Returns true if HFile blocks should be cached on the servers for this scan, false otherwise
|
int |
getCaching()
Returns the number of rows that the scanner to fetch at once
|
List<byte[]> |
getColumns()
Returns list of columns of interest in column:qualifier format, or empty for all
|
byte[] |
getEndRow()
Returns end row
|
long |
getEndTime()
Returns the upper bound on timestamps of items of interest
|
String |
getFilter()
Returns the filter specification
|
private static org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider |
getJasonProvider()
Get the
JacksonJaxbJsonProvider instance; |
List<String> |
getLabels() |
int |
getMaxVersions()
Returns maximum number of versions to return
|
ProtobufMessageHandler |
getObjectFromMessage(byte[] message)
Initialize the model from a protobuf representation.
|
byte[] |
getStartRow()
Returns start row
|
long |
getStartTime()
Returns the lower bound on timestamps of items of interest
|
boolean |
hasEndRow()
Returns true if an end row was specified
|
boolean |
hasStartRow()
Returns true if a start row was specified
|
void |
setBatch(int batch) |
void |
setCacheBlocks(boolean value) |
void |
setCaching(int caching) |
void |
setColumns(List<byte[]> columns) |
void |
setEndRow(byte[] endRow) |
void |
setEndTime(long endTime) |
void |
setFilter(String filter) |
void |
setMaxVersions(int maxVersions) |
void |
setStartRow(byte[] startRow) |
void |
setStartTime(long startTime) |
static String |
stringifyFilter(Filter filter) |
private static final long serialVersionUID
private byte[] startRow
private byte[] endRow
private int batch
private long startTime
private long endTime
private int maxVersions
private int caching
private boolean cacheBlocks
private static final byte[] COLUMN_DIVIDER
public ScannerModel()
public ScannerModel(byte[] startRow, byte[] endRow, List<byte[]> columns, int batch, int caching, long endTime, int maxVersions, String filter)
startRow
- the start key of the row-rangeendRow
- the end key of the row-rangecolumns
- the columns to scanbatch
- the number of values to return in batchcaching
- the number of rows that the scanner will fetch at onceendTime
- the upper bound on timestamps of values of interestmaxVersions
- the maximum number of versions to returnfilter
- a filter specification (values with timestamps later than this are excluded)public ScannerModel(byte[] startRow, byte[] endRow, List<byte[]> columns, int batch, int caching, long startTime, long endTime, String filter)
startRow
- the start key of the row-rangeendRow
- the end key of the row-rangecolumns
- the columns to scanbatch
- the number of values to return in batchcaching
- the number of rows that the scanner will fetch at oncestartTime
- the lower bound on timestamps of values of interest (values with timestamps
earlier than this are excluded)endTime
- the upper bound on timestamps of values of interest (values with timestamps
later than this are excluded)filter
- a filter specificationprivate static org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider getJasonProvider()
JacksonJaxbJsonProvider
instance;JacksonJaxbJsonProvider
.public static Filter buildFilter(String s) throws Exception
s
- the JSON representation of the filterException
public static String stringifyFilter(Filter filter) throws Exception
filter
- the filterException
public static ScannerModel fromScan(Scan scan) throws Exception
scan
- the scan specification nException
public void addColumn(byte[] column)
column
- the column name, as <column>(:<qualifier>)?public boolean hasStartRow()
public byte[] getStartRow()
public boolean hasEndRow()
public byte[] getEndRow()
public List<byte[]> getColumns()
public int getBatch()
public int getCaching()
public boolean getCacheBlocks()
public long getStartTime()
public long getEndTime()
public int getMaxVersions()
public void setStartRow(byte[] startRow)
startRow
- start rowpublic void setEndRow(byte[] endRow)
endRow
- end rowpublic void setColumns(List<byte[]> columns)
columns
- list of columns of interest in column:qualifier format, or empty for allpublic void setBatch(int batch)
batch
- the number of cells to return in batchpublic void setCaching(int caching)
caching
- the number of rows to fetch at oncepublic void setCacheBlocks(boolean value)
value
- true if HFile blocks should be cached on the servers for this scan, false
otherwisepublic void setMaxVersions(int maxVersions)
maxVersions
- maximum number of versions to returnpublic void setStartTime(long startTime)
startTime
- the lower bound on timestamps of values of interestpublic void setEndTime(long endTime)
endTime
- the upper bound on timestamps of values of interestpublic byte[] createProtobufOutput()
ProtobufMessageHandler
createProtobufOutput
in interface ProtobufMessageHandler
public ProtobufMessageHandler getObjectFromMessage(byte[] message) throws IOException
ProtobufMessageHandler
getObjectFromMessage
in interface ProtobufMessageHandler
message
- the raw bytes of the protobuf messageIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.