quasardb 3.14.2.dev1__cp312-cp312-macosx_11_0_arm64.whl → 3.14.2.dev4__cp312-cp312-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.

Files changed (95) hide show
  1. quasardb/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  2. quasardb/Makefile +20 -20
  3. quasardb/__init__.py +33 -4
  4. quasardb/cmake_install.cmake +7 -1
  5. quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  6. quasardb/date/CMakeFiles/Export/a52b05f964b070ee926bcad51d3288af/dateTargets.cmake +13 -13
  7. quasardb/date/Makefile +20 -20
  8. quasardb/date/cmake_install.cmake +7 -1
  9. quasardb/date/dateConfigVersion.cmake +9 -2
  10. quasardb/date/dateTargets.cmake +4 -8
  11. quasardb/libqdb_api.dylib +0 -0
  12. quasardb/numpy/__init__.py +58 -10
  13. quasardb/pandas/__init__.py +58 -102
  14. quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  15. quasardb/pybind11/Makefile +20 -20
  16. quasardb/pybind11/cmake_install.cmake +7 -1
  17. quasardb/quasardb.cpython-312-darwin.so +0 -0
  18. quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  19. quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +13 -13
  20. quasardb/range-v3/CMakeFiles/range.v3.headers.dir/DependInfo.cmake +6 -2
  21. quasardb/range-v3/CMakeFiles/range.v3.headers.dir/build.make +7 -4
  22. quasardb/range-v3/Makefile +20 -20
  23. quasardb/range-v3/cmake_install.cmake +19 -1
  24. quasardb/range-v3/range-v3-config-version.cmake +9 -2
  25. quasardb/range-v3/range-v3-config.cmake +4 -8
  26. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/METADATA +15 -10
  27. quasardb-3.14.2.dev4.dist-info/RECORD +45 -0
  28. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/WHEEL +1 -1
  29. quasardb/CMakeLists.txt +0 -510
  30. quasardb/batch_column.hpp +0 -80
  31. quasardb/batch_inserter.hpp +0 -248
  32. quasardb/blob.hpp +0 -150
  33. quasardb/cluster.cpp +0 -89
  34. quasardb/cluster.hpp +0 -551
  35. quasardb/concepts.hpp +0 -278
  36. quasardb/continuous.cpp +0 -149
  37. quasardb/continuous.hpp +0 -106
  38. quasardb/convert/array.hpp +0 -282
  39. quasardb/convert/point.hpp +0 -330
  40. quasardb/convert/range.hpp +0 -282
  41. quasardb/convert/unicode.hpp +0 -598
  42. quasardb/convert/util.hpp +0 -22
  43. quasardb/convert/value.hpp +0 -711
  44. quasardb/convert.hpp +0 -38
  45. quasardb/detail/qdb_resource.hpp +0 -129
  46. quasardb/detail/ts_column.hpp +0 -224
  47. quasardb/direct_blob.hpp +0 -108
  48. quasardb/direct_handle.hpp +0 -83
  49. quasardb/direct_integer.hpp +0 -94
  50. quasardb/dispatch.hpp +0 -157
  51. quasardb/double.hpp +0 -87
  52. quasardb/entry.hpp +0 -273
  53. quasardb/error.hpp +0 -318
  54. quasardb/handle.cpp +0 -29
  55. quasardb/handle.hpp +0 -98
  56. quasardb/integer.hpp +0 -88
  57. quasardb/logger.cpp +0 -106
  58. quasardb/logger.hpp +0 -228
  59. quasardb/masked_array.hpp +0 -651
  60. quasardb/metrics.cpp +0 -103
  61. quasardb/metrics.hpp +0 -112
  62. quasardb/module.cpp +0 -76
  63. quasardb/module.hpp +0 -24
  64. quasardb/node.hpp +0 -123
  65. quasardb/numpy.cpp +0 -6
  66. quasardb/numpy.hpp +0 -489
  67. quasardb/object_tracker.hpp +0 -283
  68. quasardb/options.hpp +0 -244
  69. quasardb/perf.hpp +0 -336
  70. quasardb/pytypes.hpp +0 -221
  71. quasardb/query.cpp +0 -420
  72. quasardb/query.hpp +0 -92
  73. quasardb/reader/ts_row.hpp +0 -281
  74. quasardb/reader/ts_value.hpp +0 -245
  75. quasardb/remove_cvref.hpp +0 -31
  76. quasardb/string.hpp +0 -160
  77. quasardb/table.cpp +0 -289
  78. quasardb/table.hpp +0 -325
  79. quasardb/table_reader.hpp +0 -220
  80. quasardb/tag.hpp +0 -77
  81. quasardb/timestamp.hpp +0 -97
  82. quasardb/traits.hpp +0 -619
  83. quasardb/ts_iterator.hpp +0 -193
  84. quasardb/utils/blob_deque.hpp +0 -96
  85. quasardb/utils/ostream.hpp +0 -17
  86. quasardb/utils/permutation.hpp +0 -50
  87. quasardb/utils/stable_sort.hpp +0 -25
  88. quasardb/utils/unzip_view.hpp +0 -89
  89. quasardb/utils.cpp +0 -28
  90. quasardb/utils.hpp +0 -174
  91. quasardb/writer.cpp +0 -534
  92. quasardb/writer.hpp +0 -396
  93. quasardb-3.14.2.dev1.dist-info/RECORD +0 -109
  94. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/LICENSE.md +0 -0
  95. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/top_level.txt +0 -0
quasardb/dispatch.hpp DELETED
@@ -1,157 +0,0 @@
1
- #pragma once
2
-
3
- #include "concepts.hpp"
4
- #include "error.hpp"
5
- #include "numpy.hpp"
6
- #include "traits.hpp"
7
- #include <string>
8
-
9
- /**
10
- * Define various way to do runtime -> compile time template dispatch for the
11
- * types that we have.
12
- */
13
- namespace qdb::dispatch
14
- {
15
-
16
- ////////////////////////////////////////////////////////////////////////////////
17
- //
18
- // DTYPE DISPATCHER
19
- //
20
- // Most complex dispatcher: dispatch based on dtype size, kind, and could even
21
- // be extended to datetime precision and whatnot.
22
- //
23
- ////////////////////////////////////////////////////////////////////////////////
24
-
25
- template <template <qdb_ts_column_type_t, typename> class Callback,
26
- qdb_ts_column_type_t ColumnType,
27
- typename DType,
28
- typename... Args>
29
- concept valid_callback = requires(Args... args) {
30
- {
31
- Callback<ColumnType, DType>{}
32
- };
33
- {
34
- Callback<ColumnType, DType>{}(std::forward<Args>(args)...)
35
- };
36
- };
37
-
38
- template <template <qdb_ts_column_type_t, typename> class Callback,
39
- qdb_ts_column_type_t ColumnType,
40
- concepts::dtype DType,
41
- typename... Args>
42
- requires(not valid_callback<Callback, ColumnType, DType, Args...>)
43
- static inline constexpr void by_dtype_(Args &&... args)
44
- {
45
- throw qdb::incompatible_type_exception{"Dtype dispatcher not implemented for ColumnType '"
46
- + std::to_string(ColumnType)
47
- + "': " + numpy::detail::to_string(DType::dtype())};
48
- };
49
-
50
- // Template is only expanded when it actually has a dispatch function with the
51
- // correct signature.
52
- template <template <qdb_ts_column_type_t, typename> class Callback,
53
- qdb_ts_column_type_t ColumnType,
54
- concepts::dtype DType,
55
- typename... Args>
56
-
57
- requires(valid_callback<Callback, ColumnType, DType, Args...>)
58
- static inline constexpr decltype(auto) by_dtype_(Args &&... args)
59
- {
60
- return Callback<ColumnType, DType>{}(std::forward<Args>(args)...);
61
- };
62
-
63
- /**
64
- * Converts runtime kind/size into compile-time template function dispatch.
65
- *
66
- * TODO(leon): possibly allow choice whgether or not to raise a compile-time error
67
- * on unimplemented template functions, right now it assumes these are
68
- * just side effects on template expansion overload: the fact that a
69
- * C++ compiler decides to generate functions for all possible
70
- * combinations of dtype properties.
71
- */
72
- template <template <qdb_ts_column_type_t, typename> class Callback,
73
- qdb_ts_column_type_t ColumnType,
74
- typename... Args>
75
- static inline constexpr decltype(auto) by_dtype(
76
- traits::dtype_kind kind, py::ssize_t size, Args &&... args)
77
- {
78
- #define CASE(K, DT) \
79
- case K: \
80
- return by_dtype_<Callback, ColumnType, DT, Args...>(std::forward<Args>(args)...);
81
-
82
- switch (kind)
83
- {
84
- CASE(traits::unicode_kind, traits::unicode_dtype);
85
- CASE(traits::bytestring_kind, traits::bytestring_dtype);
86
- CASE(traits::datetime_kind, traits::datetime64_ns_dtype);
87
- CASE(traits::object_kind, traits::pyobject_dtype);
88
-
89
- case traits::int_kind:
90
- switch (size)
91
- {
92
- CASE(2, traits::int16_dtype);
93
- CASE(4, traits::int32_dtype);
94
- CASE(8, traits::int64_dtype);
95
- default:
96
- throw qdb::not_implemented_exception{
97
- "Integer dtype with size " + std::to_string(size) + " is not supported"};
98
- };
99
-
100
- case traits::float_kind:
101
- switch (size)
102
- {
103
- CASE(4, traits::float32_dtype);
104
- CASE(8, traits::float64_dtype);
105
- default:
106
- throw qdb::not_implemented_exception{
107
- "Integer dtype with size " + std::to_string(size) + " is not supported"};
108
- };
109
-
110
- default:
111
- throw qdb::not_implemented_exception{
112
- "Unable to dispatch: dtype with kind '" + std::string{(char)kind, 1} + "' not recognized"};
113
- };
114
-
115
- #undef SIZED_CASE3
116
- #undef SIZED_CASE2
117
- #undef CASE
118
- }
119
-
120
- template <template <qdb_ts_column_type_t, typename> class Callback,
121
- qdb_ts_column_type_t ColumnType,
122
- typename... Args>
123
- static inline constexpr decltype(auto) by_dtype(py::dtype const & dt, Args &&... args)
124
- {
125
- return by_dtype<Callback, ColumnType, Args...>(
126
- static_cast<traits::dtype_kind>(dt.kind()), dt.itemsize(), std::forward<Args>(args)...);
127
- }
128
-
129
- ////////////////////////////////////////////////////////////////////////////////
130
- //
131
- // COLUMN TYPE DISPATCHER
132
- //
133
- ////////////////////////////////////////////////////////////////////////////////
134
-
135
- template <template <qdb_ts_column_type_t> class Callback, typename... Args>
136
- static inline constexpr decltype(auto) by_column_type(qdb_ts_column_type_t ct, Args &&... args)
137
- {
138
- switch (ct)
139
- {
140
- #define CASE(CT) \
141
- case CT: \
142
- return Callback<CT>{}(std::forward<Args>(args)...);
143
-
144
- CASE(qdb_ts_column_int64);
145
- CASE(qdb_ts_column_double);
146
- CASE(qdb_ts_column_timestamp);
147
- CASE(qdb_ts_column_blob);
148
- CASE(qdb_ts_column_string);
149
- CASE(qdb_ts_column_symbol);
150
-
151
- default:
152
- throw qdb::not_implemented_exception{"Column type dispatch not handled: " + std::to_string(ct)};
153
- };
154
- #undef CASE
155
- }
156
-
157
- }; // namespace qdb::dispatch
quasardb/double.hpp DELETED
@@ -1,87 +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 "entry.hpp"
34
- #include <qdb/double.h>
35
-
36
- namespace qdb
37
- {
38
-
39
- class double_entry : public expirable_entry
40
- {
41
- public:
42
- double_entry(handle_ptr h, std::string a) noexcept
43
- : expirable_entry{h, a}
44
- {}
45
-
46
- public:
47
- double get()
48
- {
49
- double result;
50
- qdb::qdb_throw_if_error(*_handle, qdb_double_get(*_handle, _alias.c_str(), &result));
51
- return result;
52
- }
53
-
54
- void put(double val)
55
- {
56
- qdb::qdb_throw_if_error(*_handle, qdb_double_put(*_handle, _alias.c_str(), val, qdb_time_t{0}));
57
- }
58
-
59
- void update(double val)
60
- {
61
- qdb::qdb_throw_if_error(
62
- *_handle, qdb_double_update(*_handle, _alias.c_str(), val, qdb_time_t{0}));
63
- }
64
-
65
- double add(double val)
66
- {
67
- double result;
68
- qdb::qdb_throw_if_error(*_handle, qdb_double_add(*_handle, _alias.c_str(), val, &result));
69
- return result;
70
- }
71
- };
72
-
73
- template <typename Module>
74
- static inline void register_double(Module & m)
75
- {
76
- namespace py = pybind11;
77
-
78
- py::class_<qdb::double_entry, qdb::expirable_entry>(m, "Double") //
79
- .def(py::init<qdb::handle_ptr, std::string>()) //
80
- .def("get", &qdb::double_entry::get) //
81
- .def("put", &qdb::double_entry::put, py::arg("double")) //
82
- .def("update", &qdb::double_entry::update, py::arg("double")) //
83
- .def("add", &qdb::double_entry::add, py::arg("addend")) //
84
- ; //
85
- }
86
-
87
- } // namespace qdb
quasardb/entry.hpp DELETED
@@ -1,273 +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 "error.hpp"
34
- #include "handle.hpp"
35
- #include "pytypes.hpp"
36
- #include "utils.hpp"
37
- #include <qdb/tag.h>
38
- #include "convert/value.hpp"
39
- #include <pybind11/pybind11.h>
40
- #include <pybind11/stl.h>
41
- #include <chrono>
42
-
43
- namespace qdb
44
- {
45
-
46
- using hostname = std::pair<std::string, unsigned short>;
47
-
48
- class entry
49
- {
50
-
51
- public:
52
- struct metadata
53
- {
54
- metadata() noexcept
55
- {}
56
-
57
- // we need to adjust for timezone as quasardb is UTC and pybind11 will
58
- // assume local date time points
59
- metadata(qdb_entry_metadata_t const & md) noexcept
60
- : type{md.type}
61
- , size{md.size}
62
- , modification_time{md.modification_time.tv_sec}
63
- , expiry_time{md.expiry_time.tv_sec}
64
- {}
65
-
66
- qdb_entry_type_t type{qdb_entry_uninitialized};
67
- qdb_uint_t size{0};
68
- qdb_timespec_t modification_time;
69
- qdb_timespec_t expiry_time;
70
- };
71
-
72
- public:
73
- entry(handle_ptr h, std::string a)
74
- : _handle{h}
75
- , _alias{a}
76
- {}
77
-
78
- public:
79
- bool attach_tag(const std::string & tag)
80
- {
81
- const qdb_error_t err = qdb_attach_tag(*_handle, _alias.c_str(), tag.c_str());
82
-
83
- if (err != qdb_e_tag_already_set) [[likely]]
84
- {
85
- qdb_throw_if_error(*_handle, err);
86
- }
87
- return err != qdb_e_tag_already_set;
88
- }
89
-
90
- void attach_tags(const std::vector<std::string> & tags)
91
- {
92
- std::vector<const char *> tag_pointers(tags.size());
93
-
94
- std::transform(tags.cbegin(), tags.cend(), tag_pointers.begin(),
95
- [](const std::string & s) { return s.c_str(); });
96
-
97
- qdb::qdb_throw_if_error(*_handle,
98
- qdb_attach_tags(*_handle, _alias.c_str(), tag_pointers.data(), tag_pointers.size()));
99
- }
100
-
101
- bool detach_tag(const std::string & tag)
102
- {
103
- const qdb_error_t err = qdb_detach_tag(*_handle, _alias.c_str(), tag.c_str());
104
-
105
- if (err != qdb_e_tag_not_set) [[likely]]
106
- {
107
- qdb_throw_if_error(*_handle, err);
108
- }
109
-
110
- return err != qdb_e_tag_not_set;
111
- }
112
-
113
- void detach_tags(const std::vector<std::string> & tags)
114
- {
115
- std::vector<const char *> tag_pointers(tags.size());
116
-
117
- std::transform(tags.cbegin(), tags.cend(), tag_pointers.begin(),
118
- [](const std::string & s) { return s.c_str(); });
119
-
120
- qdb::qdb_throw_if_error(*_handle,
121
- qdb_detach_tags(*_handle, _alias.c_str(), tag_pointers.data(), tag_pointers.size()));
122
- }
123
-
124
- bool has_tag(const std::string & tag)
125
- {
126
- return qdb_has_tag(*_handle, _alias.c_str(), tag.c_str()) == qdb_e_ok;
127
- }
128
-
129
- std::vector<std::string> get_tags()
130
- {
131
- const char ** tags = nullptr;
132
- size_t tag_count = 0;
133
-
134
- qdb::qdb_throw_if_error(*_handle, qdb_get_tags(*_handle, _alias.c_str(), &tags, &tag_count));
135
-
136
- return convert_strings_and_release(_handle, tags, tag_count);
137
- }
138
-
139
- public:
140
- void remove()
141
- {
142
- qdb::qdb_throw_if_error(*_handle, qdb_remove(*_handle, _alias.c_str()));
143
- }
144
-
145
- inline qdb::hostname get_location() const
146
- {
147
- qdb_remote_node_t rn;
148
-
149
- qdb::qdb_throw_if_error(*_handle, qdb_get_location(*_handle, _alias.c_str(), &rn));
150
-
151
- qdb::hostname res{rn.address, rn.port};
152
-
153
- qdb_release(*_handle, &rn);
154
-
155
- return res;
156
- }
157
-
158
- inline bool exists() const
159
- {
160
- // There isn't an official way to do it, but quite reliable a way is
161
- // to just check whether an entry has metadata.
162
- qdb_entry_metadata_t md;
163
- qdb_error_t err = qdb_get_metadata(*_handle, _alias.c_str(), &md);
164
-
165
- return err == qdb_e_ok;
166
- }
167
-
168
- inline metadata get_metadata() const
169
- {
170
- qdb_entry_metadata_t md;
171
-
172
- qdb::qdb_throw_if_error(*_handle, qdb_get_metadata(*_handle, _alias.c_str(), &md));
173
-
174
- return metadata{md};
175
- }
176
-
177
- inline qdb_entry_type_t get_entry_type() const
178
- {
179
- return get_metadata().type;
180
- }
181
-
182
- const std::string & get_name() const noexcept
183
- {
184
- return _alias;
185
- }
186
-
187
- protected:
188
- handle_ptr _handle;
189
- std::string _alias;
190
- };
191
-
192
- class expirable_entry : public entry
193
- {
194
- public:
195
- expirable_entry(handle_ptr h, std::string a)
196
- : entry{h, a}
197
- {}
198
-
199
- public:
200
- static qdb_time_t from_pydatetime(qdb::pydatetime const & dt) noexcept
201
- {
202
- return qdb::convert::value<qdb::pydatetime, qdb_time_t>(dt);
203
- }
204
-
205
- public:
206
- void expires_at(const qdb::pydatetime & expiry_time)
207
- {
208
- qdb::qdb_throw_if_error(
209
- *_handle, qdb_expires_at(*_handle, _alias.c_str(), from_pydatetime(expiry_time)));
210
- }
211
-
212
- void expires_from_now(std::chrono::milliseconds expiry_delta)
213
- {
214
- qdb::qdb_throw_if_error(
215
- *_handle, qdb_expires_from_now(*_handle, _alias.c_str(), expiry_delta.count()));
216
- }
217
-
218
- qdb::pydatetime get_expiry_time()
219
- {
220
- return convert::value<qdb_timespec_t, qdb::pydatetime>(get_metadata().expiry_time);
221
- }
222
- };
223
-
224
- template <typename Module>
225
- static inline void register_entry(Module & m)
226
- {
227
- namespace py = pybind11;
228
-
229
- py::class_<qdb::entry> e{m, "Entry"};
230
-
231
- py::enum_<qdb_entry_type_t>{e, "Type", py::arithmetic(), "Entry type"} //
232
- .value("Uninitialized", qdb_entry_uninitialized) //
233
- .value("Integer", qdb_entry_integer) //
234
- .value("HashSet", qdb_entry_hset) //
235
- .value("Tag", qdb_entry_tag) //
236
- .value("Deque", qdb_entry_deque) //
237
- .value("Stream", qdb_entry_stream) //
238
- .value("Timeseries", qdb_entry_ts) //
239
- ;
240
-
241
- e.def(py::init<qdb::handle_ptr, std::string>()) //
242
- .def("attach_tag", &qdb::entry::attach_tag) //
243
- .def("attach_tags", &qdb::entry::attach_tags) //
244
- .def("detach_tag", &qdb::entry::detach_tag) //
245
- .def("detach_tags", &qdb::entry::detach_tags) //
246
- .def("has_tag", &qdb::entry::has_tag) //
247
- .def("get_tags", &qdb::entry::get_tags) //
248
- .def("remove", &qdb::entry::remove) //
249
- .def("exists", &qdb::entry::exists, //
250
- "Returns true if the entry exists") //
251
- .def("get_location", &qdb::entry::get_location) //
252
- .def("get_entry_type", &qdb::entry::get_entry_type) //
253
- .def("get_metadata", &qdb::entry::get_metadata) //
254
- .def("get_name", &qdb::entry::get_name) //
255
- ;
256
-
257
- py::class_<qdb::entry::metadata>{e, "Metadata"} //
258
- .def(py::init<>()) //
259
- .def_readwrite("type", &qdb::entry::metadata::type) //
260
- .def_readwrite("size", &qdb::entry::metadata::size) //
261
- .def_readwrite("modification_time", &qdb::entry::metadata::modification_time) //
262
- .def_readwrite("expiry_time", &qdb::entry::metadata::expiry_time) //
263
- ;
264
-
265
- py::class_<qdb::expirable_entry, qdb::entry>{m, "ExpirableEntry"} //
266
- .def(py::init<qdb::handle_ptr, std::string>()) //
267
- .def("expires_at", &qdb::expirable_entry::expires_at) //
268
- .def("expires_from_now", &qdb::expirable_entry::expires_from_now) //
269
- .def("get_expiry_time", &qdb::expirable_entry::get_expiry_time) //
270
- ;
271
- }
272
-
273
- } // namespace qdb