pyrex-rocksdb 0.1.0__cp312-cp312-macosx_14_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 pyrex-rocksdb might be problematic. Click here for more details.
- pyrex/.dylibs/libgflags.2.2.2.dylib +0 -0
- pyrex/.dylibs/liblz4.1.10.0.dylib +0 -0
- pyrex/.dylibs/librocksdb.10.4.2.dylib +0 -0
- pyrex/.dylibs/libsnappy.1.2.2.dylib +0 -0
- pyrex/.dylibs/libzstd.1.5.7.dylib +0 -0
- pyrex/__init__.py +23 -0
- pyrex/_pyrex.cpp +302 -0
- pyrex/_pyrex.cpython-312-darwin.so +0 -0
- pyrex_rocksdb-0.1.0.dist-info/METADATA +76 -0
- pyrex_rocksdb-0.1.0.dist-info/RECORD +13 -0
- pyrex_rocksdb-0.1.0.dist-info/WHEEL +6 -0
- pyrex_rocksdb-0.1.0.dist-info/licenses/LICENSE +202 -0
- pyrex_rocksdb-0.1.0.dist-info/top_level.txt +1 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
pyrex/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This makes functions and classes like `PyRocksDB` directly available as `pyrex.PyRocksDB`
|
|
2
|
+
from ._pyrex import *
|
|
3
|
+
|
|
4
|
+
# Version information (highly recommended)
|
|
5
|
+
try:
|
|
6
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
7
|
+
except ImportError: # Python < 3.8
|
|
8
|
+
from importlib_metadata import version, PackageNotFoundError # pip install importlib_metadata for older Pythons
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version("pyrex-rocksdb") # Use the 'name' from pyproject.toml
|
|
12
|
+
except PackageNotFoundError:
|
|
13
|
+
# Package is not installed (e.g., running tests in dev mode without editable install)
|
|
14
|
+
__version__ = "unknown"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Package Docstring
|
|
18
|
+
"""
|
|
19
|
+
A fast RocksDB wrapper for Python using pybind11.
|
|
20
|
+
|
|
21
|
+
This package provides high-performance bindings to the RocksDB key-value store,
|
|
22
|
+
allowing seamless interaction from Python applications.
|
|
23
|
+
"""
|
pyrex/_pyrex.cpp
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
// rocksdb_wrapper.cpp
|
|
2
|
+
#include <pybind11/pybind11.h>
|
|
3
|
+
#include <pybind11/stl.h>
|
|
4
|
+
|
|
5
|
+
// NEW: Include for std::unique_ptr
|
|
6
|
+
#include <memory>
|
|
7
|
+
|
|
8
|
+
#include "rocksdb/db.h"
|
|
9
|
+
#include "rocksdb/options.h"
|
|
10
|
+
#include "rocksdb/status.h"
|
|
11
|
+
#include "rocksdb/slice.h"
|
|
12
|
+
#include "rocksdb/table.h"
|
|
13
|
+
#include "rocksdb/filter_policy.h"
|
|
14
|
+
#include "rocksdb/write_batch.h"
|
|
15
|
+
#include "rocksdb/iterator.h"
|
|
16
|
+
|
|
17
|
+
#include <iostream>
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <cstring>
|
|
20
|
+
|
|
21
|
+
namespace py = pybind11;
|
|
22
|
+
|
|
23
|
+
// Define a custom exception for RocksDB errors
|
|
24
|
+
class RocksDBException : public std::runtime_error {
|
|
25
|
+
public:
|
|
26
|
+
explicit RocksDBException(const std::string& msg) : std::runtime_error(msg) {}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// --- PyOptions class to wrap rocksdb::Options ---
|
|
30
|
+
class PyOptions {
|
|
31
|
+
public:
|
|
32
|
+
rocksdb::Options options_;
|
|
33
|
+
|
|
34
|
+
PyOptions() : options_() {}
|
|
35
|
+
|
|
36
|
+
bool get_create_if_missing() const { return options_.create_if_missing; }
|
|
37
|
+
void set_create_if_missing(bool value) { options_.create_if_missing = value; }
|
|
38
|
+
|
|
39
|
+
bool get_error_if_exists() const { return options_.error_if_exists; }
|
|
40
|
+
void set_error_if_exists(bool value) { options_.error_if_exists = value; }
|
|
41
|
+
|
|
42
|
+
int get_max_open_files() const { return options_.max_open_files; }
|
|
43
|
+
void set_max_open_files(int value) { options_.max_open_files = value; }
|
|
44
|
+
|
|
45
|
+
size_t get_write_buffer_size() const { return options_.write_buffer_size; }
|
|
46
|
+
void set_write_buffer_size(size_t value) { options_.write_buffer_size = value; }
|
|
47
|
+
|
|
48
|
+
rocksdb::CompressionType get_compression() const { return options_.compression; }
|
|
49
|
+
void set_compression(rocksdb::CompressionType value) { options_.compression = value; }
|
|
50
|
+
|
|
51
|
+
int get_max_background_jobs() const { return options_.max_background_jobs; }
|
|
52
|
+
void set_max_background_jobs(int value) { options_.max_background_jobs = value; }
|
|
53
|
+
|
|
54
|
+
void increase_parallelism(int total_threads) {
|
|
55
|
+
options_.IncreaseParallelism(total_threads);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void optimize_for_small_db() {
|
|
59
|
+
options_.OptimizeForSmallDb();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void use_block_based_bloom_filter(double bits_per_key = 10.0) {
|
|
63
|
+
if (options_.table_factory == nullptr ||
|
|
64
|
+
std::strcmp(options_.table_factory->Name(), "BlockBasedTable") != 0) {
|
|
65
|
+
options_.table_factory.reset(rocksdb::NewBlockBasedTableFactory());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
rocksdb::BlockBasedTableOptions table_options;
|
|
69
|
+
// NOTE: This part assumes we are creating a new policy, not modifying an existing one.
|
|
70
|
+
// This is a reasonable simplification for a wrapper.
|
|
71
|
+
|
|
72
|
+
// Create a new bloom filter policy
|
|
73
|
+
table_options.filter_policy.reset(rocksdb::NewBloomFilterPolicy(bits_per_key));
|
|
74
|
+
options_.table_factory.reset(rocksdb::NewBlockBasedTableFactory(table_options));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// --- PyWriteBatch class to wrap rocksdb::WriteBatch ---
|
|
79
|
+
class PyWriteBatch {
|
|
80
|
+
public:
|
|
81
|
+
rocksdb::WriteBatch wb_;
|
|
82
|
+
|
|
83
|
+
PyWriteBatch() : wb_() {}
|
|
84
|
+
|
|
85
|
+
void put(const py::bytes& key_bytes, const py::bytes& value_bytes) {
|
|
86
|
+
wb_.Put(static_cast<std::string>(key_bytes), static_cast<std::string>(value_bytes));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void del(const py::bytes& key_bytes) {
|
|
90
|
+
wb_.Delete(static_cast<std::string>(key_bytes));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
void clear() {
|
|
94
|
+
wb_.Clear();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// --- PyRocksDBIterator class to wrap rocksdb::Iterator ---
|
|
99
|
+
class PyRocksDBIterator {
|
|
100
|
+
public:
|
|
101
|
+
// Raw pointer to the RocksDB Iterator.
|
|
102
|
+
// The lifetime of this pointer is managed by this class's constructor/destructor.
|
|
103
|
+
rocksdb::Iterator* it_;
|
|
104
|
+
|
|
105
|
+
explicit PyRocksDBIterator(rocksdb::Iterator* it) : it_(it) {
|
|
106
|
+
if (!it_) {
|
|
107
|
+
throw RocksDBException("Failed to create RocksDB iterator: null pointer received.");
|
|
108
|
+
}
|
|
109
|
+
// std::cout << "DEBUG: Creating RocksDB iterator." << std::endl; // Optional: for debugging
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Destructor: Ensures the C++ iterator is deleted when this object is destroyed.
|
|
113
|
+
~PyRocksDBIterator() {
|
|
114
|
+
if (it_ != nullptr) {
|
|
115
|
+
std::cout << "DEBUG: Deleting RocksDB iterator." << std::endl;
|
|
116
|
+
delete it_;
|
|
117
|
+
it_ = nullptr;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
bool valid() const {
|
|
122
|
+
return it_->Valid();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
void seek_to_first() {
|
|
126
|
+
it_->SeekToFirst();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
void seek_to_last() {
|
|
130
|
+
it_->SeekToLast();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
void seek(const py::bytes& key_bytes) {
|
|
134
|
+
it_->Seek(static_cast<std::string>(key_bytes));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void next() {
|
|
138
|
+
it_->Next();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
void prev() {
|
|
142
|
+
it_->Prev();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
py::object key() {
|
|
146
|
+
if (it_->Valid()) {
|
|
147
|
+
return py::bytes(it_->key().ToString());
|
|
148
|
+
}
|
|
149
|
+
return py::none();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
py::object value() {
|
|
153
|
+
if (it_->Valid()) {
|
|
154
|
+
return py::bytes(it_->value().ToString());
|
|
155
|
+
}
|
|
156
|
+
return py::none();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
void check_status() {
|
|
160
|
+
rocksdb::Status status = it_->status();
|
|
161
|
+
if (!status.ok()) {
|
|
162
|
+
throw RocksDBException("RocksDB Iterator error: " + status.ToString());
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// --- PyRocksDB class to wrap rocksdb::DB ---
|
|
168
|
+
class PyRocksDB {
|
|
169
|
+
public:
|
|
170
|
+
rocksdb::DB* db_;
|
|
171
|
+
PyOptions opened_options_; // Store the options used to open the DB
|
|
172
|
+
std::string path_; // IMPROVEMENT: Store the path for accurate debug messages
|
|
173
|
+
|
|
174
|
+
PyRocksDB(const std::string& path, PyOptions* py_options = nullptr) : db_(nullptr), path_(path) {
|
|
175
|
+
rocksdb::Options actual_options;
|
|
176
|
+
|
|
177
|
+
if (py_options != nullptr) {
|
|
178
|
+
actual_options = py_options->options_;
|
|
179
|
+
} else {
|
|
180
|
+
actual_options.create_if_missing = true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
opened_options_.options_ = actual_options;
|
|
184
|
+
|
|
185
|
+
rocksdb::Status status = rocksdb::DB::Open(actual_options, path_, &db_);
|
|
186
|
+
|
|
187
|
+
if (!status.ok()) {
|
|
188
|
+
throw RocksDBException("Failed to open RocksDB at " + path_ + ": " + status.ToString());
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
std::cout << "RocksDB opened successfully at: " << path_ << std::endl;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
~PyRocksDB() {
|
|
195
|
+
if (db_ != nullptr) {
|
|
196
|
+
// IMPROVEMENT: Use the stored path_ member for a reliable close message.
|
|
197
|
+
std::cout << "DEBUG: Closing RocksDB database at " << path_ << std::endl;
|
|
198
|
+
delete db_;
|
|
199
|
+
db_ = nullptr;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
void put(const py::bytes& key_bytes, const py::bytes& value_bytes) {
|
|
204
|
+
rocksdb::Status status = db_->Put(rocksdb::WriteOptions(),
|
|
205
|
+
static_cast<std::string>(key_bytes),
|
|
206
|
+
static_cast<std::string>(value_bytes));
|
|
207
|
+
if (!status.ok()) {
|
|
208
|
+
throw RocksDBException("Failed to put key-value pair: " + status.ToString());
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
py::object get(const py::bytes& key_bytes) {
|
|
213
|
+
std::string value_str;
|
|
214
|
+
rocksdb::Status status = db_->Get(rocksdb::ReadOptions(), static_cast<std::string>(key_bytes), &value_str);
|
|
215
|
+
|
|
216
|
+
if (status.ok()) {
|
|
217
|
+
return py::bytes(value_str);
|
|
218
|
+
} else if (status.IsNotFound()) {
|
|
219
|
+
return py::none();
|
|
220
|
+
} else {
|
|
221
|
+
throw RocksDBException("Failed to get value for key: " + status.ToString());
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// This method is safe to return by value, as PyOptions is a simple
|
|
226
|
+
// wrapper around a copyable rocksdb::Options object.
|
|
227
|
+
PyOptions get_options() const {
|
|
228
|
+
return opened_options_;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
void write(PyWriteBatch& py_write_batch) {
|
|
232
|
+
rocksdb::Status status = db_->Write(rocksdb::WriteOptions(), &py_write_batch.wb_);
|
|
233
|
+
if (!status.ok()) {
|
|
234
|
+
throw RocksDBException("Failed to write batch: " + status.ToString());
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// **FIXED**: Return a unique_ptr to transfer ownership to pybind11.
|
|
239
|
+
// This prevents the temporary iterator object from being destroyed prematurely.
|
|
240
|
+
std::unique_ptr<PyRocksDBIterator> new_iterator() {
|
|
241
|
+
rocksdb::ReadOptions read_options;
|
|
242
|
+
return std::make_unique<PyRocksDBIterator>(db_->NewIterator(read_options));
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// --- PYBIND11 MODULE DEFINITION ---
|
|
247
|
+
PYBIND11_MODULE(_pyrex, m) {
|
|
248
|
+
m.doc() = "pybind11 RocksDB wrapper";
|
|
249
|
+
|
|
250
|
+
py::register_exception<RocksDBException>(m, "RocksDBException");
|
|
251
|
+
|
|
252
|
+
py::enum_<rocksdb::CompressionType>(m, "CompressionType")
|
|
253
|
+
.value("kNoCompression", rocksdb::kNoCompression)
|
|
254
|
+
.value("kSnappyCompression", rocksdb::kSnappyCompression)
|
|
255
|
+
.value("kBZip2Compression", rocksdb::kBZip2Compression)
|
|
256
|
+
.value("kLZ4Compression", rocksdb::kLZ4Compression)
|
|
257
|
+
.value("kLZ4HCCompression", rocksdb::kLZ4HCCompression)
|
|
258
|
+
.value("kXpressCompression", rocksdb::kXpressCompression)
|
|
259
|
+
.value("kZSTD", rocksdb::kZSTD)
|
|
260
|
+
.value("kDisableCompressionOption", rocksdb::kDisableCompressionOption)
|
|
261
|
+
.export_values();
|
|
262
|
+
|
|
263
|
+
py::class_<PyOptions>(m, "PyOptions")
|
|
264
|
+
.def(py::init<>())
|
|
265
|
+
.def_property("create_if_missing", &PyOptions::get_create_if_missing, &PyOptions::set_create_if_missing)
|
|
266
|
+
.def_property("error_if_exists", &PyOptions::get_error_if_exists, &PyOptions::set_error_if_exists)
|
|
267
|
+
.def_property("max_open_files", &PyOptions::get_max_open_files, &PyOptions::set_max_open_files)
|
|
268
|
+
.def_property("write_buffer_size", &PyOptions::get_write_buffer_size, &PyOptions::set_write_buffer_size)
|
|
269
|
+
.def_property("compression", &PyOptions::get_compression, &PyOptions::set_compression)
|
|
270
|
+
.def_property("max_background_jobs", &PyOptions::get_max_background_jobs, &PyOptions::set_max_background_jobs)
|
|
271
|
+
.def("increase_parallelism", &PyOptions::increase_parallelism, py::arg("total_threads"))
|
|
272
|
+
.def("optimize_for_small_db", &PyOptions::optimize_for_small_db)
|
|
273
|
+
.def("use_block_based_bloom_filter", &PyOptions::use_block_based_bloom_filter, py::arg("bits_per_key") = 10.0);
|
|
274
|
+
|
|
275
|
+
py::class_<PyWriteBatch>(m, "PyWriteBatch")
|
|
276
|
+
.def(py::init<>())
|
|
277
|
+
.def("put", &PyWriteBatch::put, py::arg("key"), py::arg("value"))
|
|
278
|
+
.def("delete", &PyWriteBatch::del, py::arg("key"))
|
|
279
|
+
.def("clear", &PyWriteBatch::clear);
|
|
280
|
+
|
|
281
|
+
py::class_<PyRocksDBIterator>(m, "PyRocksDBIterator")
|
|
282
|
+
.def("valid", &PyRocksDBIterator::valid)
|
|
283
|
+
.def("seek_to_first", &PyRocksDBIterator::seek_to_first)
|
|
284
|
+
.def("seek_to_last", &PyRocksDBIterator::seek_to_last)
|
|
285
|
+
.def("seek", &PyRocksDBIterator::seek, py::arg("key"))
|
|
286
|
+
.def("next", &PyRocksDBIterator::next)
|
|
287
|
+
.def("prev", &PyRocksDBIterator::prev)
|
|
288
|
+
.def("key", &PyRocksDBIterator::key)
|
|
289
|
+
.def("value", &PyRocksDBIterator::value)
|
|
290
|
+
.def("check_status", &PyRocksDBIterator::check_status);
|
|
291
|
+
|
|
292
|
+
py::class_<PyRocksDB>(m, "PyRocksDB")
|
|
293
|
+
.def(py::init<const std::string&, PyOptions*>(), py::arg("path"), py::arg("options") = nullptr)
|
|
294
|
+
.def("put", &PyRocksDB::put, py::arg("key"), py::arg("value"))
|
|
295
|
+
.def("get", &PyRocksDB::get, py::arg("key"))
|
|
296
|
+
.def("get_options", &PyRocksDB::get_options)
|
|
297
|
+
.def("write", &PyRocksDB::write, py::arg("write_batch"))
|
|
298
|
+
.def("new_iterator", &PyRocksDB::new_iterator,
|
|
299
|
+
"Creates and returns a new RocksDB iterator.",
|
|
300
|
+
py::keep_alive<0, 1>()
|
|
301
|
+
);
|
|
302
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyrex-rocksdb
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A fast RocksDB wrapper for Python using pybind11.
|
|
5
|
+
Author-email: Charilaos Mylonas <mylonas.charilaos@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/mylonasc/pyrex
|
|
7
|
+
Project-URL: Repository, https://github.com/mylonasc/pyrex
|
|
8
|
+
Keywords: rocksdb,database,key-value,pybind11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Development Status :: 3 - Alpha
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: Topic :: Database
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest; extra == "dev"
|
|
27
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
28
|
+
Requires-Dist: sphinx-rtd-theme; extra == "dev"
|
|
29
|
+
Requires-Dist: cibuildwheel; extra == "dev"
|
|
30
|
+
Requires-Dist: twine; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
[](https://github.com/mylonasc/pyrex/actions/workflows/build_wheels.yml)
|
|
34
|
+
|
|
35
|
+
# pyrex
|
|
36
|
+
a python rocksdb wrapper
|
|
37
|
+
|
|
38
|
+
## Motivation
|
|
39
|
+
rocksdb python wrappers are broken. This is yet another attempt to create a working python wrapper for rocksdb.
|
|
40
|
+
|
|
41
|
+
## Example usage:
|
|
42
|
+
Check the `test.py` file.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
On Linux/macOS: Open your terminal, navigate to the parent directory of my_rocksdb_wrapper, and run:
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Build and Use the Wrapper:
|
|
50
|
+
After saving the files, follow these steps to build and use your Python wrapper:
|
|
51
|
+
|
|
52
|
+
### Prerequisites:
|
|
53
|
+
|
|
54
|
+
* RocksDB C++ Library Installed (headers and libraries accessible). (in Ubuntu `sudo apt-get install librocksdb` may suffice)
|
|
55
|
+
* C++11 compatible compiler (e.g., g++ or clang++).
|
|
56
|
+
* Python 3.7+ and its development headers.
|
|
57
|
+
|
|
58
|
+
* Python pybind11 package: `pip install pybind11`
|
|
59
|
+
|
|
60
|
+
Python setuptools package: `pip install --upgrade setuptools`
|
|
61
|
+
|
|
62
|
+
### Adjust setup.py (if needed):
|
|
63
|
+
|
|
64
|
+
Open setup.py and verify that `include_dirs` and `library_dirs` correctly point to your RocksDB installation paths.
|
|
65
|
+
If RocksDB is not in `/usr/local/include` or `/usr/local/lib`, update these paths.
|
|
66
|
+
|
|
67
|
+
If RocksDB was built with specific compression libraries (like Snappy, Zlib, LZ4, Zstandard), add their corresponding names (e.g., 'snappy', 'z') to the libraries list.
|
|
68
|
+
|
|
69
|
+
Compile the Wrapper:
|
|
70
|
+
Navigate to the directory containing rocksdb_wrapper.cpp and setup.py in your terminal, and run:
|
|
71
|
+
|
|
72
|
+
```Bash
|
|
73
|
+
|
|
74
|
+
python setup.py install
|
|
75
|
+
```
|
|
76
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
pyrex/__init__.py,sha256=zshmllNLYDo3znwRaknHeAd4obEkjS3jK6UkcXAsvw4,831
|
|
2
|
+
pyrex/_pyrex.cpython-312-darwin.so,sha256=hkoAwtprFoZamx3W55FLQUTnZMD77RfPQjxiV6UEo6E,540080
|
|
3
|
+
pyrex/_pyrex.cpp,sha256=mgzrP3PpeDVylK7pkjts2L8hv_tuiQ_Mfy-80r39o8I,10986
|
|
4
|
+
pyrex/.dylibs/libsnappy.1.2.2.dylib,sha256=RtFJkVOnmB0FU6L5PGz-SRdNhutch4TzcNi-wB13m_0,79184
|
|
5
|
+
pyrex/.dylibs/liblz4.1.10.0.dylib,sha256=k7TzQdjquM1GQIEVgXlSdUc9wfXAF7lCCMVqOWU0l2o,176960
|
|
6
|
+
pyrex/.dylibs/librocksdb.10.4.2.dylib,sha256=ybpmZR-J9Hr88Nf_Bkl7ae8siEQPfn8A20dmzJl-X7U,11266240
|
|
7
|
+
pyrex/.dylibs/libgflags.2.2.2.dylib,sha256=uiE_yjZcs48WAx0cx5VsLtCi-Jf1tip-QamzYNGTG70,172336
|
|
8
|
+
pyrex/.dylibs/libzstd.1.5.7.dylib,sha256=c-Z4ifatarhfQRED6aESDQIMTHw8XxG_OYBBdVYdDVg,670240
|
|
9
|
+
pyrex_rocksdb-0.1.0.dist-info/RECORD,,
|
|
10
|
+
pyrex_rocksdb-0.1.0.dist-info/WHEEL,sha256=VrhWOWJdu4wN9IKhAFBqWPMo6yuww-SFg9GbWc0qbmI,136
|
|
11
|
+
pyrex_rocksdb-0.1.0.dist-info/top_level.txt,sha256=0YbfttFoNSJjWKBullYqKklNMzgq7obw3oD751OmOOo,6
|
|
12
|
+
pyrex_rocksdb-0.1.0.dist-info/METADATA,sha256=-5O5YaIogXmPdAxSHCo-XlghhcZzMAJyAcN-gYnfYf8,2830
|
|
13
|
+
pyrex_rocksdb-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyrex
|