gossipdb

package module
v0.0.0-...-7935e07 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 8 Imported by: 0

README

gossipdb

Distributed Embedded Key-Value store

What it does?

An in memory cache which listens to neighbouring nodes and replicates messages using gossip protocol.

gossipdb provides the replication and in-memory persistance layer for the nodes of the cluster. It provides APIs to put and fetch data in a key value pair. It also provides an API to fetch the active members of the cluster.

Example

The 'example' directory contains an example application which has can be used to add keys using an API call and fetching it from any of the nodes.

You can build the example using the following steps:

cd example
glide install
go build

You then need to run two instances of the app on different tabs of your terminal:

./example -http_port 8000 -rpc_port 9000 -members
'0.0.0.0:9000,0.0.0.0:9001'

./example -http_port 8001 -rpc_port 9001 -members
'0.0.0.0:9000,0.0.0.0:9001'

Sample payload for the '/add_key' API is shown below:

{
"key": "ping",
"value": "pong"
}

The key can then be fetched by using the query '/value?key=ping'

Roadmap

GossipDb is currently an early alpha project. Api interface is likely to change, and is not recommended for production usages.

Todos

  1. Improve test coverage
  2. CI pipeline and code linting tools
  3. Config Objects for DB
  4. Better capability from Key-Value store, like ttl, and deletes
  5. Improved Object parser
  6. Cluster health and Status
  7. Instrumentation on replication
  8. Benchmarking
  9. Example usage

Building

CI Status: Travis CI

try,
  make init
  make deps
  make test (or clean)
or,
  make

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GossipDb

type GossipDb struct {
	// contains filtered or unexported fields
}

func NewGossipDb

func NewGossipDb(members string, port int) (*GossipDb, error)

func (*GossipDb) Get

func (gdb *GossipDb) Get(k string) (interface{}, bool)

func (*GossipDb) Members

func (gdb *GossipDb) Members() []string

func (*GossipDb) Set

func (gdb *GossipDb) Set(key string, value interface{})

func (*GossipDb) Shutdown

func (gdb *GossipDb) Shutdown()

type Pair

type Pair struct {
	Key   string
	Value interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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