mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
add examples for new charbuffer and bytebuffer bindings
This commit is contained in:
parent
6a0eca25d7
commit
8590dc35ef
75
nb/src/main/resources/examples/bindings-bytebuffers.yaml
Normal file
75
nb/src/main/resources/examples/bindings-bytebuffers.yaml
Normal file
@ -0,0 +1,75 @@
|
||||
description: |
|
||||
This is a set of example for how to create or use
|
||||
ByteBuffers in various ways.
|
||||
|
||||
bindings:
|
||||
cycle: Identity()
|
||||
# fill a byte buffer of the given size with hashed longs
|
||||
# Hashing is incremental, not recursive, thus data looks
|
||||
# like a sliding window over values
|
||||
hashed_bb: ByteBufferSizedHashed(1000);
|
||||
|
||||
# control the size of the extracted sample with a hash range
|
||||
hashed_bb_sizerange: ByteBufferSizedHashed(HashRange(1,10))
|
||||
|
||||
# control the size of the extracted sample based on a continuous function
|
||||
hashed_bb_size_normal: ByteBufferSizedHashed(Normal(5.0, 1.0))
|
||||
|
||||
# control the size of the extracted sample based on a discrete function
|
||||
hashed_bb_size_binomial: ByteBufferSizedHashed(Binomial(8,0.5))
|
||||
|
||||
# convert a ByteBuffer to a hex-encoded string with upper case
|
||||
bb_to_hex_uc: ByteBufferSizedHashed(1000); ToHexString();
|
||||
|
||||
# convert a ByteBuffer to a hex-encoded string with lower case
|
||||
bb_to_hex_lc: ByteBufferSizedHashed(1000); ToHexString(false);
|
||||
|
||||
# generate a byte buffer of 1000 bytes, and then compute a MD5
|
||||
# digest into another byte buffer
|
||||
digest_bb: ByteBufferSizedHashed(1000); DigestToByteBuffer('MD5');
|
||||
|
||||
# Md5 digest as above, but using a long as input, short-circuiting
|
||||
# the byte buffer construction spelled out above. This is easier
|
||||
# to use and faster to generate, although any digest will be
|
||||
# more intensive to calculate as test data, so only use digests
|
||||
# where you have specific testing requirements for them.
|
||||
digest_bb_direct: DigestToByteBuffer('MD5');
|
||||
|
||||
# A canned version of the above
|
||||
long_md5_bb: ToMD5ByteBuffer()
|
||||
|
||||
# The example below show various type-specialized ByteBuffer
|
||||
# functions which are automatically selected depending on the
|
||||
# input type.
|
||||
|
||||
# long byte buffer
|
||||
# same as long -> ToByteBuffer() -> ByteBuffer
|
||||
long_bb: ToByteBuffer();
|
||||
|
||||
# double byte buffer
|
||||
# same as long -> ToDouble() -> double; double -> ToByteBuffer() -> ByteBuffer
|
||||
double_bb: ToDouble(); ToByteBuffer();
|
||||
|
||||
# integer byte buffer
|
||||
# same as long -> ToInt() -> int; int -> ToByteBuffer() -> ByteBuffer
|
||||
int_bb: ToInt(); ToByteBuffer();
|
||||
|
||||
# string to ByteBuffer
|
||||
# same as long -> NumberNameToString() -> String; String -> ToByteBuffer()
|
||||
string_bb: NumberNameToString(); ToByteBuffer();
|
||||
|
||||
# char buffer to byte buffer
|
||||
# same as
|
||||
# long -> NumberNameToString() -> String; String -> ToCharBuffer() -> CharBuffer; CharBuffer -> ToByteBuffer() -> ByteBuffer
|
||||
cb_bb: NumberNameToString(); ToCharBuffer(); ToByteBuffer();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
74
nb/src/main/resources/examples/bindings-charbuffers.yaml
Normal file
74
nb/src/main/resources/examples/bindings-charbuffers.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
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.
|
||||
|
||||
|
||||
|
||||
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_samples_with_seed: CharBufImage('01 ',100,3,2L)
|
||||
|
Loading…
Reference in New Issue
Block a user