Bounty DB is very fast and clean, it implements Bloom filter to reduce disk lookups for non-existent keys.
Setup Bounty in 3 steps
- Run
make
- 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 theconfig
param.
You can always 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
Answer:
{
"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
}
Answer:
{
"status": "ok"
}
Delete value
DELETE /store/{key}
Answer:
{
"status": "ok"
}