ctl

package
v0.0.0-...-0ce2e87 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultReadBufSize    = 10 << 20
	DefaultWriteBufSize   = 10 << 20
	DefaultMaxMsgSize     = 50 << 20
	DefaultTimeout        = 10 * time.Second
	DefaultConnectTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectOpts

type ConnectOpts struct {
	ReadBufSize    int
	WriteBufSize   int
	MaxMsgSize     int
	Timeout        time.Duration
	ConnectTimeout time.Duration
}

ConnectOpts DKV Client Connection Options

var DefaultConnectOpts ConnectOpts = ConnectOpts{
	ReadBufSize:    DefaultReadBufSize,
	WriteBufSize:   DefaultWriteBufSize,
	MaxMsgSize:     DefaultMaxMsgSize,
	Timeout:        DefaultTimeout,
	ConnectTimeout: DefaultConnectTimeout,
}

DefaultConnectOpts Default Connection Opts for DKV Client

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, opts ConnectOpts) (*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, expireTS uint64) (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) GetClusterInfo

func (dkvClnt *DKVClient) GetClusterInfo(dcId string, database string, vBucket string) ([]*serverpb.RegionInfo, error)

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]*models.NodeInfo, 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.

func (*DKVClient) UpdateStatus

func (dkvClnt *DKVClient) UpdateStatus(info serverpb.RegionInfo) error

type InProcessDKVClient

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

InProcessDKVClient offers an internal buffer based dial capability to the DKVServer Based on the discussion at https://github.com/grpc/grpc-go/issues/906 This is the best possible current solution for inprocess grpc-client

func CreateInProcessDKVClient

func CreateInProcessDKVClient(dKVService serverpb.DKVServer) *InProcessDKVClient

func (*InProcessDKVClient) GRPCClient

func (bc *InProcessDKVClient) GRPCClient() (serverpb.DKVClient, error)

func (*InProcessDKVClient) Listen

func (bc *InProcessDKVClient) Listen()

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