nacs

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImpl = errors.New("the method is not implement")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Name    string
	Payload []byte
}

type ConfigHandler

type ConfigHandler interface {
	OnChange(event Event, cfg Config)
	ReportError(err error)
}

TODO: implement

type Configor

type Configor interface {
	LookupConfig(ctx context.Context, name string, opts ...LookupAndWatchConfigOption) (Config, error)
	WatchConfig(ctx context.Context, handler ConfigHandler, names ...string) error
}

type Configs

type Configs []Config

func (Configs) Get

func (cs Configs) Get(name string) []byte

type DeRegister

type DeRegister func(context.Context) error

type Event

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

type Filter

type Filter func(svc Service) bool

true: for pass

type LookupAndWatchConfigOption

type LookupAndWatchConfigOption func(context.Context) context.Context

type LookupAndWatchServiceOption

type LookupAndWatchServiceOption func(context.Context) context.Context

type Registry

type Registry interface {
	Register(ctx context.Context, addr, ver string) (DeRegister, error)
	LookupService(ctx context.Context, options ...LookupAndWatchServiceOption) ([]Service, error)
	WatchService(ctx context.Context, handler ServiceHandler, options ...LookupAndWatchServiceOption) error
}

type Service

type Service struct {
	Name    string
	Version string
	Addr    string
	Meta    map[string]string
}

type ServiceHandler

type ServiceHandler interface {
	OnServiceChange(ev Event, svc Service)
}

TODO: implement

Jump to

Keyboard shortcuts

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