Documentation ¶
Index ¶
- Constants
- 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) (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) Iterate(keyPrefix, startKey []byte) (<-chan *KVPair, error)
- func (dkvClnt *DKVClient) ListNodes() (uint64, map[uint64]string, 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
- type KVPair
Constants ¶
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 ¶
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 ¶
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) 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.