Documentation ¶
Overview ¶
Package resourcemanager provides set of API to provide access to system resources such as devices, cpu, ram, etc
Index ¶
- Variables
- type AlertSender
- type ResourceManager
- func (resourcemanager *ResourceManager) AllocateDevice(device, instanceID string) error
- func (resourcemanager *ResourceManager) CheckNodeConfig(configJSON, version string) error
- func (resourcemanager *ResourceManager) GetCurrentNodeConfig() (cloudprotocol.NodeConfig, error)
- func (resourcemanager *ResourceManager) GetDeviceInfo(name string) (deviceInfo cloudprotocol.DeviceInfo, err error)
- func (resourcemanager *ResourceManager) GetDeviceInstances(device string) ([]string, error)
- func (resourcemanager *ResourceManager) GetNodeConfigStatus() (version string, err error)
- func (resourcemanager *ResourceManager) GetResourceInfo(name string) (cloudprotocol.ResourceInfo, error)
- func (resourcemanager *ResourceManager) ReleaseDevice(device, instanceID string) error
- func (resourcemanager *ResourceManager) ReleaseDevices(instanceID string) (err error)
- func (resourcemanager *ResourceManager) SubscribeCurrentNodeConfigChange() <-chan cloudprotocol.NodeConfig
- func (resourcemanager *ResourceManager) UpdateNodeConfig(configJSON, version string) error
Constants ¶
This section is empty.
Variables ¶
var ErrNoAvailableDevice = errors.New("no device available")
ErrNoAvailableDevice indicates there is no device available.
Functions ¶
This section is empty.
Types ¶
type AlertSender ¶
type AlertSender interface {
SendAlert(alert interface{})
}
AlertSender provides alert sender interface.
type ResourceManager ¶
ResourceManager instance.
func New ¶
func New(nodeConfigFile string, alertSender AlertSender) (resourcemanager *ResourceManager, err error)
New creates new resource manager object.
func (*ResourceManager) AllocateDevice ¶
func (resourcemanager *ResourceManager) AllocateDevice(device, instanceID string) error
AllocateDevice tries to allocate device.
func (*ResourceManager) CheckNodeConfig ¶
func (resourcemanager *ResourceManager) CheckNodeConfig(configJSON, version string) error
CheckNodeConfig checks node config.
func (*ResourceManager) GetCurrentNodeConfig ¶
func (resourcemanager *ResourceManager) GetCurrentNodeConfig() (cloudprotocol.NodeConfig, error)
GetCurrentNodeConfig returns current node configuration.
func (*ResourceManager) GetDeviceInfo ¶
func (resourcemanager *ResourceManager) GetDeviceInfo(name string) (deviceInfo cloudprotocol.DeviceInfo, err error)
GetDeviceInfo returns device information.
func (*ResourceManager) GetDeviceInstances ¶
func (resourcemanager *ResourceManager) GetDeviceInstances(device string) ([]string, error)
GetDeviceInstances returns ID list of instances that allocate specific device.
func (*ResourceManager) GetNodeConfigStatus ¶
func (resourcemanager *ResourceManager) GetNodeConfigStatus() (version string, err error)
GetNodeConfigStatus returns node config status.
func (*ResourceManager) GetResourceInfo ¶
func (resourcemanager *ResourceManager) GetResourceInfo(name string) (cloudprotocol.ResourceInfo, error)
GetResourceInfo returns resource information.
func (*ResourceManager) ReleaseDevice ¶
func (resourcemanager *ResourceManager) ReleaseDevice(device, instanceID string) error
ReleaseDevice releases device for instance.
func (*ResourceManager) ReleaseDevices ¶
func (resourcemanager *ResourceManager) ReleaseDevices(instanceID string) (err error)
ReleaseDevices releases all previously allocated device.
func (*ResourceManager) SubscribeCurrentNodeConfigChange ¶
func (resourcemanager *ResourceManager) SubscribeCurrentNodeConfigChange() <-chan cloudprotocol.NodeConfig
SubscribeCurrentNodeConfigChange subscribes new current node config listener.
func (*ResourceManager) UpdateNodeConfig ¶
func (resourcemanager *ResourceManager) UpdateNodeConfig(configJSON, version string) error
UpdateNodeConfig updates node configuration.