juju: github.com/juju/juju/core/settings Index | Files

package settings

import "github.com/juju/juju/core/settings"

Index

Package Files

settings.go

type ItemChange Uses

type ItemChange struct {
    // Type is an enumeration indicating the type of settings change.
    Type int
    // Key is the setting being changed.
    Key string
    // OldValue is the previous value for the setting.
    OldValue interface{}
    // NewValue is the settings value resulting from this change.
    NewValue interface{}
}

ItemChange represents the change of an item in a settings collection.

func MakeAddition Uses

func MakeAddition(key string, newVal interface{}) ItemChange

MakeAddition returns an itemChange indicating a modification of the input key, with its new value.

func MakeDeletion Uses

func MakeDeletion(key string, oldVal interface{}) ItemChange

MakeDeletion returns an ItemChange indicating a deletion of the input key, with its old value.

func MakeModification Uses

func MakeModification(key string, oldVal, newVal interface{}) ItemChange

MakeModification returns an ItemChange indicating a modification of the input key, with its old and new values.

func (*ItemChange) IsAddition Uses

func (c *ItemChange) IsAddition() bool

IsAddition returns true if this change indicates a settings value not previously defines.

func (*ItemChange) IsDeletion Uses

func (c *ItemChange) IsDeletion() bool

Is deletion returns true if this change indicates the removal of a previously operator-defined setting.

func (*ItemChange) IsModification Uses

func (c *ItemChange) IsModification() bool

IsModification returns true if this change is an update of a previously operator-defined setting.

func (*ItemChange) String Uses

func (c *ItemChange) String() string

String returns the item change in a readable format.

type ItemChanges Uses

type ItemChanges []ItemChange

ItemChanges contains a slice of item changes in a config node. It implements the sort interface to sort the items changes by key.

func (ItemChanges) ApplyDeltaSource Uses

func (c ItemChanges) ApplyDeltaSource(oldChanges ItemChanges) (ItemChanges, error)

ApplyDeltaSource uses this second-order delta to generate a first-older delta. It accepts a collection of changes representing a previous state. These are combined with the current changes to generate a new collection. It addresses a requirement that each branch change should represent the "from" state of master config at the time it is first created.

func (ItemChanges) EffectiveChanges Uses

func (c ItemChanges) EffectiveChanges(defaults charm.Settings) map[string]interface{}

EffectiveChanges returns the effective changes resulting from the application of these changes to the input defaults.

func (ItemChanges) Len Uses

func (c ItemChanges) Len() int

func (ItemChanges) Less Uses

func (c ItemChanges) Less(i, j int) bool

func (ItemChanges) Map Uses

func (c ItemChanges) Map() (map[string]ItemChange, error)

Map is a convenience method for working with collections of changes. It returns a map representation of the change collection, indexed with the change key. An error return indicates that the collection had duplicate keys.

func (ItemChanges) Swap Uses

func (c ItemChanges) Swap(i, j int)

Package settings imports 3 packages (graph) and is imported by 8 packages. Updated 2019-07-10. Refresh now. Tools for package owners.