Skip to content

mpereira/noronha

Repository files navigation

noronha

https://travis-ci.org/mpereira/noronha.svg?branch=master

Distributed key-value database written in Rust.

resources/noronha.jpg

Development

Dependencies

  • rustc (tested with rustc 1.28.0 (9634041f0 2018-07-30))
  • cargo-watch (tested with cargo-watch 7.0.1)

Running

cargo watch -x run
[Running cargo run]
  Compiling noronha v0.1.0 (file:///Users/murilo/git/noronha)
    Finished dev [unoptimized + debuginfo] target(s) in 1.13s
    Running `target/debug/noronha`
2018-08-04T18:33:53.575939+02:00 INFO noronha - Starting
2018-08-04T18:33:53.581905+02:00 INFO actix_web::server::srv - Starting 10 http workers
2018-08-04T18:33:53.582030+02:00 INFO actix_web::server::srv - Starting server on http://0.
0.0.0:6500
curl -is localhost:6500
HTTP/1.1 200 OK
content-length: 90
content-type: application/json
date: Sat, 04 Aug 2018 16:28:54 GMT

{
  "cluster_name": "noronha",
  "node_name": "noronha-0",
  "noronha_version": "0.1.0-SNAPSHOT"
}

Get Started

Create keyspace

curl -is -XPUT localhost:6500/people
HTTP/1.1 201 Created
content-length: 71
content-type: application/json
date: Mon, 06 Aug 2018 15:49:41 GMT

{
  "id": "cb91bc79-77f5-4cf9-bccd-d2dd3c7bbc1e",
  "name": "people"
}

Get keyspace with name

curl -is -XGET localhost:6500/people
HTTP/1.1 200 OK
content-length: 71
content-type: application/json
date: Mon, 06 Aug 2018 15:49:52 GMT

{
  "id": "cb91bc79-77f5-4cf9-bccd-d2dd3c7bbc1e",
  "name": "people"
}

Create object

curl -is -XPOST localhost:6500/people \
  -H 'Content-Type: application/json' \
  -d '{ "name": "John Doe" }'
HTTP/1.1 201 Created
content-length: 73
content-type: application/json
date: Mon, 06 Aug 2018 15:55:33 GMT

{
  "id": "f5d18d91-bca5-4b4d-be5b-0a66dc0278b6",
  "name": "John Doe"
}

Create object with ID

curl -is -XPUT localhost:6500/people/f31b0448-cbc0-4150-a6b4-1c0350a770ae \
  -H 'Content-Type: application/json' \
  -d '{ "name": "Mary Jane" }'
HTTP/1.1 201 Created
content-length: 73
content-type: application/json
date: Mon, 06 Aug 2018 15:54:24 GMT

{
  "id": "f31b0448-cbc0-4150-a6b4-1c0350a770ae",
  "name": "Mary Jane"
}

Update object with ID

curl -is -XPUT localhost:6500/people/f31b0448-cbc0-4150-a6b4-1c0350a770ae \
  -H 'Content-Type: application/json' \
  -d '{ "name": "Mary Jane II" }'
HTTP/1.1 200 OK
content-length: 76
content-type: application/json
date: Mon, 06 Aug 2018 15:56:14 GMT

{
  "id": "f31b0448-cbc0-4150-a6b4-1c0350a770ae",
  "name": "Mary Jane II"
}

Get object with ID

curl -is -XGET localhost:6500/people/f31b0448-cbc0-4150-a6b4-1c0350a770ae
HTTP/1.1 200 OK
content-length: 76
content-type: application/json
date: Mon, 06 Aug 2018 15:56:49 GMT

{
  "id": "f31b0448-cbc0-4150-a6b4-1c0350a770ae",
  "name": "Mary Jane II"
}

Deployment

DC/OS

Assuming you have a DC/OS cluster provisioned and set-up you can start a three-node Noronha cluster with:

dcos marathon app add deploy/dcos/applications/noronha-node-0.json
dcos marathon app add deploy/dcos/applications/noronha-node-1.json
dcos marathon app add deploy/dcos/applications/noronha-node-2.json

Author

Murilo Pereira

License

MIT

About

Distributed key-value store written in Rust.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published