A simple persistent key value store implemented to learn go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


# Go key value store
This is a basic key value store which is persisted to disk in a json serialized form

It supports:
	* Storing a key value pair
	* Retreiving the value for a given key
	* Deleting a key value pair
	* Retreiving a list of keys with a given prefix

# Protocol

 1. Allow storing of data using an input stream like below
    'SET key value'
    The 'key' should be a sequence of letters without a space. And the value can be any string without a new line/carriage return
    A key must match this regex [a-zA-Z0-9_-]+
 2. Allow getting of a value for a key like below
    'GET key'
    If the key is not found the returned result will be a literal string '<NULL>'
 3. Allow getting of a list of keys with a prefix like below
    'LIST prefix'
    The prefix can be empty, when it is empty all the keys should be listed, one for each line
 4. Allow deleting of keys like below
    'DELETE key'
 5. If a command is invalid the result will be a literal string '<INVALID COMMAND>'

- - -

# How to install

  1. Install it using
      go get github.com/minhajuddin/gokv
  2. Run the server in one terminal:
  3. From a different terminal query it like below
      nc localhost 4000
      GET name
      SET age 27

Make sure you have a file at `~/.gokv.json`. An example seed file would be:

  {"foo":"This is cool","name":"Khaja Minhajuddin","age":27}