mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
nosqlbench-1071 NBIO should favor finding exactly specified file path as a short circuit
This commit is contained in:
@@ -145,7 +145,7 @@ public class BasicScriptBuffer implements ScriptBuffer {
|
||||
|
||||
logger.debug(() -> "Looking for " + script_path);
|
||||
|
||||
Content<?> one = NBIO.all().prefix("scripts").name(script_path).extension("js").one();
|
||||
Content<?> one = NBIO.all().searchPrefixes("scripts").pathname(script_path).extensionSet("js").one();
|
||||
scriptData = one.asString();
|
||||
|
||||
StrInterpolator interpolator = new StrInterpolator(cmd.getParams());
|
||||
|
||||
@@ -306,16 +306,16 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
logger.debug(() -> "user requests to copy out " + resourceToCopy);
|
||||
|
||||
Optional<Content<?>> tocopy = NBIO.classpath()
|
||||
.prefix("activities")
|
||||
.prefix(options.wantsIncludes())
|
||||
.name(resourceToCopy).extension(RawOpsLoader.YAML_EXTENSIONS).first();
|
||||
.searchPrefixes("activities")
|
||||
.searchPrefixes(options.wantsIncludes())
|
||||
.pathname(resourceToCopy).extensionSet(RawOpsLoader.YAML_EXTENSIONS).first();
|
||||
|
||||
if (tocopy.isEmpty()) {
|
||||
|
||||
tocopy = NBIO.classpath()
|
||||
.prefix().prefix(options.wantsIncludes())
|
||||
.prefix(options.wantsIncludes())
|
||||
.name(resourceToCopy).first();
|
||||
.searchPrefixes().searchPrefixes(options.wantsIncludes())
|
||||
.searchPrefixes(options.wantsIncludes())
|
||||
.pathname(resourceToCopy).first();
|
||||
}
|
||||
|
||||
Content<?> data = tocopy.orElseThrow(
|
||||
|
||||
@@ -71,9 +71,9 @@ public class NBCLICommandParser {
|
||||
break;
|
||||
default:
|
||||
Optional<Content<?>> scriptfile = NBIO.local()
|
||||
.prefix("scripts/auto")
|
||||
.name(word)
|
||||
.extension("js")
|
||||
.searchPrefixes("scripts/auto")
|
||||
.pathname(word)
|
||||
.extensionSet("js")
|
||||
.first();
|
||||
|
||||
//Script
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,9 +35,9 @@ public class PathCanonicalizer {
|
||||
|
||||
public String canonicalizePath(String path) {
|
||||
|
||||
Optional<Content<?>> found = NBIO.local().prefix("activities")
|
||||
.prefix(includes)
|
||||
.name(path)
|
||||
Optional<Content<?>> found = NBIO.local().searchPrefixes("activities")
|
||||
.searchPrefixes(includes)
|
||||
.pathname(path)
|
||||
.first();
|
||||
|
||||
if (found.isPresent()) {
|
||||
@@ -46,7 +46,7 @@ public class PathCanonicalizer {
|
||||
rewriteTo=(rewriteTo.startsWith(separator) ? rewriteTo.substring(1) : rewriteTo);
|
||||
|
||||
if (!rewriteTo.equals(path)) {
|
||||
if (NBIO.local().prefix("activities").prefix(includes).name(rewriteTo).first().isPresent()) {
|
||||
if (NBIO.local().searchPrefixes("activities").searchPrefixes(includes).pathname(rewriteTo).first().isPresent()) {
|
||||
logger.info("rewrote path for " + path + " as " + rewriteTo);
|
||||
return rewriteTo;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user