requirements

package
v1.59.10 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotRegistered = errors.New("Not registered")
)

Functions

func CheckRequirement

func CheckRequirement(key, value string, enabledModules ...set.Set) (bool, error)

CheckRequirement run check functions for `key` requirement. Returns true if all checks is passed, false otherwise enabledModules is optional and will filter check-functions if module is disabled

func GetValue added in v1.38.1

func GetValue(key string) (interface{}, bool)

GetValue returns saved value. !Attention: Please don't use it in hooks, only for tests

func HasDisruption added in v0.0.6

func HasDisruption(key string) (bool, string)

HasDisruption run check function for `key` disruption. Returns true if disruption condition is met, false otherwise. Returns reason for true response.

func RegisterCheck added in v0.0.6

func RegisterCheck(key string, f CheckFunc)

RegisterCheck add CheckFunc for some component

func RegisterDisruption added in v0.0.6

func RegisterDisruption(key string, f DisruptionFunc)

RegisterDisruption add DisruptionFunc for some component

func RemoveValue added in v1.38.1

func RemoveValue(key string)

RemoveValue remove previously stored value

func SaveValue added in v1.38.1

func SaveValue(key string, value interface{})

SaveValue could be used in the modules, to store their internal values for updater One module does not have access to the other's module values, so we can do it through this interface

Types

type CheckFunc

type CheckFunc func(requirementValue string, getter ValueGetter) (bool, error)

CheckFunc check come precondition, comparing desired value (requirementValue) with current value (getter)

type DisruptionFunc added in v0.0.6

type DisruptionFunc func(getter ValueGetter) (bool, string)

DisruptionFunc implements inner logic to warn users about potentially dangerous changes

type MemoryValuesStore added in v1.38.1

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

func (*MemoryValuesStore) Get added in v1.38.1

func (m *MemoryValuesStore) Get(key string) (interface{}, bool)

func (*MemoryValuesStore) Remove added in v1.38.1

func (m *MemoryValuesStore) Remove(key string)

func (*MemoryValuesStore) Set added in v1.38.1

func (m *MemoryValuesStore) Set(key string, value interface{})

type ValueGetter

type ValueGetter interface {
	Get(path string) (interface{}, bool)
}

Jump to

Keyboard shortcuts

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