chainmgmt

package
v1.0.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChainInitOpCreate indicates that the chains should be creates afresh
	ChainInitOpCreate chainInitOp = iota + 1
	// ChainInitOpOpen indicates that the existing chains should be opened
	ChainInitOpOpen
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchConf

type BatchConf struct {
	BatchSize int
	SignBlock bool
}

BatchConf captures the batch related configurations BatchSize specifies the number of transactions in one block SignBlock specifies whether the transactions should be signed

type Chain

type Chain struct {
	ledger.PeerLedger
	ID ChainID
	// contains filtered or unexported fields
}

Chain extends ledger.PeerLedger and the experiments invoke ledger functions via a chain type

func (*Chain) Commit

func (c *Chain) Commit(block *common.Block)

Commit overrides the Commit function in ledger.PeerLedger because, experiments are not expected to call Commit directly to the ledger

func (*Chain) Done

func (c *Chain) Done()

Done is expected to be called by an experiment when the experiment does not have any more transactions to submit

func (*Chain) SubmitTx

func (c *Chain) SubmitTx(sr SimulationResult)

SubmitTx is expected to be called by an experiment for submitting the transactions

type ChainID

type ChainID int

ChainID is a type used for the ids for the chains for experiments

func (ChainID) String

func (chainID ChainID) String() string

type ChainMgrConf

type ChainMgrConf struct {
	DataDir   string
	NumChains int
}

ChainMgrConf captures the configurations meant at the level of chainMgr DataDir field specifies the filesystem location where the chains data is maintained NumChains field specifies the number of chains to instantiate

type SimulationResult

type SimulationResult []byte

SimulationResult is a type used for simulation results

type TestEnv

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

TestEnv is a high level struct that the experiments are expeted to use as a starting point. See one of the Benchmark tests for the intented usage

func InitTestEnv

func InitTestEnv(mgrConf *ChainMgrConf, batchConf *BatchConf, initOperation chainInitOp) *TestEnv

InitTestEnv initialize TestEnv with given configurations. The initialization cuases creation (or openning of existing) chains and the block creation and commit go routines for each of the chains. For configurations options, see comments on specific configuration type

func (TestEnv) Chains

func (env TestEnv) Chains() []*Chain

Chains returns handle to all the chains

func (TestEnv) WaitForTestCompletion

func (env TestEnv) WaitForTestCompletion()

WaitForTestCompletion waits till all the transactions are committed An experiment after launching all the goroutine should call this so that the process is alive till all the goroutines complete

Jump to

Keyboard shortcuts

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