Skip to content

aluminiumgeek/bountydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bounty DB

A simple key-value store written in Erlang.

Bounty DB is very fast and clean, it implements Bloom filter to reduce disk lookups for non-existent keys.

Requirements

  • Erlang

Setup

  • Run make inside the directory that contains cloned repo
  • Open main.config, set the server port and path to db file
  • Start server with config=main ./start command. However, you can make your config file and specify its filename to the config param.
  • You can check status of the server with ./status command, and stop the server by ./stop

API

Bounty DB provides simple HTTP REST API.

Get value

GET /store/{key}

You can append parameter default={defaultValue} to the request. This default value will return if there's no stored value for specified key in the database

Response:

{
    "status": "ok",
    "value": {value}
}

When no value:

{
    "status": "error"
}

Save value

PUT /store/{key}

Request body must be JSON string.
Example, set value:

{
    "value": "myValue"
}

Example, set value with a one minute timeout on key (after this timeout has expired, the key will automatically deleted):

{
    "value": "myValue",
    "timeout": 60
}

Response:

{
    "status": "ok"
}

Delete value

DELETE /store/{key}

Response:

{
    "status": "ok"
}