nosqlbench-1071 NBIO should favor finding exactly specified file path as a short circuit

This commit is contained in:
Jonathan Shook
2023-02-10 10:20:45 -06:00
parent 756e1e5ff0
commit 70408621dd
29 changed files with 555 additions and 250 deletions

View File

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

View File

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

View File

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

View File

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