1 #ifndef __GPUDB_MULTIHEAD_IO_UTILS_H__ 2 #define __GPUDB_MULTIHEAD_IO_UTILS_H__ 26 typedef std::vector<gpudb::HttpUrl> worker_list;
71 size_t size()
const {
return m_worker_urls.size(); }
75 const_iterator
begin()
const {
return m_worker_urls.begin(); }
76 const_iterator
end()
const {
return m_worker_urls.end(); }
79 bool empty()
const {
return m_worker_urls.empty(); }
87 worker_list m_worker_urls;
89 static void split_string(
const std::string &in_string,
91 std::vector<std::string> &elements );
117 void reset(
size_t buffer_size );
121 void add_char1(
const std::string& value,
bool is_null );
124 void add_char2(
const std::string& value,
bool is_null );
127 void add_char4(
const std::string& value,
bool is_null );
130 void add_char8(
const std::string& value,
bool is_null );
133 void add_char16(
const std::string& value,
bool is_null );
136 void add_char32(
const std::string& value,
bool is_null );
139 void add_char64(
const std::string& value,
bool is_null );
142 void add_char128(
const std::string& value,
bool is_null );
145 void add_char256(
const std::string& value,
bool is_null );
148 void add_date(
const std::string& value,
bool is_null );
151 void add_datetime(
const std::string& value,
bool is_null );
154 void add_decimal(
const std::string& value,
bool is_null );
157 void add_double(
double value,
bool is_null );
160 void add_float(
float value,
bool is_null );
163 void add_int8( int8_t value,
bool is_null );
166 void add_int16( int16_t value,
bool is_null );
169 void add_int( int32_t value,
bool is_null );
172 void add_ipv4(
const std::string& value,
bool is_null );
175 void add_long( int64_t value,
bool is_null );
178 void add_time(
const std::string& value,
bool is_null );
181 void add_timestamp( int64_t value,
bool is_null );
184 void add_string(
const std::string& value,
bool is_null );
192 size_t route(
const std::vector<int32_t>& routing_table )
const;
198 bool operator==(
const RecordKey& rhs)
const;
202 bool operator<(
const RecordKey& rhs)
const;
204 && !(*
this == rhs) ); }
206 std::string
toString(
const std::string& separator =
" " )
const;
213 bool is_buffer_full(
bool throw_if_full =
true )
const;
216 bool will_buffer_overflow(
int n,
bool throw_if_overflow =
true )
const;
219 void add( uint8_t b );
221 std::vector<unsigned char> m_buffer;
222 size_t m_buffer_size;
223 size_t m_current_size;
225 int64_t m_routing_hash;
227 bool m_key_is_complete;
264 typedef boost::optional<int32_t> nullableInt;
267 std::vector<int32_t> m_pk_shard_key_indices;
268 std::vector<ColumnType_T> m_column_types;
269 size_t m_key_buffer_size;
287 std::string& result )
const;
291 bool has_key()
const {
return !m_pk_shard_key_indices.empty(); }
317 bool m_has_primary_key;
318 bool m_update_on_existing_pk;
319 recordVector_T m_queue;
323 typedef std::map<RecordKey, size_t> primary_key_map_t;
324 primary_key_map_t m_primary_key_map;
336 WorkerQueue(
const std::string& url,
size_t capacity,
bool has_primary_key,
337 bool update_on_existing_pk );
344 void flush( recordVector_T& flushed_records );
349 recordVector_T& flushed_records );
362 #endif // __GPUDB_MULTIHEAD_IO_UTILS_H__ const std::string CHAR1
This property provides optimized memory, disk and query performance for string columns.
const std::string CHAR4
This property provides optimized memory, disk and query performance for string columns.
WorkerList(const GPUdb &gpudb)
const std::string IPV4
This property provides optimized memory, disk and query performance for string columns representing I...
const std::string TIMESTAMP
Valid only for 'long' columns.
const std::string CHAR16
This property provides optimized memory, disk and query performance for string columns.
const std::string TIME
Valid only for 'string' columns.
int32_t get_hash_code() const
const std::string CHAR32
This property provides optimized memory, disk and query performance for string columns.
std::string toString() const
std::vector< gpudb::GenericRecord > recordVector_T
const std::string CHAR64
This property provides optimized memory, disk and query performance for string columns.
const_iterator begin() const
bool operator!=(const RecordKey &rhs) const
bool operator>(const RecordKey &rhs) const
const std::string INT8
This property provides optimized memory and query performance for int columns.
const std::string INT16
This property provides optimized memory and query performance for int columns.
const std::string DATE
Valid only for 'string' columns.
const std::string CHAR128
This property provides optimized memory, disk and query performance for string columns.
const std::string CHAR256
This property provides optimized memory, disk and query performance for string columns.
const std::string DECIMAL
Valid only for 'string' columns.
bool operator!=(const RecordKeyBuilder &rhs) const
worker_list::const_iterator const_iterator
const_iterator end() const
const std::string DATETIME
Valid only for 'string' columns.
const std::string CHAR2
This property provides optimized memory, disk and query performance for string columns.
const std::string CHAR8
This property provides optimized memory, disk and query performance for string columns.
const gpudb::HttpUrl & get_url() const
Returns the URL in string format for this worker.