Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBroadcastClient(node Node) (orderer.AtomicBroadcast_BroadcastClient, error)
- func CreateDeliverFilteredClient() (peer.Deliver_DeliverFilteredClient, error)
- func CreateEndorserClient(node Node) (peer.EndorserClient, error)
- func CreateProposal(txid string, channel, ccname, version string, args []string) (*peer.Proposal, string, error)
- func CreateSignedDeliverNewestEnv() (*common.Envelope, error)
- func CreateSignedTx(proposal *peer.Proposal, responses []*peer.ProposalResponse) (*common.Envelope, error)
- func DERToPrivateKey(der []byte) (key interface{}, err error)
- func DialConnection(node Node) (*grpc.ClientConn, error)
- func End2End()
- func GetCertificate(f string) (*x509.Certificate, []byte, error)
- func GetChaincodeProposalPayload(ccProposalPayloadBytes []byte) (*peer.ChaincodeProposalPayload, error)
- func GetPrivateKey(f string) (*ecdsa.PrivateKey, error)
- func GetSignatureHeader(signatureHeaderBytes []byte) (*common.SignatureHeader, error)
- func GetTLSCACerts(file string) ([]byte, error)
- func GetVersionInfo() string
- func NewEndorsedChannel() chan *Element
- func NewIntegratedChannel() chan *Element
- func NewLogChannel() chan string
- func NewObserverEndChannel() chan struct{}
- func NewReportChannel() chan string
- func NewSignedChannel() []chan *Element
- func NewUnsignedChannel() chan *Element
- func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error)
- func Process(c *Config, l *log.Logger)
- func SignProposal(prop *peer.Proposal) (*peer.SignedProposal, error)
- func UnmarshalSignatureHeader(bytes []byte) (*common.SignatureHeader, error)
- func WaitObserverEnd(startTime time.Time, printWG *sync.WaitGroup)
- func WriteLogToFile(printWG *sync.WaitGroup)
- type Broadcaster
- type Broadcasters
- type Config
- type Crypto
- type CryptoConfig
- type ECDSASignature
- type Element
- type Initiator
- type Integrator
- type Integrators
- type MetricInstance
- type Node
- type Observer
- type Proposer
- type ProposerClient
- type Proposers
- type Signer
- type Signers
- type TimeKeeper
- type TimeKeepers
- type WorkloadGenerator
Constants ¶
const (
CH_MAX_CAPACITY = 1e6
)
const (
MAX_TRY = 3
)
Variables ¶
var (
Metric = NewMetricInstance()
)
Functions ¶
func CreateBroadcastClient ¶
func CreateBroadcastClient(node Node) (orderer.AtomicBroadcast_BroadcastClient, error)
func CreateDeliverFilteredClient ¶
func CreateDeliverFilteredClient() (peer.Deliver_DeliverFilteredClient, error)
func CreateEndorserClient ¶
func CreateEndorserClient(node Node) (peer.EndorserClient, error)
func CreateProposal ¶
func CreateProposal(txid string, channel, ccname, version string, args []string) (*peer.Proposal, string, error)
CreateProposal creates an unsigned proposal based on the given information and returns a proposal and its transaction id
func CreateSignedTx ¶
func CreateSignedTx(proposal *peer.Proposal, responses []*peer.ProposalResponse) (*common.Envelope, error)
CreateSignedTx extract response, then signs and generates an envelope
func DERToPrivateKey ¶
DERToPrivateKey unmarshals a der to private key
func DialConnection ¶
func DialConnection(node Node) (*grpc.ClientConn, error)
func End2End ¶
func End2End()
End2End executes end-to-end benchmark on HLF An Element (i.e. a transaction) will go through the following channels unsignedCh -> signedCh -> endorsedCh -> integratedCh
func GetCertificate ¶
func GetCertificate(f string) (*x509.Certificate, []byte, error)
func GetChaincodeProposalPayload ¶
func GetChaincodeProposalPayload(ccProposalPayloadBytes []byte) (*peer.ChaincodeProposalPayload, error)
func GetPrivateKey ¶
func GetPrivateKey(f string) (*ecdsa.PrivateKey, error)
func GetSignatureHeader ¶
func GetSignatureHeader(signatureHeaderBytes []byte) (*common.SignatureHeader, error)
func GetTLSCACerts ¶
func NewEndorsedChannel ¶
func NewEndorsedChannel() chan *Element
func NewIntegratedChannel ¶
func NewIntegratedChannel() chan *Element
func NewLogChannel ¶
func NewLogChannel() chan string
func NewObserverEndChannel ¶
func NewObserverEndChannel() chan struct{}
func NewReportChannel ¶
func NewReportChannel() chan string
func NewSignedChannel ¶
func NewSignedChannel() []chan *Element
func NewUnsignedChannel ¶
func NewUnsignedChannel() chan *Element
func PEMtoPrivateKey ¶
PEMtoPrivateKey unmarshals a pem to private key
func SignProposal ¶
func SignProposal(prop *peer.Proposal) (*peer.SignedProposal, error)
SignProposal signs an unsigned proposal and attach the signature to the signed proposal
func UnmarshalSignatureHeader ¶
func UnmarshalSignatureHeader(bytes []byte) (*common.SignatureHeader, error)
func WriteLogToFile ¶
WriteLogToFile receives and write the following types of log to file:
Start: timestamp txid-index txid endorser-id, connection-id, client-id Proposal: timestamp txid-index txid endorser-id, connection-id, client-id Broadcast: timestamp txid-index txid broadcaster-id End: timestamp txid-index txid [VALID/MVCC] Number of all transactions: total-transaction-num Number of VALID transactions: valid-transaction-num Number of ABORTED transactions: aborted-transaction-num Abort rate: abort-rate Duration: duration TPS: throughput
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
type Broadcasters ¶
type Broadcasters struct {
// contains filtered or unexported fields
}
func NewBroadcasters ¶
func NewBroadcasters(inCh <-chan *Element) *Broadcasters
func (*Broadcasters) StartAsync ¶
func (bs *Broadcasters) StartAsync()
StartAsync starts a goroutine for every broadcaster
type Config ¶
type Config struct { // Network Endorsers []Node `yaml:"endorsers"` // peers Committer Node `yaml:"committer"` // the peer chosen to observe blocks from Orderer Node `yaml:"orderer"` // orderer Channel string `yaml:"channel"` // name of the channel to be operated on // Chaincode Chaincode string `yaml:"chaincode"` // chaincode name Version string `yaml:"version"` // chaincode version Args []string `yaml:"args"` // chaincode arguments // Client identity MSPID string `yaml:"mspid"` // the MSP the client belongs PrivateKey string `yaml:"privateKey"` // client's private key SignCert string `yaml:"signCert"` // client's certificate Identity *Crypto // client's identity End2End bool `yaml:"e2e"` // running mode Rate int `yaml:"rate"` // average speed of transaction generation Burst int `yaml:"burst"` // maximum speed of transaction generation TxNum int `yaml:"txNum"` // number of transactions TxTime int `yaml:"txTime"` // maximum execution time TxType string `yaml:"txType"` // transaction type ['put', 'conflict'] TxIDStart int `yaml:"txIDStart"` // the start of TX ID Session string `yaml:"session"` // session name HotAccountRatio float64 `yaml:"hotAccountRatio"` // percentage of hot accounts ConflictRatio float64 `yaml:"conflictRatio"` // Percentage of conflict ConnNum int `yaml:"connNum"` // number of connection ClientPerConnNum int `yaml:"clientPerConnNum"` // number of client per connection IntegratorNum int `yaml:"integratorNum"` // number of integrator BroadcasterNum int `yaml:"broadcasterNum"` // number of orderer client EndorserNum int // number of endorsers // If true, let the protoutil generate txid automatically // If false, encode the txid by us // WARNING: Must modify the code in core/endorser/msgvalidation.go:Validate() and // protoutil/proputils.go:ComputeTxID (v2) before compilation CheckTxID bool `yaml:"checkTxID"` // If true, print the read set and write set to STDOUT CheckRWSet bool `yaml:"checkRWSet"` LogPath string `yaml:"logPath"` // path of the log file ReportPath string `yaml:"reportPath"` // path of the report file Seed int `yaml:"seed"` // random seed }
func LoadConfigFromFile ¶
type Crypto ¶
type Crypto struct { Creator []byte PrivKey *ecdsa.PrivateKey SignCert *x509.Certificate }
func (*Crypto) NewSignatureHeader ¶
func (s *Crypto) NewSignatureHeader() (*common.SignatureHeader, error)
type CryptoConfig ¶
type ECDSASignature ¶
type Element ¶
type Element struct { Proposal *peer.Proposal SignedProposal *peer.SignedProposal Responses []*peer.ProposalResponse Envelope *common.Envelope Txid string // contains filtered or unexported fields }
Element contains the data for the whole lifecycle of a transaction
type Initiator ¶
type Initiator struct {
// contains filtered or unexported fields
}
func NewInitiator ¶
type Integrator ¶
type Integrator struct {
// contains filtered or unexported fields
}
func (*Integrator) Integrate ¶
func (it *Integrator) Integrate(e *Element) (*Element, error)
integrate extracts responses and generates an envelope
func (*Integrator) Start ¶
func (it *Integrator) Start()
StartIntegrator tries to extract enough response from endorsed transaction and integrate them into an envelope
type Integrators ¶
type Integrators struct {
// contains filtered or unexported fields
}
func NewIntegrators ¶
func NewIntegrators(inCh chan *Element, outCh chan *Element) *Integrators
func (*Integrators) StartAsync ¶
func (its *Integrators) StartAsync()
type MetricInstance ¶
type MetricInstance struct {
Abort int32
}
func NewMetricInstance ¶
func NewMetricInstance() *MetricInstance
func (*MetricInstance) AddAbort ¶
func (m *MetricInstance) AddAbort()
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
func NewObserver ¶
func NewObserver() *Observer
type ProposerClient ¶
type ProposerClient struct {
// contains filtered or unexported fields
}
type Proposers ¶
type Proposers struct {
// contains filtered or unexported fields
}
func NewProposers ¶
func (*Proposers) StartAsync ¶
func (ps *Proposers) StartAsync()
StartAsync starts a goroutine as proposer per client per connection per endorser
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
func (*Signer) SignElement ¶
SignElement signs a transaction with the assembler's identity
type TimeKeeper ¶
type TimeKeepers ¶
type TimeKeepers struct {
// contains filtered or unexported fields
}
type WorkloadGenerator ¶
type WorkloadGenerator struct {
// contains filtered or unexported fields
}
func NewWorkloadGenerator ¶
func NewWorkloadGenerator() *WorkloadGenerator