Documentation
¶
Index ¶
- Constants
- type ConnectOpts
- type DKVClient
- func (dkvClnt *DKVClient) AddNode(nodeURL string) error
- func (dkvClnt *DKVClient) Backup(path string) error
- func (dkvClnt *DKVClient) Close() error
- func (dkvClnt *DKVClient) CompareAndSet(key []byte, expect []byte, update []byte, expireTS uint64) (bool, error)
- func (dkvClnt *DKVClient) Delete(key []byte) error
- func (dkvClnt *DKVClient) Get(rc serverpb.ReadConsistency, key []byte) (*serverpb.GetResponse, error)
- func (dkvClnt *DKVClient) GetChanges(fromChangeNum uint64, maxNumChanges uint32) (*serverpb.GetChangesResponse, error)
- func (dkvClnt *DKVClient) GetClusterInfo(dcId string, database string, vBucket string) ([]*serverpb.RegionInfo, error)
- func (dkvClnt *DKVClient) Iterate(keyPrefix, startKey []byte) (<-chan *KVPair, error)
- func (dkvClnt *DKVClient) ListNodes() (uint64, map[uint64]*models.NodeInfo, error)
- func (dkvClnt *DKVClient) MultiGet(rc serverpb.ReadConsistency, keys ...[]byte) ([]*serverpb.KVPair, error)
- func (dkvClnt *DKVClient) Put(key []byte, value []byte) error
- func (dkvClnt *DKVClient) PutTTL(key []byte, value []byte, expireTS uint64) error
- func (dkvClnt *DKVClient) RemoveNode(nodeURL string) error
- func (dkvClnt *DKVClient) Restore(path string) error
- func (dkvClnt *DKVClient) UpdateStatus(info serverpb.RegionInfo) error
- type InProcessDKVClient
- type KVPair
Constants ¶
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 ¶
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 ¶
Backup backs up the entire keyspace into the given filesystem location using the underlying GRPC Backup method. This is a convenience wrapper.
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 ¶
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 (*DKVClient) Iterate ¶
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 ¶
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 ¶
Put takes the key and value as byte arrays and invokes the GRPC Put method. This is a convenience wrapper.
func (*DKVClient) PutTTL ¶
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 ¶
RemoveNode removes the node with the given URL from the Nexus cluster of which the current node is a member of.
func (*DKVClient) Restore ¶
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()