keeper

package
v0.0.0-...-bbad4b4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMirror

func MakeMirror(ctx context.Context, c *clientv3.Client, dc *clientv3.Client) error

Types

type Cfg

type Cfg struct {
	Endpoints []string `json:"endpoints"`
	UserName  string   `json:"user_name"`
	PassWord  string   `json:"pass_word"`
}

type Client

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

Client 连接etcd服务端的client

func NewClient

func NewClient(cfg *Cfg) (*Client, error)

func (*Client) AddKv

func (cli *Client) AddKv(key, value string, leaseId int64) (*clientv3.PutResponse, error)

func (*Client) DeleteKeys

func (cli *Client) DeleteKeys(key string) error

func (*Client) Equal

func (cli *Client) Equal(host string) bool

func (*Client) GetEndpoints

func (cli *Client) GetEndpoints() []string

func (*Client) GetEtcdConn

func (cli *Client) GetEtcdConn() *clientv3.Client

func (*Client) GetPassWord

func (cli *Client) GetPassWord() string

func (*Client) GetUserName

func (cli *Client) GetUserName() string

func (*Client) GetValue

func (cli *Client) GetValue(key string) (*clientv3.GetResponse, error)

func (*Client) GrantLease

func (cli *Client) GrantLease(ttl int64) (*clientv3.LeaseGrantResponse, error)

GrantLease 创建租约ID

func (*Client) KeepAliveOnce

func (cli *Client) KeepAliveOnce(leaseId clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)

func (*Client) Leases

func (cli *Client) Leases() (*clientv3.LeaseLeasesResponse, error)

Leases 获取多有的LeaseId

func (*Client) RangeAllKvs

func (cli *Client) RangeAllKvs() (*clientv3.GetResponse, error)

func (*Client) RevokeLease

func (cli *Client) RevokeLease(leaseId clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)

RevokeLease 清楚对应的lease

func (*Client) SetEndpoints

func (cli *Client) SetEndpoints(host string)

func (*Client) Status

func (cli *Client) Status(ctx context.Context) error

func (*Client) TimeToAliveTime

func (cli *Client) TimeToAliveTime(leaseId clientv3.LeaseID) (*clientv3.LeaseTimeToLiveResponse, error)

TimeToAliveTime 获取当前租约剩余时间

func (*Client) UpdateValue

func (cli *Client) UpdateValue(key, value string) (*clientv3.PutResponse, error)

Jump to

Keyboard shortcuts

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