Class DiagDriverAdapter
- All Implemented Interfaces:
SyntheticOpTemplateProvider,DriverAdapter<DiagOp,,DiagSpace> DriverAdapterDecorators,NBComponent,NBComponentAdvisors,NBComponentEvents,NBComponentMetrics,NBComponentProps,NBComponentServices,NBComponentTimeline,NBProviderSearch,NBTokenWords,NBCanConfigure,NBCanReconfigure,NBConfigModelProvider,NBConfigurable,NBReconfigModelProvider,NBReconfigurable,NBLabeledElement,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
NBLabeledElement.BasicLabeledElement -
Field Summary
Fields inherited from class io.nosqlbench.nb.api.components.core.NBBaseComponent
bufferOrphanedMetrics, closed_ns, error, errored_ns, labels, metricsBuffer, parent, started_epoch_ms, started_ns, state, teardown_nsFields inherited from interface io.nosqlbench.nb.api.components.core.NBComponent
EMPTY_COMPONENTFields inherited from interface io.nosqlbench.nb.api.components.core.NBComponentProps
HDRDIGITS, SUMMARYFields inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidImplementors should take care to ensure that this can be called after initial construction without unexpected interactions between construction parameters and configuration parameters.voidThis applies a configuration to an element AFTER the initial configuration fromNBConfigurable.In order to be provided with config information, it is required that the driver adapter specify the valid configuration options, their types, and so on.Op Mapping
Provide a list of field remappers which operate exclusively on the 'stmt' field in the op template.Implement this method by returning an instance ofConfigModel.This method allows each driver adapter to create named state which is automatically cached and re-used by name.getSyntheticOpTemplates(OpsDocList opsDocList, Map<String, Object> params) If a driver adapter supports creating example op templates from bindings, it must implement this method to do so.Methods inherited from class io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter
beforeDetach, getConfiguration, getOpFieldRemappers, getPreprocessor, getSpaceFuncMethods inherited from class io.nosqlbench.nb.api.components.core.NBBaseComponent
addAdvisor, addMetricsCloseable, attachChild, close, create, detachChild, find, findParentService, getAdvisors, getChildren, getComponentOnlyLabels, getComponentProp, getComponentState, getLabels, getNanosSinceStart, getParent, getTokens, nanosof_close, nanosof_error, nanosof_start, nanosof_teardown, onError, onEvent, reportExecutionMetric, setComponentProp, started_epoch_ms, teardown, toStringMethods inherited from class io.nosqlbench.nb.api.components.core.NBBaseComponentMetrics
addComponentMetric, addListener, findComponentMetrics, findComponentMetrics, getComponentMetric, getComponentMetrics, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter
getAdapterMaturity, getAdapterName, getBundledDocs, getErrorNameMapperMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponent
attachChild, close, detachChild, getChildren, getComponentOnlyLabels, getNanosSinceStart, getParent, reportExecutionMetricMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponentAdvisors
addAdvisor, getAdvisorResults, getAdvisorsMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponentEvents
onEventMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponentMetrics
addComponentMetric, findComponentMetrics, findComponentMetrics, findOneComponentMetric, findOneComponentMetric, getComponentMetric, getComponentMetricsMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponentProps
getComponentProp, setComponentPropMethods inherited from interface io.nosqlbench.nb.api.components.core.NBComponentServices
create, findMethods inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
description, getLabelsMethods inherited from interface io.nosqlbench.nb.api.components.decorators.NBProviderSearch
findParentService
-
Constructor Details
-
DiagDriverAdapter
-
-
Method Details
-
getOpMapper
Description copied from interface:DriverAdapterOp Mapping
An Op Mapper is a function which can look at a
ParsedOpand create a matchingOpDispenser. An OpDispenser is a function that will produce a special typeDriverAdapterthat this DriverAdapter implements. There may be many different ops supported by an adapter, thus there may be similarly many dispensers.Both
OpMapperandOpDispenserare functions. The role ofOpMapperis to map the op template provided by the user to an op implementation provided by the driver adapter, and then to create a suitable function for creating that type of operations, known as theOpDispenser.These roles are split for a very good reason: Mapping what the user wants to do with an op template is resource intensive, and should be as pre-baked as possible. This phase is the op mapping phase. It is essential that the mapping logic be very clear and maintainable. Performance is not as important at this phase, because all of the mapping logic is run during initialization of an activity.
Conversely, op dispensing (the next phase) while an activity is running should be as efficient as possible.
- Specified by:
getOpMapperin interfaceDriverAdapter<DiagOp,DiagSpace> - Returns:
- a dispensing function for an
DriverAdapterop generation
-
getSpaceInitializer
Description copied from interface:DriverAdapterThis method allows each driver adapter to create named state which is automatically cached and re-used by name. For each (driver,space) combination in an activity, a distinct space instance will be created. In general, adapter developers will use the space type associated with an adapter to wrap native driver instances one-to-one. As such, if the space implementation is an
AutoCloseable, it will be explicitly shutdown as part of the activity shutdown.It is not necessary to implement a space for a stateless driver adapter, or one which injects all necessary state into each op instance.
- Specified by:
getSpaceInitializerin interfaceDriverAdapter<DiagOp,DiagSpace> - Returns:
- A function which can initialize a new Space, which is a place to hold object state related to retained objects for the lifetime of a native driver.
-
getConfigModel
Description copied from class:BaseDriverAdapterIn order to be provided with config information, it is required that the driver adapter specify the valid configuration options, their types, and so on.- Specified by:
getConfigModelin interfaceNBConfigModelProvider- Specified by:
getConfigModelin interfaceNBConfigurable- Overrides:
getConfigModelin classBaseDriverAdapter<DiagOp,DiagSpace> - Returns:
- A valid configuration model for the implementing class
-
getReconfigModel
Description copied from interface:NBReconfigurableImplement this method by returning an instance ofConfigModel. Any configuration which is provided to theNBReconfigurable.applyReconfig(NBConfiguration)method will be validated through this model. A configuration model is required in order to build a validated configuration from source data provided by a user.- Specified by:
getReconfigModelin interfaceNBReconfigModelProvider- Specified by:
getReconfigModelin interfaceNBReconfigurable- Overrides:
getReconfigModelin classBaseDriverAdapter<DiagOp,DiagSpace> - Returns:
- A valid configuration model for the implementing class
-
getOpStmtRemappers
Description copied from class:BaseDriverAdapterProvide a list of field remappers which operate exclusively on the 'stmt' field in the op template. These are useful, for example, for taking the 'stmt' field and parsing it into component fields which might otherwise be specified by the user. This allows users to specify String-form op templates which are automatically parsed and destructured into the canonical field-wise form for a given type of operation.
Each function in this list is applied in order. If the function returns a value, then the 'stmt' field is removed and the resulting map is added to the other fields in the op template.
If a driver adapter is meant to support the
stmtfield, then this must be provided. The use of the stmt field should be documented in the driver adapter user docs with examples for any supported formats. A default implementation does nothing, as it must be decided per-driver whether or not the stmt field will be used directly or whether it is short-hand for a more canonical form.
If you want to automatically destructure stmt values into a map and inject its entries into the op template fields, simply provide an implementation like this:
return List.of(stmt -> Optional.of(NBParams.one(stmt).getMap()));- Overrides:
getOpStmtRemappersin classBaseDriverAdapter<DiagOp,DiagSpace> - Returns:
- A list of optionally applied remapping functions.
-
applyConfig
Description copied from interface:NBConfigurableImplementors should take care to ensure that this can be called after initial construction without unexpected interactions between construction parameters and configuration parameters.- Specified by:
applyConfigin interfaceNBCanConfigure- Specified by:
applyConfigin interfaceNBConfigurable- Overrides:
applyConfigin classBaseDriverAdapter<DiagOp,DiagSpace> - Parameters:
cfg- The configuration data to be applied to a new instance
-
applyReconfig
Description copied from interface:NBReconfigurableThis applies a configuration to an element AFTER the initial configuration fromNBConfigurable.- Specified by:
applyReconfigin interfaceNBCanReconfigure- Specified by:
applyReconfigin interfaceNBReconfigurable- Overrides:
applyReconfigin classBaseDriverAdapter<DiagOp,DiagSpace> - Parameters:
cfg- The configuration data to be applied to a new instance
-
getSyntheticOpTemplates
Description copied from interface:SyntheticOpTemplateProviderIf a driver adapter supports creating example op templates from bindings, it must implement this method to do so.- Specified by:
getSyntheticOpTemplatesin interfaceSyntheticOpTemplateProvider- Parameters:
opsDocList- The existing doc structure, which should contain no fully defined op templates, but may contain other elements like bindings- Returns:
- A list of op templates, size zero or more
-