package corecollect

import "github.com/purpleidea/mgmt/lang/core/world/collect"

Index

Constants

const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "collect"
)
const (
	// ResFuncName is the name this function is registered as.
	ResFuncName = "res"
)

Types

type ResFunc

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

ResFunc is a special function which returns information about available resource collection data. You specify the kind, and it tells you which of those are available and from which hosts.

This function is a simplified version of the internal _collect function.

TODO: We could have a second version of this res function which can take a filter as a second or third arg to attempt to reduce the amount of raw data that we have to filter out in mcl.

func (*ResFunc) ArgGen

func (obj *ResFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*ResFunc) Call

func (obj *ResFunc) Call(ctx context.Context, args []types.Value) (types.Value, error)

Call this function with the input args and return the value if it is possible to do so at this time. This was previously getValue which gets the value we're looking for.

func (*ResFunc) Info

func (obj *ResFunc) Info() *interfaces.Info

Info returns some static info about itself. Build must be called before this will return correct data.

func (*ResFunc) Init

func (obj *ResFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*ResFunc) Stream

func (obj *ResFunc) Stream(ctx context.Context) error

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

func (*ResFunc) String

func (obj *ResFunc) String() string

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

func (*ResFunc) Validate

func (obj *ResFunc) Validate() error

Validate tells us if the input struct takes a valid form.

Source Files

collect.go res.go

Version
v0.0.0-20250405210053-9c1c587f7bc2 (latest)
Published
Apr 5, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
1 day ago

Tools for package owners.