-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from labteral/develop
v2
- Loading branch information
Showing
6 changed files
with
133 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# easyrocks | ||
A [`python-rocksdb`](https://github.com/twmht/python-rocksdb) wrapper for a more comfortable interaction with RocksDB. | ||
|
||
> Keys must be of type `bytes`. Values can be nested structures or complex objects. Value serialization is automatically performed with MessagePack if possible, otherwise with Pickle. | ||
## Usage | ||
```python | ||
from easyrocks import RocksDB | ||
|
||
db = RocksDB(path='./rocksdb', read_only=False) | ||
|
||
key = b'key1' | ||
db.put(key, 'one') | ||
db.get(key) | ||
db.exists(key) | ||
|
||
for key, value in db.scan(prefix=None, start_key=None, stop_key=None, reversed_scan=False): | ||
print(key, value) | ||
``` | ||
|
||
## Utils | ||
There are some useful functions to transform a key to and from `bytes`: | ||
```python | ||
from easyrocks.utils import ( | ||
str_to_bytes | ||
bytes_to_str | ||
int_to_bytes | ||
bytes_to_int | ||
str_to_padded_bytes | ||
int_to_padded_bytes | ||
) | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from rocksdb import * | ||
from .easyrocks import * | ||
|
||
__version__ = '0.0.17a' | ||
__version__ = '2.214.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters