Documentation ¶
Index ¶
- Constants
- func CreateChannel(server *BenchmarkServer) string
- func Halt(server *BenchmarkServer)
- func InitializeServerPool(number int)
- func MakeNormalTx(channelID string, size int) *cb.Envelope
- func OrdererExec(f func(s *BenchmarkServer))
- func OrdererExecWithArgs(f func(s *BenchmarkServer, i ...interface{}), i ...interface{})
- func RandomID(num int) string
- func SeekAllBlocks(c *DeliverClient, channelID string, number uint64) (status cb.Status, err error)
- func WaitForChannels(server *BenchmarkServer, channelIDs ...interface{})
- func WaitForService(server *BenchmarkServer)
- type BenchmarkServer
- func (server *BenchmarkServer) CreateBroadcastClient() *BroadcastClient
- func (server *BenchmarkServer) CreateDeliverClient() *DeliverClient
- func (server *BenchmarkServer) Halt()
- func (server *BenchmarkServer) RegisterService(s ab.AtomicBroadcastServer)
- func (server *BenchmarkServer) Start()
- func (server *BenchmarkServer) WaitForService()
- type BroadcastClient
- func (bc *BroadcastClient) Close()
- func (BroadcastClient) Context() context.Context
- func (bc *BroadcastClient) Errors() <-chan error
- func (bc *BroadcastClient) GetResponse() *ab.BroadcastResponse
- func (bc *BroadcastClient) Recv() (*cb.Envelope, error)
- func (bc *BroadcastClient) Send(br *ab.BroadcastResponse) error
- func (bc *BroadcastClient) SendRequest(request *cb.Envelope)
- type DeliverClient
- func (bc *DeliverClient) Close()
- func (DeliverClient) Context() context.Context
- func (bc *DeliverClient) GetResponse() *ab.DeliverResponse
- func (bc *DeliverClient) Recv() (*cb.Envelope, error)
- func (bc *DeliverClient) Send(br *ab.DeliverResponse) error
- func (bc *DeliverClient) SendRequest(request *cb.Envelope)
Constants ¶
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) string
CreateChannel creates a channel with randomly generated ID of length 10
func InitializeServerPool ¶
func InitializeServerPool(number int)
InitializeServerPool instantiates a Benchmark server pool of size 'number'
func MakeNormalTx ¶
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 SeekAllBlocks ¶
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) 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) 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) 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