Version: v0.0.0-...-aed1ee4 Latest Latest

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0



Package target has utility functions for working with target configuration proto messages in target.proto.



This section is empty.


This section is empty.


func Validate

func Validate(config *pb.Configuration) error

Validate confirms that the configuration is valid.


type Config

type Config struct {
	// contains filtered or unexported fields

Config handles configuration file changes and contains configuration state.

func NewConfig

func NewConfig(h Handler) *Config

NewConfig creates a new Config that can process configuration changes.

func (*Config) Current

func (c *Config) Current() *pb.Configuration

Current returns a copy of the current configuration.

func (*Config) Load

func (c *Config) Load(config *pb.Configuration) error

Load updates the current configuration and invokes Handler callbacks for detected changes. An error is returned when loading fails, or the new revision is not strictly increasing.

type Handler

type Handler struct {
	// Add handles addition of a new target.
	Add func(Update)
	// Update handles target modification, including subscription request changes.
	Update func(Update)
	// Delete handles a target being removed.
	Delete func(name string)

Handler defines callbacks to be synchronously invoked in response to configuration changes.

type Update

type Update struct {
	Name    string
	Request *gpb.SubscribeRequest
	Target  *pb.Target

Update describes a single target configuration.

Source Files

Jump to

Keyboard shortcuts

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