remotecfg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 21 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"`
	Metadata         map[string]string        `alloy:"metadata,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 Options

type Options struct {
	Logger      log.Logger // Where to send logs.
	StoragePath string     // Where to cache configuration on-disk.
}

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 is a no-op for the remotecfg service.

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