performance

package
v0.0.0-...-bea2300 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kilo allows us to convert byte units to kB.
	Kilo = 1024 // TODO Consider adding a unit pkg
)

Variables

This section is empty.

Functions

func CreateChannel

func CreateChannel(server *BenchmarkServer, channelProfile *genesisconfig.Profile) string

CreateChannel creates a channel with randomly generated ID of length 10

func Halt

func Halt(server *BenchmarkServer)

Halt server

func InitializeServerPool

func InitializeServerPool(number int)

InitializeServerPool instantiates a Benchmark server pool of size 'number'

func MakeNormalTx

func MakeNormalTx(channelID string, size int) *cb.Envelope

MakeNormalTx creates a properly signed transaction that could be used against `broadcast` API

func OrdererExec

func OrdererExec(f func(s *BenchmarkServer))

OrdererExec executes func for each orderer in parallel

func OrdererExecWithArgs

func OrdererExecWithArgs(f func(s *BenchmarkServer, i ...interface{}), i ...interface{})

OrdererExecWithArgs executes func for each orderer in parallel

func RandomID

func RandomID(num int) string

RandomID generates a random string of num chars

func SeekAllBlocks

func SeekAllBlocks(c *DeliverClient, channelID string, number uint64) (status cb.Status, err error)

SeekAllBlocks seeks block from oldest to specified number

func WaitForChannels

func WaitForChannels(server *BenchmarkServer, channelIDs ...interface{})

WaitForChannels probes a channel till it's ready

func WaitForService

func WaitForService(server *BenchmarkServer)

WaitForService blocks waiting for service to be registered

Types

type BenchmarkServer

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

BenchmarkServer is a pseudo-server that grpc services could be registered to

func GetBenchmarkServer

func GetBenchmarkServer() *BenchmarkServer

GetBenchmarkServer retrieves next unused server in the pool. This method should ONLY be called by orderer main() and it should be used after initialization

func GetBenchmarkServerPool

func GetBenchmarkServerPool() []*BenchmarkServer

GetBenchmarkServerPool returns the whole server pool for client to use This should be used after initialization

func (*BenchmarkServer) CreateBroadcastClient

func (server *BenchmarkServer) CreateBroadcastClient() *BroadcastClient

CreateBroadcastClient creates a broadcast client of this server

func (*BenchmarkServer) CreateDeliverClient

func (server *BenchmarkServer) CreateDeliverClient() *DeliverClient

CreateDeliverClient creates a broadcast client of this server

func (*BenchmarkServer) Halt

func (server *BenchmarkServer) Halt()

Halt server

func (*BenchmarkServer) RegisterService

func (server *BenchmarkServer) RegisterService(s ab.AtomicBroadcastServer)

RegisterService registers a grpc service to server

func (*BenchmarkServer) Start

func (server *BenchmarkServer) Start()

Start blocks until server being halted. It is to prevent main process to exit

func (*BenchmarkServer) WaitForService

func (server *BenchmarkServer) WaitForService()

WaitForService blocks waiting for service to be registered

type BroadcastClient

type BroadcastClient struct {
	grpc.ServerStream
	// contains filtered or unexported fields
}

BroadcastClient represents a broadcast client that is used to interact with `broadcast` API

func (*BroadcastClient) Close

func (bc *BroadcastClient) Close()

Close closes a broadcast client

func (BroadcastClient) Context

func (BroadcastClient) Context() context.Context

func (*BroadcastClient) Errors

func (bc *BroadcastClient) Errors() <-chan error

Errors returns the channel which return value of broadcast handler is sent to

func (*BroadcastClient) GetResponse

func (bc *BroadcastClient) GetResponse() *ab.BroadcastResponse

GetResponse waits for a response of `broadcast` API synchronously

func (*BroadcastClient) Recv

func (bc *BroadcastClient) Recv() (*cb.Envelope, error)

Recv implements AtomicBroadcast_BroadcastServer interface

func (*BroadcastClient) Send

func (bc *BroadcastClient) Send(br *ab.BroadcastResponse) error

Send implements AtomicBroadcast_BroadcastServer interface

func (*BroadcastClient) SendRequest

func (bc *BroadcastClient) SendRequest(request *cb.Envelope)

SendRequest sends an envelope to `broadcast` API synchronously

type DeliverClient

type DeliverClient struct {
	grpc.ServerStream

	ResponseChan chan *ab.DeliverResponse
	ResultChan   chan error
	// contains filtered or unexported fields
}

DeliverClient represents a deliver client that is used to interact with `deliver` API

func (*DeliverClient) Close

func (bc *DeliverClient) Close()

Close closes a deliver client

func (DeliverClient) Context

func (DeliverClient) Context() context.Context

func (*DeliverClient) GetResponse

func (bc *DeliverClient) GetResponse() *ab.DeliverResponse

GetResponse waits for a response of `deliver` API synchronously

func (*DeliverClient) Recv

func (bc *DeliverClient) Recv() (*cb.Envelope, error)

Recv implements AtomicBroadcast_BroadcastServer interface

func (*DeliverClient) Send

func (bc *DeliverClient) Send(br *ab.DeliverResponse) error

Send implements AtomicBroadcast_BroadcastServer interface

func (*DeliverClient) SendRequest

func (bc *DeliverClient) SendRequest(request *cb.Envelope)

SendRequest sends an envelope to `deliver` API synchronously

Jump to

Keyboard shortcuts

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