Documentation ¶
Index ¶
- Variables
- type Device
- type DeviceMap
- type ID
- type List
- func (d *List) Add(dev *Device)
- func (d *List) All() DeviceMap
- func (d *List) Copy() *List
- func (d *List) Flatten() map[string]interface{}
- func (d *List) Get(id ID) *Device
- func (d *List) Len() int
- func (d *List) MarshalJSON() ([]byte, error)
- func (d *List) Remove(id ID)
- func (d *List) SetState(id ID, state State) error
- func (d *List) StateGroupedByNode() map[string]map[ID]State
- func (d *List) UnmarshalJSON(b []byte) error
- type State
- func (ds State) Bool(key string, fn func(bool))
- func (ds State) Clone() State
- func (ds State) Diff(right State) State
- func (ds State) Equal(right State) bool
- func (ds State) Float(key string, fn func(float64))
- func (ds State) Int(key string, fn func(int64))
- func (ds State) Merge(right State) State
- func (ds State) MergeWith(right State)
- func (ds State) String(key string, fn func(string))
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWrongIDFormat = fmt.Errorf("wrong ID format. Expected nodeuuid.deviceid")
ErrWrongIDFormat is returned if the new ID is not in the correct format.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Type string `json:"type"` ID ID `json:"id"` Name string `json:"name,omitempty"` Alias string `json:"alias,omitempty"` Online bool `json:"online"` State State `json:"state"` Traits []string `json:"traits"` sync.RWMutex }
func (*Device) MarshalJSON ¶
type List ¶
func (*List) MarshalJSON ¶
func (*List) StateGroupedByNode ¶
StateGroupedByNode get state from all devices grouped by node uuid.
func (*List) UnmarshalJSON ¶
type State ¶
type State map[string]interface{}
func (State) Diff ¶
Diff calculates the diff between 2 states. If key is missing in right but exists in left it will not be a diff.
Click to show internal directories.
Click to hide internal directories.