registry

package
v0.0.0-...-3b1ec4e Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypeCreate = iota
	ActionTypeUpdate
	ActionTypeDelete
)

Variables

This section is empty.

Functions

func RegisterRegistry

func RegisterRegistry(name string, registry Registry)

Types

type ActionType

type ActionType = int

type EvaRegistry

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

func NewEvaRegistry

func NewEvaRegistry(c clientv3.Config) *EvaRegistry

func (*EvaRegistry) DeRegister

func (r *EvaRegistry) DeRegister(name, net, id string) error

func (*EvaRegistry) GetAddrs

func (r *EvaRegistry) GetAddrs(name, net string) ([]string, error)

func (*EvaRegistry) Register

func (r *EvaRegistry) Register(name, net, id, addr string, opts ...Option) error

func (*EvaRegistry) Watcher

func (r *EvaRegistry) Watcher() (Watcher, error)

type Option

type Option func(options *options)

Option registry option

type Registry

type Registry interface {
	// Register, register service
	Register(name, net, id, addr string, opts ...Option) error
	// UnRegister, unregister service
	DeRegister(name, net, id string) error

	// GetService, get services by name, which may have more than one version
	GetAddrs(name, proto string) ([]string, error)

	// Watcher, returns a watcher, which watches events on NamingService backend
	Watcher() (Watcher, error)
}

Registry registry interacts with the remote Nameing Service

func GetRegistry

func GetRegistry(name string) Registry

type Result

type Result struct {
	Action ActionType
}

Result watch result of event

type Watcher

type Watcher interface {
	Next() (*Result, error)
	Stop()
}

Watcher watch event from remote Naming Service

Jump to

Keyboard shortcuts

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