change

package
v0.0.0-...-24c7f32 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	ID          ID
	Description string
	Created     time.Time
	Config      ValueCollections
}

Change is one of the primary objects to be stored A model of the Change object - its is an immutable collection of ChangeValues

func CreateChange

func CreateChange(config ValueCollections, desc string) (*Change, error)

CreateChange creates a Change object from ChangeValues The ID is a has generated from the change values,a nd does not include the description or the time. This way changes that have an identical meaning can be identified

func (Change) GnmiChange

func (c Change) GnmiChange() (*gnmi.SetRequest, error)

GnmiChange converts a Change object to gNMI format

func (Change) IsValid

func (c Change) IsValid() error

IsValid checks the contents of the Change against its hash This enforces the immutability of the Change. The hash is only on the changes and not the description or the time

func (Change) String

func (c Change) String() string

Stringer method for the Change

type ConfigValue

type ConfigValue struct {
	Path  string
	Value string
}

ConfigValue is a of a path and a value

func (ConfigValue) IsPathValid

func (c ConfigValue) IsPathValid() error

IsPathValid tests for valid paths. Path is valid if it 1) starts with a slash 2) is followed by at least one of alphanumeric or any of : = - _ [ ] 3) and any further combinations of 1+2 Two contiguous slashes are not allowed Paths not starting with slash are not allowed

type ID

type ID []byte

ID is an alias for the ID of the change

type Value

type Value struct {
	ConfigValue
	Remove bool
}

Value is a model that extends ConfigValue - path and a value and bool

func CreateChangeValue

func CreateChangeValue(path string, value string, isRemove bool) (*Value, error)

CreateChangeValue decodes a path and value in to an object

func (Value) String

func (c Value) String() string

Value.String is the stringer for Value

type ValueCollections

type ValueCollections []*Value

ValueCollections is an alias for a slice of ChangeValues

Jump to

Keyboard shortcuts

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