remotecfg

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "remotecfg"

ServiceName defines the name used for the remotecfg service.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	URL              string                   `alloy:"url,attr,optional"`
	ID               string                   `alloy:"id,attr,optional"`
	Name             string                   `alloy:"name,attr,optional"`
	Attributes       map[string]string        `alloy:"attributes,attr,optional"`
	PollFrequency    time.Duration            `alloy:"poll_frequency,attr,optional"`
	HTTPClientConfig *config.HTTPClientConfig `alloy:",squash"`
}

Arguments holds runtime settings for the remotecfg service.

func GetDefaultArguments

func GetDefaultArguments() Arguments

GetDefaultArguments populates the default values for the Arguments struct.

func (*Arguments) Hash

func (a *Arguments) Hash() (string, error)

Hash marshals the Arguments and returns a hash representation.

func (*Arguments) SetToDefault

func (a *Arguments) SetToDefault()

SetToDefault implements syntax.Defaulter.

func (*Arguments) Validate

func (a *Arguments) Validate() error

Validate implements syntax.Validator.

type Data added in v1.4.0

type Data struct {
	// Host exposes the Host of the isolated controller that is created by the
	// remotecfg service.
	Host service.Host
}

Data includes information associated with the HTTP service.

type Options

type Options struct {
	Logger      log.Logger            // Where to send logs.
	StoragePath string                // Where to cache configuration on-disk.
	ConfigPath  string                // Where the root config file is.
	Metrics     prometheus.Registerer // Where to send metrics to.
}

Options are used to configure the remotecfg service. Options are constant for the lifetime of the remotecfg service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements a service for remote configuration. The default value of ch is nil; this means it will block forever if the remotecfg service is not configured. In addition, we're keeping track of the ticker so we can avoid leaking goroutines. The datapath field is where the service looks for the local cache location. It is defined as a hash of the Arguments field.

func New

func New(opts Options) (*Service, error)

New returns a new instance of the remotecfg service.

func (*Service) Data

func (s *Service) Data() any

Data returns an instance of Data. Calls to Data are cachable by the caller. Data must only be called after Run.

func (*Service) Definition

func (s *Service) Definition() service.Definition

Definition returns the definition of the remotecfg service.

func (*Service) Run

func (s *Service) Run(ctx context.Context, host service.Host) error

Run implements service.Service and starts the remotecfg service. It will run until the provided context is canceled or there is a fatal error.

func (*Service) Update

func (s *Service) Update(newConfig any) error

Update implements service.Service and applies settings.

Jump to

Keyboard shortcuts

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