corelocal

package
v0.0.0-...-a064a87 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VarDirFunctionsPrefix is the prefix we prepend to any VarDir path
	// request, so that if the local.VarDir API is used elsewhere, it
	// doesn't conflict with what we're doing here.
	VarDirFunctionsPrefix = "functions/"

	// VarDirFuncName is the name this function is registered as.
	VarDirFuncName = "vardir"
)
View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "local"
)
View Source
const (
	// PoolFuncName is the name this function is registered as.
	PoolFuncName = "pool"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PoolFunc

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

PoolFunc is a function that returns a unique integer from a pool of numbers. Within a given namespace, it returns the same integer for a given name. It is a simple mechanism to allocate numbers to different inputs when we don't have a hashing alternative. It does not allocate zero.

func (*PoolFunc) ArgGen

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

ArgGen returns the Nth arg name for this function.

func (*PoolFunc) Call

func (obj *PoolFunc) Call(ctx context.Context, input []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.

func (*PoolFunc) Info

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

Info returns some static info about itself.

func (*PoolFunc) Init

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

Init runs some startup code for this function.

func (*PoolFunc) SetData

func (obj *PoolFunc) SetData(data *interfaces.FuncData)

SetData is used by the language to pass our function some code-level context.

func (*PoolFunc) Stream

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

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

func (*PoolFunc) String

func (obj *PoolFunc) String() string

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

func (*PoolFunc) Validate

func (obj *PoolFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type VarDirFunc

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

VarDirFunc is a function that returns the absolute, full path in the deploy from an input path that is relative to the calling file. If you pass it an empty string, you'll just get the absolute deploy directory path that you're in.

func (*VarDirFunc) ArgGen

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

ArgGen returns the Nth arg name for this function.

func (*VarDirFunc) Call

func (obj *VarDirFunc) Call(ctx context.Context, input []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.

func (*VarDirFunc) Info

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

Info returns some static info about itself.

func (*VarDirFunc) Init

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

Init runs some startup code for this function.

func (*VarDirFunc) SetData

func (obj *VarDirFunc) SetData(data *interfaces.FuncData)

SetData is used by the language to pass our function some code-level context.

func (*VarDirFunc) Stream

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

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

func (*VarDirFunc) String

func (obj *VarDirFunc) String() string

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

func (*VarDirFunc) Validate

func (obj *VarDirFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

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