key-value-store

command module
v0.0.0-...-91249f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 14 Imported by: 0

README

Key-Value Store

This is an academic reference implementation of a distributed in-memory data store. It was developed as an undergraduate project in distributed systems by Spencer Peterson, Adam Askari, Vineet Ramareddi, and Will Asper.

Key features include

  • High availability: Designed to accept writes in the event of failed nodes.
  • Eventual causal consistency: Database interactions will never violate the happens-before relationship, and replicas gossip new writes.
  • Sharded: Data is partitioned among shards for scalability.
  • Replicated: Data is replicated within shards for durability.
  • Proxying: Nodes transparently proxy requests as needed to load balance traffic.

Build and Run

The binary can be compiled with a Go toolchain and

go install github.com/spencer-p/key-value-store

Alternatively, a Docker image can be built with

docker build path/to/key-value-store -t key-value-store:latest

To run, the binary must be supplied with a few environment variables:

  1. ADDRESS. The IP address this node is running on.
  2. PORT. The TCP port to bind to.
  3. VIEW. A comma-separted list of addresses including in the cluster.
  4. REPL_FACTOR. The number of replicas to assign per shard (integer).

API

The key value store exposes a CRUD API over HTTP.

Every request may supply a causal-context which the key value store will use to appropriately apply requests. Every response will return the most up-to-date causal-context which should be supplied in subsequent requests.

Create & Update
PUT /kv-store/keys/x HTTP/1.1
Host: 127.0.0.1
Content-type: application/json
Content-length: 36

{"value": "1", "causal-context": {}}
Delete
DELETE /kv-store/keys/x HTTP/1.1
Host: 127.0.0.1
Content-length: ???
{"causal-context": {insert-context-here}}
Read
GET /kv-store/keys/x HTTP/1.1
Host: 127.0.0.1
Content-length: ???
{"causal-context": {insert-context-here}}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
handlers
Package leader implements handlers for follower instances.
Package leader implements handlers for follower instances.
msg
ptr
Package ptr boxes literals.
Package ptr boxes literals.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL