js

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle added in v0.13.0

type Bundle struct {
	Filename *url.URL
	Source   string
	Program  *goja.Program
	Options  lib.Options

	BaseInitContext *InitContext

	Env map[string]string
}

A Bundle is a self-contained bundle of scripts and resources. You can use this to produce identical BundleInstance objects.

func NewBundle added in v0.13.0

func NewBundle(src *loader.SourceData, filesystems map[string]afero.Fs, rtOpts lib.RuntimeOptions) (*Bundle, error)

NewBundle creates a new bundle from a source file and a filesystem.

func NewBundleFromArchive added in v0.15.0

func NewBundleFromArchive(arc *lib.Archive, rtOpts lib.RuntimeOptions) (*Bundle, error)

NewBundleFromArchive creates a new bundle from an lib.Archive.

func (*Bundle) Instantiate added in v0.13.0

func (b *Bundle) Instantiate() (bi *BundleInstance, instErr error)

Instantiate creates a new runtime from this bundle.

type BundleInstance added in v0.13.0

type BundleInstance struct {
	Runtime *goja.Runtime
	Context *context.Context
	Default goja.Callable
}

A BundleInstance is a self-contained instance of a Bundle.

type InitContext added in v0.13.0

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

InitContext provides APIs for use in the init context.

func NewInitContext added in v0.13.0

func NewInitContext(
	rt *goja.Runtime, compiler *compiler.Compiler, ctxPtr *context.Context, filesystems map[string]afero.Fs, pwd *url.URL,
) *InitContext

NewInitContext creates a new initcontext with the provided arguments

func (*InitContext) Open added in v0.13.0

func (i *InitContext) Open(filename string, args ...string) (goja.Value, error)

Open implements open() in the init context and will read and return the contents of a file

func (*InitContext) Require added in v0.13.0

func (i *InitContext) Require(arg string) goja.Value

Require is called when a module/file needs to be loaded by a script

type Runner

type Runner struct {
	Bundle *Bundle
	Logger *log.Logger

	BaseDialer net.Dialer
	Resolver   *dnscache.Resolver
	RPSLimit   *rate.Limiter
	// contains filtered or unexported fields
}

func New

func New(src *loader.SourceData, filesystems map[string]afero.Fs, rtOpts lib.RuntimeOptions) (*Runner, error)

New returns a new Runner for the provide source

func NewFromArchive added in v0.15.0

func NewFromArchive(arc *lib.Archive, rtOpts lib.RuntimeOptions) (*Runner, error)

func NewFromBundle added in v0.15.0

func NewFromBundle(b *Bundle) (*Runner, error)

func (*Runner) GetDefaultGroup added in v0.5.0

func (r *Runner) GetDefaultGroup() *lib.Group

func (*Runner) GetOptions

func (r *Runner) GetOptions() lib.Options

func (*Runner) GetSetupData added in v0.21.0

func (r *Runner) GetSetupData() []byte

GetSetupData returns the setup data as json if Setup() was specified and executed, nil otherwise

func (*Runner) MakeArchive added in v0.15.0

func (r *Runner) MakeArchive() *lib.Archive

func (*Runner) NewVU

func (r *Runner) NewVU(samplesOut chan<- stats.SampleContainer) (lib.VU, error)

func (*Runner) SetOptions added in v0.18.1

func (r *Runner) SetOptions(opts lib.Options) error

func (*Runner) SetSetupData added in v0.21.0

func (r *Runner) SetSetupData(data []byte)

SetSetupData saves the externally supplied setup data as json in the runner, so it can be used in VUs

func (*Runner) Setup added in v0.20.0

func (r *Runner) Setup(ctx context.Context, out chan<- stats.SampleContainer) error

func (*Runner) Teardown added in v0.20.0

func (r *Runner) Teardown(ctx context.Context, out chan<- stats.SampleContainer) error

type VU

type VU struct {
	BundleInstance

	Runner    *Runner
	Transport *http.Transport
	Dialer    *netext.Dialer
	CookieJar *cookiejar.Jar
	TLSConfig *tls.Config
	ID        int64
	Iteration int64

	Console *console
	BPool   *bpool.BufferPool

	Samples chan<- stats.SampleContainer
	// contains filtered or unexported fields
}

func (*VU) Reconfigure

func (u *VU) Reconfigure(id int64) error

func (*VU) RunOnce

func (u *VU) RunOnce(ctx context.Context) error

Directories

Path Synopsis
k6
k6/html
generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst
generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst

Jump to

Keyboard shortcuts

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