etcd

package module
v0.0.0-...-ab6f026 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelServiceMap

func DelServiceMap(prefix, key string)

func GetServiceMap

func GetServiceMap(prefix string) map[string]string

func SetServiceMap

func SetServiceMap(prefix, key, val string)

Types

type Client

type Client struct {
	Client *clientv3.Client
	Prefix string
}

func NewClient

func NewClient(endpoints []string) (*Client, error)

func (*Client) GetValue

func (this *Client) GetValue(key string) error

func (*Client) Watcher

func (this *Client) Watcher()

type Service

type Service struct {
	Client        *clientv3.Client
	Lease         clientv3.Lease
	LeaseResp     *clientv3.LeaseGrantResponse
	CancelFunc    func()
	KeepAliveChan <-chan *clientv3.LeaseKeepAliveResponse
	Key           string
}

func NewService

func NewService(endpoints []string, ttl int64) (*Service, error)

func (*Service) PutService

func (this *Service) PutService(key, val string) error

通过租约 注册服务

func (*Service) RevokeLease

func (this *Service) RevokeLease() error

撤销租约

func (*Service) SetLease

func (this *Service) SetLease(ttl int64) error

设置租约

Jump to

Keyboard shortcuts

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