mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
rename driver space cache for upcoming changes
This commit is contained in:
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
|
||||
public abstract class BaseDriverAdapter<R extends Op, S> extends NBBaseComponent implements DriverAdapter<R, S>, NBConfigurable, NBReconfigurable {
|
||||
private final static Logger logger = LogManager.getLogger("ADAPTER");
|
||||
|
||||
private DriverSpaceCache<? extends S> spaceCache;
|
||||
private StringDriverSpaceCache<? extends S> spaceCache;
|
||||
private NBConfiguration cfg;
|
||||
private LongFunction<S> spaceF;
|
||||
|
||||
@@ -129,9 +129,9 @@ public abstract class BaseDriverAdapter<R extends Op, S> extends NBBaseComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized DriverSpaceCache<? extends S> getSpaceCache() {
|
||||
public final synchronized StringDriverSpaceCache<? extends S> getSpaceCache() {
|
||||
if (spaceCache == null) {
|
||||
spaceCache = new DriverSpaceCache<>(this, getSpaceInitializer(getConfiguration()));
|
||||
spaceCache = new StringDriverSpaceCache<>(this, getSpaceInitializer(getConfiguration()));
|
||||
}
|
||||
return spaceCache;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public abstract class BaseDriverAdapter<R extends Op, S> extends NBBaseComponent
|
||||
@Override
|
||||
public LongFunction<S> getSpaceFunc(ParsedOp pop) {
|
||||
LongFunction<String> spaceNameF = pop.getAsFunctionOr("space", "default");
|
||||
DriverSpaceCache<? extends S> cache = getSpaceCache();
|
||||
StringDriverSpaceCache<? extends S> cache = getSpaceCache();
|
||||
return l -> getSpaceCache().get(spaceNameF.apply(l));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public interface DriverAdapter<OPTYPE extends Op, SPACETYPE> extends NBComponent
|
||||
* things needed by operations, or things needed during the
|
||||
* construction of operations.
|
||||
*
|
||||
* See {@link DriverSpaceCache} for details on when and how to use this function.
|
||||
* See {@link StringDriverSpaceCache} for details on when and how to use this function.
|
||||
*
|
||||
* <p>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
|
||||
@@ -146,7 +146,7 @@ public interface DriverAdapter<OPTYPE extends Op, SPACETYPE> extends NBComponent
|
||||
*
|
||||
* @return A cache of named objects
|
||||
*/
|
||||
DriverSpaceCache<? extends SPACETYPE> getSpaceCache();
|
||||
StringDriverSpaceCache<? extends SPACETYPE> getSpaceCache();
|
||||
|
||||
/**
|
||||
* This method allows each driver adapter to create named state which is automatically
|
||||
|
||||
@@ -46,13 +46,13 @@ import java.util.function.Function;
|
||||
* @param <S>
|
||||
* The type which will represent the cache for a given type of adapter.
|
||||
*/
|
||||
public class DriverSpaceCache<S> extends NBBaseComponent {
|
||||
public class StringDriverSpaceCache<S> extends NBBaseComponent {
|
||||
|
||||
private final ConcurrentHashMap<String, S> cache = new ConcurrentHashMap<>();
|
||||
|
||||
private final Function<String, S> newSpaceFunction;
|
||||
|
||||
public DriverSpaceCache(NBComponent parent, Function<String, S> newSpaceFunction) {
|
||||
public StringDriverSpaceCache(NBComponent parent, Function<String, S> newSpaceFunction) {
|
||||
super(parent);
|
||||
this.newSpaceFunction = newSpaceFunction;
|
||||
this.create().gauge(
|
||||
Reference in New Issue
Block a user