Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeneratedValue ¶
type GeneratedValue struct { indexer.Value Entries []multihash.Multihash }
GeneratedValue captures a synthetically created indexer.Value along with the entries associated to it.
func GenerateRandomValues ¶
func GenerateRandomValues(b testing.TB, rng *rand.Rand, cfg GeneratorConfig) ([]GeneratedValue, int)
GenerateRandomValues generates a set of random GeneratedValue and returns them along with their total size in bytes.
type GeneratorConfig ¶
type GeneratorConfig struct { // NumProviders sets the number of unique providers to generate. Defaults to 1 if unset. NumProviders int // NumValuesPerProvider is the function that is called to determine the number of values // to generate for each provider. Defaults to 10 if unset. NumValuesPerProvider func() uint64 // NumEntriesPerValue is the function that is called to determine the number of multihash // entries to generate for each value. Defaults to 100 if unset. NumEntriesPerValue func() uint64 // DuplicateEntries is the function that is called prior to generating multihash entries, // in order to determine weather to reuse already generated entries from another provider. // This function effectively allows the user to set the probability of providers providing // the same content in the network. // Note that same entries are never duplicated for the same provider. // Defaults to no duplicates if unset. DuplicateEntries func() bool // MultihashLength is the function that is called to determine the multihash length to // generate for each entry. Defaults to 32 if unset. MultihashLength func() uint64 // ContextIDLength is the function that is called to determine the context ID length to // generate for each value. Defaults to 32 if unset. ContextIDLength func() uint64 // MetadataLength is the function that is called to determine the metadata length to // generate for each value. Defaults to 32 if unset. MetadataLength func() uint64 // ShuffleValues specifies weather to shuffle the generated values. Defaults to unshuffled. ShuffleValues bool }
GeneratorConfig captures the configuration to use for generating values for testing and benchmarking purposes.
Click to show internal directories.
Click to hide internal directories.