db

package
v0.0.0-...-f0fce53 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KVActionTypeSet    = "set"
	KVActionTypeDelete = "delete"
)

Variables

View Source
var ClientV3 *clientv3.Client

Functions

func InitKV

func InitKV() error

Types

type EtcdClient

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

func NewEtcdClient

func NewEtcdClient(endpoints []string) (*EtcdClient, error)

func (*EtcdClient) Delete

func (c *EtcdClient) Delete(key string) (string, error)

func (*EtcdClient) Get

func (c *EtcdClient) Get(key string) (string, error)

func (*EtcdClient) List

func (c *EtcdClient) List(key string, withPrefix bool) (map[string]string, error)

func (*EtcdClient) Lock

func (c *EtcdClient) Lock(ctx context.Context, key string) error

func (*EtcdClient) Range

func (c *EtcdClient) Range(begin string, end string) (map[string]string, error)

func (*EtcdClient) Set

func (c *EtcdClient) Set(key string, value string) error

func (*EtcdClient) Unlock

func (c *EtcdClient) Unlock(ctx context.Context, key string) error

func (*EtcdClient) Watch

func (c *EtcdClient) Watch(ctx context.Context, key string, withPrefix bool) <-chan KVAction

type KVAction

type KVAction struct {
	Key        string
	Value      string
	ActionType string
}

type KVMutex

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

type KVStorage

type KVStorage interface {
	Get(string) (string, error)
	Set(string, string) error
	List(string, bool) (map[string]string, error)
	Delete(string) (string, error)
	Range(string, string) (map[string]string, error)
	Watch(context.Context, string, bool) <-chan KVAction
	Lock(context.Context, string) error
	Unlock(context.Context, string) error
}
var KV KVStorage

Jump to

Keyboard shortcuts

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