watcher

package
v0.0.0-...-89cf96b Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Log           nlogger.Provider
	File          string
	WatchInterval time.Duration
}

Config holds the watcher config

type ConfigMap

type ConfigMap map[string]map[string]map[string]Namespace

ConfigMap holds the app config

type Namespace

type Namespace struct {
	ReleaseKey string            `yaml:"releaseKey" json:"releaseKey"`
	Properties map[string]string `yaml:"properties" json:"properties"`
	Yml        string            `yaml:"yml" json:"yml"`
	Yaml       string            `yaml:"yaml" json:"yaml"`
	JSON       string            `yaml:"json" json:"json"`
	XML        string            `yaml:"xml" json:"xml"`
}

Namespace holds the namespace config

type Watcher

type Watcher struct {
	UpdateEvent <-chan struct{}
	// contains filtered or unexported fields
}

Watcher holds information for the watcher

func New

func New(ctx context.Context, cfg Config) (*Watcher, error)

New returns a new Watcher

func (*Watcher) Config

func (w *Watcher) Config() ConfigMap

Config returns a stored read-only ConfigMap

func (*Watcher) MockFS

func (w *Watcher) MockFS(fs afero.Fs)

MockFS injects mocked fs into Watcher this should only be called immediately after watcher is initialized since it's not a thread safe operation

func (*Watcher) ReloadConfig

func (w *Watcher) ReloadConfig(log nlogger.Provider) error

ReloadConfig reloads file config without senging an update event

func (*Watcher) TriggerEvent

func (w *Watcher) TriggerEvent()

TriggerEvent triggers the update event

Jump to

Keyboard shortcuts

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