Documentation
¶
Index ¶
- type Change
- type Config
- func (c Config) Delete(k Key) Config
- func (c Config) DeleteAll() Config
- func (c Config) DeleteRecursive(k Key) Config
- func (c Config) Diff(other Config) []DiffResult
- func (c Config) Get(k Key) (Value, bool)
- func (c Config) GetAll() Entries
- func (c Config) GetChangeHistory() []Change
- func (c Config) Set(k Key, v Value) (Config, error)
- type ConfigOption
- type Converter
- type DiffResult
- type DoguConfig
- type Entries
- type GlobalConfig
- type Key
- type OptionalValue
- type Value
- type WatchFilter
- type YamlConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
Change represents a change to a configuration key. When the Key has been deleted, Deleted is set to true.
type Config ¶
type Config struct { PersistenceContext any // this is needed for the RetryWatcher that operates on ListResourceVersions and needs an initial starting point InitialListResourceVersion string // contains filtered or unexported fields }
Config represents a general configuration with entries and change history. PersistenceContext is used by a repository to detect conflicts due to remote changes.
func CreateConfig ¶
func CreateConfig(data Entries, options ...ConfigOption) Config
CreateConfig creates a new configuration with the provided entries.
func (Config) Delete ¶
Delete removes the configuration Key and Value. Returns a new Config with the Key deleted.
func (Config) DeleteAll ¶
DeleteAll removes all key values pairs for the configuration. Returns a new empty Config with a change history containing all keys that haven been deleted.
func (Config) DeleteRecursive ¶
DeleteRecursive removes all configuration for the given Key, including all configuration for sub-keys. Returns a new Config with without given Key.
func (Config) Diff ¶
func (c Config) Diff(other Config) []DiffResult
Diff returns a list of DiffResult with all values that differs for a given key.
func (Config) Get ¶
Get returns the configuration value for the given key. When the key does not exist false is returned.
func (Config) GetChangeHistory ¶
GetChangeHistory returns a slice of all changes made to the configuration.
type ConfigOption ¶
type ConfigOption func(config *Config)
func WithInitialListResourceVersion ¶ added in v0.3.1
func WithInitialListResourceVersion(resourceVersion string) ConfigOption
WithInitialListResourceVersion adds the resourceVersion of the list containing the config. It's main use case is for the Config-Watches that operate on lists instead of single objects.
func WithPersistenceContext ¶
func WithPersistenceContext(pCtx any) ConfigOption
type DiffResult ¶
type DiffResult struct { Key Key Value OptionalValue OtherValue OptionalValue }
DiffResult represents a result of a configuration comparison.
type DoguConfig ¶
type DoguConfig struct { DoguName dogu.SimpleName Config }
DoguConfig represents a Dogu-specific configuration.
func CreateDoguConfig ¶
func CreateDoguConfig(dogu dogu.SimpleName, e Entries) DoguConfig
CreateDoguConfig creates a new Dogu-specific configuration with the provided Dogu name and entries.
type GlobalConfig ¶
type GlobalConfig struct {
Config
}
GlobalConfig represents a global configuration.
func CreateGlobalConfig ¶
func CreateGlobalConfig(e Entries) GlobalConfig
CreateGlobalConfig creates a new global configuration with the provided entries.
type OptionalValue ¶
OptionalValue represents a configuration value as a string that may be null.
type WatchFilter ¶
type WatchFilter func([]DiffResult) bool
WatchFilter can be applied to the result of a comparison of two configurations. It is a predicate function that should to return true in case the filter matches.
func DirectoryFilter ¶
func DirectoryFilter(directory Key) WatchFilter
DirectoryFilter is a WatchFilter to watch for changes for a directory. This can encompass multiple keys with the same prefix. For example: Filter with Key "key1/" watch for changes for the keys: key1/key2/key3 key1/key2/key3 ...
func KeyFilter ¶
func KeyFilter(k Key) WatchFilter
KeyFilter is a WatchFilter to watch for changes for a single Key.