device

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device added in v0.6.5

type Device struct {
	ID ID
	*topodevice.Device
}

Device is a topology service device

type Event added in v0.6.5

type Event struct {
	// Type is the event type
	Type EventType

	// Device is the updated device
	Device Device
}

Event is a device event

type EventType added in v0.6.5

type EventType string

EventType is a device event type

const (
	// EventNone is an event indicating the replay of an existing device
	EventNone EventType = ""
	// EventAdded indicates a newly added device
	EventAdded EventType = "added"
	// EventUpdated indicates an updated device
	EventUpdated EventType = "updated"
	// EventRemoved indicates a removed device
	EventRemoved EventType = "removed"
)

type ID added in v0.6.5

type ID sb.ECGI

ID is a topology service device identifier

func (ID) Key added in v0.6.7

func (i ID) Key() Key

Key returns the device ID as a key

type Key added in v0.6.7

type Key string

Key is a device key

type Store

type Store interface {
	// Get gets a device by ID
	Get(ID) (*Device, error)

	// Update updates a given device
	Update(*Device) (*Device, error)

	// List lists the devices in the store
	List(chan<- Device) error

	// Watch watches the device store for changes
	Watch(chan<- Event) error
}

Store is a device store

func NewStore

func NewStore(client topodevice.DeviceServiceClient) (Store, error)

NewStore returns a new device store for the given client

func NewTopoStore

func NewTopoStore(topoEndpoint string, opts ...grpc.DialOption) (Store, error)

NewTopoStore returns a new topo-based device store

Jump to

Keyboard shortcuts

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