configpoller

package
v0.0.0-...-70e7a0d Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNotModified = errors.New("config not modified")

Functions

This section is empty.

Types

type ConfigPoller

type ConfigPoller interface {
	// Subscribe subscribes to the config poller with a handler function that will be invoked
	// with the latest router config and the previous version string. If the handler takes longer than the poll interval
	// to execute, the next invocation will be skipped.
	Subscribe(ctx context.Context, handler func(newConfig *nodev1.RouterConfig, oldVersion string) error)
	// GetRouterConfig returns the latest router config from the CDN
	// If the Config is nil, no new config is available and the current config should be used.
	// and updates the latest router config version. This method is only used for the initial config
	GetRouterConfig(ctx context.Context) (*routerconfig.Response, error)
	// Stop stops the config poller. After calling stop, the config poller cannot be used again.
	Stop(ctx context.Context) error
}

func New

func New(token string, opts ...Option) ConfigPoller

type Option

type Option func(cp *configPoller)

func WithClient

func WithClient(client routerconfig.Client) Option

func WithFallbackClient

func WithFallbackClient(client *routerconfig.Client) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

Jump to

Keyboard shortcuts

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