Interface ActivityType<A extends Activity>
- All Known Implementing Classes:
StandardActivityType
public interface ActivityType<A extends Activity>
An ActivityType is the central extension point in NB for new activity types drivers. It is responsible for naming the activity type, as well as providing the input, activity, and motor instances that will be assembled into an activity.
At the very minimum, a useful implementation of an activity type should provide an action dispenser. Default implementations of input and motor dispensers are provided, and by extension, default inputs and motors.
-
Method Summary
Modifier and Type Method Description default ActionDispensergetActionDispenser(A activity)This method will be called once per action instance.default AgetActivity(io.nosqlbench.engine.api.activityimpl.ActivityDef activityDef)Create an instance of an activity from the activity type.default ActivitygetAssembledActivity(io.nosqlbench.engine.api.activityimpl.ActivityDef activityDef, java.util.Map<java.lang.String,Activity> activities)Create an instance of an activity that ties together all the components into a usable activity instance.default InputDispensergetInputDispenser(A activity)Return the InputDispenser instance that will be used by the associated activity to create Input factories for each thread slot.default <T> MotorDispenser<T>getMotorDispenser(A activity, InputDispenser inputDispenser, ActionDispenser actionDispenser, OutputDispenser outputDispenser)default java.util.Optional<OutputDispenser>getOutputDispenser(A activity)This method will be called once per action instance.default java.util.Map<java.lang.String,java.lang.Class<?>>getTypeMap()An ActivityType can describe the canonical named types as known within that driver implementation, and the Java compatible types which can be assigned to them.
-
Method Details
-
getActivity
Create an instance of an activity from the activity type.- Parameters:
activityDef- the definition that initializes and controls the activity.- Returns:
- a distinct Activity instance for each call
-
getAssembledActivity
default Activity getAssembledActivity(io.nosqlbench.engine.api.activityimpl.ActivityDef activityDef, java.util.Map<java.lang.String,Activity> activities)Create an instance of an activity that ties together all the components into a usable activity instance. This is the method that should be called by executor classes.- Parameters:
activityDef- the definition that initializez and controlls the activity.activities- a map of existing activities- Returns:
- a distinct activity instance for each call
-
getOutputDispenser
This method will be called once per action instance.- Parameters:
activity- The activity instance that will parameterize the returned MarkerDispenser instance.- Returns:
- an instance of MarkerDispenser
-
getActionDispenser
This method will be called once per action instance.- Parameters:
activity- The activity instance that will parameterize the returned ActionDispenser instance.- Returns:
- an instance of ActionDispenser
-
getInputDispenser
Return the InputDispenser instance that will be used by the associated activity to create Input factories for each thread slot.- Parameters:
activity- the Activity instance which will parameterize this InputDispenser- Returns:
- the InputDispenser for the associated activity
-
getMotorDispenser
default <T> MotorDispenser<T> getMotorDispenser(A activity, InputDispenser inputDispenser, ActionDispenser actionDispenser, OutputDispenser outputDispenser) -
getTypeMap
default java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()An ActivityType can describe the canonical named types as known within that driver implementation, and the Java compatible types which can be assigned to them. This map is consulted when users need to select the name from within that driver in order to see the compatible functions which may produce a valid type for it. For example, a CQL users may want to know what java type (and thus what binding functions) can support the CQL timeuuid type. Conversely, a user may want to know what types are supported by the java.util.UUIDclass in CQL. In that case, this map will also be consulted, and multiple keys will match. When there are multiple answers in this way, but the driver has its own default about which one to use when the user's intent is ambiguous, the map should be be ordered as inLinkedHashMap, and the preferred form should be listed first.- Returns:
- a type map indicating co-compatible associations of driver-specific type names and Java types
-