kvstore

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config defines the distributed store config

func NewConfig

func NewConfig(logger log.Logger, client *clientv3.Client) *Config

NewConfig creates an instance of Config

type KVStore

type KVStore struct {
	clientv3.KV
	clientv3.Lease
	clientv3.Watcher
	// Namespaced Session for session and concurrency operations in the KVStore
	*concurrency.Session
	*clientv3.Client
	// contains filtered or unexported fields
}

KVStore defines a clustered key value store

func New

func New(config *Config) (*KVStore, error)

New creates an instance of KVStore

func (*KVStore) DeleteKey

func (s *KVStore) DeleteKey(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

DeleteKey deletes a given key from the store

func (*KVStore) GetValue

func (s *KVStore) GetValue(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

GetValue retrieves the value of a given key from the store

func (*KVStore) IsPeerRunning

func (s *KVStore) IsPeerRunning(ctx context.Context, peerID string, timeout time.Duration) (int, bool)

IsPeerRunning checks whether the given peer is up running

func (*KVStore) SetValue

func (s *KVStore) SetValue(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

SetValue sets the value of a given key unto the store

func (*KVStore) Shutdown

func (s *KVStore) Shutdown() error

Shutdown closes the store connections

func (*KVStore) UpdateEndpoints

func (s *KVStore) UpdateEndpoints() error

UpdateEndpoints updates the configured endpoints and saves them

Jump to

Keyboard shortcuts

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