Modifier and Type | Class and Description |
---|---|
static class |
GPUdbBase.HASynchronicityMode
A enumeration of high-availability synchronicity override modes.
|
static class |
GPUdbBase.Options
A set of configurable options for the GPUdb API.
|
static class |
GPUdbBase.SubmitException
An exception that occurred during the submission of a request to GPUdb.
|
Modifier and Type | Field and Description |
---|---|
static long |
END_OF_SET
Constant used with certain requests to indicate that the maximum allowed
number of results should be returned.
|
protected static String |
HA_SYNC_MODE |
Modifier | Constructor and Description |
---|---|
protected |
GPUdbBase(List<URL> urls,
GPUdbBase.Options options) |
protected |
GPUdbBase(String url,
GPUdbBase.Options options) |
protected |
GPUdbBase(URL url,
GPUdbBase.Options options) |
Modifier and Type | Method and Description |
---|---|
<T> void |
addKnownType(String typeId,
Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class as a type descriptor for
a GPUdb type, identified by a type ID, to the known type list, and also
adds the type object map to the known type object map list.
|
void |
addKnownType(String typeId,
Object typeDescriptor)
Adds a type descriptor for a GPUdb type (excluding types of join tables),
identified by a type ID, to the known type list.
|
<T> void |
addKnownTypeFromTable(String tableName,
Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class as a type descriptor for
the GPUdb type stored in the specified table to the known type list, and
also adds the type object map to the known type object map list.
|
void |
addKnownTypeFromTable(String tableName,
Object typeDescriptor)
Adds a type descriptor for the GPUdb type stored in the specified table
to the known type list.
|
<T> void |
addKnownTypeObjectMap(Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class to the known type object
map list.
|
protected <T> List<T> |
decode(List<String> typeIds,
List<ByteBuffer> data) |
protected <T> List<T> |
decode(Object typeDescriptor,
List<ByteBuffer> data) |
protected <T> List<T> |
decode(String typeId,
List<ByteBuffer> data) |
protected <T> List<List<T>> |
decodeMultiple(List<String> typeIds,
List<List<ByteBuffer>> data) |
protected <T> List<List<T>> |
decodeMultiple(Object typeDescriptor,
List<List<ByteBuffer>> data) |
protected <T> List<ByteBuffer> |
encode(List<T> data) |
protected <T> List<ByteBuffer> |
encode(TypeObjectMap<T> typeObjectMap,
List<T> data) |
static String |
getApiVersion()
Gets the version number of the GPUdb Java API.
|
ExecutorService |
getExecutor()
Gets the
executor service used for managing
threads during data encoding and decoding operations. |
GPUdbBase.HASynchronicityMode |
getHASyncMode()
Gets the current high availability synchronicity override mode.
|
URL |
getHmURL()
Gets the active URL of the GPUdb host manager.
|
List<URL> |
getHmURLs()
Gets the list of URLs for the GPUdb host manager.
|
Map<String,String> |
getHttpHeaders()
Gets the map of additional HTTP headers that will be sent to GPUdb with
each request.
|
String |
getPassword()
Gets the password used for authentication to GPUdb.
|
int |
getThreadCount()
Gets the number of threads used during data encoding and decoding
operations.
|
int |
getTimeout()
Gets the timeout value, in milliseconds, after which a lack of
response from the GPUdb server will result in requests being aborted.
|
protected Object |
getTypeDescriptor(String typeId) |
protected <T> TypeObjectMap<T> |
getTypeObjectMap(Class<T> objectClass) |
URL |
getURL()
Gets the active URL of the GPUdb server.
|
List<URL> |
getURLs()
Gets the list of URLs for the GPUdb server.
|
String |
getUsername()
Gets the username used for authentication to GPUdb.
|
boolean |
getUseSnappy()
Gets the value of the flag indicating whether Snappy compression will be
used for certain GPUdb requests that potentially submit large amounts of
data.
|
protected HttpURLConnection |
initializeHttpConnection(URL url)
Create and initialize an HTTP connection object with the request headers
(including authorization header), connection type, time out etc.
|
static <T> List<T> |
list(T... values)
A utility method for creating a list of objects inline.
|
static Map<String,String> |
options(String... values)
A utility method for creating a map of
strings to strings} inline.
|
void |
ping()
Verifies that GPUdb is running on the server.
|
void |
setHASyncMode(GPUdbBase.HASynchronicityMode syncMode)
Sets the current high availability synchronicity override mode.
|
GPUdbBase |
setHostManagerPort(int value)
Re-sets the host manager port number for the host manager URLs.
|
protected void |
setTypeDescriptorIfMissing(String typeId,
String label,
String typeSchema,
Map<String,List<String>> properties) |
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response)
Submits an arbitrary request to GPUdb and saves the response into a
pre-created response object.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response,
boolean enableCompression)
Submits an arbitrary request to GPUdb and saves the response into a
pre-created response object, optionally compressing the request before
sending.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(URL url,
org.apache.avro.generic.IndexedRecord request,
T response,
boolean enableCompression)
Submits an arbitrary request to GPUdb via the specified URL and saves the
response into a pre-created response object, optionally compressing the
request before sending.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequestToHM(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response)
Submits an arbitrary request to the GPUdb host manager and saves the
response into a pre-created response object.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequestToHM(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response,
boolean enableCompression)
Submits an arbitrary request to the GPUdb host manager and saves the
response into a pre-created response object, optionally compressing
the request before sending.
|
protected void |
updateHostManagerPort()
Automatically resets the host manager port number for the host manager
URLs by finding out what the host manager port is.
|
public static final long END_OF_SET
protected static final String HA_SYNC_MODE
protected GPUdbBase(String url, GPUdbBase.Options options) throws GPUdbException
GPUdbException
protected GPUdbBase(URL url, GPUdbBase.Options options) throws GPUdbException
GPUdbException
protected GPUdbBase(List<URL> urls, GPUdbBase.Options options) throws GPUdbException
GPUdbException
public static String getApiVersion()
@SafeVarargs public static <T> List<T> list(T... values)
T
- the type of objects in the listvalues
- the objects to be added to the listpublic static Map<String,String> options(String... values)
values
- an even number of string valuesIllegalArgumentException
- if an odd number of values is specifiedpublic List<URL> getURLs()
getURL
to determine which one), but in the event of failure, the
other URLs will be tried in order, and if a working one is found
it will become the new active URL.public URL getURL()
public List<URL> getHmURLs()
getHmURL
to determine which one), but in the event of failure, the
other URLs will be tried in order, and if a working one is found
it will become the new active URL.public URL getHmURL()
public GPUdbBase.HASynchronicityMode getHASyncMode()
setHASyncMode(HASynchronicityMode)
public String getUsername()
GPUdb constructor
via GPUdbBase.Options
.GPUdbBase.Options.setUsername(String)
public String getPassword()
GPUdb constructor
via GPUdbBase.Options
.GPUdbBase.Options.setPassword(String)
public boolean getUseSnappy()
false
if not overridden using the GPUdb constructor
via GPUdbBase.Options
.GPUdbBase.Options.setUseSnappy(boolean)
public int getThreadCount()
GPUdb constructor
via GPUdbBase.Options
.GPUdbBase.Options.setThreadCount(int)
public ExecutorService getExecutor()
executor service
used for managing
threads during data encoding and decoding operations. Will be
null
if none was provided to the
GPUdb constructor
via
GPUdbBase.Options
.GPUdbBase.Options.setExecutor(ExecutorService)
public Map<String,String> getHttpHeaders()
GPUdb constructor
via GPUdbBase.Options
.GPUdbBase.Options.addHttpHeader(String, String)
,
GPUdbBase.Options.setHttpHeaders(Map)
public int getTimeout()
GPUdbBase.Options.setTimeout(int)
public void setHASyncMode(GPUdbBase.HASynchronicityMode syncMode)
GPUdbBase.HASynchronicityMode.DEFAULT
, normal operation will resume (where
the high availability process determines which endpoints will be
synchronous and which ones will be asynchronous).syncMode
- the ha synchronicity override modepublic GPUdbBase setHostManagerPort(int value) throws IllegalArgumentException, GPUdbException
value
- the host manager port numberGPUdbBase
instanceIllegalArgumentException
GPUdbException
protected void updateHostManagerPort() throws GPUdbException
GPUdbException
public void addKnownType(String typeId, Object typeDescriptor)
typeId
- the type ID of the type in GPUdb (must not be the
type of a join table)typeDescriptor
- the type descriptor to be used for decoding the
typeIllegalArgumentException
- if typeDescriptor
is not a
Schema
, Type
, TypeObjectMap
, or Class
that implements IndexedRecord
public <T> void addKnownType(String typeId, Class<T> objectClass, TypeObjectMap<T> typeObjectMap)
T
- the classtypeId
- the type ID of the type in GPUdbobjectClass
- the classtypeObjectMap
- the type object map to be used for encoding and
decodingpublic void addKnownTypeFromTable(String tableName, Object typeDescriptor) throws GPUdbException
tableName
- the name of the table in GPUdbtypeDescriptor
- the type descriptor to be used for decoding the
typeIllegalArgumentException
- if typeDescriptor
is not a
Schema
, Type
, TypeObjectMap
, or Class
that implements IndexedRecord
GPUdbException
- if the table does not exist or is not homogeneous,
or if an error occurs during the request for table informationpublic <T> void addKnownTypeFromTable(String tableName, Class<T> objectClass, TypeObjectMap<T> typeObjectMap) throws GPUdbException
T
- the classtableName
- the name of the table in GPUdbobjectClass
- the classtypeObjectMap
- the type object map to be used for encoding and
decodingGPUdbException
- if the table does not exist or is not homogeneous,
or if an error occurs during the request for informationpublic <T> void addKnownTypeObjectMap(Class<T> objectClass, TypeObjectMap<T> typeObjectMap)
T
- the classobjectClass
- the classtypeObjectMap
- the type object map to be used for encodingprotected <T> List<T> decode(Object typeDescriptor, List<ByteBuffer> data) throws GPUdbException
GPUdbException
protected <T> List<T> decode(String typeId, List<ByteBuffer> data) throws GPUdbException
GPUdbException
protected <T> List<T> decode(List<String> typeIds, List<ByteBuffer> data) throws GPUdbException
GPUdbException
protected <T> List<List<T>> decodeMultiple(Object typeDescriptor, List<List<ByteBuffer>> data) throws GPUdbException
GPUdbException
protected <T> List<List<T>> decodeMultiple(List<String> typeIds, List<List<ByteBuffer>> data) throws GPUdbException
GPUdbException
protected <T> List<ByteBuffer> encode(List<T> data) throws GPUdbException
GPUdbException
protected <T> List<ByteBuffer> encode(TypeObjectMap<T> typeObjectMap, List<T> data) throws GPUdbException
GPUdbException
protected Object getTypeDescriptor(String typeId) throws GPUdbException
GPUdbException
protected <T> TypeObjectMap<T> getTypeObjectMap(Class<T> objectClass) throws GPUdbException
GPUdbException
protected void setTypeDescriptorIfMissing(String typeId, String label, String typeSchema, Map<String,List<String>> properties) throws GPUdbException
GPUdbException
protected HttpURLConnection initializeHttpConnection(URL url) throws Exception
url
- the URL to which the connection needs to be madeException
public <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(String endpoint, org.apache.avro.generic.IndexedRecord request, T response) throws GPUdbBase.SubmitException
IndexedRecord
interface.T
- the type of the response objectendpoint
- the GPUdb endpoint to send the request torequest
- the request objectresponse
- the response objectresponse
parameter)GPUdbBase.SubmitException
- if an error occurs while submitting the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(String endpoint, org.apache.avro.generic.IndexedRecord request, T response, boolean enableCompression) throws GPUdbBase.SubmitException
IndexedRecord
interface. The request will only be compressed if
enableCompression
is true
and the
GPUdb constructor
was
called with the Snappy compression
flag
set to true
.T
- the type of the response objectendpoint
- the GPUdb endpoint to send the request torequest
- the request objectresponse
- the response objectenableCompression
- whether to compress the requestresponse
parameter)GPUdbBase.SubmitException
- if an error occurs while submitting the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequestToHM(String endpoint, org.apache.avro.generic.IndexedRecord request, T response) throws GPUdbBase.SubmitException
IndexedRecord
interface.T
- the type of the response objectendpoint
- the GPUdb endpoint to send the request torequest
- the request objectresponse
- the response objectresponse
parameter)GPUdbBase.SubmitException
- if an error occurs while submitting the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequestToHM(String endpoint, org.apache.avro.generic.IndexedRecord request, T response, boolean enableCompression) throws GPUdbBase.SubmitException
IndexedRecord
interface. The request
will only be compressed if enableCompression
is true
and
the GPUdb constructor
was
called with the Snappy compression
flag
set to true
.T
- the type of the response objectendpoint
- the GPUdb endpoint to send the request torequest
- the request objectresponse
- the response objectenableCompression
- whether to compress the requestresponse
parameter)GPUdbBase.SubmitException
- if an error occurs while submitting the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(URL url, org.apache.avro.generic.IndexedRecord request, T response, boolean enableCompression) throws GPUdbBase.SubmitException
IndexedRecord
interface. The request will only be
compressed if enableCompression
is true
and the
GPUdb constructor
was
called with the Snappy compression
flag
set to true
.T
- the type of the response objecturl
- the URL to send the request torequest
- the request objectresponse
- the response objectenableCompression
- whether to compress the requestresponse
parameter)GPUdbBase.SubmitException
- if an error occurs while submitting the requestpublic void ping() throws GPUdbException
GPUdbException
- if an error occurs and/or GPUdb is not running on
the serverCopyright © 2019. All rights reserved.