Merge pull request #208 from tendermint/bucky/remotedb
Move remotedb under db
This commit is contained in:
commit
4fb515fa08
|
@ -1,9 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.8.3 (develop branch)
|
## 0.8.3 (May 14th, 2018)
|
||||||
|
|
||||||
FEATURES:
|
FEATURES:
|
||||||
|
|
||||||
|
- [db/remotedb] New DB type using an external CLevelDB process via
|
||||||
|
GRPC
|
||||||
- [autofile] logjack command for piping stdin to a rotating file
|
- [autofile] logjack command for piping stdin to a rotating file
|
||||||
- [common] ASCIITrim()
|
- [common] ASCIITrim()
|
||||||
|
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -72,12 +72,12 @@ gen_certs: clean_certs
|
||||||
certstrap init --common-name "tendermint.com" --passphrase ""
|
certstrap init --common-name "tendermint.com" --passphrase ""
|
||||||
certstrap request-cert -ip "::" --passphrase ""
|
certstrap request-cert -ip "::" --passphrase ""
|
||||||
certstrap sign "::" --CA "tendermint.com" --passphrase ""
|
certstrap sign "::" --CA "tendermint.com" --passphrase ""
|
||||||
mv out/::.crt out/::.key remotedb
|
mv out/::.crt out/::.key db/remotedb
|
||||||
|
|
||||||
clean_certs:
|
clean_certs:
|
||||||
## Cleaning TLS testing certificates...
|
## Cleaning TLS testing certificates...
|
||||||
rm -rf out
|
rm -rf out
|
||||||
rm -f remotedb/::.crt remotedb/::.key
|
rm -f db/remotedb/::.crt db/remotedb/::.key
|
||||||
|
|
||||||
test: gen_certs
|
test: gen_certs
|
||||||
go test -tags gcc $(shell go list ./... | grep -v vendor)
|
go test -tags gcc $(shell go list ./... | grep -v vendor)
|
||||||
|
@ -135,4 +135,4 @@ metalinter_all:
|
||||||
.PHONY: check protoc build check_tools get_tools get_protoc update_tools get_vendor_deps test fmt metalinter metalinter_all gen_certs clean_certs
|
.PHONY: check protoc build check_tools get_tools get_protoc update_tools get_vendor_deps test fmt metalinter metalinter_all gen_certs clean_certs
|
||||||
|
|
||||||
grpc_dbserver:
|
grpc_dbserver:
|
||||||
protoc -I proto/ proto/defs.proto --go_out=plugins=grpc:proto
|
protoc -I db/remotedb/proto/ db/remotedb/proto/defs.proto --go_out=plugins=grpc:db/remotedb/proto
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
|
||||||
protodb "github.com/tendermint/tmlibs/proto"
|
protodb "github.com/tendermint/tmlibs/db/remotedb/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Security defines how the client will talk to the gRPC server.
|
// Security defines how the client will talk to the gRPC server.
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
grpcdb "github.com/tendermint/tmlibs/grpcdb"
|
grpcdb "github.com/tendermint/tmlibs/db/remotedb/grpcdb"
|
||||||
protodb "github.com/tendermint/tmlibs/proto"
|
protodb "github.com/tendermint/tmlibs/db/remotedb/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Example() {
|
func Example() {
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/db"
|
"github.com/tendermint/tmlibs/db"
|
||||||
protodb "github.com/tendermint/tmlibs/proto"
|
protodb "github.com/tendermint/tmlibs/db/remotedb/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListenAndServe is a blocking function that sets up a gRPC based
|
// ListenAndServe is a blocking function that sets up a gRPC based
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/db"
|
"github.com/tendermint/tmlibs/db"
|
||||||
"github.com/tendermint/tmlibs/grpcdb"
|
"github.com/tendermint/tmlibs/db/remotedb/grpcdb"
|
||||||
protodb "github.com/tendermint/tmlibs/proto"
|
protodb "github.com/tendermint/tmlibs/db/remotedb/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoteDB struct {
|
type RemoteDB struct {
|
|
@ -2,12 +2,13 @@ package remotedb_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/grpcdb"
|
"github.com/tendermint/tmlibs/db/remotedb"
|
||||||
"github.com/tendermint/tmlibs/remotedb"
|
"github.com/tendermint/tmlibs/db/remotedb/grpcdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRemoteDB(t *testing.T) {
|
func TestRemoteDB(t *testing.T) {
|
||||||
|
@ -26,7 +27,14 @@ func TestRemoteDB(t *testing.T) {
|
||||||
|
|
||||||
client, err := remotedb.NewRemoteDB(ln.Addr().String(), cert)
|
client, err := remotedb.NewRemoteDB(ln.Addr().String(), cert)
|
||||||
require.Nil(t, err, "expecting a successful client creation")
|
require.Nil(t, err, "expecting a successful client creation")
|
||||||
require.Nil(t, client.InitRemote(&remotedb.Init{Name: "test-remote-db", Type: "leveldb"}))
|
dbName := "test-remote-db"
|
||||||
|
require.Nil(t, client.InitRemote(&remotedb.Init{Name: dbName, Type: "leveldb"}))
|
||||||
|
defer func() {
|
||||||
|
err := os.RemoveAll(dbName + ".db")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
k1 := []byte("key-1")
|
k1 := []byte("key-1")
|
||||||
v1 := client.Get(k1)
|
v1 := client.Get(k1)
|
|
@ -1,3 +1,3 @@
|
||||||
package version
|
package version
|
||||||
|
|
||||||
const Version = "0.8.2"
|
const Version = "0.8.3"
|
||||||
|
|
Loading…
Reference in New Issue