reconfigurer

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package reconfigurer is responsible for providing configuration state to a watcher. It may acquire that state from somewhere such as a Git repository or an API. When state needs to be updated, a configuration provider will call the Watcher's SetState method. The state transition is then the reponsibility of the watcher. All a configuration provider does is acquire configuration from some source and ensure it's valid. Providers may store a fallback state if validation fails to ensure reliability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitProvider

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

GitProvider implements a Provider backed by Git. It will reconfigure its watcher process upon commits to its defined configuration repository.

func New

func New(
	directory string,
	hostname string,
	configRepo string,
	checkInterval time.Duration,
	authMethod transport.AuthMethod,
) *GitProvider

New creates a new provider with all necessary parameters

func (*GitProvider) Configure

func (p *GitProvider) Configure(w watcher.Watcher) error

Configure implements Provider

type Provider

type Provider interface {
	Configure(watcher.Watcher) error
}

Provider describes a type that can provide config state events to a target watcher. It will reconfigure and restart the watcher whenever necessary.

type Static

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

Static implements a Provider with a static config state that only sets its watcher state once on initialisation.

func NewStatic

func NewStatic(state config.State, w watcher.Watcher) Static

NewStatic creates and calls SetState

func (*Static) Configure

func (s *Static) Configure(w watcher.Watcher) error

Configure implements Provider

Jump to

Keyboard shortcuts

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