device

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 1MB/s
	BandwidthUnit = 1024 * 1024
	// 1GB
	StorageUnit = 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device represents a device and its properties

func NewDevice

func NewDevice(nodeID, internalIP string, res *Resources, storage Storage) *Device

NewDevice creates a new Device instance with the specified properties.

func (*Device) GetBandwidthDown

func (device *Device) GetBandwidthDown() int64

GetBandwidthDown returns the bandwidth download limit for the device.

func (*Device) GetBandwidthUp

func (device *Device) GetBandwidthUp() int64

GetBandwidthUp returns the bandwidth upload limit for the device.

func (*Device) GetInternalIP

func (device *Device) GetInternalIP() string

GetInternalIP returns the internal IP address for the device.

func (*Device) GetNodeID

func (device *Device) GetNodeID(ctx context.Context) (string, error)

GetNodeID returns the ID of the device.

func (*Device) GetNodeInfo

func (device *Device) GetNodeInfo(ctx context.Context) (types.NodeInfo, error)

GetNodeInfo returns information about the device as a NodeInfo struct.

type Resources added in v0.1.14

type Resources struct {
	// CPU Limit cpu usage
	CPU *config.CPU
	// Memory Limit memory usage
	Memory *config.Memory
	// Storage Limit storage usage
	Storage *config.Storage
	// Bandwidth Limit bandwidth usage
	Bandwidth *config.Bandwidth
}

type Storage

type Storage interface {
	GetDiskUsageStat() (totalSpace, usage float64)
	GetFileSystemType() string
}

Storage represents a storage system and its properties.

Jump to

Keyboard shortcuts

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