6 #include <boost/thread/mutex.hpp> 13 #include "gpudb/Avro.hpp" 21 class GPUdb :
private boost::noncopyable
44 avro::ExecutorPtr executor;
49 static inline std::string
getApiVersion() {
return GPUdb::API_VERSION; }
52 std::string
getUrl()
const;
59 template<
typename TRequest,
typename TResponse> TResponse&
submitRequest(
const std::string& endpoint,
const TRequest& request, TResponse& response,
const bool enableCompression =
false)
const 61 std::vector<uint8_t> requestBytes;
62 avro::encode(requestBytes, request);
64 submitRequestRaw(endpoint, requestBytes, gpudbResponse, enableCompression);
65 avro::decode(response, gpudbResponse.
data);
71 void addKnownType(
const std::string& typeId,
const avro::DecoderPtr& decoder);
78 template<
typename T>
void addKnownType(
const std::string& typeId,
const std::string& schemaString)
80 addKnownType(typeId, avro::createDecoder<T>(schemaString));
83 template<
typename T>
void addKnownType(
const std::string& typeId, const ::avro::ValidSchema& schema)
106 static const std::string API_VERSION;
113 std::string username;
114 std::string password;
115 std::string authorization;
118 avro::ExecutorPtr executor;
119 mutable std::map<std::string, avro::DecoderPtr> knownTypes;
120 mutable boost::mutex knownTypesMutex;
122 void submitRequestRaw(
const std::string& endpoint,
const std::vector<uint8_t>& request,
GpudbResponse& response,
const bool enableCompression)
const;
123 avro::DecoderPtr getDecoder(
const std::string& typeId)
const;
124 void setDecoderIfMissing(
const std::string& typeId,
const std::string& label,
const std::string& schemaString,
const std::map<std::string, std::vector<std::string> >& properties)
const;
void addKnownType(const std::string &typeId, const avro::DecoderPtr &decoder)
void addKnownTypeFromTable(const std::string &tableName, const ::avro::ValidSchema &schema)
void addKnownType(const std::string &typeId)
void addKnownTypeFromTable(const std::string &tableName)
std::string getPassword() const
Options & setUsername(const std::string &value)
GPUdb(const std::string &url, const Options &options=Options())
size_t getThreadCount() const
A set of output parameters forendpoint /gpudbresponse}.
void addKnownTypeFromTable(const std::string &tableName, const avro::DecoderPtr &decoder)
TResponse & submitRequest(const std::string &endpoint, const TRequest &request, TResponse &response, const bool enableCompression=false) const
void addKnownType(const std::string &typeId, const ::avro::ValidSchema &schema)
static std::string getApiVersion()
Options & setExecutor(const avro::ExecutorPtr value)
std::string getUsername() const
static const int64_t END_OF_SET
avro::ExecutorPtr getExecutor() const
Options & setThreadCount(const size_t value)
void addKnownTypeFromTable(const std::string &tableName, const std::string &schemaString)
bool getUseSnappy() const
std::string getUrl() const
Options & setUseSnappy(const bool value)
Options & setPassword(const std::string &value)
void addKnownType(const std::string &typeId, const std::string &schemaString)
std::vector< uint8_t > data