confregdiscover

package
v3.1.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfRegDiscover

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

ConfRegDiscover is config register and discover

func NewConfRegDiscover

func NewConfRegDiscover(serv string) *ConfRegDiscover

NewConfRegDiscover used to create a object of ConfRegDiscover session timeout default 60 second

func NewConfRegDiscoverWithTimeOut

func NewConfRegDiscoverWithTimeOut(serv string, timeOut time.Duration) *ConfRegDiscover

NewConfRegDiscoverWithTimeOut used to create a object

func (*ConfRegDiscover) DiscoverConfig

func (crd *ConfRegDiscover) DiscoverConfig(key string) (<-chan *DiscoverEvent, error)

DiscoverConfig discover the config wether is changed

func (*ConfRegDiscover) Ping

func (crd *ConfRegDiscover) Ping() error

Ping to ping server

func (*ConfRegDiscover) Read

func (crd *ConfRegDiscover) Read(path string) (string, error)

Read the configure data

func (*ConfRegDiscover) Start

func (crd *ConfRegDiscover) Start() error

Start the register and discover service

func (*ConfRegDiscover) Stop

func (crd *ConfRegDiscover) Stop() error

Stop the register and discover service

func (*ConfRegDiscover) Write

func (crd *ConfRegDiscover) Write(key string, data []byte) error

Write the configure data

type ConfRegDiscvIf

type ConfRegDiscvIf interface {
	// Ping to ping server
	Ping() error
	// Start the register and discover service
	Start() error
	// Stop the register and discover service
	Stop() error
	// Write the config data into configure register-discover service
	Write(key string, data []byte) error
	// Read the config data from configure register-discover service
	Read(key string) (string, error)
	// Discover the config change
	Discover(key string) (<-chan *DiscoverEvent, error)
}

ConfRegDiscvIf define the configurate register and discover function interface

type DiscoverEvent

type DiscoverEvent struct {
	Err  error
	Key  string
	Data []byte
}

DiscoverEvent if servers changed, will create a discover event

type ZkRegDiscover

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

ZkRegDiscover config register and discover by zookeeper

func NewZkRegDiscover

func NewZkRegDiscover(serv string, timeOut time.Duration) *ZkRegDiscover

NewZkRegDiscover create a object of ZkRegDiscover

func (*ZkRegDiscover) Discover

func (zkRD *ZkRegDiscover) Discover(key string) (<-chan *DiscoverEvent, error)

func (*ZkRegDiscover) Ping

func (zkRD *ZkRegDiscover) Ping() error

Ping to ping server

func (*ZkRegDiscover) Read

func (zkRD *ZkRegDiscover) Read(path string) (string, error)

func (*ZkRegDiscover) Start

func (zkRD *ZkRegDiscover) Start() error

Start used to run register and discover server

func (*ZkRegDiscover) Stop

func (zkRD *ZkRegDiscover) Stop() error

Stop to stop register and discover server

func (*ZkRegDiscover) Write

func (zkRD *ZkRegDiscover) Write(path string, data []byte) error

Write to save config data into zookeeper

Jump to

Keyboard shortcuts

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