runtime

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog added in v0.15.0

type Catalog struct {
	Gadgets   []*GadgetInfo
	Operators []*OperatorInfo
}

Catalog stores both data about gadgets and operators in a serializable way. This is used to handle gadgets and operators, even if they aren't run locally (and their code is not or only partially available)

type CombinedGadgetResult added in v0.15.0

type CombinedGadgetResult map[string]*GadgetResult

func (CombinedGadgetResult) Err added in v0.15.0

func (r CombinedGadgetResult) Err() error

type GadgetContext

type GadgetContext interface {
	ID() string
	Parser() parser.Parser
	GadgetDesc() gadgets.GadgetDesc
	Context() context.Context
	Operators() operators.Operators
	Logger() logger.Logger
	RuntimeParams() *params.Params
	GadgetParams() *params.Params
	Args() []string
	OperatorsParamCollection() params.Collection
	Timeout() time.Duration

	Cancel()
	ImageName() string
	RegisterDataSource(datasource.Type, string) (datasource.DataSource, error)
	GetDataSources() map[string]datasource.DataSource
	SetVar(string, any)
	GetVar(string) (any, bool)
	SerializeGadgetInfo() (*api.GadgetInfo, error)
	LoadGadgetInfo(info *api.GadgetInfo, paramValues api.ParamValues, run bool) error
	Params() []*api.Param
	SetMetadata([]byte)
	SetParams([]*api.Param)
	DataOperators() []operators.DataOperator

	Run(paramValues api.ParamValues) error
	PrepareGadgetInfo(paramValues api.ParamValues) error
}

type GadgetInfo added in v0.15.0

type GadgetInfo struct {
	ID                       string                `json:"id"`
	Name                     string                `json:"name"`
	Category                 string                `json:"category"`
	Type                     string                `json:"type"`
	Description              string                `json:"description"`
	Params                   params.ParamDescs     `json:"params"`
	ColumnsDefinition        any                   `json:"columnsDefinition"`
	OperatorParamsCollection params.DescCollection `json:"operatorParamsCollection"`
}

GadgetInfo is used to store GadgetDesc information in a serializable way

func GadgetInfoFromGadgetDesc added in v0.15.0

func GadgetInfoFromGadgetDesc(gadgetDesc gadgets.GadgetDesc) *GadgetInfo

type GadgetResult added in v0.15.0

type GadgetResult struct {
	Payload []byte
	Error   error
}

GadgetResult contains the (optional) payload and error of a gadget run for a node

type OperatorInfo added in v0.15.0

type OperatorInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

OperatorInfo is used to store operator information in a serializable way

func OperatorToOperatorInfo added in v0.15.0

func OperatorToOperatorInfo(operator operators.Operator) *OperatorInfo

type Runtime

type Runtime interface {
	Init(globalRuntimeParams *params.Params) error
	Close() error
	GlobalParamDescs() params.ParamDescs
	ParamDescs() params.ParamDescs

	// GetGadgetInfo returns information about the gadget and used operators; this info potentially comes
	// from a cache
	GetGadgetInfo(gadgetCtx GadgetContext, runtimeParams *params.Params, paramValueMap api.ParamValues) (*api.GadgetInfo, error)

	RunBuiltInGadget(gadgetCtx GadgetContext) (CombinedGadgetResult, error)
	RunGadget(gadgetCtx GadgetContext, runtimeParams *params.Params, paramValueMap api.ParamValues) error
	GetCatalog() (*Catalog, error)
	SetDefaultValue(params.ValueHint, string)
	GetDefaultValue(params.ValueHint) (string, bool)
}

Runtime is the interface for gadget runtimes. Runtimes are used to control the lifecycle of gadgets either locally or remotely.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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