adapters

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidAdapterConfig indicates that none of the adapter's config were given.
	ErrInvalidAdapterConfig = errors.New("invalid config passed")
)

Functions

This section is empty.

Types

type AdapterConfig

type AdapterConfig struct {
	OrdererClient     *OrdererClientConfig     `mapstructure:"orderer-client"`
	SidecarClient     *SidecarClientConfig     `mapstructure:"sidecar-client"`
	CoordinatorClient *CoordinatorClientConfig `mapstructure:"coordinator-client"`
	VCClient          *VCClientConfig          `mapstructure:"vc-client"`
	VerifierClient    *VerifierClientConfig    `mapstructure:"verifier-client"`
	LoadGenClient     *LoadGenClientConfig     `mapstructure:"loadgen-client"`
}

AdapterConfig contains all adapters configurations.

type ClientResources

type ClientResources struct {
	Metrics *metrics.PerfMetrics
	Profile *workload.Profile
	Stream  *workload.StreamOptions
	Limit   *GenerateLimit
}

ClientResources holds client's pre-generated resources to be used by the adapters.

type CoordinatorAdapter

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

CoordinatorAdapter applies load on the coordinator.

func NewCoordinatorAdapter

func NewCoordinatorAdapter(config *CoordinatorClientConfig, res *ClientResources) *CoordinatorAdapter

NewCoordinatorAdapter instantiate CoordinatorAdapter.

func (*CoordinatorAdapter) NextBlockNum

func (c *CoordinatorAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*CoordinatorAdapter) Progress

func (c *CoordinatorAdapter) Progress() uint64

Progress a submitted block indicates progress for the coordinator as it guaranteed to preserve the order.

func (*CoordinatorAdapter) RunWorkload

