dkv

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: 6 Imported by: 0

Documentation

Index

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 DKVNode

type DKVNode struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

DKVNode defines a DKV Node by a given Host & Port

type DKVNodeSet

type DKVNodeSet struct {
	Name  string    `json:"name"`
	Nodes []DKVNode `json:"nodes"`
}

DKVNodeSet defines a group of DKV Node(s)

type DKVServerRole

type DKVServerRole string

DKVServerRole defines the role of the DKV node

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 DKVShardKey

type DKVShardKey string

DKVShardKey defined a DKV ShardKey

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

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.

func (*ShardedDKVClient) Put

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

Put takes the key and value as byte arrays, find the corresponding shard and invokes the GRPC Put method.

Jump to

Keyboard shortcuts

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