etcd

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the error returned by storages if a resource cannot be found.
	ErrNotFound = errors.New("not found")
	// ErrAlreadyExists is the error returned by storages if a resource ID is taken during a create.
	ErrAlreadyExists = errors.New("ID already exists")
)

Functions

func DeleteKey

func DeleteKey(ctx context.Context, db *clientv3.Client, key string) error

DeleteKey delete a existing object from etcd with given key

func GetKey

func GetKey(ctx context.Context, db *clientv3.Client, key string, value interface{}) error

GetKey get a existing object from etcd with given key

func TxnCreate

func TxnCreate(ctx context.Context, db *clientv3.Client, key string, value interface{}) error

TxnCreate creates a new object into etcd with given key and value and ensure transaction consistency.

func TxnUpdate

func TxnUpdate(ctx context.Context, db *clientv3.Client, key string, update func(current []byte) ([]byte, error)) error

TxnUpdate updates a existing object into etcd with given key and update function and ensure transaction consistency.

Types

This section is empty.

Jump to

Keyboard shortcuts

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