resourcemanager

package
v0.0.0-...-03d9887 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package resourcemanager provides set of API to provide access to system resources such as devices, cpu, ram, etc

Index

Constants

This section is empty.

Variables

View Source
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

type ResourceManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

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