rename driver space cache for upcoming changes

This commit is contained in:
Jonathan Shook
2024-10-11 15:21:01 -05:00
parent 4fa93955c0
commit 41b1296469
26 changed files with 66 additions and 66 deletions

View File

@@ -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));
}
}

View File

@@ -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

View File

@@ -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(