coresys

package
v0.0.0-...-c555478 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LoadScale factor scales the output from sysinfo to the correct float
	// value.
	LoadScale = 65536 // XXX: is this correct or should it be 65535?
)
View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "sys"
)

Variables

This section is empty.

Functions

func DefaultEnv

func DefaultEnv(input []types.Value) (types.Value, error)

DefaultEnv gets environment variable by name or returns default if non existing.

func Env

func Env(input []types.Value) (types.Value, error)

Env returns a map of all keys and their values.

func GetEnv

func GetEnv(input []types.Value) (types.Value, error)

GetEnv gets environment variable by name or returns empty string if non existing.

func HasEnv

func HasEnv(input []types.Value) (types.Value, error)

HasEnv returns true if environment variable exists.

Types

type CPUCountFact

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

CPUCountFact is a fact that returns the current CPU count.

func (*CPUCountFact) Close

func (obj *CPUCountFact) Close() error

Close runs cleanup code for the fact and turns off the Stream.

func (*CPUCountFact) Info

func (obj *CPUCountFact) Info() *facts.Info

Info returns static typing info about what the fact returns.

func (*CPUCountFact) Init

func (obj *CPUCountFact) Init(init *facts.Init) error

Init runs startup code for this fact. Initializes the closeChan and sets the facts.Init variable.

func (CPUCountFact) Stream

func (obj CPUCountFact) Stream() error

Stream returns the changing values that this fact has over time. It will first poll sysfs to get the initial cpu count, and then receives UEvents from the kernel as CPUs are added/removed.

type HostnameFact

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

HostnameFact is a function that returns the hostname. TODO: support hostnames that change in the future.

func (*HostnameFact) Close

func (obj *HostnameFact) Close() error

Close runs some shutdown code for this fact and turns off the stream.

func (*HostnameFact) Info

func (obj *HostnameFact) Info() *facts.Info

Info returns some static info about itself.

func (*HostnameFact) Init

func (obj *HostnameFact) Init(init *facts.Init) error

Init runs some startup code for this fact.

func (*HostnameFact) Stream

func (obj *HostnameFact) Stream() error

Stream returns the single value that this fact has, and then closes.

type LoadFact

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

LoadFact is a fact which returns the current system load.

func (*LoadFact) Close

func (obj *LoadFact) Close() error

Close runs some shutdown code for this fact and turns off the stream.

func (*LoadFact) Info

func (obj *LoadFact) Info() *facts.Info

Info returns some static info about itself.

func (*LoadFact) Init

func (obj *LoadFact) Init(init *facts.Init) error

Init runs some startup code for this fact.

func (*LoadFact) Stream

func (obj *LoadFact) Stream() error

Stream returns the changing values that this fact has over time.

type UptimeFact

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

UptimeFact is a fact which returns the current uptime of your system.

func (*UptimeFact) Close

func (obj *UptimeFact) Close() error

Close runs some shutdown code for this fact and turns off the stream.

func (*UptimeFact) Info

func (obj *UptimeFact) Info() *facts.Info

Info returns some static info about itself.

func (*UptimeFact) Init

func (obj *UptimeFact) Init(init *facts.Init) error

Init runs some startup code for this fact.

func (*UptimeFact) Stream

func (obj *UptimeFact) Stream() error

Stream returns the changing values that this fact has over time.

Jump to

Keyboard shortcuts

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