Interface DriverAdapter<OPTYPE extends Op,SPACETYPE>
- Type Parameters:
OPTYPE- The type of Runnable operation which will be used to wrap all operations for this driver adapter. This allows you to add context or features common to all operations of this type.SPACETYPE- The type of context space used by this driver to hold cached instances of clients, session, or other native driver esoterica. This is the shared state which might be needed during construction of R type operations, or even for individual operations.
- All Known Implementing Classes:
BaseDriverAdapter
The DriverAdapter interface is expected to be the replacement for ActivityTypes. This interface takes a simpler approach. Specifically, all of the core logic which was being pasted into each driver type is centralized, and only the necessary interfaces needed for construction new operations and shared context are exposed. This means all drivers can now benefit from cross-cutting enhancements in the core implementation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault io.nosqlbench.nb.annotations.Maturitydefault Stringdefault io.nosqlbench.docapi.DocsBinderThe standard way to provide docs for a driver adapter is to put them in one of two common places: <resources>/<adaptername>.md - A single markdown file which is the named top-level markdown file for this driver adapter. <resources>/docs/<adaptername>/ - A directory containing any type of file which is to be included in docs under the adapter name, otherwise known as theService.selector()path <resources>/docs/<adaptername>.io.nosqlbench.nb.api.config.standard.NBConfigurationWhen a driver needs to identify an error uniquely for the purposes of routing it to the correct error handler, or naming it in logs, or naming metrics, override this method in your activity.The preprocessor function allows the driver adapter to remap the fields in the op template before they are interpreted canonically.DriverSpaceCache<? extends SPACETYPE>The cache of all objects needed within a single instance of a DriverAdapter which are not operations.getSpaceInitializer(io.nosqlbench.nb.api.config.standard.NBConfiguration cfg)
-
Method Details
-
getOpMapper
Op Mapping
An Op Mapper is a function which can look at the parsed fields in aParsedOpand create an OpDispenser. An OpDispenser is a function that will produce a special typeDriverAdapterthat this DriverAdapter implements as its op implementation.The function that is returned is responsible for creating another function. This might seem counter-intuitive but it is very intentional because of these design constraints:
- Mapping op semantics to a type of operation must be very clear and flexible. Performance is not important at this layer because this is all done during initialization time for an activity.
- Synthesizing executable operations from a known type of operational template must be done very efficiently. This part is done during activity execution, so having the details of how you are going to create an op for execution already sorted out is important.
A note on implementation strategy:
Generally speaking, implementations of this method should interrogate the op fields in the ParsedOp and return an OpDispenser that matches the user's intentions. This can be based on something explicit, like the value of atypefield, or it can be based on whether certain fields are present or not. Advanced implementations might take into account which fields are provided as static values and which are specified as bindings. In any case, the op mapping phase is meant to qualify and pre-check that the fields provided are valid and specific for a given type of operation. What happens withinOpDispenserimplementations (the second phase), however, should do as little qualification of field values as possible, focusing simply on constructing the type of operation for which they are designed.- Returns:
- a synthesizer function for
DriverAdapterop generation
-
getPreprocessor
The preprocessor function allows the driver adapter to remap the fields in the op template before they are interpreted canonically. At this level, the transform is applied once to the input map (once per op template) to yield the map that is provided toOpMapperimplementations.- Returns:
- A function to pre-process the op template fields.
-
getErrorNameMapper
When a driver needs to identify an error uniquely for the purposes of routing it to the correct error handler, or naming it in logs, or naming metrics, override this method in your activity.- Returns:
- A function that can reliably and safely map an instance of Throwable to a stable name.
-
getOpFieldRemappers
-
getSpaceCache
DriverSpaceCache<? extends SPACETYPE> getSpaceCache()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. SeeDriverSpaceCachefor 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.
- Returns:
- A cache of named objects
-
getSpaceInitializer
default Function<String,? extends SPACETYPE> getSpaceInitializer(io.nosqlbench.nb.api.config.standard.NBConfiguration cfg) - Returns:
- A function which can initialize a new S
-
getConfiguration
io.nosqlbench.nb.api.config.standard.NBConfiguration getConfiguration() -
getBundledDocs
default io.nosqlbench.docapi.DocsBinder getBundledDocs()The standard way to provide docs for a driver adapter is to put them in one of two common places:- <resources>/<adaptername>.md - A single markdown file which is the named top-level markdown file for this driver adapter.
- <resources>/docs/<adaptername>/ - A directory containing any type of file which
is to be included in docs under the adapter name, otherwise known as the
Service.selector()
- Returns:
- A
DocsBinderwhich describes docs to include for a given adapter.
-
getAdapterName
-
getAdapterMaturity
default io.nosqlbench.nb.annotations.Maturity getAdapterMaturity()
-