quasardb 3.14.2.dev0__cp310-cp310-macosx_11_0_arm64.whl → 3.14.2.dev4__cp310-cp310-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of quasardb might be problematic. Click here for more details.
- quasardb/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/Makefile +20 -20
- quasardb/__init__.py +33 -4
- quasardb/cmake_install.cmake +7 -1
- quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/date/CMakeFiles/Export/a52b05f964b070ee926bcad51d3288af/dateTargets.cmake +13 -13
- quasardb/date/Makefile +20 -20
- quasardb/date/cmake_install.cmake +7 -1
- quasardb/date/dateConfigVersion.cmake +9 -2
- quasardb/date/dateTargets.cmake +4 -8
- quasardb/libqdb_api.dylib +0 -0
- quasardb/numpy/__init__.py +58 -10
- quasardb/pandas/__init__.py +58 -102
- quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/pybind11/Makefile +20 -20
- quasardb/pybind11/cmake_install.cmake +7 -1
- quasardb/quasardb.cpython-310-darwin.so +0 -0
- quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +13 -13
- quasardb/range-v3/CMakeFiles/range.v3.headers.dir/DependInfo.cmake +6 -2
- quasardb/range-v3/CMakeFiles/range.v3.headers.dir/build.make +7 -4
- quasardb/range-v3/Makefile +20 -20
- quasardb/range-v3/cmake_install.cmake +19 -1
- quasardb/range-v3/range-v3-config-version.cmake +9 -2
- quasardb/range-v3/range-v3-config.cmake +4 -8
- {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/METADATA +15 -10
- quasardb-3.14.2.dev4.dist-info/RECORD +45 -0
- {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/WHEEL +1 -1
- quasardb/CMakeLists.txt +0 -500
- quasardb/batch_column.hpp +0 -80
- quasardb/batch_inserter.hpp +0 -248
- quasardb/blob.hpp +0 -150
- quasardb/cluster.cpp +0 -89
- quasardb/cluster.hpp +0 -551
- quasardb/concepts.hpp +0 -278
- quasardb/continuous.cpp +0 -149
- quasardb/continuous.hpp +0 -106
- quasardb/convert/array.hpp +0 -282
- quasardb/convert/point.hpp +0 -330
- quasardb/convert/range.hpp +0 -282
- quasardb/convert/unicode.hpp +0 -598
- quasardb/convert/util.hpp +0 -22
- quasardb/convert/value.hpp +0 -711
- quasardb/convert.hpp +0 -38
- quasardb/detail/qdb_resource.hpp +0 -129
- quasardb/detail/ts_column.hpp +0 -224
- quasardb/direct_blob.hpp +0 -108
- quasardb/direct_handle.hpp +0 -83
- quasardb/direct_integer.hpp +0 -94
- quasardb/dispatch.hpp +0 -157
- quasardb/double.hpp +0 -87
- quasardb/entry.hpp +0 -273
- quasardb/error.hpp +0 -318
- quasardb/handle.cpp +0 -29
- quasardb/handle.hpp +0 -98
- quasardb/integer.hpp +0 -88
- quasardb/logger.cpp +0 -106
- quasardb/logger.hpp +0 -228
- quasardb/masked_array.hpp +0 -651
- quasardb/metrics.cpp +0 -103
- quasardb/metrics.hpp +0 -112
- quasardb/module.cpp +0 -76
- quasardb/module.hpp +0 -24
- quasardb/node.hpp +0 -123
- quasardb/numpy.cpp +0 -6
- quasardb/numpy.hpp +0 -489
- quasardb/object_tracker.hpp +0 -283
- quasardb/options.hpp +0 -244
- quasardb/perf.hpp +0 -336
- quasardb/pytypes.hpp +0 -221
- quasardb/query.cpp +0 -420
- quasardb/query.hpp +0 -92
- quasardb/reader/ts_row.hpp +0 -281
- quasardb/reader/ts_value.hpp +0 -245
- quasardb/remove_cvref.hpp +0 -31
- quasardb/string.hpp +0 -160
- quasardb/table.cpp +0 -289
- quasardb/table.hpp +0 -325
- quasardb/table_reader.hpp +0 -220
- quasardb/tag.hpp +0 -77
- quasardb/timestamp.hpp +0 -97
- quasardb/traits.hpp +0 -619
- quasardb/ts_iterator.hpp +0 -193
- quasardb/utils/blob_deque.hpp +0 -96
- quasardb/utils/ostream.hpp +0 -17
- quasardb/utils/permutation.hpp +0 -50
- quasardb/utils/stable_sort.hpp +0 -25
- quasardb/utils/unzip_view.hpp +0 -89
- quasardb/utils.cpp +0 -28
- quasardb/utils.hpp +0 -174
- quasardb/writer.cpp +0 -534
- quasardb/writer.hpp +0 -396
- quasardb-3.14.2.dev0.dist-info/RECORD +0 -109
- {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/LICENSE.md +0 -0
- {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/top_level.txt +0 -0
quasardb/cluster.hpp
DELETED
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Official Python API
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2009-2024, quasardb SAS. All rights reserved.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
|
9
|
-
* modification, are permitted provided that the following conditions are met:
|
|
10
|
-
*
|
|
11
|
-
* * Redistributions of source code must retain the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
|
13
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
|
16
|
-
* * Neither the name of quasardb nor the names of its contributors may
|
|
17
|
-
* be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
21
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
22
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
24
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
25
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
26
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
27
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
29
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
*/
|
|
31
|
-
#pragma once
|
|
32
|
-
|
|
33
|
-
#include "batch_inserter.hpp"
|
|
34
|
-
#include "blob.hpp"
|
|
35
|
-
#include "continuous.hpp"
|
|
36
|
-
#include "double.hpp"
|
|
37
|
-
#include "error.hpp"
|
|
38
|
-
#include "handle.hpp"
|
|
39
|
-
#include "integer.hpp"
|
|
40
|
-
#include "logger.hpp"
|
|
41
|
-
#include "node.hpp"
|
|
42
|
-
#include "options.hpp"
|
|
43
|
-
#include "perf.hpp"
|
|
44
|
-
#include "query.hpp"
|
|
45
|
-
#include "string.hpp"
|
|
46
|
-
#include "table.hpp"
|
|
47
|
-
#include "table_reader.hpp"
|
|
48
|
-
#include "tag.hpp"
|
|
49
|
-
#include "timestamp.hpp"
|
|
50
|
-
#include "utils.hpp"
|
|
51
|
-
#include "writer.hpp"
|
|
52
|
-
#include <qdb/node.h>
|
|
53
|
-
#include <qdb/prefix.h>
|
|
54
|
-
#include <qdb/suffix.h>
|
|
55
|
-
#include "detail/qdb_resource.hpp"
|
|
56
|
-
#include <pybind11/chrono.h>
|
|
57
|
-
#include <pybind11/operators.h>
|
|
58
|
-
#include <pybind11/stl.h>
|
|
59
|
-
#include <chrono>
|
|
60
|
-
#include <iostream>
|
|
61
|
-
|
|
62
|
-
namespace qdb
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
class cluster
|
|
66
|
-
{
|
|
67
|
-
public:
|
|
68
|
-
cluster(const std::string & uri,
|
|
69
|
-
const std::string & user_name = {},
|
|
70
|
-
const std::string & user_private_key = {},
|
|
71
|
-
const std::string & cluster_public_key = {},
|
|
72
|
-
const std::string & user_security_file = {},
|
|
73
|
-
const std::string & cluster_public_key_file = {},
|
|
74
|
-
std::chrono::milliseconds timeout = std::chrono::minutes{1},
|
|
75
|
-
bool do_version_check = false);
|
|
76
|
-
|
|
77
|
-
public:
|
|
78
|
-
void close();
|
|
79
|
-
|
|
80
|
-
bool is_open() const
|
|
81
|
-
{
|
|
82
|
-
return _handle.get() != nullptr && _handle->is_open();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Throws exception if the connection is not open. Should be invoked before any operation
|
|
87
|
-
* is done on the handle, as the QuasarDB C API only checks for a canary presence in the
|
|
88
|
-
* handle's memory arena. If a compiler is optimizing enough, the handle can be closed but
|
|
89
|
-
* the canary still present in memory, so it's UB.
|
|
90
|
-
*
|
|
91
|
-
* As such, we should check on a higher level.
|
|
92
|
-
*/
|
|
93
|
-
void check_open() const
|
|
94
|
-
{
|
|
95
|
-
if (is_open() == false) [[unlikely]]
|
|
96
|
-
{
|
|
97
|
-
throw qdb::invalid_handle_exception{};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
void tidy_memory()
|
|
102
|
-
{
|
|
103
|
-
if (_handle)
|
|
104
|
-
{
|
|
105
|
-
_logger.info("Tidying memory");
|
|
106
|
-
qdb_option_client_tidy_memory(*_handle);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
std::string get_memory_info()
|
|
111
|
-
{
|
|
112
|
-
std::string result;
|
|
113
|
-
if (_handle)
|
|
114
|
-
{
|
|
115
|
-
char const * buf;
|
|
116
|
-
qdb_size_t n;
|
|
117
|
-
qdb_option_client_get_memory_info(*_handle, &buf, &n);
|
|
118
|
-
|
|
119
|
-
result = std::string{buf, n};
|
|
120
|
-
|
|
121
|
-
qdb_release(*_handle, buf);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return result;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public:
|
|
128
|
-
qdb::node node(const std::string & uri)
|
|
129
|
-
{
|
|
130
|
-
return qdb::node(uri, _handle);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
private:
|
|
134
|
-
pybind11::object convert_to_json_and_release(const char * content)
|
|
135
|
-
{
|
|
136
|
-
const auto result = _json_loads(content);
|
|
137
|
-
qdb_release(*_handle, content);
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public:
|
|
142
|
-
cluster enter()
|
|
143
|
-
{
|
|
144
|
-
// No-op, all initialization is done in the constructor.
|
|
145
|
-
return *this;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
void exit(pybind11::object type, pybind11::object value, pybind11::object traceback)
|
|
149
|
-
{
|
|
150
|
-
return close();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
pybind11::object node_config(const std::string & uri)
|
|
154
|
-
{
|
|
155
|
-
check_open();
|
|
156
|
-
|
|
157
|
-
const char * content = nullptr;
|
|
158
|
-
qdb_size_t content_length = 0;
|
|
159
|
-
|
|
160
|
-
qdb::qdb_throw_if_error(
|
|
161
|
-
*_handle, qdb_node_config(*_handle, uri.c_str(), &content, &content_length));
|
|
162
|
-
|
|
163
|
-
return convert_to_json_and_release(content);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
pybind11::object node_status(const std::string & uri)
|
|
167
|
-
{
|
|
168
|
-
check_open();
|
|
169
|
-
|
|
170
|
-
const char * content = nullptr;
|
|
171
|
-
qdb_size_t content_length = 0;
|
|
172
|
-
|
|
173
|
-
qdb::qdb_throw_if_error(
|
|
174
|
-
*_handle, qdb_node_status(*_handle, uri.c_str(), &content, &content_length));
|
|
175
|
-
|
|
176
|
-
return convert_to_json_and_release(content);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
pybind11::object node_topology(const std::string & uri)
|
|
180
|
-
{
|
|
181
|
-
check_open();
|
|
182
|
-
|
|
183
|
-
const char * content = nullptr;
|
|
184
|
-
qdb_size_t content_length = 0;
|
|
185
|
-
|
|
186
|
-
qdb::qdb_throw_if_error(
|
|
187
|
-
*_handle, qdb_node_topology(*_handle, uri.c_str(), &content, &content_length));
|
|
188
|
-
|
|
189
|
-
return convert_to_json_and_release(content);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public:
|
|
193
|
-
qdb::tag tag(const std::string & alias)
|
|
194
|
-
{
|
|
195
|
-
check_open();
|
|
196
|
-
|
|
197
|
-
return qdb::tag{_handle, alias};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
qdb::blob_entry blob(const std::string & alias)
|
|
201
|
-
{
|
|
202
|
-
check_open();
|
|
203
|
-
|
|
204
|
-
return qdb::blob_entry{_handle, alias};
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
qdb::string_entry string(const std::string & alias)
|
|
208
|
-
{
|
|
209
|
-
check_open();
|
|
210
|
-
|
|
211
|
-
return qdb::string_entry{_handle, alias};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
qdb::integer_entry integer(const std::string & alias)
|
|
215
|
-
{
|
|
216
|
-
check_open();
|
|
217
|
-
|
|
218
|
-
return qdb::integer_entry{_handle, alias};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
qdb::double_entry double_(const std::string & alias)
|
|
222
|
-
{
|
|
223
|
-
check_open();
|
|
224
|
-
|
|
225
|
-
return qdb::double_entry{_handle, alias};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
qdb::timestamp_entry timestamp(const std::string & alias)
|
|
229
|
-
{
|
|
230
|
-
check_open();
|
|
231
|
-
|
|
232
|
-
return qdb::timestamp_entry{_handle, alias};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
qdb::table table(const std::string & alias)
|
|
236
|
-
{
|
|
237
|
-
check_open();
|
|
238
|
-
|
|
239
|
-
return qdb::table{_handle, alias};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// the batch_inserter_ptr is non-copyable
|
|
243
|
-
qdb::batch_inserter_ptr inserter(const std::vector<batch_column_info> & ci)
|
|
244
|
-
{
|
|
245
|
-
check_open();
|
|
246
|
-
|
|
247
|
-
return std::make_unique<qdb::batch_inserter>(_handle, ci);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// the batch_inserter_ptr is non-copyable
|
|
251
|
-
qdb::writer_ptr writer()
|
|
252
|
-
{
|
|
253
|
-
check_open();
|
|
254
|
-
|
|
255
|
-
return std::make_unique<qdb::writer>(_handle);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// the batch_inserter_ptr is non-copyable
|
|
259
|
-
qdb::writer_ptr pinned_writer()
|
|
260
|
-
{
|
|
261
|
-
check_open();
|
|
262
|
-
|
|
263
|
-
return writer();
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
qdb::options options()
|
|
267
|
-
{
|
|
268
|
-
check_open();
|
|
269
|
-
|
|
270
|
-
return qdb::options{_handle};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
qdb::perf perf()
|
|
274
|
-
{
|
|
275
|
-
check_open();
|
|
276
|
-
|
|
277
|
-
return qdb::perf{_handle};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const std::string & uri()
|
|
281
|
-
{
|
|
282
|
-
return _uri;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
public:
|
|
286
|
-
std::vector<std::string> prefix_get(const std::string & prefix, qdb_int_t max_count)
|
|
287
|
-
{
|
|
288
|
-
check_open();
|
|
289
|
-
|
|
290
|
-
const char ** result = nullptr;
|
|
291
|
-
size_t count = 0;
|
|
292
|
-
|
|
293
|
-
const qdb_error_t err = qdb_prefix_get(*_handle, prefix.c_str(), max_count, &result, &count);
|
|
294
|
-
// don't throw if no prefix is found
|
|
295
|
-
if (err != qdb_e_alias_not_found)
|
|
296
|
-
{
|
|
297
|
-
qdb_throw_if_error(*_handle, err);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return convert_strings_and_release(_handle, result, count);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
qdb_uint_t prefix_count(const std::string & prefix)
|
|
304
|
-
{
|
|
305
|
-
check_open();
|
|
306
|
-
|
|
307
|
-
qdb_uint_t count = 0;
|
|
308
|
-
|
|
309
|
-
const qdb_error_t err = qdb_prefix_count(*_handle, prefix.c_str(), &count);
|
|
310
|
-
qdb_throw_if_error(*_handle, err);
|
|
311
|
-
|
|
312
|
-
return count;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
public:
|
|
316
|
-
qdb::find_query find(const std::string & query_string)
|
|
317
|
-
{
|
|
318
|
-
check_open();
|
|
319
|
-
|
|
320
|
-
return qdb::find_query{_handle, query_string};
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
py::object query(const std::string & query_string, const py::object & blobs)
|
|
324
|
-
{
|
|
325
|
-
check_open();
|
|
326
|
-
|
|
327
|
-
return py::cast(qdb::dict_query(_handle, query_string, blobs));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
py::object query_numpy(const std::string & query_string)
|
|
331
|
-
{
|
|
332
|
-
check_open();
|
|
333
|
-
|
|
334
|
-
return py::cast(qdb::numpy_query(_handle, query_string));
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
std::shared_ptr<qdb::query_continuous> query_continuous_full(
|
|
338
|
-
const std::string & query_string, std::chrono::milliseconds pace, const py::object & blobs)
|
|
339
|
-
{
|
|
340
|
-
check_open();
|
|
341
|
-
|
|
342
|
-
return std::make_shared<qdb::query_continuous>(
|
|
343
|
-
_handle, qdb_query_continuous_full, pace, query_string, blobs);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
std::shared_ptr<qdb::query_continuous> query_continuous_new_values(
|
|
347
|
-
const std::string & query_string, std::chrono::milliseconds pace, const py::object & blobs)
|
|
348
|
-
{
|
|
349
|
-
check_open();
|
|
350
|
-
|
|
351
|
-
return std::make_shared<qdb::query_continuous>(
|
|
352
|
-
_handle, qdb_query_continuous_new_values_only, pace, query_string, blobs);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
public:
|
|
356
|
-
std::vector<std::string> suffix_get(const std::string & suffix, qdb_int_t max_count)
|
|
357
|
-
{
|
|
358
|
-
check_open();
|
|
359
|
-
|
|
360
|
-
const char ** result = nullptr;
|
|
361
|
-
size_t count = 0;
|
|
362
|
-
|
|
363
|
-
const qdb_error_t err = qdb_suffix_get(*_handle, suffix.c_str(), max_count, &result, &count);
|
|
364
|
-
// don't throw if no suffix is found
|
|
365
|
-
if (err != qdb_e_alias_not_found)
|
|
366
|
-
{
|
|
367
|
-
qdb_throw_if_error(*_handle, err);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return convert_strings_and_release(_handle, result, count);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
qdb_uint_t suffix_count(const std::string & suffix)
|
|
374
|
-
{
|
|
375
|
-
check_open();
|
|
376
|
-
|
|
377
|
-
qdb_uint_t count = 0;
|
|
378
|
-
|
|
379
|
-
const qdb_error_t err = qdb_suffix_count(*_handle, suffix.c_str(), &count);
|
|
380
|
-
qdb_throw_if_error(*_handle, err);
|
|
381
|
-
|
|
382
|
-
return count;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
public:
|
|
386
|
-
void purge_all(std::chrono::milliseconds timeout_ms)
|
|
387
|
-
{
|
|
388
|
-
check_open();
|
|
389
|
-
|
|
390
|
-
qdb::qdb_throw_if_error(
|
|
391
|
-
*_handle, qdb_purge_all(*_handle, static_cast<int>(timeout_ms.count())));
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
void purge_cache(std::chrono::milliseconds timeout_ms)
|
|
395
|
-
{
|
|
396
|
-
check_open();
|
|
397
|
-
|
|
398
|
-
qdb::qdb_throw_if_error(
|
|
399
|
-
*_handle, qdb_purge_cache(*_handle, static_cast<int>(timeout_ms.count())));
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
void wait_for_stabilization(std::chrono::milliseconds timeout_ms)
|
|
403
|
-
{
|
|
404
|
-
check_open();
|
|
405
|
-
|
|
406
|
-
qdb::qdb_throw_if_error(
|
|
407
|
-
*_handle, qdb_wait_for_stabilization(*_handle, static_cast<int>(timeout_ms.count())));
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
void trim_all(std::chrono::milliseconds pause_ms, std::chrono::milliseconds timeout_ms)
|
|
411
|
-
{
|
|
412
|
-
check_open();
|
|
413
|
-
|
|
414
|
-
qdb::qdb_throw_if_error(*_handle, qdb_trim_all(*_handle, static_cast<int>(pause_ms.count()),
|
|
415
|
-
static_cast<int>(timeout_ms.count())));
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
void compact_full()
|
|
419
|
-
{
|
|
420
|
-
check_open();
|
|
421
|
-
|
|
422
|
-
qdb_compact_params_t params{};
|
|
423
|
-
params.options = qdb_compact_full;
|
|
424
|
-
|
|
425
|
-
qdb::qdb_throw_if_error(*_handle, qdb_cluster_compact(*_handle, ¶ms));
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// Returns 0 when finished / no compaction running
|
|
429
|
-
std::uint64_t compact_progress()
|
|
430
|
-
{
|
|
431
|
-
check_open();
|
|
432
|
-
|
|
433
|
-
std::uint64_t progress;
|
|
434
|
-
|
|
435
|
-
qdb::qdb_throw_if_error(*_handle, qdb_cluster_get_compact_progress(*_handle, &progress));
|
|
436
|
-
|
|
437
|
-
return progress;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
void compact_abort()
|
|
441
|
-
{
|
|
442
|
-
check_open();
|
|
443
|
-
|
|
444
|
-
qdb::qdb_throw_if_error(*_handle, qdb_cluster_abort_compact(*_handle));
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
void wait_for_compaction();
|
|
448
|
-
|
|
449
|
-
public:
|
|
450
|
-
std::vector<std::string> endpoints()
|
|
451
|
-
{
|
|
452
|
-
check_open();
|
|
453
|
-
|
|
454
|
-
qdb_remote_node_t * endpoints = nullptr;
|
|
455
|
-
qdb_size_t count = 0;
|
|
456
|
-
|
|
457
|
-
const qdb_error_t err = qdb_cluster_endpoints(*_handle, &endpoints, &count);
|
|
458
|
-
qdb_throw_if_error(*_handle, err);
|
|
459
|
-
|
|
460
|
-
std::vector<std::string> results;
|
|
461
|
-
results.resize(count);
|
|
462
|
-
|
|
463
|
-
std::transform(endpoints, endpoints + count, std::begin(results), [](auto const & endpoint) {
|
|
464
|
-
return std::string{endpoint.address} + ":" + std::to_string(endpoint.port);
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
qdb_release(*_handle, endpoints);
|
|
468
|
-
|
|
469
|
-
return results;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
private:
|
|
473
|
-
std::string _uri;
|
|
474
|
-
handle_ptr _handle;
|
|
475
|
-
pybind11::object _json_loads;
|
|
476
|
-
|
|
477
|
-
qdb::logger _logger;
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
template <typename Module>
|
|
481
|
-
static inline void register_cluster(Module & m)
|
|
482
|
-
{
|
|
483
|
-
namespace py = pybind11;
|
|
484
|
-
|
|
485
|
-
py::class_<qdb::cluster>(m, "Cluster",
|
|
486
|
-
"Represents a connection to the QuasarDB cluster. ") //
|
|
487
|
-
.def(
|
|
488
|
-
py::init<const std::string &, const std::string &, const std::string &, const std::string &,
|
|
489
|
-
const std::string &, const std::string &, std::chrono::milliseconds, bool>(), //
|
|
490
|
-
py::arg("uri"), //
|
|
491
|
-
py::arg("user_name") = std::string{}, //
|
|
492
|
-
py::arg("user_private_key") = std::string{}, //
|
|
493
|
-
py::arg("cluster_public_key") = std::string{}, //
|
|
494
|
-
py::arg("user_security_file") = std::string{}, //
|
|
495
|
-
py::arg("cluster_public_key_file") = std::string{}, //
|
|
496
|
-
py::arg("timeout") = std::chrono::minutes{1}, //
|
|
497
|
-
py::arg("do_version_check") = false) //
|
|
498
|
-
.def("__enter__", &qdb::cluster::enter) //
|
|
499
|
-
.def("__exit__", &qdb::cluster::exit) //
|
|
500
|
-
.def("tidy_memory", &qdb::cluster::tidy_memory) //
|
|
501
|
-
.def("get_memory_info", &qdb::cluster::get_memory_info) //
|
|
502
|
-
.def("is_open", &qdb::cluster::is_open) //
|
|
503
|
-
.def("uri", &qdb::cluster::uri) //
|
|
504
|
-
.def("node", &qdb::cluster::node) //
|
|
505
|
-
.def("options", &qdb::cluster::options) //
|
|
506
|
-
.def("perf", &qdb::cluster::perf) //
|
|
507
|
-
.def("node_status", &qdb::cluster::node_status) //
|
|
508
|
-
.def("node_config", &qdb::cluster::node_config) //
|
|
509
|
-
.def("node_topology", &qdb::cluster::node_topology) //
|
|
510
|
-
.def("tag", &qdb::cluster::tag) //
|
|
511
|
-
.def("blob", &qdb::cluster::blob) //
|
|
512
|
-
.def("string", &qdb::cluster::string) //
|
|
513
|
-
.def("integer", &qdb::cluster::integer) //
|
|
514
|
-
.def("double", &qdb::cluster::double_) //
|
|
515
|
-
.def("timestamp", &qdb::cluster::timestamp) //
|
|
516
|
-
.def("ts", &qdb::cluster::table) //
|
|
517
|
-
.def("table", &qdb::cluster::table) //
|
|
518
|
-
.def("ts_batch", &qdb::cluster::inserter) //
|
|
519
|
-
.def("inserter", &qdb::cluster::inserter) //
|
|
520
|
-
.def("pinned_writer", &qdb::cluster::pinned_writer) //
|
|
521
|
-
.def("writer", &qdb::cluster::writer) //
|
|
522
|
-
.def("find", &qdb::cluster::find) //
|
|
523
|
-
.def("query", &qdb::cluster::query, //
|
|
524
|
-
py::arg("query"), //
|
|
525
|
-
py::arg("blobs") = false) //
|
|
526
|
-
.def("query_numpy", &qdb::cluster::query_numpy, //
|
|
527
|
-
py::arg("query")) //
|
|
528
|
-
.def("query_continuous_full", &qdb::cluster::query_continuous_full, //
|
|
529
|
-
py::arg("query"), //
|
|
530
|
-
py::arg("pace"), //
|
|
531
|
-
py::arg("blobs") = false) //
|
|
532
|
-
.def("query_continuous_new_values", &qdb::cluster::query_continuous_new_values, //
|
|
533
|
-
py::arg("query"), //
|
|
534
|
-
py::arg("pace"), //
|
|
535
|
-
py::arg("blobs") = false) //
|
|
536
|
-
.def("prefix_get", &qdb::cluster::prefix_get) //
|
|
537
|
-
.def("prefix_count", &qdb::cluster::prefix_count) //
|
|
538
|
-
.def("suffix_get", &qdb::cluster::suffix_get) //
|
|
539
|
-
.def("suffix_count", &qdb::cluster::suffix_count) //
|
|
540
|
-
.def("close", &qdb::cluster::close) //
|
|
541
|
-
.def("purge_all", &qdb::cluster::purge_all) //
|
|
542
|
-
.def("trim_all", &qdb::cluster::trim_all) //
|
|
543
|
-
.def("purge_cache", &qdb::cluster::purge_cache) //
|
|
544
|
-
.def("compact_full", &qdb::cluster::compact_full) //
|
|
545
|
-
.def("compact_progress", &qdb::cluster::compact_progress) //
|
|
546
|
-
.def("compact_abort", &qdb::cluster::compact_abort) //
|
|
547
|
-
.def("wait_for_compaction", &qdb::cluster::wait_for_compaction) //
|
|
548
|
-
.def("endpoints", &qdb::cluster::endpoints); //
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
} // namespace qdb
|