etcd

package
v0.0.0-...-884beae Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Overview

* * @Author: xhzhang * @Date: 2019-06-11 14:21

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfisRegister

type AfisRegister struct {
	BClient   BaseClient
	Lease     clientv3.Lease
	LeaseResp *clientv3.LeaseGrantResponse
	// contains filtered or unexported fields
}

func NewAfisRegister

func NewAfisRegister(bc BaseClient) (*AfisRegister, error)

func (*AfisRegister) ListenLeaseRespChan

func (ar *AfisRegister) ListenLeaseRespChan()

func (*AfisRegister) PutWithLease

func (ar *AfisRegister) PutWithLease(key, val string) error

注册

func (*AfisRegister) RevokeLease

func (ar *AfisRegister) RevokeLease() error

撤销租约

type AfisServiceRegister

type AfisServiceRegister struct {
	Client *clientv3.Client
}

func (*AfisServiceRegister) Get

func (asr *AfisServiceRegister) Get(key string, isprefix bool) (map[string]string, error)
	如果isprefix是true,则根据前缀获取val值,反之isprefix是false,则根据key值获取val值
    返回返回map[key]val,error

func (*AfisServiceRegister) GetWithPrefix

func (asr *AfisServiceRegister) GetWithPrefix(prefix string) ([]string, error)

func (*AfisServiceRegister) NewAfisServiceRegister

func (asr *AfisServiceRegister) NewAfisServiceRegister(endpoint []string, dialtimeout time.Duration) (*AfisServiceRegister, error)

func (*AfisServiceRegister) Put

func (asr *AfisServiceRegister) Put(key, value string) error

type AgentFunc

type AgentFunc func(string, string)

type BaseClient

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

func NewBaseClient

func NewBaseClient(endpoint []string, dialtimeout time.Duration) (*BaseClient, error)

func (*BaseClient) Del

func (c *BaseClient) Del(info string, isprefix bool) error

func (*BaseClient) Get

func (c *BaseClient) Get(key string, isprefix bool) (map[string]string, error)
	如果isprefix是true,则根据前缀获取val值,反之isprefix是false,则根据key值获取val值
    返回返回map[key]val,error

func (*BaseClient) GetAgents

func (bc *BaseClient) GetAgents(dealfunc DealFunc) (map[string]string, error)

func (*BaseClient) GetServices

func (bc *BaseClient) GetServices(dealfunc DealFunc) (map[string]string, error)

func (*BaseClient) Put

func (c *BaseClient) Put(key, value string) error

type ClientDis

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

func NewClientDis

func NewClientDis(endpoint []string, dialtimeout time.Duration, putagentfunc, delagentfunc AgentFunc) (*ClientDis, error)

func (*ClientDis) DelServiceList

func (this *ClientDis) DelServiceList(key, val string)

func (*ClientDis) GetService

func (sd *ClientDis) GetService(prefix string) ([]string, error)

func (*ClientDis) SetServiceList

func (this *ClientDis) SetServiceList(key, val string)

type DealFunc

type DealFunc func(string, string, string)

type ServiceRegister

type ServiceRegister struct {
	Client    *clientv3.Client
	Lease     clientv3.Lease
	LeaseResp *clientv3.LeaseGrantResponse
	// contains filtered or unexported fields
}

func NewServiceRegister

func NewServiceRegister(endpoint []string, dialtimeout time.Duration) (*ServiceRegister, error)

func (*ServiceRegister) ListenLeaseRespChan

func (sr *ServiceRegister) ListenLeaseRespChan()

func (*ServiceRegister) PutService

func (sr *ServiceRegister) PutService(key, val string) error

注册服务

func (*ServiceRegister) RevokeLease

func (sr *ServiceRegister) RevokeLease() error

撤销租约

Jump to

Keyboard shortcuts

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