workload

package
v0.2102.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CfgConsensusNumKeptVersions is the number of last consensus state versions that the nodes are
	// keeping (e.g., due to a configured pruning policy). Versions older than that will not be
	// queried.
	//
	// Note that this is only for consensus state versions, not runtime versions.
	CfgConsensusNumKeptVersions = "queries.consensus.num_kept_versions"
	// CfgQueriesRuntimeEnabled configures whether runtime queries are enabled.
	CfgQueriesRuntimeEnabled = "queries.runtime.enabled"
)
View Source
const (
	// CfgRuntimeID is the runtime workload runtime ID.
	CfgRuntimeID = "runtime.runtime_id"
)
View Source
const NameCommission = "commission"

NameCommission is the name of the commission schedule amendements workload.

View Source
const NameDelegation = "delegation"

NameDelegation is the name of the delegation workload.

View Source
const NameGovernance = "governance"

NameGovernance is the name of the governance workload.

View Source
const NameOversized = "oversized"

NameOversized is the name of the oversized workload.

View Source
const NameParallel = "parallel"

NameParallel is the name of the parallel workload.

View Source
const NameQueries = "queries"

NameQueries is the name of the queries workload.

View Source
const NameRegistration = "registration"

NameRegistration is the name of the registration workload.

View Source
const NameRuntime = "runtime"

NameRuntime is the name of the runtime workload.

View Source
const NameTransfer = "transfer"

NameTransfer is the name of the transfer workload.

Transfer workload continuously submits transfer and burn transactions.

Variables

View Source
var ByName = map[string]Workload{
	NameCommission:   Commission,
	NameDelegation:   Delegation,
	NameOversized:    Oversized,
	NameParallel:     Parallel,
	NameQueries:      Queries,
	NameRegistration: Registration,
	NameRuntime:      Runtime,
	NameTransfer:     Transfer,
	NameGovernance:   Governance,
}

ByName is the registry of workloads that you can access with `--workload <name>` on the command line.

View Source
var Commission = &commission{
	BaseWorkload: NewBaseWorkload(NameCommission),
}

Commission is the commission schedule amendments workload.

View Source
var Delegation = &delegation{
	BaseWorkload: NewBaseWorkload(NameDelegation),
}

Delegation is the delegation workload.

Flags has the workload flags.

View Source
var (

	// Governance is the governance workload.
	Governance = &governanceWorkload{
		BaseWorkload: NewBaseWorkload(NameGovernance),
	}
)
View Source
var Oversized = &oversized{
	BaseWorkload: NewBaseWorkload(NameOversized),
}

Oversized is the oversized workload.

View Source
var Parallel = &parallel{
	BaseWorkload: NewBaseWorkload(NameParallel),
}

Parallel is the parallel workload.

View Source
var Queries = &queries{}

Queries is the queries workload.

View Source
var QueriesFlags = flag.NewFlagSet("", flag.ContinueOnError)

QueriesFlags are the queries workload flags.

View Source
var Registration = &registration{
	BaseWorkload: NewBaseWorkload(NameRegistration),
}

Registration is the registration workload.

View Source
var Runtime = &runtime{
	BaseWorkload: NewBaseWorkload(NameRuntime),
}

Runtime is the runtime workload.

View Source
var RuntimeFlags = flag.NewFlagSet("", flag.ContinueOnError)

RuntimeFlags are the runtime workload flags.

View Source
var Transfer = &transfer{
	BaseWorkload: NewBaseWorkload(NameTransfer),
}

Transfer is the transfer workload.

Functions

func FundAccountFromTestEntity

func FundAccountFromTestEntity(
	ctx context.Context,
	cc consensus.ClientBackend,
	sm consensus.SubmissionManager,
	to signature.Signer,
) error

FundAccountFromTestEntity funds an account from test entity.

Types

type BaseWorkload added in v0.2100.0

type BaseWorkload struct {
	// Logger is the logger for the workload.
	Logger *logging.Logger
	// contains filtered or unexported fields
}

BaseWorkload provides common methods for a workload.

func NewBaseWorkload added in v0.2100.0

func NewBaseWorkload(name string) BaseWorkload

NewBaseWorkload creates a new BaseWorkload.

func (*BaseWorkload) Consensus added in v0.2100.0

func (bw *BaseWorkload) Consensus() consensus.ClientBackend

Consensus returns the consensus client backend.

func (*BaseWorkload) FundSignAndSubmitTx added in v0.2100.0

func (bw *BaseWorkload) FundSignAndSubmitTx(ctx context.Context, caller signature.Signer, tx *transaction.Transaction) error

FundSignAndSubmitTx funds the caller to cover transaction fees, signs the transaction and submits it to the consensus layer.

func (*BaseWorkload) GasPrice added in v0.2100.0

func (bw *BaseWorkload) GasPrice() uint64

GasPrice returns the configured consensus gas price.

func (*BaseWorkload) Init added in v0.2100.0

func (bw *BaseWorkload) Init(
	cc consensus.ClientBackend,
	sm consensus.SubmissionManager,
	fundingAccount signature.Signer,
)

Init initializes the base workload.

func (*BaseWorkload) TransferFunds added in v0.2100.0

func (bw *BaseWorkload) TransferFunds(ctx context.Context, from signature.Signer, to staking.Address, amount uint64) error

TransferFunds transfers funds from one account to the other.

func (*BaseWorkload) TransferFundsQty added in v0.2100.0

func (bw *BaseWorkload) TransferFundsQty(ctx context.Context, from signature.Signer, to staking.Address, amount *quantity.Quantity) error

TransferFundsQty transfers funds from one account to the other, taking a Quantity amount.

type Workload

type Workload interface {
	// NeedsFunds should return true if the workload requires funding.
	NeedsFunds() bool

	// Run executes the workload.
	// If `gracefulExit`'s deadline passes, it is not an error.
	// Return `nil` after any short-ish amount of time in that case.
	// Prefer to do at least one "iteration" even so.
	Run(
		gracefulExit context.Context,
		rng *rand.Rand,
		conn *grpc.ClientConn,
		cnsc consensus.ClientBackend,
		sm consensus.SubmissionManager,
		fundingAccount signature.Signer,
		validatorEntities []signature.Signer,
	) error
}

Workload is a DRBG-backed schedule of transactions.

Jump to

Keyboard shortcuts

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