benchmark

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainManager

type ChainManager interface {
	// TipState returns the current consensus state.
	TipState() consensus.State
}

A ChainManager provides access to the current consensus state.

type Manager

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

A Manager performs benchmarks and manages contracts

func New

func New(privKey types.PrivateKey, cm ChainManager, tp TPool, w Wallet, log *zap.Logger) *Manager

New creates a new benchmark manager.

func (*Manager) BenchmarkHost

func (m *Manager) BenchmarkHost(ctx context.Context, hostAddr string, hostKey types.PublicKey, sectors uint64) (res Result, _ error)

BenchmarkHost benchmarks the host uploading and downloading the specified number of sectors.

func (*Manager) ScanHost

func (m *Manager) ScanHost(ctx context.Context, hostAddr string, hostKey types.PublicKey) (Settings, error)

ScanHost scans the host at the given address and returns the settings.

type Result

type Result struct {
	Sectors      uint64         `json:"sectors"`
	Handshake    time.Duration  `json:"handshake"`
	AppendP99    time.Duration  `json:"appendP99"`
	ReadP99      time.Duration  `json:"readP99"`
	Upload       time.Duration  `json:"upload"`
	Download     time.Duration  `json:"download"`
	UploadCost   types.Currency `json:"uploadCost"`
	DownloadCost types.Currency `json:"downloadCost"`
	Error        error          `json:"error,omitempty"`
}

A Result contains the results of a benchmark.

type Settings

type Settings struct {
	Settings   rhp2.HostSettings   `json:"settings"`
	PriceTable rhp3.HostPriceTable `json:"priceTable"`
}

Settings contains the settings scanned from a host.

type TPool

type TPool interface {
	RecommendedFee() types.Currency
}

A TPool manages transactions

type Wallet

type Wallet interface {
	Address() types.Address
	FundTransaction(txn *types.Transaction, amount types.Currency) ([]types.Hash256, func(), error)
	SignTransaction(cs consensus.State, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) error
}

A Wallet funds and signs transactions

Jump to

Keyboard shortcuts

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