Documentation ¶
Index ¶
- type KeepAlive
- func (ka *KeepAlive) Get(ctx context.Context, target *nspAPI.Target) ([]*nspAPI.Target, error)
- func (ka *KeepAlive) Remove(ctx context.Context, target *nspAPI.Target) error
- func (ka *KeepAlive) Set(ctx context.Context, target *nspAPI.Target) error
- func (ka *KeepAlive) Watch(ctx context.Context, target *nspAPI.Target) (types.TargetWatcher, error)
- type Option
- type TimeoutTrigger
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 (*KeepAlive) Get ¶
Get returns the returned value by the target registry. if no set, an empty list is returned.
func (*KeepAlive) Remove ¶
Remove will remove the target from the target registry and stop waiting for the target to be refreshed.
func (*KeepAlive) Set ¶
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.
type Option ¶
type Option func(*KeepAlive)
func WithContextTimeout ¶
func WithRegistry ¶
func WithRegistry(registry types.TargetRegistry) Option
func WithTimeout ¶
type TimeoutTrigger ¶
type TimeoutTrigger func() <-chan struct{}