registor

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(n string, b Builder)

Types

type Builder

type Builder interface {
	Build() Registor
}

func Lookup

func Lookup(n string) Builder

type Event

type Event string
const (
	ADD Event = "add"
	DEL Event = "del"
	CHG Event = "chg"
)

type Handler

type Handler interface {
	OnChange(Event, ServiceMeta, error)
}

type Registor

type Registor interface {
	Watch(ctx context.Context, h Handler, svcs ...Service) error
	Lookup(svc Service) (ServiceMeta, error)
	Register(ctx context.Context, svc ServiceMeta) error
	DeRegister(ctx context.Context, svc ServiceMeta) error
}

type Service

type Service struct {
	Name    string // service name
	Version string // service version
}

func (Service) String

func (svc Service) String() string

type ServiceMeta

type ServiceMeta struct {
	Service
	Meta    map[string]string
	Tags    []string
	Address string // ip:port
}

Jump to

Keyboard shortcuts

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