Skip to content

nikolodien/goDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#goDB

###Features

  1. Eventually Consistent
  2. Available
  3. Partition Tolerant

========

###Supported Operations

  1. Get
  2. Put
  3. Delete

========

###Mechnisms

#####Raft Leader Election for Consensus

Makes use of Raft Leader election protocol to achieve consensus. The system ensures that there is only one leader at a given point of time. It is fault tolerant. In the event of shutdown of the leader, a new leader is immediately elected. The system has been tested rigorously to maintain this property.

#####Raft Log Replication for Consistency

Consistency is achieved by using log replication. Every operation is declared to be committed only if it is committed in the log of majority of the servers. It it fails to do so then the operation is cancelled.

It makes use of leveldb to store the log entries

========

###Instructions for installing

#####Set GOPATH

> export GOPATH=<directory>

> export PATH=$PATH:$GOPATH/bin

> go get github.com/nikolodien/goDB

#####The next step can be skipped if you don't get any messages

> go build github.com/nikolodien/goDB

> go install $GOPATH/src/github.com/nikolodien/goDB/broker.go

========

###Usage

A new instance of the server has to be created using the statemachine.New() function

After that, the client needs to connect to the server as follows

client, err := rpc.DialHTTP("tcp", host:port)

Each operation is an rpc call to the server

  1. Get
    var val statemachine.Val
    var key = "key_string"
    err = client.Call("KVStore.Get", key, &val)
  2. Put
    keyValue := statemachine.KeyValue{key, i}
    var reply int
    err = client.Call("KVStore.Put", keyValue, &reply)
  3. Delete
    var reply int
    key := "key_string"
    err = client.Call("KVStore.Del", key, &reply)

========

About

Key-Value Store in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages