coresys

package
v0.0.0-...-2561dba Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CPUCountFuncName is the name this fact is registered as. It's still a
	// Func Name because this is the name space the fact is actually using.
	CPUCountFuncName = "cpu_count"
)
View Source
const (
	// HostnameFuncName is the name this fact is registered as. It's still a
	// Func Name because this is the name space the fact is actually using.
	HostnameFuncName = "hostname"
)
View Source
const (
	// LoadFuncName is the name this fact is registered as. It's still a
	// Func Name because this is the name space the fact is actually using.
	LoadFuncName = "load"
)
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"
)
View Source
const (
	// UptimeFuncName is the name this fact is registered as. It's still a
	// Func Name because this is the name space the fact is actually using.
	UptimeFuncName = "uptime"
)

Variables

This section is empty.

Functions

func DefaultEnv

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

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

func Env

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

Env returns a map of all keys and their values.

func GetEnv

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

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

func HasEnv

func HasEnv(ctx context.Context, 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) 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 and sets the facts.Init variable.

func (CPUCountFact) Stream

func (obj CPUCountFact) Stream(ctx context.Context) 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.

func (*CPUCountFact) String

func (obj *CPUCountFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

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) Call

func (obj *HostnameFact) Call(ctx context.Context) (types.Value, error)

Call returns the result of this function.

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(ctx context.Context) error

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

func (*HostnameFact) String

func (obj *HostnameFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

type LoadFact

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

LoadFact is a fact which returns the current system load.

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(ctx context.Context) error

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

func (*LoadFact) String

func (obj *LoadFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

type UptimeFact

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

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

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(ctx context.Context) error

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

func (*UptimeFact) String

func (obj *UptimeFact) String() string

String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.

Jump to

Keyboard shortcuts

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