examples.bindings-charbuffers.yaml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nbr Show documentation
Show all versions of nbr Show documentation
Runtime-Only CLI for nosqlbench
description: |
This is a set of example for how to create or use CharBuffers in various ways.
Two function types work together to offer flexibility in how you build
text images for sampling.
scenarios:
default: run driver=stdout format=readout
cb_fixed: run driver=stdout format=readout bindings='cycle|cb_fixed'
maze: run driver=stdout format=readout bindings='.*seed.*'
bindings:
# This helps us see the correspondence between input values and the results
# on the functions below.
cycle: Identity()
# CharBufImage(...) creates arbitrarily large characer buffers in memory
# to sample random extracts from. This function comes in a few forms:
# With default image function and fixed length output. This is only
# useful when you just want a static text image, either to init another
# function with, or for specialized testing scenarios. This uses characters
# a-z, A-Z, 0-9, and space only.
cb_fixed: CharBufImage(100) # imgsize
# Another static image form as above, but this one you can configure
# with a source function which provides the initial data. Any
# object type is allowed, as the toString() method is used to iteratively
# fill the initial buffer until it is full according to the imgsize
# This mode still only provides a single possible result.
#
# Create a CharBuffer of 100 characters from the names of numbers
cb_composed_fixed: CharBufImage(NumberNameToString(),100) # srcfunc, imgsize
# Alternately, you can simply provide a set of printable characters and
# ranges from US-ASCII instead of providing a full function. In this mode,
# characters are selected from the provided set for the initial fill.
# This mode still only provides a single possible result.
#
# Create a CharBuffer of 100 characters consisting of hexadecimal digits.
cb_charsets_fixed: CharBufImage('0-9A-F',100) # srcchars, imgsize
# All CharBufImage forms with three or more parameters will return
# useful and distinct samples per input value. In these forms, the third
# parameter is either a number specifying the extracted value size,
# or a function which dynamically selects the size.
# Sample from a CharBuffer of 1000 characters, 10 characters at a time
cb_samples_10chars: CharBufImage('A-Za-z0-9 _|/',1000,10) # srcchars, imgsize, samplesize
# Sample from a text image of 1000 characters, 10 characters at a time,
# but with the image built from long values in string form.
# This example shows coercing the parser to limit to valid functions,
# since virtdata isn't yet smart enough to do this automatically.
# (CharBufImage shares its input long with any inner functions)
#
# Sample from a CharBuffer of 1000 characters, 10 at a time, from the
# string representation of long values.
cb_samples_composed_10chars: CharBufImage(long->ToString(),1000,10)
# Sample from a text image of 1000 characters, with an extracted length
# of between 13 and 17 characters, inclusive.
cb_samples_varychars: CharBufImage('A-Za-z0-9 _|/',1000,HashRange(13,17))
# Sample from a text image of 1000 characters, with an extracted length
# of between 13 and 17 characters, inclusive, but with the images built
# from long values in string form.
cb_samples_composed_varychars: CharBufImage(long->ToString(),1000,HashRange(13,17))
# Sometimes you want to modify a test by changing the dataset used.
# By changing the seed from the default of 0L, you can force the
# initial image to be varied. Each seed should be thought of as a bank
# selector. This can be useful to ensure that data is different
# across similar fields in a test, for example.
cb_seed1: CharBufImage('╱╲',100,30,1L)
cb_seed2: CharBufImage('╱╲',100,30,2L)
cb_seed3: CharBufImage('╱╲',100,30,3L)
cb_seed4: CharBufImage('╱╲',100,30,4L)
cb_seed5: CharBufImage('╱╲',100,30,5L)
cb_seed6: CharBufImage('╱╲',100,30,6L)
cb_seed7: CharBufImage('╱╲',100,30,7L)
cb_seed8: CharBufImage('╱╲',100,30,8L)