runtimeconfig

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketClientFactory added in v1.16.0

type BucketClientFactory func(ctx context.Context) (objstore.Bucket, error)

type Config added in v1.13.0

type Config struct {
	ReloadPeriod time.Duration `yaml:"period"`
	// LoadPath contains the path to the runtime config file, requires an
	// non-empty value
	LoadPath string `yaml:"file"`
	Loader   Loader `yaml:"-"`

	StorageConfig bucket.Config `yaml:",inline"`
}

Config holds the config for an Manager instance. It holds config related to loading per-tenant config.

func (*Config) RegisterFlags added in v1.13.0

func (mc *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

type Loader

type Loader func(r io.Reader) (interface{}, error)

Loader loads the configuration from file.

type Manager

type Manager struct {
	services.Service
	// contains filtered or unexported fields
}

Manager periodically reloads the configuration from a file, and keeps this configuration available for clients.

func New added in v1.13.0

func New(cfg Config, registerer prometheus.Registerer, logger log.Logger, factory BucketClientFactory) (*Manager, error)

New creates an instance of Manager and starts reload config loop based on config

func (*Manager) CloseListenerChannel

func (om *Manager) CloseListenerChannel(listener <-chan interface{})

CloseListenerChannel removes given channel from list of channels to send notifications to and closes channel.

func (*Manager) CreateListenerChannel

func (om *Manager) CreateListenerChannel(buffer int) <-chan interface{}

CreateListenerChannel creates new channel that can be used to receive new config values. If there is no receiver waiting for value when config manager tries to send the update, or channel buffer is full, update is discarded.

When config manager is stopped, it closes all channels to notify receivers that they will not receive any more updates.

func (*Manager) GetConfig

func (om *Manager) GetConfig() interface{}

GetConfig returns last loaded config value, possibly nil.

Jump to

Keyboard shortcuts

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