T
- the type of object being retrievedpublic class RecordRetriever<T> extends Object
RecordRetriever
instances are thread safe and
may be used from any number of threads simultaneously.Constructor and Description |
---|
RecordRetriever(GPUdb gpudb,
String tableName,
Type type)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
Type type,
Map<String,String> options)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
TypeObjectMap<T> typeObjectMap)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
TypeObjectMap<T> typeObjectMap,
Map<String,String> options)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
TypeObjectMap<T> typeObjectMap,
WorkerList workers)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
TypeObjectMap<T> typeObjectMap,
WorkerList workers,
Map<String,String> options)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
Type type,
WorkerList workers)
Creates a
RecordRetriever with the specified parameters. |
RecordRetriever(GPUdb gpudb,
String tableName,
Type type,
WorkerList workers,
Map<String,String> options)
Creates a
RecordRetriever with the specified parameters. |
Modifier and Type | Method and Description |
---|---|
GetRecordsResponse<T> |
getByKey(List<Object> keyValues,
String expression)
Retrieves records with the given key values and filter expression from
the database using a direct-to-rank fast key lookup, if possible, and
falling back to a standard lookup via the head node, if not.
|
GPUdb |
getGPUdb()
Gets the GPUdb instance from which records will be retrieved.
|
Map<String,String> |
getOptions()
Gets the options currently used for the retriever methods.
|
String |
getTableName()
Gets the name of the table from which records will be retrieved.
|
boolean |
isDoingWorkerLookup() |
boolean |
isUsingHeadRank() |
RecordRetriever<T> |
setOptions(Map<String,String> options)
Sets the options to be used for the retriever methods.
|
public RecordRetriever(GPUdb gpudb, String tableName, Type type) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtype
- the type of records being retrievedGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, Type type, Map<String,String> options) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtype
- the type of records being retrievedoptions
- optional parameters to pass to GPUdb while retrievingGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtype
- the type of records being retrievedworkers
- worker list for multi-head retrieval (null
to
disable multi-head retrieval)GPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers, Map<String,String> options) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtype
- the type of records being retrievedworkers
- worker list for multi-head retrieval (null
to
disable multi-head retrieval)options
- optional parameters to pass to GPUdb while retrievingGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtypeObjectMap
- type object map for the type of records being
retrievedGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, Map<String,String> options) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtypeObjectMap
- type object map for the type of records being
retrievedoptions
- optional parameters to pass to GPUdb while retrievingGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtypeObjectMap
- type object map for the type of records being
retrievedworkers
- worker list for multi-head retrieval (null
to disable multi-head retrieval)GPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers, Map<String,String> options) throws GPUdbException
RecordRetriever
with the specified parameters.gpudb
- the GPUdb instance to retrieve records fromtableName
- the table to retrieve records fromtypeObjectMap
- type object map for the type of records being
retrievedworkers
- worker list for multi-head retrieval (null
to disable multi-head retrieval)options
- optional parameters to pass to GPUdb while retrievingGPUdbException
- if a configuration error occursIllegalArgumentException
- if an invalid parameter is specifiedpublic GPUdb getGPUdb()
public String getTableName()
public boolean isUsingHeadRank()
RecordRetriever
object is using the
head-rank to do a simple record fetching (not utilizing
the server's key lookup feature) (true value), or using
multi-head (the worker ranks) for key lookup (false value).public boolean isDoingWorkerLookup()
RecordRetriever
object is using the worker
ranks to do key lookups (true value), or doing simple record
fetching (not the server's key lookup feature) (false value).
Note that this will not reflect the non-worker lookup scenario
where only an expression is supplied and the table is sharded.public Map<String,String> getOptions()
GetRecordsRequest.Options.EXPRESSION
options will get overridden at the next getByKey(java.util.List<java.lang.Object>, java.lang.String)
call with the
appropriate expression.setOptions(java.util.Map<java.lang.String, java.lang.String>)
public RecordRetriever<T> setOptions(Map<String,String> options)
options
- the options to be used during record retrievalRecordRetriever
instanceGetRecordsRequest.Options.EXPRESSION
public GetRecordsResponse<T> getByKey(List<Object> keyValues, String expression) throws GPUdbException
keyValues
- the key values to use for the lookup; these must
correspond to either the explicit or implicit shard
key for sharded tables or the primary key of
replicated tablesexpression
- a filter expression that will be applied to the data
requested by the key values; if no key values are
specified this filter will be applied to all of the
data in the target tableGetRecordsResponse
with
the requested recordsGPUdbException
Copyright © 2024. All rights reserved.