Skip to main content

A simple and fast read-only embedded key-value database

Project description

============
ConstDB
============

ConstDB is a very simple and fast read-only embedded key-value database. Keys consist of 64-bit integers and values consist of arbitrary byte strings.

Sample
===============

.. code-block:: python

import constdb

with constdb.create('db_name') as db:
db.add(-2, b'7564')
db.add(3, b'23')
db.add(-1, b'66')

with constdb.read('db_name') as db:
assert db.get(-2) == b'7564'
assert db.get(-1) == b'66'
assert db.get(3) == b'23'

Documenation
===============

ConstDB contains only two functions: ``create`` and ``read``.

``create(filename)`` allows you to create a new ConstDB database.
It takes a filename and returns a ConstDBWriter. A ConstDBWriter has two methods:
``add(key, value)``: Adds a key-value pair to the database. The key must be a 64 bit integer. The value must be a byte string.

``close()``: Finalize and close the database.

``read(filename)`` allows you to read an existing ConstDB database.
It takes a filename and returns a ConstDBReader. A ConstDBReader has two methods:
``get(key)``: Get a value from the database. The key must be a 64 bit integer. Returns the value if the key is in the database. Returns None if the key is not found.

``close()``: Finalize and close the database.

Requirements
===============

The only requirement for ConstDB is Python 3.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

constdb-1.0.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

constdb-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file constdb-1.0.0.tar.gz.

File metadata

  • Download URL: constdb-1.0.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for constdb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b65c4ff31fe3c2dacbe6bc277a77a94c7f21ce987433c32c679408cc59c8700c
MD5 ef7bbcff5bb11d773f9e2f4c4d3796f3
BLAKE2b-256 0b9972cc333ccd2163e237bed49912b696268aa1ecef729b75873a4f53d05863

See more details on using hashes here.

File details

Details for the file constdb-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for constdb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e6a6a451cf5d331c3d408b42457f06b18496d746c0db5ee9048d22ec3eb4f81
MD5 8397a1cd4eeee460884337583239e939
BLAKE2b-256 ae655b6a1af8a159212c4013a270095ed8bccc8bb4034c15d54288395db509d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page