/ra-kv-store

Raft-based key-value store

Primary LanguageClojureApache License 2.0Apache-2.0

Raft-based Key/Value Store

This is a tiny key/value store based on Ra developed to be used in certain integration tests. It is not meant to be a general purpose project.

Usage

Start the HTTP API:

$ make run

Use HTTPie to play with the KV store. Retrieving a value:

$ http GET http://localhost:8080/1
HTTP/1.1 404 Not Found
content-length: 9
content-type: text/plain
date: Wed, 13 Jun 2018 07:12:15 GMT
server: Cowboy

undefined

Setting a value:

$ http -f PUT http://localhost:8080/1 value=1
HTTP/1.1 204 No Content
date: Wed, 13 Jun 2018 07:12:28 GMT
server: Cowboy

Getting the value back:

$ http GET http://localhost:8080/1
HTTP/1.1 200 OK
content-length: 1
content-type: text/plain
date: Wed, 13 Jun 2018 07:12:34 GMT
server: Cowboy

1

Comparing-and-swapping a value, success case:

$ http -f PUT http://localhost:8080/1 value=2 expected=1
HTTP/1.1 204 No Content
date: Wed, 13 Jun 2018 07:13:02 GMT
server: Cowboy

Comparing-and-swapping a value, failure case:

$ http -f PUT http://localhost:8080/1 value=2 expected=1
HTTP/1.1 409 Conflict
content-length: 1
date: Wed, 13 Jun 2018 07:13:08 GMT
server: Cowboy

2

Jepsen test

See the readme.

License

RA KV Store is Apache 2.0 licensed.

Sponsored by Pivotal