js

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: AGPL-3.0 Imports: 26 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 string
	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 *lib.SourceData, fs afero.Fs) (*Bundle, error)

Creates a new bundle from a source file and a filesystem.

func NewBundleFromArchive added in v0.15.0

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

func (*Bundle) Instantiate added in v0.13.0

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

Instantiates a new runtime from this bundle.

func (*Bundle) MakeArchive added in v0.15.0

func (b *Bundle) MakeArchive() *lib.Archive

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 Console added in v0.10.0

type Console struct {
	Logger *log.Logger
}

func NewConsole added in v0.13.0

func NewConsole() *Console

func (Console) Debug added in v0.13.0

func (c Console) Debug(ctx *context.Context, msg goja.Value, args ...goja.Value)

func (Console) Error added in v0.13.0

func (c Console) Error(ctx *context.Context, msg goja.Value, args ...goja.Value)

func (Console) Info added in v0.13.0

func (c Console) Info(ctx *context.Context, msg goja.Value, args ...goja.Value)

func (Console) Log added in v0.10.0

func (c Console) Log(ctx *context.Context, msg goja.Value, args ...goja.Value)

func (Console) Warn added in v0.13.0

func (c Console) Warn(ctx *context.Context, msg goja.Value, args ...goja.Value)

type InitContext added in v0.13.0

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

Provides APIs for use in the init context.

func NewInitContext added in v0.13.0

func NewInitContext(rt *goja.Runtime, ctxPtr *context.Context, fs afero.Fs, pwd string) *InitContext

func (*InitContext) Open added in v0.13.0

func (i *InitContext) Open(name string) (string, error)

func (*InitContext) Require added in v0.13.0

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

type Runner

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

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

func New

func New(src *lib.SourceData, fs afero.Fs) (*Runner, error)

func NewFromArchive added in v0.15.0

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

func NewFromBundle added in v0.15.0

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

func (*Runner) ApplyOptions

func (r *Runner) ApplyOptions(opts lib.Options)

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) MakeArchive added in v0.15.0

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

func (*Runner) NewVU

func (r *Runner) NewVU() (lib.VU, error)

type VU

type VU struct {
	BundleInstance

	Runner        *Runner
	HTTPTransport *http.Transport
	Dialer        *netext.Dialer
	ID            int64
	Iteration     int64

	Console *Console
	BPool   *bpool.BufferPool
}

func (*VU) Reconfigure

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

func (*VU) RunOnce

func (u *VU) RunOnce(ctx context.Context) ([]stats.Sample, error)

Directories

Path Synopsis
k6

Jump to

Keyboard shortcuts

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