Documentation
¶
Index ¶
- Variables
- type Config
- type DeviceManager
- func (dm *DeviceManager) Close() error
- func (dm *DeviceManager) GetDevice(devid string) (device.Device, error)
- func (dm *DeviceManager) Reserve(authority net.IP, tid string, capabilities ...selector.Capability) (device.Device, error)
- func (dm *DeviceManager) SelectAndReserve(tid string, capabilities ...selector.Capability) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDeviceManager is the root for the errors ErrDeviceManager = errors.NewClass("DeviceManager Error") // ErrArg describes the family of calling errors ErrArg = ErrDeviceManager.NewClass("Argument error") // ErrRuntime describes the family of system errors ErrRuntime = ErrDeviceManager.NewClass("Runtime error") // ErrInvalid is used for invalid arguments ErrInvalid = ErrArg.New("Invalid argument") // ErrNotFound indicates that the device asked by key is not available ErrNotFound = ErrRuntime.New("Device not found") // ErrClosed indicates the device manager is closed ErrClosed = ErrRuntime.New("Device Manager is closed") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // WebService string `validate:"isdefault|ip"` Peer *peer.Peer `validate:"required"` Selector selector.Selector `validate:"required"` }
Config includes the execution paramers for the DeviceManager
type DeviceManager ¶
type DeviceManager struct {
// contains filtered or unexported fields
}
DeviceManager provides clustered access to the Coordinators
func (*DeviceManager) Close ¶
func (dm *DeviceManager) Close() error
Close closes the device manager
func (*DeviceManager) GetDevice ¶
func (dm *DeviceManager) GetDevice(devid string) (device.Device, error)
GetDevice returns a connector to the Device identified by deviceID
func (*DeviceManager) Reserve ¶
func (dm *DeviceManager) Reserve(authority net.IP, tid string, capabilities ...selector.Capability) (device.Device, error)
Reserve asks the Authority Device manager to select and reserve one of the available Devices in the cluster. It returns a connector to the selected Device
func (*DeviceManager) SelectAndReserve ¶
func (dm *DeviceManager) SelectAndReserve(tid string, capabilities ...selector.Capability) (string, error)
type authorityClient struct { conn *rpc.WebSocketClient call *WebServiceOperations }
func (dm *DeviceManager) getAuthorityClient(service string) *authorityClient {
// reuse client from a pool, if the connection to authority device manager // already exists cli, ok := dm.authorities[service] if ok { return cli } call := &WebServiceOperations{} conn := rpc.NewWebSocketClient("ws://" + service + "/") //client.SetTimeout(cli.timeout) conn.UseService(call) return &authorityClient{call: call, conn: conn} }
SelectAndReserve selects and reserves one of the available Devices in the cluster based on the capability contrains. It returns the Device ID
Click to show internal directories.
Click to hide internal directories.