requirements

package
v0.0.0-...-3a6820e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KiloByte represent 1024 bytes
	KiloByte = (1 << 10)
	// MegaByte represent 1024 kilobytes
	MegaByte = (KiloByte << 10)
	// GigaByte represent 1024 megabytes
	GigaByte = (MegaByte << 10)
	// TeraByte represent 1024 gigabytes
	TeraByte = (GigaByte << 10)
)

Variables

View Source
var (
	//MemUsage represents the memory capacity of the node
	MemUsage map[Capacity]int64
	//CPUUsage represents the CPU capacity of the node
	CPUUsage map[Capacity]int64
	//NetUsage represents the networking capacity of the node
	NetUsage map[Capacity]int64

	//Usage represent all capacities of the host node
	Usage = map[string]map[Capacity]int64{
		"memory":  MemUsage,
		"cpu":     CPUUsage,
		"network": NetUsage,
	}
)

Functions

This section is empty.

Types

type Capacity

type Capacity int

Capacity represents the amout of available ressources

const (
	//CapacityLow defines the lowest tier for a performance metric
	CapacityLow Capacity = iota
	//CapacityMedium defines the middle tier for a performance metric
	CapacityMedium
	//CapacityHigh defines the highest tier for a performance metric
	CapacityHigh
)

func GetCPUCapacity

func GetCPUCapacity() (Capacity, error)

GetCPUCapacity returns the corresponding CPU Capacity

func GetMemoryCapacity

func GetMemoryCapacity() (Capacity, error)

GetMemoryCapacity returns a Capacty for the system memory

func (Capacity) String

func (c Capacity) String() string

String will expand the capacity to it's human readable value

type NetworkType

type NetworkType int

NetworkType represents the network type of the system : internal or external

const (
	//NetworkExternal represent a node with outside network access
	NetworkExternal NetworkType = iota
	//NetworkInternal represent a node with insider network access (on the target LAN)
	NetworkInternal
)

func (NetworkType) String

func (t NetworkType) String() string

String will expand the network type to it's human readable value

type Requirements

type Requirements struct {
	NetworkType       NetworkType `json:"network_type"`       // "external", "internal", ""
	NetworkCapacity   Capacity    `json:"network_capacity"`   // CapacityLow, CapacityMedium, CapacityHigh
	ComputingCapacity Capacity    `json:"computing_capacity"` // CapacityLow, CapacityMedium, CapacityHigh
	MemoryCapacity    Capacity    `json:"memory_capacity"`    // CapacityLow, CapacityMedium, CapacityHigh
}

Requirements defines all the specification needed for a node to be eligble at executing commands.

func (Requirements) MarshalJSON

func (r Requirements) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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