Documentation
¶
Overview ¶
Package workload contains utility types for creating synthetic workloads. The types in this package should avoid direct database access.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct { *GeneratorBase LoadChild func(id int) (parent int, val int64, ok bool, err error) LoadParent func(id int) (val int64, ok bool, err error) RowCounter func(table ident.Table) (int, error) StageCounter func(table ident.Table, rng hlc.Range) (int, error) }
Checker is an abstraction over validating the data that was emitted by a GeneratorBase.
func (*Checker) CheckConsistent ¶
CheckConsistent validates the expected state within the generator to the relevant external store.
type GeneratorBase ¶
type GeneratorBase struct { // Tables and expected rows. Child ident.Table `json:"child"` Children map[int]struct{} `json:"children"` Parent ident.Table `json:"parent"` Parents map[int]struct{} `json:"parents"` // The highest timestamp passed to GenerateInto. MaxTime hlc.Time `json:"maxTime"` // Compare data to ensure time order is maintained. ChildVals map[int]int64 `json:"childVals"` ParentVals map[int]int64 `json:"parentVals"` // The keys are child ids and the value the parent id. ChildToParent map[int]int `json:"childToParent"` // contains filtered or unexported fields }
GeneratorBase creates batches of test data. It assumes that there is a parent table and a child table.
func NewGeneratorBase ¶
func NewGeneratorBase(parent, child ident.Table) *GeneratorBase
NewGeneratorBase constructs an empty payload generator.
func (*GeneratorBase) GenerateInto ¶
func (g *GeneratorBase) GenerateInto(batch *types.MultiBatch, time hlc.Time)
GenerateInto will add mutations to the batch at the requested time.
func (*GeneratorBase) Range ¶
func (g *GeneratorBase) Range() hlc.Range
Range returns a range that includes all times at which the Generator created data.
func (*GeneratorBase) WaitForCatchUp ¶
func (g *GeneratorBase) WaitForCatchUp( ctx context.Context, stats *notify.Var[sequencer.Stat], ) error
WaitForCatchUp returns when the Stat shows all tables have advanced beyond the highest timestamp passed to [Generator.GenerateInto].