quasardb 3.14.2.dev0__cp310-cp310-win_amd64.whl → 3.14.2.dev4__cp310-cp310-win_amd64.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/INSTALL.vcxproj +9 -4
- quasardb/__init__.py +33 -4
- quasardb/cmake_install.cmake +6 -0
- quasardb/date/ALL_BUILD.vcxproj +9 -8
- quasardb/date/CMakeFiles/Export/df49adab93b9e0c10c64f72458b31971/dateTargets.cmake +13 -13
- quasardb/date/CMakeFiles/generate.stamp.depend +4 -4
- quasardb/date/INSTALL.vcxproj +9 -4
- quasardb/date/cmake_install.cmake +6 -0
- quasardb/date/dateConfigVersion.cmake +0 -5
- quasardb/date/dateTargets.cmake +4 -8
- quasardb/numpy/__init__.py +58 -10
- quasardb/pandas/__init__.py +58 -102
- quasardb/pybind11/ALL_BUILD.vcxproj +9 -8
- quasardb/pybind11/CMakeFiles/generate.stamp.depend +14 -14
- quasardb/pybind11/INSTALL.vcxproj +9 -4
- quasardb/pybind11/cmake_install.cmake +6 -0
- quasardb/qdb_api.dll +0 -0
- quasardb/quasardb.cp310-win_amd64.pyd +0 -0
- quasardb/range-v3/ALL_BUILD.vcxproj +9 -8
- quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +13 -13
- quasardb/range-v3/CMakeFiles/generate.stamp.depend +11 -11
- quasardb/range-v3/INSTALL.vcxproj +9 -4
- quasardb/range-v3/cmake_install.cmake +42 -0
- quasardb/range-v3/range-v3-config-version.cmake +0 -5
- quasardb/range-v3/range-v3-config.cmake +4 -8
- quasardb/range-v3/range.v3.headers.vcxproj +9 -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 +54 -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 -118
- {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/metrics.cpp
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#include "metrics.hpp"
|
|
2
|
-
#include <mutex>
|
|
3
|
-
|
|
4
|
-
namespace qdb
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
static metrics_container_t metrics_totals_ = metrics_container_t{};
|
|
8
|
-
static std::mutex metrics_lock_ = std::mutex{};
|
|
9
|
-
|
|
10
|
-
metrics::scoped_capture::~scoped_capture()
|
|
11
|
-
{
|
|
12
|
-
using std::chrono::nanoseconds;
|
|
13
|
-
|
|
14
|
-
time_point_t stop = clock_t::now();
|
|
15
|
-
|
|
16
|
-
auto duration = std::chrono::duration_cast<nanoseconds>(stop - start_);
|
|
17
|
-
|
|
18
|
-
metrics::record(test_id_, duration.count());
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
metrics::measure::measure()
|
|
22
|
-
: start_{metrics::totals()}
|
|
23
|
-
{}
|
|
24
|
-
|
|
25
|
-
metrics_container_t metrics::measure::get() const
|
|
26
|
-
{
|
|
27
|
-
metrics_container_t cur = metrics::totals();
|
|
28
|
-
|
|
29
|
-
metrics_container_t ret{};
|
|
30
|
-
|
|
31
|
-
for (auto i : cur)
|
|
32
|
-
{
|
|
33
|
-
assert(ret.find(i.first) == ret.end());
|
|
34
|
-
|
|
35
|
-
metrics_container_t::const_iterator prev = start_.find(i.first);
|
|
36
|
-
|
|
37
|
-
if (prev == start_.end())
|
|
38
|
-
{
|
|
39
|
-
// Previously, metric didn't exist yet, as such it's entirely new
|
|
40
|
-
// and all accumulated time was within the scope.
|
|
41
|
-
ret.emplace(i.first, i.second);
|
|
42
|
-
}
|
|
43
|
-
else if (i.second > prev->second)
|
|
44
|
-
{
|
|
45
|
-
// Accumulated time actually increased, record difference
|
|
46
|
-
ret.emplace(i.first, i.second - prev->second);
|
|
47
|
-
}
|
|
48
|
-
else
|
|
49
|
-
{
|
|
50
|
-
// Integrity check: we can only increase totals over time, never decrease
|
|
51
|
-
assert(i.second == prev->second);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return ret;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/* static */ void metrics::record(std::string const & test_id, std::uint64_t nsec)
|
|
59
|
-
{
|
|
60
|
-
std::lock_guard<std::mutex> guard(metrics_lock_);
|
|
61
|
-
|
|
62
|
-
metrics_container_t::iterator pos = metrics_totals_.lower_bound(test_id);
|
|
63
|
-
|
|
64
|
-
if (pos == metrics_totals_.end() || pos->first != test_id) [[unlikely]]
|
|
65
|
-
{
|
|
66
|
-
pos = metrics_totals_.emplace_hint(pos, test_id, 0);
|
|
67
|
-
|
|
68
|
-
assert(pos->second == 0);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
assert(pos->first == test_id);
|
|
72
|
-
pos->second += nsec;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* static */ metrics_container_t metrics::totals()
|
|
76
|
-
{
|
|
77
|
-
std::lock_guard<std::mutex> guard(metrics_lock_);
|
|
78
|
-
return metrics_totals_;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/* static */ void metrics::clear()
|
|
82
|
-
{
|
|
83
|
-
std::lock_guard<std::mutex> guard(metrics_lock_);
|
|
84
|
-
metrics_totals_.clear();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
void register_metrics(py::module_ & m)
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
py::module_ metrics_module =
|
|
91
|
-
m.def_submodule("metrics", "Keep track of low-level performance metrics")
|
|
92
|
-
.def("totals", &qdb::metrics::totals)
|
|
93
|
-
.def("clear", &qdb::metrics::clear);
|
|
94
|
-
|
|
95
|
-
auto metrics_measure = py::class_<qdb::metrics::measure>(
|
|
96
|
-
metrics_module, "Measure", "Track all metrics within a block of code")
|
|
97
|
-
.def(py::init())
|
|
98
|
-
.def("__enter__", &qdb::metrics::measure::enter)
|
|
99
|
-
.def("__exit__", &qdb::metrics::measure::exit)
|
|
100
|
-
.def("get", &qdb::metrics::measure::get);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
}; // namespace qdb
|
quasardb/metrics.hpp
DELETED
|
@@ -1,112 +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 <pybind11/pybind11.h>
|
|
34
|
-
#include <pybind11/stl.h>
|
|
35
|
-
#include <cassert>
|
|
36
|
-
#include <chrono>
|
|
37
|
-
#include <map>
|
|
38
|
-
#include <string>
|
|
39
|
-
|
|
40
|
-
namespace qdb
|
|
41
|
-
{
|
|
42
|
-
namespace py = pybind11;
|
|
43
|
-
using metrics_container_t = std::map<std::string, std::uint64_t>;
|
|
44
|
-
|
|
45
|
-
class metrics
|
|
46
|
-
{
|
|
47
|
-
private:
|
|
48
|
-
public:
|
|
49
|
-
/**
|
|
50
|
-
* Utility fixture that automatically records timings for a certain block of code.
|
|
51
|
-
* This is intended to be used from native C++ code only.
|
|
52
|
-
*/
|
|
53
|
-
class scoped_capture
|
|
54
|
-
{
|
|
55
|
-
using clock_t = std::chrono::high_resolution_clock;
|
|
56
|
-
using time_point_t = std::chrono::time_point<clock_t>;
|
|
57
|
-
|
|
58
|
-
public:
|
|
59
|
-
scoped_capture(std::string const & test_id) noexcept
|
|
60
|
-
: test_id_{test_id}
|
|
61
|
-
, start_{clock_t::now()} {};
|
|
62
|
-
~scoped_capture();
|
|
63
|
-
|
|
64
|
-
private:
|
|
65
|
-
std::string test_id_;
|
|
66
|
-
time_point_t start_;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Utility class that's exposed to Python which can be used to record metrics in
|
|
71
|
-
* a scope. It makes it easy to track the difference between the beginning and end
|
|
72
|
-
* of execution.
|
|
73
|
-
*/
|
|
74
|
-
class measure
|
|
75
|
-
{
|
|
76
|
-
public:
|
|
77
|
-
measure();
|
|
78
|
-
~measure(){};
|
|
79
|
-
|
|
80
|
-
public:
|
|
81
|
-
measure enter()
|
|
82
|
-
{
|
|
83
|
-
// No-op, all initialization is done in the constructor.
|
|
84
|
-
return *this;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
void exit(py::object /* type */, py::object /* value */, py::object /* traceback */)
|
|
88
|
-
{}
|
|
89
|
-
|
|
90
|
-
metrics_container_t get() const;
|
|
91
|
-
|
|
92
|
-
private:
|
|
93
|
-
metrics_container_t start_;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
public:
|
|
97
|
-
metrics() noexcept {};
|
|
98
|
-
|
|
99
|
-
~metrics() noexcept {};
|
|
100
|
-
|
|
101
|
-
public:
|
|
102
|
-
static void record(std::string const & test_id, std::uint64_t nsec);
|
|
103
|
-
|
|
104
|
-
static metrics_container_t totals();
|
|
105
|
-
static void clear();
|
|
106
|
-
|
|
107
|
-
private:
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
void register_metrics(py::module_ & m);
|
|
111
|
-
|
|
112
|
-
} // namespace qdb
|
quasardb/module.cpp
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#include "module.hpp"
|
|
2
|
-
#include "cluster.hpp"
|
|
3
|
-
#include "metrics.hpp"
|
|
4
|
-
#include "node.hpp"
|
|
5
|
-
#include "writer.hpp"
|
|
6
|
-
#include <functional>
|
|
7
|
-
#include <list>
|
|
8
|
-
|
|
9
|
-
namespace qdb
|
|
10
|
-
{
|
|
11
|
-
/**
|
|
12
|
-
* This approach is inspired from pybind11, where we keep a global static variable
|
|
13
|
-
* of initializers for components/modules that which to register with our global
|
|
14
|
-
* quasardb module.
|
|
15
|
-
*
|
|
16
|
-
* It has the downside of module initialization order essentially being random, which
|
|
17
|
-
* is fine for our use case. It allows decoupling of code in many places.
|
|
18
|
-
*/
|
|
19
|
-
std::list<std::function<void(py::module_ &)>> & initializers()
|
|
20
|
-
{
|
|
21
|
-
static std::list<std::function<void(py::module_ &)>> inits;
|
|
22
|
-
return inits;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
submodule_initializer::submodule_initializer(initialize_fn init)
|
|
26
|
-
{
|
|
27
|
-
initializers().emplace_back(init);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
submodule_initializer::submodule_initializer(const char * submodule_name, initialize_fn init)
|
|
31
|
-
{
|
|
32
|
-
initializers().emplace_back([=](py::module_ & parent) { init(parent); });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}; // namespace qdb
|
|
36
|
-
|
|
37
|
-
PYBIND11_MODULE(quasardb, m)
|
|
38
|
-
{
|
|
39
|
-
m.doc() = "QuasarDB Official Python API";
|
|
40
|
-
m.def("version", &qdb_version, "Return version number");
|
|
41
|
-
m.def("build", &qdb_build, "Return build number");
|
|
42
|
-
m.attr("never_expires") = std::chrono::system_clock::time_point{};
|
|
43
|
-
|
|
44
|
-
qdb::register_errors(m);
|
|
45
|
-
qdb::register_cluster(m);
|
|
46
|
-
qdb::register_node(m);
|
|
47
|
-
qdb::register_options(m);
|
|
48
|
-
qdb::register_perf(m);
|
|
49
|
-
qdb::register_entry(m);
|
|
50
|
-
qdb::register_double(m);
|
|
51
|
-
qdb::register_integer(m);
|
|
52
|
-
qdb::register_blob(m);
|
|
53
|
-
qdb::register_string(m);
|
|
54
|
-
qdb::register_timestamp(m);
|
|
55
|
-
qdb::register_direct_blob(m);
|
|
56
|
-
qdb::register_direct_integer(m);
|
|
57
|
-
qdb::register_tag(m);
|
|
58
|
-
qdb::register_query(m);
|
|
59
|
-
qdb::register_continuous(m);
|
|
60
|
-
qdb::register_table(m);
|
|
61
|
-
qdb::register_batch_column(m);
|
|
62
|
-
qdb::register_batch_inserter(m);
|
|
63
|
-
qdb::register_table_reader(m);
|
|
64
|
-
qdb::register_masked_array(m);
|
|
65
|
-
qdb::register_writer(m);
|
|
66
|
-
qdb::register_metrics(m);
|
|
67
|
-
|
|
68
|
-
qdb::detail::register_ts_column(m);
|
|
69
|
-
qdb::reader::register_ts_value(m);
|
|
70
|
-
qdb::reader::register_ts_row(m);
|
|
71
|
-
|
|
72
|
-
for (const auto & initializer : qdb::initializers())
|
|
73
|
-
{
|
|
74
|
-
initializer(m);
|
|
75
|
-
}
|
|
76
|
-
}
|
quasardb/module.hpp
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <pybind11/pybind11.h>
|
|
4
|
-
|
|
5
|
-
namespace qdb
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
namespace py = pybind11;
|
|
9
|
-
|
|
10
|
-
class submodule_initializer
|
|
11
|
-
{
|
|
12
|
-
using initialize_fn = void (*)(py::module_ &);
|
|
13
|
-
|
|
14
|
-
public:
|
|
15
|
-
explicit submodule_initializer(initialize_fn init);
|
|
16
|
-
submodule_initializer(const char * submodule_name, initialize_fn init);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
}; // namespace qdb
|
|
20
|
-
|
|
21
|
-
#define QDB_REGISTER_MODULE(name, variable) \
|
|
22
|
-
void qdb_submodule_##name(py::module_ &); \
|
|
23
|
-
submodule_initializer name(#name, qdb_submodule_##name); \
|
|
24
|
-
void qdb_submodule_##name(py::module_ &(variable))
|
quasardb/node.hpp
DELETED
|
@@ -1,123 +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 "direct_blob.hpp"
|
|
34
|
-
#include "direct_handle.hpp"
|
|
35
|
-
#include "direct_integer.hpp"
|
|
36
|
-
#include "options.hpp"
|
|
37
|
-
#include "utils.hpp"
|
|
38
|
-
#include <memory>
|
|
39
|
-
|
|
40
|
-
namespace qdb
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
class node
|
|
44
|
-
{
|
|
45
|
-
public:
|
|
46
|
-
/**
|
|
47
|
-
* Construct a direct node connection directly, possibly with security credentials.
|
|
48
|
-
*/
|
|
49
|
-
node(const std::string & node_uri,
|
|
50
|
-
const std::string & user_name = {},
|
|
51
|
-
const std::string & user_private_key = {},
|
|
52
|
-
const std::string & cluster_public_key = {},
|
|
53
|
-
const std::string & user_security_file = {},
|
|
54
|
-
const std::string & cluster_public_key_file = {})
|
|
55
|
-
: _uri{node_uri}
|
|
56
|
-
, _handle{make_handle_ptr()}
|
|
57
|
-
, _direct_handle{make_direct_handle_ptr()}
|
|
58
|
-
{
|
|
59
|
-
qdb::options{_handle}.apply_credentials(user_name, user_private_key, cluster_public_key,
|
|
60
|
-
user_security_file, cluster_public_key_file);
|
|
61
|
-
_direct_handle->connect(_handle, node_uri);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Construct a direct node from a cluster handle, reusing its security credentials if applicable.
|
|
66
|
-
*/
|
|
67
|
-
node(const std::string & node_uri, handle_ptr handle)
|
|
68
|
-
: _uri{node_uri}
|
|
69
|
-
, _handle{handle}
|
|
70
|
-
, _direct_handle{make_direct_handle_ptr()}
|
|
71
|
-
{
|
|
72
|
-
_direct_handle->connect(_handle, node_uri);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
std::vector<std::string> prefix_get(const std::string & prefix, qdb_int_t max_count)
|
|
76
|
-
{
|
|
77
|
-
const char ** result = nullptr;
|
|
78
|
-
size_t count = 0;
|
|
79
|
-
|
|
80
|
-
// don't throw if no prefix is found
|
|
81
|
-
const qdb_error_t err =
|
|
82
|
-
qdb_direct_prefix_get(*_direct_handle, prefix.c_str(), max_count, &result, &count);
|
|
83
|
-
qdb_throw_if_error(*_handle, err);
|
|
84
|
-
|
|
85
|
-
return convert_strings_and_release(_handle, result, count);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
qdb::direct_blob_entry blob(const std::string & alias)
|
|
89
|
-
{
|
|
90
|
-
return qdb::direct_blob_entry{_handle, _direct_handle, alias};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
qdb::direct_integer_entry integer(const std::string & alias)
|
|
94
|
-
{
|
|
95
|
-
return qdb::direct_integer_entry{_handle, _direct_handle, alias};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private:
|
|
99
|
-
std::string _uri;
|
|
100
|
-
handle_ptr _handle;
|
|
101
|
-
direct_handle_ptr _direct_handle;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
template <typename Module>
|
|
105
|
-
static inline void register_node(Module & m)
|
|
106
|
-
{
|
|
107
|
-
namespace py = pybind11;
|
|
108
|
-
|
|
109
|
-
py::class_<qdb::node>(m, "Node")
|
|
110
|
-
.def(py::init<std::string const &, std::string const &, std::string const &, std::string const &,
|
|
111
|
-
std::string const &, std::string const &>(),
|
|
112
|
-
py::arg("uri"), //
|
|
113
|
-
py::arg("user_name") = std::string{}, //
|
|
114
|
-
py::arg("user_private_key") = std::string{}, //
|
|
115
|
-
py::arg("cluster_public_key") = std::string{}, //
|
|
116
|
-
py::arg("user_security_file") = std::string{}, //
|
|
117
|
-
py::arg("cluster_public_key_file") = std::string{}) //
|
|
118
|
-
.def("prefix_get", &qdb::node::prefix_get)
|
|
119
|
-
.def("blob", &qdb::node::blob)
|
|
120
|
-
.def("integer", &qdb::node::integer);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
} // namespace qdb
|