A Python implementation of a rudimentary key/value server.

David Blume David Blume Remove some extraneous ljust() calls. fcbcac9 @ 2016-09-12 21:01:20
.htaccess first commit 2016-09-08 23:30:02
LICENSE.txt Improve the documentation a little. 2016-09-09 10:52:19
README.md Document the ACID properties of the store. 2016-09-12 20:54:13
auth_sample.txt first commit 2016-09-08 23:30:02
filelock.py first commit 2016-09-08 23:30:02
index.py Remove some extraneous ljust() calls. 2016-09-12 21:01:20
texttime.py Give Björn Lindqvist credit for texttime.py 2016-09-09 15:38:30

Key Value Store

kvs is a rudimentary key/value store written in Python.

Dependencies and Guarantees

kvs was written as an experiment. The master branch uses a local file for its backing store. Its ACID properties are as follows:

  • Atomicity: Either all tuples in a transaction are successfully saved or none are.
  • Consistency: Only valid states are saved, and saves are atomic.
  • Isolation: All transactions are serialized.
  • Durability: System failure or restart won't break the store. Store writes are atomic.

Getting the project

You can get a copy of this project by clicking on the ZIP or TAR buttons near the top right of the GitList web page.

If you're me, and you want to contribute to the repo, then you can clone it like so:

git clone ssh://USERNAME@dlma.com/~/git/kvs.git

Building it

  1. Enable Python pages at your web server. See How to use Python in the web. My configuration is for Apache, hence the .htaccess file.
  2. Move auth_sample.txt to auth.txt, and replace yourauthorizationhere with a passcode you choose. chmod 600 the file or deny access to it via .htaccess.
  3. Optional: Use secure HTTP. I recommend getting a free SSL certificate from Let's Encrypt.
  4. If you don't have the YAML module, pip install pyyaml.

Using it

Here is a live instance that serves an index page. You can send a key to get a value like so:


Special use case, here's how to get the value for the most-recently updated key of a list of keys. The list could contain any number of keys, but only one value will be returned.


Here's the recipe for a cURL command to store a new value for a key:

curl --data "key=value&auth={authorization}" https://{url}

Here's the source code for a Roku channel client of such a service.

Is it any good?



This software uses the MIT license.