java.lang.Object
com.gpudb.RecordRetriever<T>
Type Parameters:
T - the type of object being retrievedObject that permits efficient retrieval of records from GPUdb, with support for multi-head access.
RecordRetriever instances are thread safe and may be used from any number of threads simultaneously.Constructor Summary
ConstructorsConstructorDescriptionRecordRetriever(GPUdb gpudb, String tableName, Type type) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers, Map<String, String> options) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, Map<String, String> options) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers) Creates aRecordRetrieverwith the specified parameters.RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers, Map<String, String> options) Creates aRecordRetrieverwith the specified parameters.Creates aRecordRetrieverwith the specified parameters.Method Summary
Modifier and TypeMethodDescriptionRetrieves 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.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.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.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.getGPUdb()Gets the GPUdb instance from which records will be retrieved.Gets the options currently used for the retriever methods.Gets the name of the table from which records will be retrieved.booleanbooleansetOptions(Map<String, String> options) Sets the options to be used for the retriever methods.
Constructor Details
RecordRetriever
Creates aRecordRetrieverwith the specified parameters.
It will use default settings for theGPUdb.getRecords(String, long, long, Map)call supportinggetByKey(List, String)and theGPUdb.getRecordsByColumn(String, List, long, long, Map)call supportinggetColumnsByKey(List, List, String).
Details can be found atGetRecordsRequest.OptionsandGetRecordsByColumnRequest.Options, respectively.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtype- theTypeof records being retrievedThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, Type type, Map<String, String> options) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtype- theTypeof records being retrievedoptions- optional parameters to pass to GPUdb while retrieving (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.getRecords(String, long, long, Map)andGPUdb.getRecordsByColumn(String, List, long, long, Map)calls.
The details can be found atGetRecordsRequest.OptionsandGetRecordsByColumnRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtype- theTypeof records being retrievedworkers- worker list for multi-head retrieval (nullto disable multi-head retrieval)Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, Type type, WorkerList workers, Map<String, String> options) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtype- theTypeof records being retrievedworkers- worker list for multi-head retrieval (nullto disable multi-head retrieval)options- optional parameters to pass to GPUdb while retrieving (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.getRecords(String, long, long, Map)andGPUdb.getRecordsByColumn(String, List, long, long, Map)calls.
The details can be found atGetRecordsRequest.OptionsandGetRecordsByColumnRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtypeObjectMap- theTypeObjectMapfor the type of records being retrievedThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, Map<String, String> options) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtypeObjectMap- theTypeObjectMapfor the type of records being retrievedoptions- optional parameters to pass to GPUdb while retrieving (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.getRecords(String, long, long, Map)andGPUdb.getRecordsByColumn(String, List, long, long, Map)calls.
The details can be found atGetRecordsRequest.OptionsandGetRecordsByColumnRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtypeObjectMap- theTypeObjectMapfor the type of records being retrievedworkers- worker list for multi-head retrieval (nullto disable multi-head retrieval)Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedRecordRetriever
public RecordRetriever(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, WorkerList workers, Map<String, String> options) throws GPUdbException Creates aRecordRetrieverwith the specified parameters.Parameters:gpudb- theGPUdbinstance to retrieve records fromtableName- the table to retrieve records fromtypeObjectMap- theTypeObjectMapfor the type of records being retrievedworkers- worker list for multi-head retrieval (nullto disable multi-head retrieval)options- optional parameters to pass to GPUdb while retrieving (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.getRecords(String, long, long, Map)andGPUdb.getRecordsByColumn(String, List, long, long, Map)calls.
The details can be found atGetRecordsRequest.OptionsandGetRecordsByColumnRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specified
Method Details
isUsingHeadRank
public boolean isUsingHeadRank()Returns:whether thisRecordRetrieverobject 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).isDoingWorkerLookup
public boolean isDoingWorkerLookup()Returns:whether thisRecordRetrieverobject 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.getOptions
Gets the options currently used for the retriever methods. Note that anyGetRecordsRequest.Options.EXPRESSIONoptions will get overridden at the nextgetByKey(java.util.List<java.lang.Object>, java.lang.String)call with the appropriate expression.Returns:the options used during record retrievalSee Also:setOptions
Sets the options to be used for the retriever methods.Parameters:options- the options to be used during record retrievalReturns:the currentRecordRetrieverinstanceSee Also:getByKey
public GetRecordsResponse<T> getByKey(List<Object> keyValues, String expression) throws GPUdbException 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.
This method operates in four modes, depending on the parameters passed:- keyValues only - attempts a direct-to-rank lookup for records matching the given key values
- keyValues and expression - attempts a direct-to-rank lookup for records matching the given key values, filtering them by the given expression
- expression only - requests, via the head rank, all records in the table matching the given filter expression
- neither - retrieves all records from the table via the head rank
Parameters: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 tableReturns:aGetRecordsResponsewith the requested recordsThrows:getByKey
public GetRecordsResponse<T> getByKey(List<Object> keyValues, String expression, long offset) throws GPUdbException 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. Returns records in the overall result set starting from the givenoffset.
This method operates in four modes, depending on the parameters passed:- keyValues only - attempts a direct-to-rank lookup for records matching the given key values
- keyValues and expression - attempts a direct-to-rank lookup for records matching the given key values, filtering them by the given expression
- expression only - requests, via the head rank, all records in the table matching the given filter expression
- neither - retrieves all records from the table via the head rank
Parameters: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 tableoffset- offset of the record(s) within the result set to returnReturns:aGetRecordsResponsewith the requested recordsThrows:getColumnsByKey
public GetRecordsByColumnResponse getColumnsByKey(List<String> columns, List<Object> keyValues, String expression) throws GPUdbException 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.
This method operates in four modes, depending on the parameters passed:- keyValues only - attempts a direct-to-rank lookup for records matching the given key values
- keyValues and expression - attempts a direct-to-rank lookup for records matching the given key values, filtering them by the given expression
- expression only - requests, via the head rank, all records in the table matching the given filter expression
- neither - retrieves all records from the table via the head rank
Parameters:columns- The requested columns (which can include expressions) being requested. May use ”*” for all columns.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 tableReturns:aGetRecordsResponsewith the requested recordsThrows:getColumnsByKey
public GetRecordsByColumnResponse getColumnsByKey(List<String> columns, List<Object> keyValues, String expression, long offset) throws GPUdbException 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. Returns records in the overall result set starting from the givenoffset.
This method operates in four modes, depending on the parameters passed:- keyValues only - attempts a direct-to-rank lookup for records matching the given key values
- keyValues and expression - attempts a direct-to-rank lookup for records matching the given key values, filtering them by the given expression
- expression only - requests, via the head rank, all records in the table matching the given filter expression
- neither - retrieves all records from the table via the head rank
Parameters:columns- The requested columns (which can include expressions) being requested. May use ”*” for all columns.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 tableoffset- offset of the record(s) within the result set to returnReturns:aGetRecordsResponsewith the requested recordsThrows: