I have looked at the key-value database Redis and am curious about alternatives that would offer the following:
Instead of starting an external database engine as a separate process, and then connecting to it, e.g. via the C interface:
redisContext *c = redisConnect("127.0.0.1", 6379);
Is there an alternative that gives the option of including the database code as a library, and loading the data as a file within-binary? For example, given the binary myDbBinary
and the command:
$ myBinary --filter=filterOptions db.dat
The binary myBinary
would not start a separate db process and connect to its port, but, instead, myBinary
loads the keys (and hashes) from the file db.dat
into memory (or similar VM arrangement) which it can then filter (with filterOptions
, whatever they might be) and perform key/hash lookups.
C and Python interfaces to data and storage directives.
Hash support, by which I mean a key maintains a hash table as a value.
Does any software like this exist?
No, Redis works as a process, not as a library. There is no way currently of doing so. You can use alternatives like Kyoto Cabinet (which is more redis-like).
Kyoto has hash tables support for C and Python.
Alternatively you can use SQLite but it's quite different than what you asked.
SQLite does have considerable built-in and implicit lock management. So you could have multiple processes sharing a single SQLite data store (files) and still get reasonable ACID guarantees (even over NFS) without explicitly having to code up your own lock management and contention handling. (Note the concurrency support will be pretty weak, limited to your platform's fnctl/flock performance; but it's still sane for low traffic situations and you can grow out of it towards PostgreSQL or MySQL, etc later).