Skip to content

Repository files navigation

ProtoBunt

Go

Server and client for BuntDB using gRPC over binary Protocol Buffers on top of simple TCP.

BuntDB is awesome simple key/value storage written on Go. It can be used locally, but there is not out-of-box way to use remote database connection. ProtoBunt claims to be the solution.

Install

$ go get -u github.com/biobdeveloper/protobunt

Usage

Start BundDb Server

package main
import"github.com/tidwall/buntdb"import"github.com/biobdeveloper/protobunt"funcmain() {
// First, open some database...db, _:=buntdb.Open("dbname.db")
// ...Then start the serverhost:="127.0.0.1"port:="8080"StartBuntServer(host, port, db)
}

Setup BundDb Client

package main
import"fmt"import"github.com/biobdeveloper/protobunt"import pb "protobunt/proto"funcmain() {
// When the client is created, it makes the first test connection // to negotiate the library version with the remote servercli, ctx, cancel:=CreateBuntClient("127.0.0.1", "8080")
defercancel()
// Create some record by pass key, value argsreq1:= pb.UpdateRequest{Key: "Alice", Value: "Bob", Action: SET}
cli.Update(ctx, &req1)
req2:= pb.ViewRequest{Key: "Alice", Action: GET}
initValue, _:=cli.View(ctx, &req2)
res2:=initValue.GetVal()
fmt.Printf("Alice loves %s", res2)
// Alice loves Bob
}

Warning

ProtoBundDB is currenty alpha version!

About

Client/Server wrapper for BuntDB storage based on gRPC

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages