github.com/adowair/kvdb@v0.0.0-20231101174258-ceca93b03596/README.md (about) 1 # KVDB 2 3 `kvdb` is a lightweight, filesystem-backed, cli-driven key-value store written 4 in Go. This project started as a submission to a 4-hour coding challenge. 5 6 ## Get Started & Usage 7 8 To get started, clone this repository and install the `kvdb` CLI using 9 `go install` 10 11 ```console 12 $ git clone github.com/adowair/kvdb 13 ... 14 $ cd kvdb 15 $ go install . 16 $ kvdb --help 17 Kvdb is a lightweight, filesystem-backed key-value store written in Go. 18 By default, kvdb uses the current directory to store data. To get started: 19 20 kvdb set <key> <value> 21 kvdb get <key> 22 23 Usage: 24 kvdb [command] 25 26 Available Commands: 27 del Delete a key 28 get Get the value for a key 29 help Help about any command 30 set Set the value for a key 31 ts Get the created and last-modified timestamps for a key 32 33 Flags: 34 -h, --help help for kvdb 35 36 Use "kvdb [command] --help" for more information about a command. 37 ``` 38 39 ## Features 40 - `kvdb` supports valid `utf-8` strings not containing path delimiters 41 (`/`, `\`) as keys and values. 42 - By design, `kvdb` does not support empty values for keys. This was done to 43 reduce confusion. To unset a key, simple delete it. 44 - Kvdb operations are atomic. Multiple processes can safely invoke `kvdb` to 45 safely read and write the same keys. 46 47 ## Possible Improvements 48 - Use shared (not exclusive) locks for reads. 49 - Support nested keys (i.e. "key/subkey"). 50 - Implement configurable database location, backed by a config file. 51 - Lazily read data files, saving some work when only timestamps are requested. 52 - Retain key's metadata when it is deleted, "remembering" first-set timestamps.