func (c *CoordinatorAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the coordinator.

func (*CoordinatorAdapter) Supports

func (*CoordinatorAdapter) Supports() Phases

Supports specify which phases an adapter supports.

type CoordinatorClientConfig

type CoordinatorClientConfig struct {
	Endpoint *connection.Endpoint `mapstructure:"endpoint"`
}

CoordinatorClientConfig is a struct that contains the configuration for the coordinator client.

type GenerateLimit

type GenerateLimit struct {
	Blocks       uint64 `mapstructure:"blocks" yaml:"blocks"`
	Transactions uint64 `mapstructure:"transactions" yaml:"transactions"`
}

GenerateLimit describes a stopping condition for generating load according to the collected metrics. Zero value indicate no limit. The limit on the number of TXs is applied at block granularity. I.e., more TXs might be created than expected if a block overshot. The load generator stops when both requirements are met, i.e., one of them might overshoot. For the orderer adapter, the blocks limit is ignored for broadcasting as we don't track submitted blocks. For adapters that use concurrent submitters, we cannot enforce exact limits. The sidecar and coordinator adapters are sequential, so they don't have these issues.

func (*GenerateLimit) HasLimit

func (g *GenerateLimit) HasLimit() bool

HasLimit returns true if any limit is set.

type LoadGenAdapter

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

LoadGenAdapter applies load on another load generator.

func NewLoadGenAdapter

func NewLoadGenAdapter(config *LoadGenClientConfig, res *ClientResources) *LoadGenAdapter

NewLoadGenAdapter instantiate LoadGenAdapter.

func (*LoadGenAdapter) NextBlockNum

func (c *LoadGenAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*LoadGenAdapter) Progress

func (c *LoadGenAdapter) Progress() uint64

Progress a committed transaction indicate progress for most adapters.

func (*LoadGenAdapter) RunWorkload

func (c *LoadGenAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the SV.

func (*LoadGenAdapter) Supports

func (*LoadGenAdapter) Supports() Phases

Supports specify which phases an adapter supports. The load generator supports only load generator. The config TX and the namespaces are generated by the main generator.

type LoadGenClientConfig

type LoadGenClientConfig struct {
	Endpoint *connection.Endpoint `mapstructure:"endpoint"`
}

LoadGenClientConfig is a struct that contains the configuration for the load generator client.

type OrdererAdapter

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

OrdererAdapter applies load on the sidecar.

func NewOrdererAdapter

func NewOrdererAdapter(config *OrdererClientConfig, res *ClientResources) *OrdererAdapter

NewOrdererAdapter instantiate OrdererAdapter.

func (*OrdererAdapter) NextBlockNum

func (c *OrdererAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*OrdererAdapter) Progress

func (c *OrdererAdapter) Progress() uint64

Progress a committed transaction indicate progress for most adapters.

func (*OrdererAdapter) RunWorkload

func (c *OrdererAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the sidecar.

func (*OrdererAdapter) Supports

func (*OrdererAdapter) Supports() Phases

Supports specify which phases an adapter supports. The sidecar does not support config transactions as it filters them. To generate a config TX, the orderer must submit a config block.

type OrdererClientConfig

type OrdererClientConfig struct {
	Orderer              ordererconn.Config `mapstructure:"orderer"`
	BroadcastParallelism int                `mapstructure:"broadcast-parallelism"`
	// SidecarEndpoint is used to deliver status from the sidecar.
	// If omitted, we will fetch directly from the orderer.
	SidecarEndpoint *connection.Endpoint `mapstructure:"sidecar-endpoint"`
}

OrdererClientConfig is a struct that contains the configuration for the orderer client.

type Phases

type Phases struct {
	Config     bool `mapstructure:"config" yaml:"config"`
	Namespaces bool `mapstructure:"namespaces" yaml:"namespaces"`
	Load       bool `mapstructure:"load" yaml:"load"`
}

Phases specify the generation phases to enable.

func PhasesIntersect

func PhasesIntersect(p1, p2 Phases) Phases

PhasesIntersect returns the phases that are both in p1 and p2. If one of them is empty, it is assumed not to be specified.

func (*Phases) Empty

func (p *Phases) Empty() bool

Empty returns true if no phase was applied.

type SidecarAdapter

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

SidecarAdapter applies load on the sidecar.

func NewSidecarAdapter

func NewSidecarAdapter(config *SidecarClientConfig, res *ClientResources) *SidecarAdapter

NewSidecarAdapter instantiate SidecarAdapter.

func (*SidecarAdapter) NextBlockNum

func (c *SidecarAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*SidecarAdapter) Progress

func (c *SidecarAdapter) Progress() uint64

Progress a committed transaction indicate progress for most adapters.

func (*SidecarAdapter) RunWorkload

func (c *SidecarAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the sidecar.

func (*SidecarAdapter) Supports

func (*SidecarAdapter) Supports() Phases

Supports specify which phases an adapter supports. The sidecar does not support config transactions as it filters them. To generate a config TX, the orderer must submit a config block.

type SidecarClientConfig

type SidecarClientConfig struct {
	SidecarEndpoint *connection.Endpoint       `mapstructure:"sidecar-endpoint"`
	OrdererServers  []*connection.ServerConfig `mapstructure:"orderer-servers"`
}

SidecarClientConfig is a struct that contains the configuration for the sidecar client.

type SvAdapter

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

SvAdapter applies load on the SV.

func NewSVAdapter

func NewSVAdapter(config *VerifierClientConfig, res *ClientResources) *SvAdapter

NewSVAdapter instantiate SvAdapter.

func (*SvAdapter) NextBlockNum

func (c *SvAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*SvAdapter) Progress

func (c *SvAdapter) Progress() uint64

Progress a committed transaction indicate progress for most adapters.

func (*SvAdapter) RunWorkload

func (c *SvAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the SV.

func (*SvAdapter) Supports

func (*SvAdapter) Supports() Phases

Supports specify which phases an adapter supports.

type VCClientConfig

type VCClientConfig struct {
	Endpoints []*connection.Endpoint `mapstructure:"endpoints"`
}

VCClientConfig is a struct that contains the configuration for the VC client.

type VcAdapter

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

VcAdapter applies load on the VC.

func NewVCAdapter

func NewVCAdapter(config *VCClientConfig, res *ClientResources) *VcAdapter

NewVCAdapter instantiate VcAdapter.

func (*VcAdapter) NextBlockNum

func (c *VcAdapter) NextBlockNum() uint64

NextBlockNum returns the next block number to use.

func (*VcAdapter) Progress

func (c *VcAdapter) Progress() uint64

Progress a committed transaction indicate progress for most adapters.

func (*VcAdapter) RunWorkload

func (c *VcAdapter) RunWorkload(ctx context.Context, txStream *workload.StreamWithSetup) error

RunWorkload applies load on the VC.

func (*VcAdapter) Supports

func (*VcAdapter) Supports() Phases

Supports specify which phases an adapter supports.

type VerifierClientConfig

type VerifierClientConfig struct {
	Endpoints []*connection.Endpoint `mapstructure:"endpoints"`
}

VerifierClientConfig is a struct that contains the configuration for the verifier client.

Jump to

Keyboard shortcuts

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