db_etcd

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package db_etcd Mode Name: etcd Mode Desc: 模块功能描述

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ETCDClient

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

func NewETCDClient

func NewETCDClient() *ETCDClient

func (*ETCDClient) Close

func (ec *ETCDClient) Close()

Close 关闭etcd客户端

关闭前应该保证业务已经退出,否则退出时自动关闭所有的锁可能会导致业务异常

func (*ETCDClient) Connect

func (ec *ETCDClient) Connect() error

func (*ETCDClient) Del

func (ec *ETCDClient) Del(key string) error

Del 删除存储记录

func (*ETCDClient) Get

func (ec *ETCDClient) Get(key string, withPrefix bool) (*clientv3.GetResponse, error)

Get 获取存储记录

func (*ETCDClient) Init

func (ec *ETCDClient) Init(conf *ETCDConf) chaoserrors.CError

func (*ETCDClient) Lock

func (ec *ETCDClient) Lock(key string) error

Lock 加锁

func (*ETCDClient) Put

func (ec *ETCDClient) Put(key, value string) error

Put 存储记录

func (*ETCDClient) Unlock

func (ec *ETCDClient) Unlock(key string) error

Unlock 解锁

type ETCDConf

type ETCDConf struct {
	AddrList []string
	RootPath string
	UserName string
	Password string
	Log      log.ILogger
}

Jump to

Keyboard shortcuts

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