etcd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Req_Timeout time.Duration = 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Close

func (c *Client) Close(key string)

func (*Client) Connect

func (c *Client) Connect(conf Config) error

func (*Client) Delete

func (c *Client) Delete(key string, isPrefix bool) error

func (*Client) Get

func (c *Client) Get(key string, isPrefix bool) (Values, error)

func (*Client) Grant

func (c *Client) Grant(ttl int64) (clientv3.LeaseID, error)

func (*Client) KeepAlive

func (c *Client) KeepAlive(leaseId clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)

func (*Client) KeepAliveOnce

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

func (*Client) Put

func (c *Client) Put(key, value string, opts ...clientv3.OpOption) error

func (*Client) Revoke

func (c *Client) Revoke(leaseId clientv3.LeaseID) error

func (*Client) Shutdown

func (c *Client) Shutdown()

func (*Client) Watch

func (c *Client) Watch(e IEvent, opts ...clientv3.OpOption) error

type Config

type Config struct {
	Endpoints   []string `yaml:"endpoints" json:"endpoints"`
	DialTimeout int      `yaml:"timeout" json:"timeout"`
	Username    string   `yaml:"username" json:"username"`
	Password    string   `yaml:"password" json:"password"`
	Namespace   string   `yaml:"namespace" json:"namespace"`
}

type IEvent

type IEvent interface {
	Create(key, value string) error
	Modify(key, value string) error
	Delete(key, value string) error
	Key() string
	IsPrefix() bool
	Tick(t time.Time) error
}

type Values

type Values map[string]string

func (Values) Add

func (v Values) Add(key, value string)

func (Values) Get

func (v Values) Get(key string) string

Jump to

Keyboard shortcuts

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