discovery

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWatcherStopped = errors.New("err watcher stopped")
	ErrTimeout        = errors.New("err watcher timeout")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Interval  time.Duration `yaml:"interval"`
	Driver    string        `yaml:"driver"`
	DriverCfg *config.Node  `yaml:"driver_config"`
}

func (*Config) Check

func (cfg *Config) Check() *Config

type Discovery

type Discovery interface {
	String() string
	Watch(ctx context.Context, srv string, opts ...WatchOpt) result.Result[Watcher]
	GetService(ctx context.Context, srv string, opts ...GetOpt) result.Result[[]*service.Service]
}

func NewNoopDiscovery

func NewNoopDiscovery() Discovery

type GetOpt

type GetOpt func(*GetOpts)

type GetOpts

type GetOpts struct {
	Timeout time.Duration
}

type Result

type Result struct {
	Action  lavapbv1.EventType
	Service *service.Service
}

Result is returned by a call to Next on the watcher. Actions can be create, update, delete

type WatchOpt

type WatchOpt func(*WatchOpts)

type WatchOpts

type WatchOpts struct {
	Service string
}

type Watcher

type Watcher interface {
	// Next is a blocking call
	Next() result.Result[*Result]
	Stop() error
}

Watcher is an interface that returns updates about services within the registry.

Jump to

Keyboard shortcuts

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