Documentation ¶
Overview ¶
package workload contains an interface for orchestrating goroutines. The idea is that we can experiment with different concurrency models without disrupting our call sites.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor func(WorkloadConfig) (Workload, error)
func GetWorkloadConstructor ¶
func GetWorkloadConstructor(workloadType string) (Constructor, error)
GetWorkload adds future support for different concurrency models
type WorkerPool ¶
type WorkerPool struct { Context context.Context Config *config.Config Schema schema.Schema Pool *pool.Pool Jobs []pool.Job MetricsRegistry metrics.Registry // contains filtered or unexported fields }
func (*WorkerPool) Initialize ¶
func (w *WorkerPool) Initialize() error
func (*WorkerPool) Load ¶
func (w *WorkerPool) Load(tableName string) error
func (*WorkerPool) Run ¶
func (w *WorkerPool) Run(tableName string) error
type WorkerPoolLoadJob ¶
type WorkerPoolLoadJob struct { Context context.Context Client *spanner.Client TableName string RowCount int Statement string GeneratorMap data.GeneratorMap Batch bool BatchSize int WaitGroup *sync.WaitGroup MetricsRegistry metrics.Registry }
WorkerPoolLoadJob is responsible for inserting data into a table
func (*WorkerPoolLoadJob) Execute ¶
func (j *WorkerPoolLoadJob) Execute()
func (*WorkerPoolLoadJob) InsertDML ¶
func (j *WorkerPoolLoadJob) InsertDML()
func (*WorkerPoolLoadJob) InsertMap ¶
func (j *WorkerPoolLoadJob) InsertMap()
func (*WorkerPoolLoadJob) InsertMapBatch ¶
func (j *WorkerPoolLoadJob) InsertMapBatch()
type WorkerPoolRunJob ¶
type WorkerPoolRunJob struct { Context context.Context Client *spanner.Client TableName string ReadMap data.GeneratorMap // Generate data for point reads WriteMap data.GeneratorMap // Generate data for writes OperationSelector selector.Selector // Weghted choice selector (read or write) WaitGroup *sync.WaitGroup StaleReads bool // Should we perform stale reads? If not, strong reads Staleness time.Duration Operations int // How many operations to perform Table schema.Table ReadGenerator *sample.SampleGenerator MetricsRegistry metrics.Registry // contains filtered or unexported fields }
func (*WorkerPoolRunJob) Execute ¶
func (j *WorkerPoolRunJob) Execute()
func (*WorkerPoolRunJob) Initialize ¶
func (j *WorkerPoolRunJob) Initialize() error
func (*WorkerPoolRunJob) Insert ¶
func (j *WorkerPoolRunJob) Insert() error
func (*WorkerPoolRunJob) ReadStale ¶
func (j *WorkerPoolRunJob) ReadStale() error
func (*WorkerPoolRunJob) ReadStrong ¶
func (j *WorkerPoolRunJob) ReadStrong() error
type Workload ¶
type Workload interface { // Initialize is called once before any operations can proceed Initialize() error Load(string) error Run(string) error Stop() error }
func NewPoolWorkload ¶
func NewPoolWorkload(cfg WorkloadConfig) (Workload, error)
NewPoolWorkload initializes a "worker pool" type workload
Source Files ¶
Click to show internal directories.
Click to hide internal directories.