Emmanuel T Odeke 11bee6194a DB as a service
Fixes https://github.com/tendermint/tendermint/issues/1162

Databases as a service!

Can now access Databases as a remote service
via gRPC for performance and easy deployment.

The caveat is that each service is stateful in regards to
the DB i.e. each unique service uses only one unique DB
but nonetheless multiple clients can access it.

A full standalone example

```go
package main

import (
  "bytes"
  "context"
  "log"

  grpcdb "github.com/tendermint/tmlibs/grpcdb"
  protodb "github.com/tendermint/tmlibs/proto"
)

func main() {
  addr := ":8998"
  go func() {
    if err := grpcdb.BindRemoteDBServer(addr); err != nil {
      log.Fatalf("BindRemoteDBServer: %v", err)
    }
  }()

  client, err := grpcdb.NewClient(addr, false)
  if err != nil {
    log.Fatalf("Failed to create grpcDB client: %v", err)
  }

  ctx := context.Background()
  // 1. Initialize the DB
  in := &protodb.Init{
    Type: "leveldb",
    Name: "grpc-uno-test",
    Dir:  ".",
  }
  if _, err := client.Init(ctx, in); err != nil {
    log.Fatalf("Init error: %v", err)
  }

  // 2. Now it can be used!
  query1 := &protodb.Entity{Key: []byte("Project"), Value:
[]byte("Tmlibs-on-gRPC")}
  if _, err := client.SetSync(ctx, query1); err != nil {
    log.Fatalf("SetSync err: %v", err)
  }

  query2 := &protodb.Entity{Key: []byte("Project")}
  read, err := client.Get(ctx, query2)
  if err != nil {
    log.Fatalf("Get err: %v", err)
  }
  if g, w := read.Value, []byte("Tmlibs-on-gRPC"); !bytes.Equal(g, w) {
    log.Fatalf("got= (%q ==> % X)\nwant=(%q ==> % X)", g, g, w, w)
  }
}
```
2018-05-07 22:00:33 +02:00
2018-04-03 12:23:28 +02:00
2018-03-28 15:35:52 +02:00
2018-04-03 12:23:28 +02:00
2018-04-23 01:32:18 -07:00
2018-04-21 04:25:45 -07:00
2018-04-03 12:23:28 +02:00
2018-03-15 09:43:23 -07:00
2018-05-07 22:00:33 +02:00
2018-04-05 21:56:29 +02:00
2018-05-07 22:00:33 +02:00
2018-04-09 14:36:40 +02:00
2018-04-03 12:23:28 +02:00
2018-04-21 04:25:45 -07:00
2017-11-11 11:25:30 -05:00
2017-11-09 17:42:32 -05:00
2018-01-02 10:53:56 -05:00
2017-10-11 12:48:05 +04:00
2018-02-09 13:31:32 +04:00
2018-02-09 13:31:32 +04:00
2018-02-27 16:01:49 +04:00
2018-02-27 16:01:49 +04:00
2017-12-06 02:05:57 -05:00
2018-05-07 22:00:33 +02:00
2017-04-18 17:56:05 -04:00
2017-12-29 10:42:02 -05:00

TMLIBS

This repo is a home for various small packages.

autofile

Autofile is file access with automatic log rotation. A group of files is maintained and rotation happens when the leading file gets too big. Provides a reader for reading from the file group.

cli

CLI wraps the cobra and viper packages and handles some common elements of building a CLI like flags and env vars for the home directory and the logger.

clist

Clist provides a linekd list that is safe for concurrent access by many readers.

common

Common provides a hodgepodge of useful functions.

db

DB provides a database interface and a number of implementions, including ones using an in-memory map, the filesystem directory structure, an implemention of LevelDB in Go, and the official LevelDB in C.

events

Events is a synchronous PubSub package.

flowrate

Flowrate is a fork of https://github.com/mxk/go-flowrate that added a SetREMA method.

log

Log is a log package structured around key-value pairs that allows logging level to be set differently for different keys.

merkle

Merkle provides a simple static merkle tree and corresponding proofs.

process

Process is a simple utility for spawning OS processes.

pubsub

PubSub is an asynchronous PubSub package.

Description
No description provided
Readme Apache-2.0 63 MiB
Languages
Go 72.6%
C 17.7%
Shell 3.2%
Python 1.6%
Makefile 1%
Other 3.7%