-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdrivers.go
More file actions
30 lines (23 loc) · 933 Bytes
/
drivers.go
File metadata and controls
30 lines (23 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package avcontrol
import (
"context"
)
// DriverRegistry is the interface used to register drivers with the api
type DriverRegistry interface {
// Register registers a driver with the given name.
Register(string, Driver) error
// MustRegister is like Register but panics if there is an error registering the driver.
MustRegister(string, Driver)
// Get returns the driver that was registered with name.
Get(string) Driver
// List returns the list of names that have been registered.
List() []string
}
type Driver interface {
// CreateDevice is called whenever the API needs to get or set state on
// a device. Addr is the address (IP or hostname) of the device.
// See Device for interfaces the returned struct should implement.
CreateDevice(ctx context.Context, addr string) (Device, error)
// ParseConfig is called by the DriverRegistry when a driver is registered.
ParseConfig(map[string]interface{}) error
}