gadgetcontext

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: 17 Imported by: 5

Documentation

Overview

Package gadgetcontext handles initializing gadgets and installed operators before handing them over to a specified runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForTimeoutOrDone added in v0.15.0

func WaitForTimeoutOrDone(c gadgets.GadgetContext)

func WithTimeoutOrCancel added in v0.15.0

func WithTimeoutOrCancel(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

Types

type GadgetContext

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

GadgetContext handles running gadgets by the gadget interface; it orchestrates the whole lifecycle of the gadget instance and communicates with gadget and runtime.

func New

func New(
	ctx context.Context,
	imageName string,
	options ...Option,
) *GadgetContext

func NewBuiltIn added in v0.28.0

func NewBuiltIn(
	ctx context.Context,
	id string,
	runtime runtime.Runtime,
	runtimeParams *params.Params,
	gadget gadgets.GadgetDesc,
	gadgetParams *params.Params,
	args []string,
	operatorsParamCollection params.Collection,
	parser parser.Parser,
	logger logger.Logger,
	timeout time.Duration,
) *GadgetContext

func (*GadgetContext) Args added in v0.18.0

func (c *GadgetContext) Args() []string

func (*GadgetContext) Cancel added in v0.15.0

func (c *GadgetContext) Cancel()

func (*GadgetContext) Context

func (c *GadgetContext) Context() context.Context

func (*GadgetContext) DataOperators added in v0.27.0

func (c *GadgetContext) DataOperators() []operators.DataOperator

func (*GadgetContext) GadgetDesc

func (c *GadgetContext) GadgetDesc() gadgets.GadgetDesc

func (*GadgetContext) GadgetParams

func (c *GadgetContext) GadgetParams() *params.Params

func (*GadgetContext) GetDataSources added in v0.27.0

func (c *GadgetContext) GetDataSources() map[string]datasource.DataSource

func (*GadgetContext) GetVar added in v0.27.0

func (c *GadgetContext) GetVar(varName string) (any, bool)

func (*GadgetContext) GetVars added in v0.27.0

func (c *GadgetContext) GetVars() map[string]any

func (*GadgetContext) ID

func (c *GadgetContext) ID() string

func (*GadgetContext) ImageName added in v0.27.0

func (c *GadgetContext) ImageName() string

func (*GadgetContext) LoadGadgetInfo added in v0.27.0

func (c *GadgetContext) LoadGadgetInfo(info *api.GadgetInfo, paramValues api.ParamValues, run bool) error

func (*GadgetContext) Logger

func (c *GadgetContext) Logger() logger.Logger

func (*GadgetContext) Operators

func (c *GadgetContext) Operators() operators.Operators

func (*GadgetContext) OperatorsParamCollection

func (c *GadgetContext) OperatorsParamCollection() params.Collection

func (*GadgetContext) Params added in v0.27.0

func (c *GadgetContext) Params() []*api.Param

func (*GadgetContext) Parser

func (c *GadgetContext) Parser() parser.Parser

func (*GadgetContext) PrepareGadgetInfo added in v0.27.0

func (c *GadgetContext) PrepareGadgetInfo(paramValues api.ParamValues) error

func (*GadgetContext) RegisterDataSource added in v0.27.0

func (c *GadgetContext) RegisterDataSource(t datasource.Type, name string) (datasource.DataSource, error)

func (*GadgetContext) Run added in v0.27.0

func (c *GadgetContext) Run(paramValues api.ParamValues) error

func (*GadgetContext) Runtime

func (c *GadgetContext) Runtime() runtime.Runtime

func (*GadgetContext) RuntimeParams added in v0.15.0

func (c *GadgetContext) RuntimeParams() *params.Params

func (*GadgetContext) SerializeGadgetInfo added in v0.27.0

func (c *GadgetContext) SerializeGadgetInfo() (*api.GadgetInfo, error)

func (*GadgetContext) SetMetadata added in v0.27.0

func (c *GadgetContext) SetMetadata(m []byte)

func (*GadgetContext) SetParams added in v0.27.0

func (c *GadgetContext) SetParams(params []*api.Param)

func (*GadgetContext) SetVar added in v0.27.0

func (c *GadgetContext) SetVar(varName string, value any)

func (*GadgetContext) Timeout added in v0.15.0

func (c *GadgetContext) Timeout() time.Duration

type Option added in v0.27.0

type Option func(gadgetCtx *GadgetContext)

func WithDataOperators added in v0.27.0

func WithDataOperators(ops ...operators.DataOperator) Option

func WithLogger added in v0.27.0

func WithLogger(logger logger.Logger) Option

func WithTimeout added in v0.28.0

func WithTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

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