Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStopped = errors.New("plan stopped")
ErrStopped is returned when the Stop method has been called on the Plan instance. A new Plan must be created.
Functions ¶
This section is empty.
Types ¶
type DoFunc ¶
DoFunc defines a database operation.
If a DoFunc returns false, it's latency measurement is abandoned and it's call does not count towards the operation limit. Implementations of DoFunc should return false when an error occurs.
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan defines a series of operations to perform.
A Plan concurrently runs the configured number of workers, each performing operations in sequence and measuring their latency.
A Plan stops the workers when the configured maximum number of operations is reached, or Stop is called.
func New ¶
New returns an empty Plan, configured to run opsMax number of operations, with paddingSize amount of randomised binary record padding.
func (*Plan) Add ¶
Add pushes a new operation into the Plan run list.
Each worker will run all operations in the sequence provided to Add.
func (*Plan) Run ¶
Run starts workers number of concurrent workers, and writes a description (including approximate average throughput) of each operation every second to w.
When complete, the operation statistics from each worker are aggregated and returned.
func (*Plan) SetIDGenerator ¶
func (p *Plan) SetIDGenerator(id idgen.GeneratorSource)
SetIDGenerator configures PLan to use id as it's ID generator.