remotedb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

remotedb is a package for connecting to distributed Tendermint db.DB instances. The purpose is to detach difficult deployments such as CLevelDB that requires gcc or perhaps for databases that require custom configurations such as extra disk space. It also eases the burden and cost of deployment of dependencies for databases to be used by Tendermint developers. Most importantly it is built over the high performant gRPC transport.

remotedb's RemoteDB implements db.DB so can be used normally like other databases. One just has to explicitly connect to the remote database with a client setup such as:

client, err := remotedb.NewRemoteDB(addr, cert)
// Make sure to invoke InitRemote!
if err := client.InitRemote(&remotedb.Init{Name: "test-remote-db", Type: "leveldb"}); err != nil {
    log.Fatalf("Failed to initialize the remote db")
}

client.Set(key1, value)
gv1 := client.SetSync(k2, v2)

client.Delete(k1)
gv2 := client.Get(k1)

for itr := client.Iterator(k1, k9); itr.Valid(); itr.Next() {
    ik, iv := itr.Key(), itr.Value()
    ds, de := itr.Domain()
}

stats := client.Stats()

if !client.Has(dk1) {
      client.SetSync(dk1, dv1)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Init

type Init struct {
	Dir  string
	Name string
	Type string
}

type RemoteDB

type RemoteDB struct {
	common.PlaceHolder
	// contains filtered or unexported fields
}

func NewRemoteDB

func NewRemoteDB(serverAddr string, serverKey string) (*RemoteDB, error)

func (*RemoteDB) Close

func (rd *RemoteDB) Close() error

Close is a noop currently

func (*RemoteDB) Delete

func (rd *RemoteDB) Delete(key []byte) error

func (*RemoteDB) DeleteSync

func (rd *RemoteDB) DeleteSync(key []byte) error

func (*RemoteDB) Get

func (rd *RemoteDB) Get(key []byte) ([]byte, error)

func (*RemoteDB) GetUnsafeValue

func (rd *RemoteDB) GetUnsafeValue(key []byte, processor db.UnsafeValueProcessor) (interface{}, error)

func (*RemoteDB) Has

func (rd *RemoteDB) Has(key []byte) (bool, error)

func (*RemoteDB) InitRemote

func (rd *RemoteDB) InitRemote(in *Init) error

func (*RemoteDB) Iterator

func (rd *RemoteDB) Iterator(start, end []byte) (db.Iterator, error)

func (*RemoteDB) NewBatch

func (rd *RemoteDB) NewBatch() db.Batch

func (*RemoteDB) Print

func (rd *RemoteDB) Print() error

TODO: Implement Print when db.DB implements a method to print to a string and not db.Print to stdout.

func (*RemoteDB) ReverseIterator

func (rd *RemoteDB) ReverseIterator(start, end []byte) (db.Iterator, error)

func (*RemoteDB) Set

func (rd *RemoteDB) Set(key, value []byte) error

func (*RemoteDB) SetSync

func (rd *RemoteDB) SetSync(key, value []byte) error

func (*RemoteDB) Stats

func (rd *RemoteDB) Stats() map[string]string

Directories

Path Synopsis
grpcdb is the distribution of Tendermint's db.DB instances using the gRPC transport to decouple local db.DB usages from applications, to using them over a network in a highly performant manner.
grpcdb is the distribution of Tendermint's db.DB instances using the gRPC transport to decouple local db.DB usages from applications, to using them over a network in a highly performant manner.

Jump to

Keyboard shortcuts

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