Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.33 KB

skvdb.mkd

File metadata and controls

35 lines (26 loc) · 1.33 KB

skvdb -- simple key/value database

(2022-03-13) WARNING: program completely rewritten, including usage and location of key-value store

I know there are a LOT of key value databases. I need one for very low-volume use, that does not make ANY demands in terms of installation. Well, assuming git is already installed anyway :)

skvdb (I did say I am horrible at naming things, did I not?) is a simple shell script whose usage message is:

Usage:
    skvdb get APPNAME key
    skvdb set APPNAME key val
    skvdb lock APPNAME key info
    skvdb unlock APPNAME key
    skvdb del APPNAME key
    skvdb keys APPNAME

APPNAME is basically a section name in git-config terms; lets you use the
same DB for multiple, unrelated, applications.

Lock and unlock are just syntactic sugar; not even "flock" style locking
is happening.  It's a simple convenience, and to be truly useful we'd also
need to wrap the whole script in "flock".

(Internally, "lock" is just "error out if key already exists, else set key
to the info given", and "unlock" is just "del"!)

That's it.

Skvdb, in turn, uses ~/.config/skvdb as a key-value store, using git config to manipulate it. It allows you to use arbitrary keys by munging the key you supply with md5sum to make it suitable to use as a "key" in git-config.