Skip to main content

kona

It is a project created to manage various key-value stores.
Currently, only RocksDB is supported, but we will continue to increase the number of key-value stores that can be supported.

Prerequisite

  • python 3.7.5

Supported Key-Value Store

  • RocksDB

Installation

$ pip install kona

Example

from kona.key_value_store import KeyValueStore

db = KeyValueStore.new(
    'file://./key_value_store_test_database',
    store_type='rocksdb',
    create_if_missing=True
)

db.put(b'foo', b'bar')
print(db.get(b'foo'))
db.close()
db.destroy_store()

# Result
# b'bar'

Batch

You can write to DataBase at a specific point in time using WriteBatch().

from kona.key_value_store import KeyValueStore

db = KeyValueStore.new(
    'file://./key_value_store_test_database',
    store_type='rocksdb',
    create_if_missing=True
)

batch = db.WriteBatch()

batch.put(b'test_key_1', b'test_value_1')
batch.put(b'test_key_2', b'test_value_2')

batch.write()

print(db.get(b'test_key_1'))
print(db.get(b'test_key_2'))

db.destroy_store()

# Result
# b'test_value_1'
# b'test_value_2'

CancelableBatch

You can cancel data written in batches using CancelableWriteBatch().

from kona.key_value_store import KeyValueStore

db = KeyValueStore.new(
    'file://./key_value_store_test_database',
    store_type='rocksdb',
    create_if_missing=True
)

test_items = {
    b'test_key_1': b'test_value_1',
    b'test_key_2': b'test_value_2',
    b'test_key_3': b'test_value_3',
    b'test_key_4': b'test_value_4',
    b'test_key_5': b'test_value_5',
}

for key, value in test_items.items():
    db.put(key, value)

cancelable_batch = db.CancelableWriteBatch()
cancelable_batch.put(b'cancelable_key_1', b'cancelable_value_1')
cancelable_batch.put(b'test_key_2', b'edited_test_value_2')
cancelable_batch.put(b'cancelable_key_2', b'cancelable_value_2')
cancelable_batch.put(b'test_key_4', b'edited_test_value_4')
cancelable_batch.write()

for key, value in db.Iterator():
    print(f'Before Cancel: key={key}, value={value}')

cancelable_batch.cancel()

for key, value in db.Iterator():
    print(f'After Cancel: key={key}, value={value}')

db.destroy_store()

# Before Cancel
# Before Cancel: key=b'cancelable_key_1', value=b'cancelable_value_1'
# Before Cancel: key=b'cancelable_key_2', value=b'cancelable_value_2'
# Before Cancel: key=b'test_key_1', value=b'test_value_1'
# Before Cancel: key=b'test_key_2', value=b'edited_test_value_2'
# Before Cancel: key=b'test_key_3', value=b'test_value_3'
# Before Cancel: key=b'test_key_4', value=b'edited_test_value_4'
# Before Cancel: key=b'test_key_5', value=b'test_value_5'

# After Cancel
# After Cancel: key=b'test_key_1', value=b'test_value_1'
# After Cancel: key=b'test_key_2', value=b'test_value_2'
# After Cancel: key=b'test_key_3', value=b'test_value_3'
# After Cancel: key=b'test_key_4', value=b'test_value_4'
# After Cancel: key=b'test_key_5', value=b'test_value_5'

Metadata

Release files for kona 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kona 0.1.2
File Size Uploaded Provenance
kona-0.1.2.tar.gz 11.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kona 0.1.2
File Interpreter ABI Platform
kona-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / kona-0.1.2.tar.gz

Download URL kona-0.1.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fbe153db5c4de6a8a505179c92884a020a249543192b2c1f707a2450d2394bfa
BLAKE2b-256 checksum
How to use checksums
fb2e2697bb5c79713ec178cabf939b05289307d33a7a1511ac5e0c00a56849ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Release files / kona-0.1.2-py3-none-any.whl

Download URL kona-0.1.2-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b47b7410d3420fa9628f17fa1b0cfef87cb30ea688c00114fb43ad07ba65ba3d
BLAKE2b-256 checksum
How to use checksums
5573033c8f60220e915095cc380e8a15271da2aea0aa3ece3f05f9ec631511d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Security for kona 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page