datagen

package
v0.0.0-...-0a6e51c Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TailSize = 1024

TailSize specifies number of extra random bytes in the buffer tail.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datagen

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

Datagen represents an instance of the module for every VU.

func (*Datagen) Exports

func (d *Datagen) Exports() modules.Exports

Exports implements the modules.Instance interface and returns the exports of the JS module.

func (*Datagen) Generator

func (d *Datagen) Generator(size int, typ string, streaming bool) *Generator

type Generator

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

Generator stores buffer of random bytes with some tail and returns data slices with an increasing offset so that we receive a different set of bytes after each call without re-generation of the entire buffer from scratch:

[<----------size----------><-tail->]
[<----------slice0-------->........]
[.<----------slice1-------->.......]
[..<----------slice2-------->......]

func NewGenerator

func NewGenerator(vu modules.VU, size int, typ string, streaming bool) Generator

func (*Generator) GenPayload

func (g *Generator) GenPayload() Payload

type Payload

type Payload interface {
	// Reader returns io.Reader instance to read the payload.
	// Must not be called twice.
	Reader() io.Reader
	// Bytes is a helper which reads all data from Reader() into slice.
	// The sole purpose of this method is to simplify HTTP scenario,
	// where all payload needs to be read and wrapped.
	Bytes() []byte
	// Size returns payload size, which is equal to the total amount of data
	// that could be read from the Reader().
	Size() int
	// Hash returns payload sha256 hash. Must be called after all data is read from the reader.
	Hash() string
}

Payload represents arbitrary data to be packed into S3 or native object. Implementations could be thread-unsafe.

func NewFixedPayload

func NewFixedPayload(data []byte) Payload

func NewStreamPayload

func NewStreamPayload(size int, seed int64, typ string) Payload

type RootModule

type RootModule struct{}

RootModule is the global module object type. It is instantiated once per test run and will be used to create k6/x/frostfs/registry module instances for each VU.

func (*RootModule) NewModuleInstance

func (r *RootModule) NewModuleInstance(vu modules.VU) modules.Instance

NewModuleInstance implements the modules.Module interface and returns a new instance for each VU.

Jump to

Keyboard shortcuts

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