Documentation
¶
Index ¶
- type Chooser
- type KVStore
- func (kv *KVStore) AddShard(shard string, storage Storage)
- func (kv *KVStore) BeginMigration(continuum Chooser)
- func (kv *KVStore) BeginMigrationWithShards(continuum Chooser, shards []Shard)
- func (kv *KVStore) DeleteShard(shard string)
- func (kv *KVStore) Destroy(ctx context.Context) error
- func (kv *KVStore) EndMigration()
- func (kv *KVStore) FindPartition(tblName, rowKey string) (int, error)
- func (kv *KVStore) Get(ctx context.Context, tblName, rowKey, columnKey string, refKey int64) (cell models.Cell, found bool, err error)
- func (kv *KVStore) GetLatest(ctx context.Context, tblName, rowKey, columnKey string) (cell models.Cell, found bool, err error)
- func (kv *KVStore) PartitionRead(ctx context.Context, tblName string, partitionNumber int, location string, ...) (cells []models.Cell, found bool, err error)
- func (kv *KVStore) Put(ctx context.Context, tblName, rowKey, columnKey string, refKey int64, ...) error
- func (kv *KVStore) ResetConnection(ctx context.Context, key string) error
- func (kv *KVStore) WithName(name string) *KVStore
- type Shard
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chooser ¶
type Chooser interface { // SetBuckets sets the list of known buckets from which the chooser should select SetBuckets([]string) error // Choose returns a bucket for a given key Choose(key string) string // Buckets returns the list of known buckets Buckets() []string }
Chooser maps keys to shards
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
KVStore is a sharded key-value store
func (*KVStore) BeginMigration ¶
BeginMigration begins a continuum migration. All the shards in the new continuum must already be known to the KVStore via AddShard().
func (*KVStore) BeginMigrationWithShards ¶
BeginMigrationWithShards begins a continuum migration using the new set of shards.
func (*KVStore) DeleteShard ¶
DeleteShard removes a shard from the list of known shards
func (*KVStore) EndMigration ¶
func (kv *KVStore) EndMigration()
EndMigration ends a continuum migration and marks the migration continuum as the new primary
func (*KVStore) FindPartition ¶
func (*KVStore) PartitionRead ¶
func (*KVStore) ResetConnection ¶
type Storage ¶
type Storage interface { // Get the cell designated (row key, column key, ref key) Get(ctx context.Context, tblName string, rowKey string, columnKey string, refKey int64) (cell models.Cell, found bool, err error) // GetLatest returns the latest value for a given rowKey and columnKey, and a bool indicating if the key was present GetLatest(ctx context.Context, tblName string, rowKey string, columnKey string) (cell models.Cell, found bool, err error) // PartitionRead returns 'limit' cells after 'location' from shard 'shard_no' PartitionRead(ctx context.Context, tblName string, partitionNumber int, location string, value int64, limit int) (cells []models.Cell, found bool, err error) // Put inits a cell with given row key, column key, and ref key Put(ctx context.Context, tblName string, rowKey string, columnKey string, refKey int64, body string) (err error) // FindPartition returns the partition number for a specific rowKey FindPartition(tblName, rowKey string) int // ResetConnection reinitializes the connection for the shard responsible for a key ResetConnection(ctx context.Context, key string) error // Destroy cleans up any resources, etc. Destroy(ctx context.Context) error }
Storage is a key-value storage backend
Click to show internal directories.
Click to hide internal directories.