keepalive

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeepAlive

type KeepAlive struct {
	TargetRegistry types.TargetRegistry
	Timeout        TimeoutTrigger
	// contains filtered or unexported fields
}

KeepAlive is a middleware for the Target registry. It will monitor each target and check if they receive refresh notifications. If not, target will be removed.

func New

func New(options ...Option) (*KeepAlive, error)

NewServer is the constructor of KeepAlive

func (*KeepAlive) Get

func (ka *KeepAlive) Get(ctx context.Context, target *nspAPI.Target) ([]*nspAPI.Target, error)

Get returns the returned value by the target registry. if no set, an empty list is returned.

func (*KeepAlive) Remove

func (ka *KeepAlive) Remove(ctx context.Context, target *nspAPI.Target) error

Remove will remove the target from the target registry and stop waiting for the target to be refreshed.

func (*KeepAlive) Set

func (ka *KeepAlive) Set(ctx context.Context, target *nspAPI.Target) error

Set will add/update the target to the target registry and will wait for the target to be refreshed. If not refreshed on time, the target will be removed from the target registry. A target cannot be added with the enabled status, it has first to be disabled and then to be updated as enabled. This function will set the status to disabled if the target were not existing previously.

func (*KeepAlive) Watch

func (ka *KeepAlive) Watch(ctx context.Context, target *nspAPI.Target) (types.TargetWatcher, error)

Get returns the returned value by the target registry. if no set, an error is returned.

type Option

type Option func(*KeepAlive)

func WithContextTimeout

func WithContextTimeout(ctx context.Context) Option

func WithRegistry

func WithRegistry(registry types.TargetRegistry) Option

func WithTimeout

func WithTimeout(delayTime time.Duration) Option

type TimeoutTrigger

type TimeoutTrigger func() <-chan struct{}

Jump to

Keyboard shortcuts

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