All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nosqlbench.engine.api.activityimpl.DiagRunnableOpDispenser Maven / Gradle / Ivy

Go to download

The engine API for nosqlbench; Provides the interfaces needed to build internal modules for the nosqlbench core engine

There is a newer version: 5.17.0
Show newest version
package io.nosqlbench.engine.api.activityimpl;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.nosqlbench.engine.api.templating.CommandTemplate;

import java.util.Map;

public class DiagRunnableOpDispenser implements OpDispenser {

    private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
    private final CommandTemplate cmdTpl;

    public DiagRunnableOpDispenser(CommandTemplate commandTemplate) {
        this.cmdTpl = commandTemplate;
    }

    @Override
    public Runnable apply(long value) {
        Map command = cmdTpl.getCommand(value);
        String body = gson.toJson(command);
        return new DiagRunnableOp(body);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy