rdbpython 0.2.6__cp314-cp314-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.
Files changed (45) hide show
  1. rdbpy/.dylibs/libbz2.1.0.8.dylib +0 -0
  2. rdbpy/.dylibs/liblz4.1.9.4.dylib +0 -0
  3. rdbpy/.dylibs/libsnappy.1.2.1.dylib +0 -0
  4. rdbpy/.dylibs/libz.1.3.1.dylib +0 -0
  5. rdbpy/.dylibs/libzstd.1.5.6.dylib +0 -0
  6. rdbpy/__init__.py +1 -0
  7. rdbpy/backup.pxd +35 -0
  8. rdbpy/cache.pxd +8 -0
  9. rdbpy/comparator.pxd +23 -0
  10. rdbpy/db.pxd +230 -0
  11. rdbpy/env.pxd +5 -0
  12. rdbpy/errors.py +26 -0
  13. rdbpy/filter_policy.pxd +39 -0
  14. rdbpy/include/rdb_include/comparator_wrapper.hpp +63 -0
  15. rdbpy/include/rdb_include/filter_policy_wrapper.hpp +89 -0
  16. rdbpy/include/rdb_include/memtable_factories.hpp +15 -0
  17. rdbpy/include/rdb_include/merge_operator_wrapper.hpp +132 -0
  18. rdbpy/include/rdb_include/slice_transform_wrapper.hpp +109 -0
  19. rdbpy/include/rdb_include/utils.hpp +8 -0
  20. rdbpy/include/rdb_include/write_batch_iter_helper.hpp +65 -0
  21. rdbpy/interfaces.py +77 -0
  22. rdbpy/iterator.pxd +16 -0
  23. rdbpy/lib_rocksdb.cpython-314-darwin.so +0 -0
  24. rdbpy/lib_rocksdb.pxd +769 -0
  25. rdbpy/lib_rocksdb.pyi +1465 -0
  26. rdbpy/lib_rocksdb.pyx +3294 -0
  27. rdbpy/lib_utils.py +52 -0
  28. rdbpy/logger.pxd +5 -0
  29. rdbpy/memtablerep.pxd +12 -0
  30. rdbpy/merge_operator.pxd +46 -0
  31. rdbpy/merge_operators.py +25 -0
  32. rdbpy/options.pxd +179 -0
  33. rdbpy/slice_.pxd +20 -0
  34. rdbpy/slice_transform.pxd +37 -0
  35. rdbpy/snapshot.pxd +3 -0
  36. rdbpy/status.pxd +15 -0
  37. rdbpy/std_memory.pxd +7 -0
  38. rdbpy/table_factory.pxd +59 -0
  39. rdbpy/transaction.pxd +154 -0
  40. rdbpy/universal_compaction.pxd +15 -0
  41. rdbpython-0.2.6.dist-info/METADATA +98 -0
  42. rdbpython-0.2.6.dist-info/RECORD +45 -0
  43. rdbpython-0.2.6.dist-info/WHEEL +6 -0
  44. rdbpython-0.2.6.dist-info/licenses/LICENSE.md +201 -0
  45. rdbpython-0.2.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,109 @@
1
+ #include <string>
2
+ #include "rocksdb/slice_transform.h"
3
+ #include "rocksdb/env.h"
4
+ #include <stdexcept>
5
+
6
+ using std::string;
7
+ using rocksdb::SliceTransform;
8
+ using rocksdb::Slice;
9
+ using rocksdb::Logger;
10
+
11
+ namespace py_rocks {
12
+ class SliceTransformWrapper: public SliceTransform {
13
+ public:
14
+ typedef Slice (*transform_func)(
15
+ void*,
16
+ Logger*,
17
+ string&,
18
+ const Slice&);
19
+
20
+ typedef bool (*in_domain_func)(
21
+ void*,
22
+ Logger*,
23
+ string&,
24
+ const Slice&);
25
+
26
+ typedef bool (*in_range_func)(
27
+ void*,
28
+ Logger*,
29
+ string&,
30
+ const Slice&);
31
+
32
+ SliceTransformWrapper(
33
+ string name,
34
+ void* ctx,
35
+ transform_func transfrom_callback,
36
+ in_domain_func in_domain_callback,
37
+ in_range_func in_range_callback):
38
+ name(name),
39
+ ctx(ctx),
40
+ transfrom_callback(transfrom_callback),
41
+ in_domain_callback(in_domain_callback),
42
+ in_range_callback(in_range_callback)
43
+ {}
44
+
45
+ virtual const char* Name() const {
46
+ return this->name.c_str();
47
+ }
48
+
49
+ virtual Slice Transform(const Slice& src) const {
50
+ string error_msg;
51
+ Slice val;
52
+
53
+ val = this->transfrom_callback(
54
+ this->ctx,
55
+ this->info_log.get(),
56
+ error_msg,
57
+ src);
58
+
59
+ if (error_msg.size()) {
60
+ throw std::runtime_error(error_msg.c_str());
61
+ }
62
+ return val;
63
+ }
64
+
65
+ virtual bool InDomain(const Slice& src) const {
66
+ string error_msg;
67
+ bool val;
68
+
69
+ val = this->in_domain_callback(
70
+ this->ctx,
71
+ this->info_log.get(),
72
+ error_msg,
73
+ src);
74
+
75
+ if (error_msg.size()) {
76
+ throw std::runtime_error(error_msg.c_str());
77
+ }
78
+ return val;
79
+ }
80
+
81
+ virtual bool InRange(const Slice& dst) const {
82
+ string error_msg;
83
+ bool val;
84
+
85
+ val = this->in_range_callback(
86
+ this->ctx,
87
+ this->info_log.get(),
88
+ error_msg,
89
+ dst);
90
+
91
+ if (error_msg.size()) {
92
+ throw std::runtime_error(error_msg.c_str());
93
+ }
94
+ return val;
95
+ }
96
+
97
+ void set_info_log(std::shared_ptr<Logger> info_log) {
98
+ this->info_log = info_log;
99
+ }
100
+
101
+ private:
102
+ string name;
103
+ void* ctx;
104
+ transform_func transfrom_callback;
105
+ in_domain_func in_domain_callback;
106
+ in_range_func in_range_callback;
107
+ std::shared_ptr<Logger> info_log;
108
+ };
109
+ }
@@ -0,0 +1,8 @@
1
+ #include <vector>
2
+
3
+ namespace py_rocks {
4
+ template <typename T>
5
+ const T* vector_data(std::vector<T>& v) {
6
+ return v.data();
7
+ }
8
+ }
@@ -0,0 +1,65 @@
1
+ #pragma once
2
+
3
+ #include <vector>
4
+ #include "rocksdb/write_batch.h"
5
+
6
+ namespace py_rocks {
7
+
8
+ class RecordItemsHandler: public rocksdb::WriteBatch::Handler {
9
+ public:
10
+ enum Optype {PutRecord, MergeRecord, DeleteRecord};
11
+
12
+ class BatchItem {
13
+ public:
14
+ BatchItem(
15
+ const Optype& op,
16
+ uint32_t column_family_id,
17
+ const rocksdb::Slice& key,
18
+ const rocksdb::Slice& value):
19
+ op(op),
20
+ column_family_id(column_family_id),
21
+ key(key),
22
+ value(value)
23
+ {}
24
+
25
+ const Optype op;
26
+ uint32_t column_family_id;
27
+ const rocksdb::Slice key;
28
+ const rocksdb::Slice value;
29
+ };
30
+
31
+ typedef std::vector<BatchItem> BatchItems;
32
+
33
+ public:
34
+ /* Items is filled during iteration. */
35
+ RecordItemsHandler(BatchItems* items): items(items) {}
36
+
37
+ virtual rocksdb::Status PutCF(
38
+ uint32_t column_family_id, const Slice& key, const Slice& value) {
39
+ this->items->emplace_back(PutRecord, column_family_id, key, value);
40
+ return rocksdb::Status::OK();
41
+ }
42
+
43
+ virtual rocksdb::Status MergeCF(
44
+ uint32_t column_family_id, const Slice& key, const Slice& value) {
45
+ this->items->emplace_back(MergeRecord, column_family_id, key, value);
46
+ return rocksdb::Status::OK();
47
+ }
48
+
49
+ virtual rocksdb::Status DeleteCF(
50
+ uint32_t column_family_id, const Slice& key) {
51
+ this->items->emplace_back(DeleteRecord, column_family_id, key, rocksdb::Slice());
52
+ return rocksdb::Status::OK();
53
+ }
54
+
55
+ private:
56
+ BatchItems* items;
57
+ };
58
+
59
+ rocksdb::Status
60
+ get_batch_items(const rocksdb::WriteBatch* batch, RecordItemsHandler::BatchItems* items) {
61
+ RecordItemsHandler handler(items);
62
+ return batch->Iterate(&handler);
63
+ }
64
+
65
+ }
rdbpy/interfaces.py ADDED
@@ -0,0 +1,77 @@
1
+ from abc import ABCMeta, abstractmethod
2
+
3
+
4
+ class Comparator:
5
+ __metaclass__ = ABCMeta
6
+
7
+ @abstractmethod
8
+ def compare(self, a, b):
9
+ pass
10
+
11
+ @abstractmethod
12
+ def name(self):
13
+ pass
14
+
15
+
16
+ class AssociativeMergeOperator:
17
+ __metaclass__ = ABCMeta
18
+
19
+ @abstractmethod
20
+ def merge(self, key, existing_value, value):
21
+ pass
22
+
23
+ @abstractmethod
24
+ def name(self):
25
+ pass
26
+
27
+
28
+ class MergeOperator:
29
+ __metaclass__ = ABCMeta
30
+
31
+ @abstractmethod
32
+ def full_merge(self, key, existing_value, operand_list):
33
+ pass
34
+
35
+ @abstractmethod
36
+ def partial_merge(self, key, left_operand, right_operand):
37
+ pass
38
+
39
+ @abstractmethod
40
+ def name(self):
41
+ pass
42
+
43
+
44
+ class FilterPolicy:
45
+ __metaclass__ = ABCMeta
46
+
47
+ @abstractmethod
48
+ def name(self):
49
+ pass
50
+
51
+ @abstractmethod
52
+ def create_filter(self, keys):
53
+ pass
54
+
55
+ @abstractmethod
56
+ def key_may_match(self, key, filter_):
57
+ pass
58
+
59
+
60
+ class SliceTransform:
61
+ __metaclass__ = ABCMeta
62
+
63
+ @abstractmethod
64
+ def name(self):
65
+ pass
66
+
67
+ @abstractmethod
68
+ def transform(self, src):
69
+ pass
70
+
71
+ @abstractmethod
72
+ def in_domain(self, src):
73
+ pass
74
+
75
+ @abstractmethod
76
+ def in_range(self, dst):
77
+ pass
rdbpy/iterator.pxd ADDED
@@ -0,0 +1,16 @@
1
+ from libcpp cimport bool as cpp_bool
2
+ from rdbpy.slice_ cimport Slice
3
+ from rdbpy.status cimport Status
4
+
5
+ cdef extern from "rocksdb/iterator.h" namespace "rocksdb":
6
+ cdef cppclass Iterator:
7
+ cpp_bool Valid() nogil except+
8
+ void SeekToFirst() nogil except+
9
+ void SeekToLast() nogil except+
10
+ void Seek(const Slice&) nogil except+
11
+ void Next() nogil except+
12
+ void Prev() nogil except+
13
+ void SeekForPrev(const Slice&) nogil except+
14
+ Slice key() nogil except+
15
+ Slice value() nogil except+
16
+ Status status() nogil except+
Binary file