Class OpTemplate

java.lang.Object
io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate
All Implemented Interfaces:
OpTemplateProps, Tagged
Direct Known Subclasses:
OpData, OpDef

public abstract class OpTemplate extends Object implements Tagged, OpTemplateProps

The OpTemplate is a structurally normalized type which presents the user-provided op template to the NoSQLBench loading and templating mechanisms. This type is not generally used directly for new driver development. It is the backing data which is used by ParsedOp, which is used in drivers to map op templates to function to be used for a given cycle value.

This is part of the implementation of the NoSQLBench Uniform Workload Specification. Check the tests for UniformWorkloadSpecification directly to see how this specification is tested and documented.

  • Field Details

  • Constructor Details

    • OpTemplate

      public OpTemplate()
  • Method Details

    • getTags

      public abstract Map<String,String> getTags()
      Return a map of tags for this statement. Implementations are required to add a tag for "name" automatically when this value is set during construction.
      Specified by:
      getTags in interface OpTemplateProps
      Specified by:
      getTags in interface Tagged
      Returns:
      A map of assigned tags for the op, with the name added as an auto-tag.
    • getParamsAsValueType

      public <T> Map<String,T> getParamsAsValueType(Class<? extends T> type)
    • removeParamOrDefault

      public <V> V removeParamOrDefault(String name, V defaultValue)
    • getParamOrDefault

      public <V> V getParamOrDefault(String name, V defaultValue)
    • getParam

      public <V> V getParam(String name, Class<? extends V> type)
    • getOptionalStringParam

      public <V> Optional<V> getOptionalStringParam(String name, Class<? extends V> type)
    • getOptionalStringParam

      public Optional<String> getOptionalStringParam(String name)
    • getParsed

      public Optional<ParsedTemplateString> getParsed(Function<String,String>... rewriters)
      Parse the statement for anchors and return a richer view of the StmtDef which is simpler to use for most statement configuration needs.
      Returns:
      an optional ParsedTemplateString
    • getParsed

      public Optional<ParsedTemplateString> getParsed()
    • asData

      public Map<String,Object> asData()
    • getStmt

      public Optional<String> getStmt()
      Legacy support for String form statements. This is left here as a convenience method, however it is changed to an Optional to force caller refactorings.
      Specified by:
      getStmt in interface OpTemplateProps
      Returns:
      An optional string version of the op, empty if there is no 'stmt' property in the op fields, or no op fields at all.
    • getParamReader

      public Element getParamReader()
    • size

      public int size()
      Returns:
      the size of remaining fields from the op template and the params map.
    • remainingFields

      public Map<String,Object> remainingFields()
      Returns:
      the map of all remaining fields from the op template and the params map.
    • assertConsumed

      public void assertConsumed()