kv

package
v0.0.0-...-b3bb260 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcdKVBase

func NewEtcdKVBase(client *clientv3.Client, rootPath string) *etcdKVBase

NewEtcdKVBase creates a new etcd kv.

func NewSlowLogTxn

func NewSlowLogTxn(client *clientv3.Client) clientv3.Txn

NewSlowLogTxn create a SlowLogTxn.

Types

type Base

type Base interface {
	Load(key string) (string, error)
	LoadRange(key, endKey string, limit int) (keys []string, values []string, err error)
	Save(key, value string) error
	Remove(key string) error
}

Base is an abstract interface for load/save pd cluster data.

func NewMemoryKV

func NewMemoryKV() Base

NewMemoryKV returns an in-memory kvBase for testing.

type SlowLogTxn

type SlowLogTxn struct {
	clientv3.Txn
	// contains filtered or unexported fields
}

SlowLogTxn wraps etcd transaction and log slow one.

func (*SlowLogTxn) Commit

func (t *SlowLogTxn) Commit() (*clientv3.TxnResponse, error)

Commit implements Txn Commit interface.

func (*SlowLogTxn) If

func (t *SlowLogTxn) If(cs ...clientv3.Cmp) clientv3.Txn

If takes a list of comparison. If all comparisons passed in succeed, the operations passed into Then() will be executed. Or the operations passed into Else() will be executed.

func (*SlowLogTxn) Then

func (t *SlowLogTxn) Then(ops ...clientv3.Op) clientv3.Txn

Then takes a list of operations. The Ops list will be executed, if the comparisons passed in If() succeed.

Jump to

Keyboard shortcuts

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