ctl

package
v0.0.0-...-1aaebbc Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadBufSize    = 10 << 20
	WriteBufSize   = 10 << 20
	MaxMsgSize     = 50 << 20
	Timeout        = 10 * time.Second
	ConnectTimeout = 10 * time.Second
)

TODO: Should these be paramterised ?

Variables

This section is empty.

Functions

This section is empty.

Types

type DKVClient

type DKVClient struct {
	// contains filtered or unexported fields
}

A DKVClient instance is used to communicate with various DKV services over GRPC. It is an adapter to the underlying GRPC clients that exposes a simpler API to its users without having to deal with timeouts, contexts and other GRPC semantics.

func NewInSecureDKVClient

func NewInSecureDKVClient(svcAddr, authority string) (*DKVClient, error)

NewInSecureDKVClient creates an insecure GRPC client against the given DKV service address. Optionally the authority param can be used to send a :authority psuedo-header for routing purposes.

func (*DKVClient) AddNode

func (dkvClnt *DKVClient) AddNode(nodeURL string) error

AddNode adds the node with the given Nexus URL to the Nexus cluster of which the current node is a member of.

func (*DKVClient) Backup

func (dkvClnt *DKVClient) Backup(path string) error

Backup backs up the entire keyspace into the given filesystem location using the underlying GRPC Backup method. This is a convenience wrapper.

func (*DKVClient) Close

func (dkvClnt *DKVClient) Close() error

Close closes the underlying GRPC client connection to DKV service

func (*DKVClient) CompareAndSet

func (dkvClnt *DKVClient) CompareAndSet(key []byte, expect []byte, update []byte) (bool, error)

CompareAndSet provides the wrapper for the standard CAS primitive. It invokes the underlying GRPC CompareAndSet method. This is a convenience wrapper.

func (*DKVClient) Delete

func (dkvClnt *DKVClient) Delete(key []byte) error

Delete takes the key as byte arrays and invokes the GRPC Delete method. This is a convenience wrapper.

func (*DKVClient) Get

func (dkvClnt *DKVClient) Get(rc serverpb.ReadConsistency, key []byte) (*serverpb.GetResponse, error)

Get takes the key as byte array along with the consistency level and invokes the GRPC Get method. This is a convenience wrapper.

func (*DKVClient) GetChanges

func (dkvClnt *DKVClient) GetChanges(fromChangeNum uint64, maxNumChanges uint32) (*serverpb.GetChangesResponse, error)

GetChanges retrieves changes since the given change number using the underlying GRPC GetChanges method. One can limit the number of changes retrieved using the maxNumChanges parameter. This is a convenience wrapper.

func (*DKVClient) Iterate

func (dkvClnt *DKVClient) Iterate(keyPrefix, startKey []byte) (<-chan *KVPair, error)

Iterate invokes the underlying GRPC method for iterating through the entire keyspace in no particular order. `keyPrefix` can be used to select only the keys matching the given prefix and `startKey` can be used to set the lower bound for the iteration.

func (*DKVClient) ListNodes

func (dkvClnt *DKVClient) ListNodes() (uint64, map[uint64]string, error)

ListNodes retrieves the current members of the Nexus cluster along with identifying the leader.

func (*DKVClient) MultiGet

func (dkvClnt *DKVClient) MultiGet(rc serverpb.ReadConsistency, keys ...[]byte) ([]*serverpb.KVPair, error)

MultiGet takes the keys as byte arrays along with the consistency level and invokes the GRPC MultiGet method. This is a convenience wrapper.

func (*DKVClient) Put

func (dkvClnt *DKVClient) Put(key []byte, value []byte) error

Put takes the key and value as byte arrays and invokes the GRPC Put method. This is a convenience wrapper.

func (*DKVClient) PutTTL

func (dkvClnt *DKVClient) PutTTL(key []byte, value []byte, expireTS uint64) error

PutTTL takes the key and value as byte arrays, expireTS as epoch seconds and invokes the GRPC Put method. This is a convenience wrapper.

func (*DKVClient) RemoveNode

func (dkvClnt *DKVClient) RemoveNode(nodeURL string) error

RemoveNode removes the node with the given URL from the Nexus cluster of which the current node is a member of.

func (*DKVClient) Restore

func (dkvClnt *DKVClient) Restore(path string) error

Restore restores the entire keyspace from the given filesystem location using the underlying GRPC Restore method. This is a convenience wrapper.

type KVPair

type KVPair struct {
	Key, Val []byte
	ErrMsg   string
}

KVPair is convenience wrapper that captures a key and its value.

Jump to

Keyboard shortcuts

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