Documentation ¶
Index ¶
- type DKVKeyGroup
- type DKVNode
- type DKVNodeSet
- type DKVServerRole
- type DKVShard
- type DKVShardKey
- type KeyHashBasedShardProvider
- type ShardProvider
- type ShardedDKVClient
- func (dkvClnt *ShardedDKVClient) Close() error
- func (dkvClnt *ShardedDKVClient) Delete(key []byte) error
- func (dkvClnt *ShardedDKVClient) Get(rc serverpb.ReadConsistency, key []byte) (*serverpb.GetResponse, error)
- func (dkvClnt *ShardedDKVClient) Iterate(keyPrefix, startKey []byte) (<-chan *ctl.KVPair, error)
- func (dkvClnt *ShardedDKVClient) MultiGet(rc serverpb.ReadConsistency, keys ...[]byte) ([]*serverpb.KVPair, error)
- func (dkvClnt *ShardedDKVClient) Put(key []byte, value []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DKVKeyGroup ¶
type DKVKeyGroup struct { //Keys Set of byte Keys Keys [][]byte //Shard the DKV Shard associated with this keys Shard *DKVShard }
DKVKeyGroup Group of DKV Shard and associated keys.
type DKVNodeSet ¶
DKVNodeSet defines a group of DKV Node(s)
type DKVShard ¶
type DKVShard struct { Name DKVShardKey `json:"name"` Topology map[DKVServerRole]*DKVNodeSet `json:"topology"` }
DKVShard defines a group of DKVNodeSet(s) along with their roles.
type KeyHashBasedShardProvider ¶
type KeyHashBasedShardProvider struct {
// contains filtered or unexported fields
}
KeyHashBasedShardProvider A xxhash based shared provider.
func (*KeyHashBasedShardProvider) ProvideShard ¶
func (p *KeyHashBasedShardProvider) ProvideShard(key []byte) (*DKVShard, error)
ProvideShard provides shardId based on input key
func (*KeyHashBasedShardProvider) ProvideShards ¶
func (p *KeyHashBasedShardProvider) ProvideShards(keys ...[]byte) ([]DKVKeyGroup, error)
ProvideShards provides list of pairs<shardId, keys> for given list of keys.
type ShardProvider ¶
type ShardProvider interface { ProvideShard(key []byte) (*DKVShard, error) ProvideShards(keys ...[]byte) ([]DKVKeyGroup, error) }
ShardProvider Provides the ShardInformation for the given key(s)
type ShardedDKVClient ¶
type ShardedDKVClient struct {
// contains filtered or unexported fields
}
A ShardedDKVClient instance is used to communicate with a shared DKV cluster 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, sharding and other GRPC semantics.
func NewShardedDKVClient ¶
func NewShardedDKVClient(shardProvider ShardProvider, opts ctl.ConnectOpts) (*ShardedDKVClient, error)
NewShardedDKVClient creates and returns a instance of ShardedDKVClient.
func (*ShardedDKVClient) Close ¶
func (dkvClnt *ShardedDKVClient) Close() error
Close closes the underlying GRPC client(s) connection to DKV service
func (*ShardedDKVClient) Delete ¶
func (dkvClnt *ShardedDKVClient) Delete(key []byte) error
Delete takes the key and value as byte arrays, find the corresponding shard and invokes the GRPC Delete method.
func (*ShardedDKVClient) Get ¶
func (dkvClnt *ShardedDKVClient) Get(rc serverpb.ReadConsistency, key []byte) (*serverpb.GetResponse, error)
Get takes the key as byte array along with the consistency, finds the corresponding shard and invokes the GRPC Get method.
func (*ShardedDKVClient) Iterate ¶
func (dkvClnt *ShardedDKVClient) Iterate(keyPrefix, startKey []byte) (<-chan *ctl.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 (*ShardedDKVClient) MultiGet ¶
func (dkvClnt *ShardedDKVClient) MultiGet(rc serverpb.ReadConsistency, keys ...[]byte) ([]*serverpb.KVPair, error)
MultiGet takes the keys as byte arrays along with the consistency, finds the corresponding shard and invokes the GRPC MultiGet method.