Class Bindings
java.lang.Object
io.nosqlbench.virtdata.core.bindings.Bindings
Maps a template with named bind points and specifiers onto a set of data
mapping function instances. Allows for streamlined calling of mapper functions
as a set.
There are several ways to get generated data via this class. You must always provide a base input value. Fields can be accessed by parameter position or name. In some cases, you can provide an iterator stride in order to get data in bulk. In other cases, you can have setters called directly on your provided objects. See the detailed method docs for more information.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(int i, long input) Get a value for the data mapper in slot iGet a value for the cached mapper name, using the name to mapper index cache.Object[]getAll(long input) Get a value from each data mapper in the bindings listgetAllMap(long input) getIteratedMaps(long input, int count) Generate a list of maps over a range of inputs.getIteratedSuffixMap(long input, int count) Generate a map containing the results from multiple iterations, suffixing the keys in the map with the iterations from 0 to count-1.getIteratedSuffixMap(long input, int count, String... fieldNames) This is a version of thesetIteratedSuffixMap(Map, long, int, String[])which creates a new map for each call.getLazyMap(long input) voidsetAllFields(Bindings.FieldSetter fieldSetter, long input) Generate all the values named in the bind point names, then call the user-provided field setter for each name and object generated.voidsetAllFieldsIterated(Bindings.FieldSetter fieldSetter, long input, int count) Generate all the values named in the bindings for a number of iterations, calling a user-provided field setter for each name and object generated, with the iteration number appended to the fieldName.voidsetIteratedSuffixMap(Map<String, Object> donorMap, long input, long count) Set the values in a provided map, with the bound names suffixed with an internal iteration value.voidGenerate all values in the bindings template, and set each of them in the map according to their bind point name.voidsetNamedFields(Bindings.FieldSetter fieldSetter, long input, String... fieldName) Generate only the values named in fieldNames, and then call the user-provided field setter for each name and object generated.voidsetNamedFieldsIterated(Bindings.FieldSetter fieldSetter, long input, int count, String... fieldName) Generate all the values named in the bindings for a number of iterations, calling a user-provided field setter for each name and object generated, with the iteration number appended to the fieldName, but only for the named bindings.voidsetSuffixedMap(Map<String, Object> donorMap, long cycle, String suffix) Set the values in a provided map, with bound names suffixed with some value.toString()voidGenerate only the values which have matching keys in the provided map according to their bind point names, and assign them to the map under that name.
-
Constructor Details
-
Bindings
-
-
Method Details
-
toString
-
getAll
Get a value from each data mapper in the bindings list- Parameters:
input- The long value which the bound data mappers will use as in input- Returns:
- An array of objects, the values yielded from each data mapper in the bindings list
-
getTemplate
- Returns:
BindingsTemplateassociated with this set of bindings
-
getAllMap
-
getIteratedMaps
Generate a list of maps over a range of inputs.For example, calling getIteratedMaps(5,3) with bindings named alpha and gamma might produce something like:
-
- alpha -> val1
- gamma -> val2
-
- alpha -> val3
- gamma -> val4
-
- alpha -> val5
- gamma -> val6
-
-
getIteratedSuffixMap
Generate a map containing the results from multiple iterations, suffixing the keys in the map with the iterations from 0 to count-1.For example, calling getIteratedSuffixMap(5, 3) with generators named alpha and gamma might yield results like
- alpha0 -> val1
- gamma0 -> val2
- alpha1 -> val3
- gamma1 -> val4
- alpha2 -> val5
- gamma2 -> val6
-
getIteratedSuffixMap
This is a version of thesetIteratedSuffixMap(Map, long, int, String[])which creates a new map for each call.- Parameters:
input- The base input value for which the values should be generatedcount- The count of maps that should be added to the final mapfieldNames- The field names which are used to look up the functions in the binding- Returns:
- A newly created map with the generated names and values.
-
get
Get a value for the data mapper in slot i- Parameters:
i- the data mapper slot, 0-indexedinput- the long input value which the bound data mapper will use as input- Returns:
- a single object, the value yielded from the indexed data mapper in the bindings list
-
get
Get a value for the cached mapper name, using the name to mapper index cache.- Parameters:
name- The field name in the data mapperinput- the long input value which the bound data mapper will use as an input- Returns:
- a single object, the value yielded from the named and indexed data mapper in the bindings list.
-
setMap
-
setSuffixedMap
Set the values in a provided map, with bound names suffixed with some value. No non-overlapping keys in the map will be affected. -
setIteratedSuffixMap
Set the values in a provided map, with the bound names suffixed with an internal iteration value. -
updateMap
Generate only the values which have matching keys in the provided map according to their bind point names, and assign them to the map under that name. It is an error for a key name to be defined in the map for which there is no mapper.- Parameters:
donorMap- - a user-provided Map<String,Object>input- - the input for which to generate the values
-
setNamedFields
Generate only the values named in fieldNames, and then call the user-provided field setter for each name and object generated.- Parameters:
fieldSetter- user-provided object that implementsBindings.FieldSetter.input- the input for which to generate valuesfieldName- A varargs list of field names, or a String[] of names to set
-
setNamedFieldsIterated
public void setNamedFieldsIterated(Bindings.FieldSetter fieldSetter, long input, int count, String... fieldName) Generate all the values named in the bindings for a number of iterations, calling a user-provided field setter for each name and object generated, with the iteration number appended to the fieldName, but only for the named bindings.- Parameters:
fieldSetter- user-provided object that implementsBindings.FieldSetterinput- the base input value for which the objects should be generatedcount- the number of iterations to generate values and names forfieldName- the field names for which to generate values and names
-
setAllFields
Generate all the values named in the bind point names, then call the user-provided field setter for each name and object generated.- Parameters:
fieldSetter- user-provided object that implementsBindings.FieldSetterinput- the input for which to generate values
-
setAllFieldsIterated
Generate all the values named in the bindings for a number of iterations, calling a user-provided field setter for each name and object generated, with the iteration number appended to the fieldName.- Parameters:
fieldSetter- user-provided object that implementsBindings.FieldSetterinput- the base input value for which the objects should be generatedcount- the number of iterations to generate values and names for
-
getLazyMap
-