Documentation
¶
Index ¶
- type LocalWorker
- func (l *LocalWorker) AfterRun() (err error)
- func (l *LocalWorker) BeforeRun() (err error)
- func (l *LocalWorker) CheckoutCollector() (collector.Collector, bool, error)
- func (l *LocalWorker) Do() error
- func (l *LocalWorker) Done() chan struct{}
- func (l *LocalWorker) SetContext(bs []byte) (err error)
- func (l *LocalWorker) Statistics() (int64, int64)
- func (l *LocalWorker) Teardown()
- type LocalWorkerConfig
- type RemoteWorker
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalWorker ¶
type LocalWorker struct {
// contains filtered or unexported fields
}
LocalWorker is the local Worker implement
func NewLocalWorker ¶
func NewLocalWorker(config LocalWorkerConfig) (*LocalWorker, error)
NewLocalWorker create LocalWorker.
func (*LocalWorker) BeforeRun ¶
func (l *LocalWorker) BeforeRun() (err error)
BeforeRun call user hook
func (*LocalWorker) CheckoutCollector ¶
func (l *LocalWorker) CheckoutCollector() (collector.Collector, bool, error)
CheckoutCollector checkout collector.
func (*LocalWorker) SetContext ¶
func (l *LocalWorker) SetContext(bs []byte) (err error)
SetContext set the context of worker passed from Master
func (*LocalWorker) Statistics ¶
func (l *LocalWorker) Statistics() (int64, int64)
Statistic get the number of sent and missed transactions
type LocalWorkerConfig ¶
type LocalWorkerConfig struct {
Index int64 // Index the index of localWorker
Cap int64 // Cap the number of vm
Rate int64 // Rate the number of tx will be sent per second
Instant int64 // Instant the number of a batch
Wait time.Duration // Wait maximum time to wait before get vm
Duration time.Duration // Duration time of pressure test
}
LocalWorkerConfig define the local worker need config.
type RemoteWorker ¶
RemoteWorker is the agent of remote worker.
func NewRemoteWorker ¶
func NewRemoteWorker(index int, url string) (*RemoteWorker, error)
NewRemoteWorker create RemoteWorker.
type Worker ¶
type Worker interface {
// SetContext set the context of worker passed from Master.
SetContext([]byte) error
// BeforeRun call user hook
BeforeRun() error
// Do call the workers to running.
Do() error
// AfterRun call user hook
AfterRun() error
// CheckoutCollector checkout collector.
CheckoutCollector() (collector.Collector, bool, error)
// Statistic get the number of sent and missed transactions
Statistics() (int64, int64)
// Teardown close the worker manually.
Teardown()
}
Worker is the interface of worker node
func NewWorkers ¶
NewWorkers generate workers according to config
Click to show internal directories.
Click to hide internal directories.