service_discovery

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLogNil               = errors.New("service discovery log nil")
	ErrServiceAlreadyExists = errors.New("service already exists")
)

Functions

This section is empty.

Types

type EtcdServiceDiscovery

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

func NewEtcdServiceDiscovery

func NewEtcdServiceDiscovery(ctx context.Context, serviceDiscoveryConfig ServiceDiscoveryConfig, log ServiceDiscoveryLog) (*EtcdServiceDiscovery, error)

func (*EtcdServiceDiscovery) Close

func (e *EtcdServiceDiscovery) Close(ctx context.Context) error

func (*EtcdServiceDiscovery) ServiceDiscovery

func (e *EtcdServiceDiscovery) ServiceDiscovery(ctx context.Context, service string) (chan ItermInfo, error)

func (*EtcdServiceDiscovery) ServiceHeartbeat

func (e *EtcdServiceDiscovery) ServiceHeartbeat(ctx context.Context) error

func (*EtcdServiceDiscovery) ServiceRegister

func (e *EtcdServiceDiscovery) ServiceRegister(ctx context.Context) error

type ItermInfo

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

func (*ItermInfo) GetInfo

func (i *ItermInfo) GetInfo() []byte

func (*ItermInfo) GetKey

func (i *ItermInfo) GetKey() []byte

func (*ItermInfo) GetOperate

func (i *ItermInfo) GetOperate() Operate

type Operate

type Operate int8
const (
	Add    Operate = 0
	Delete Operate = 1
	Update Operate = 2
)

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	EtcdAddr               []string
	ZkAddr                 []string
	CustomServiceDiscovery []string
	LocalServiceName       string
	Ip                     string
	Host                   string
}

type ServiceDiscoveryLog added in v1.1.0

type ServiceDiscoveryLog interface {
	Debugf(f string, args ...interface{})
	Infof(f string, args ...interface{})
	Warnf(f string, args ...interface{})
	Errorf(f string, args ...interface{})
}

type ServiceDiscoveryManager

type ServiceDiscoveryManager interface {
	// Service registe
	ServiceRegister(ctx context.Context) error

	// The ServiceHeartbeat method maintains the
	// heartbeat behavior of the service and registry
	ServiceHeartbeat(ctx context.Context) error

	// If you choose the service discovery method,
	// you must consume the chan include `ItermInfo` it returns.
	ServiceDiscovery(ctx context.Context, service string) (chan ItermInfo, error)

	// Close ServiceDiscoveryManager
	Close(ctx context.Context) error
}

func NewServiceDiscoveryManager

func NewServiceDiscoveryManager(ctx context.Context, serviceDiscoveryConfig ServiceDiscoveryConfig, log ServiceDiscoveryLog) (ServiceDiscoveryManager, error)

Jump to

Keyboard shortcuts

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