protocol

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteUpdate

func WriteUpdate(w io.Writer, msg *protocol.Update) error

Types

type Devices

type Devices struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDevices

func NewDevices() *Devices

func (*Devices) Add

func (n *Devices) Add(device *devices.Device) error

func (*Devices) All

func (n *Devices) All() map[string]*devices.Device

func (*Devices) AllWithState

func (n *Devices) AllWithState(nodes *Nodes) map[string]*devices.Device

func (*Devices) ByUuid

func (n *Devices) ByUuid(uuid string) *devices.Device

func (*Devices) Delete

func (n *Devices) Delete(uuid string)

func (*Devices) RestoreFromFile

func (n *Devices) RestoreFromFile(path string)

func (*Devices) SaveToFile

func (n *Devices) SaveToFile(path string)

func (*Devices) SetOfflineByNode

func (n *Devices) SetOfflineByNode(nodeUUID string) (list []*devices.Device)

SetOfflineByNode marks device from a single node offline and returns a list of all marked devices

func (*Devices) ShallowCopy

func (n *Devices) ShallowCopy() map[string]*devices.Device

type Node

type Node interface {
	SetState(interface{})
	State() interface{}

	Devices() *devices.Map
	SetDevices(*devices.Map)

	Config() *protocol.ConfigMap
	SetConfig(*protocol.ConfigMap)

	SetElements([]*protocol.Element)
	Elements() []*protocol.Element

	Uuid() string
	Name() string
	SetUuid(string)
	SetName(string)
	Write(b []byte) (int, error)
	SetConn(conn net.Conn)
	GetNotification(json.RawMessage) *notifications.Notification
}

func NewNode

func NewNode() Node

type Nodes

type Nodes struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TODO: write tests for Nodes struct (jonaz) <Fri 10 Oct 2014 04:31:22 PM CEST>

func NewNodes

func NewNodes() *Nodes

func (*Nodes) Add

func (n *Nodes) Add(node Node) error

func (*Nodes) All

func (n *Nodes) All() map[string]Node

func (*Nodes) ByName

func (n *Nodes) ByName(name string) Node

func (*Nodes) ByUuid

func (n *Nodes) ByUuid(uuid string) Node

func (*Nodes) Delete

func (n *Nodes) Delete(uuid string)

func (*Nodes) Search

func (n *Nodes) Search(nameoruuid string) Node

type Searchable

type Searchable interface {
	Search(string) Node
}

Jump to

Keyboard shortcuts

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