Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes generates a byte slice of length length from seed. The byte slice is deterministically generated using the (very fast) xxhash algorithm.
func WithGenesis ¶
func WithGenesis() func(*Generator)
WithGenesis sets the generator state to the genesis seed. When the generator is created, it will sync to genesis state. The benchmark client needs to do this so that it can generate meaningful tx operations.
Types ¶
type Generator ¶
type Generator struct { Options // contains filtered or unexported fields }
Generator generates operations for a benchmark transaction. The generator is stateful, keeping track of which keys have been inserted so that meaningful gets and deletes can be generated.
func NewGenerator ¶
NewGenerator creates a new generator with the given options.
func (*Generator) GenesisSet ¶
GenesisSet returns a sequence of key-value pairs for the genesis state. It is called by the server during InitGenesis to generate and set the initial state. The client uses WithGenesis to sync to the genesis state.
func (*Generator) Next ¶
Next generates the next benchmark operation. The operation is one of insert, update, get, or delete. The tx client calls this function to deterministically generate the next operation.
func (*Generator) NormUint64 ¶
NormUint64 returns a random uint64 with a normal distribution.
type Options ¶
type Options struct { *module.GeneratorParams // HomeDir is for reading/writing state HomeDir string InsertWeight float64 UpdateWeight float64 GetWeight float64 DeleteWeight float64 }
Options is the configuration for the generator.
type Payload ¶
type Payload [2]uint64
Payload is a 2-tuple of seed and length. A seed is uint64 which is used to generate a byte slice of size length.
func NewPayload ¶
type State ¶
type State struct { Src interface { rand.Source encoding.BinaryMarshaler encoding.BinaryUnmarshaler } Keys [][]Payload }
State is the state of the generator. It can be marshaled and unmarshaled to/from a binary format.