Class BaseDriverAdapter<R extends Op,S>

java.lang.Object
io.nosqlbench.engine.api.activityimpl.uniform.BaseDriverAdapter<R,S>
All Implemented Interfaces:
DriverAdapter<R,S>, io.nosqlbench.nb.api.config.standard.NBCanConfigure, io.nosqlbench.nb.api.config.standard.NBCanReconfigure, io.nosqlbench.nb.api.config.standard.NBConfigModelProvider, io.nosqlbench.nb.api.config.standard.NBConfigurable, io.nosqlbench.nb.api.config.standard.NBReconfigModelProvider, io.nosqlbench.nb.api.config.standard.NBReconfigurable

public abstract class BaseDriverAdapter<R extends Op,S> extends Object implements DriverAdapter<R,S>, io.nosqlbench.nb.api.config.standard.NBConfigurable, io.nosqlbench.nb.api.config.standard.NBReconfigurable
  • Constructor Details

    • BaseDriverAdapter

      public BaseDriverAdapter()
  • Method Details

    • getPreprocessor

      public final Function<Map<String,Object>,Map<String,Object>> getPreprocessor()
      BaseDriverAdapter will take any provided functions from getOpStmtRemappers() and getOpFieldRemappers() and construct a preprocessor list. These are applied successively to the op template fields so long as remapping occurs.
      Specified by:
      getPreprocessor in interface DriverAdapter<R extends Op,S>
      Returns:
      a list of preprocessors for op template fields
    • getOpStmtRemappers

      public List<Function<String,Optional<Map<String,Object>>>> getOpStmtRemappers()

      Provide 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 stmt field, 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()));
       
       

      Returns:
      A list of optionally applied remapping functions.
    • getOpFieldRemappers

      public List<Function<Map<String,Object>,Map<String,Object>>> getOpFieldRemappers()

      Provide a list of field remappers which operate on arbitrary fields. Each function is applied to the op template fields.

      Specified by:
      getOpFieldRemappers in interface DriverAdapter<R extends Op,S>
      Returns:
    • getSpaceCache

      public final DriverSpaceCache<? extends S> getSpaceCache()
      Description copied from interface: DriverAdapter
      The cache of all objects needed within a single instance of a DriverAdapter which are not operations. These are generally things needed by operations, or things needed during the construction of operations. See DriverSpaceCache for details on when and how to use this function.

      During Adapter Initialization, Op Mapping, Op Synthesis, or Op Execution, you may need access to the objects in (the or a) space cache. You can build the type of context needed and then provide this function to provide new instances when needed.

      Specified by:
      getSpaceCache in interface DriverAdapter<R extends Op,S>
      Returns:
      A cache of named objects
    • getConfiguration

      public io.nosqlbench.nb.api.config.standard.NBConfiguration getConfiguration()
      Specified by:
      getConfiguration in interface DriverAdapter<R extends Op,S>
    • applyConfig

      public void applyConfig(io.nosqlbench.nb.api.config.standard.NBConfiguration cfg)
      Specified by:
      applyConfig in interface io.nosqlbench.nb.api.config.standard.NBCanConfigure
      Specified by:
      applyConfig in interface io.nosqlbench.nb.api.config.standard.NBConfigurable
    • applyReconfig

      public void applyReconfig(io.nosqlbench.nb.api.config.standard.NBConfiguration reconf)
      Specified by:
      applyReconfig in interface io.nosqlbench.nb.api.config.standard.NBCanReconfigure
      Specified by:
      applyReconfig in interface io.nosqlbench.nb.api.config.standard.NBReconfigurable
    • getConfigModel

      public io.nosqlbench.nb.api.config.standard.NBConfigModel getConfigModel()
      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.
      Specified by:
      getConfigModel in interface io.nosqlbench.nb.api.config.standard.NBConfigModelProvider
      Specified by:
      getConfigModel in interface io.nosqlbench.nb.api.config.standard.NBConfigurable
    • getReconfigModel

      public io.nosqlbench.nb.api.config.standard.NBConfigModel getReconfigModel()
      Specified by:
      getReconfigModel in interface io.nosqlbench.nb.api.config.standard.NBReconfigModelProvider
      Specified by:
      getReconfigModel in interface io.nosqlbench.nb.api.config.standard.NBReconfigurable