etcdclient

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ETCD_DELETE = iota
	ETCD_PUT
)

Variables

This section is empty.

Functions

func LogAction added in v0.1.29

func LogAction(action ETCD_ACTION) zap.Field

func LogKey added in v0.1.29

func LogKey(key string) zap.Field

func LogOk added in v0.1.29

func LogOk(v bool) zap.Field

func LogResp added in v0.1.29

func LogResp(resp interface{}) zap.Field

func WithAuth

func WithAuth(user string, pass string) func(client *Client)

func WithEndPoints

func WithEndPoints(endPoints ...string) func(client *Client)

func WithTimeout

func WithTimeout(timeout time.Duration) func(client *Client)

Types

type Client

type Client struct {
	clientv3.KV
	clientv3.Watcher
	*clientv3.Client
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Client

func (*Client) NewMutex

func (this *Client) NewMutex(key string, ttl int) (*Mutex, error)

type ETCD_ACTION added in v0.1.29

type ETCD_ACTION int32

func (ETCD_ACTION) ToString added in v0.1.29

func (this ETCD_ACTION) ToString() string

type Mutex

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

func CreateMutex

func CreateMutex(c *clientv3.Client, key string, ttl int) (*Mutex, error)

func (*Mutex) Lock

func (this *Mutex) Lock() (err error)

func (*Mutex) RefreshLockTTL

func (this *Mutex) RefreshLockTTL(ttl time.Duration) (err error)

func (*Mutex) Unlock

func (this *Mutex) Unlock() (err error)

type Option

type Option func(client *Client)

Jump to

Keyboard shortcuts

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