aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2018-07-27 12:46:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-27 12:48:22 -0700
commitc9efd06dc6cfef400b288becf96aed1f5ba228b2 (patch)
tree076142a5a53677d2a3a7c22ffbee90a95f7becca /src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs
parent0ae0be980ebdd0e47bdc72b122d5074d4c3d0cb5 (diff)
Automated rollback of commit 7e87730de985b7099b9b683571d58efdaab70890.
*** Reason for rollback *** Go back to the default constructor - instead of requiring everywhere to know the correct hash function, we'll have the default rely on global state. It will make transition easier, even if it makes the origin of the hash less obvious. *** Original change description *** Remove default MD5 in most of Bazel's virtual filesystems. This forces the ex-default to be explicit in a lot of tests, but I'd rather that than have the risk of implicit md5-use in production code. To keep this CL smaller, do not remove the default from UnixFS quite yet. RELNOTES: None. PiperOrigin-RevId: 206358838
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
index a83d6ab047..504cf21c5b 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
@@ -13,7 +13,6 @@
// limitations under the License.
package com.google.devtools.build.lib.vfs.inmemoryfs;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.devtools.build.lib.clock.Clock;
@@ -59,23 +58,33 @@ public class InMemoryFileSystem extends FileSystem {
// Maximum number of traversals before ELOOP is thrown.
private static final int MAX_TRAVERSALS = 256;
- // TODO(b/109764197): Remove the no-arg constructor from Jadep and then remove it here.
- @VisibleForTesting
+ /**
+ * Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
+ * within scope) and a default clock.
+ */
public InMemoryFileSystem() {
- this(new JavaClock(), DigestHashFunction.MD5);
+ this(new JavaClock());
}
/**
* Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
* within scope) and a default clock.
*
- * @param hashFunction
+ * @param hashFunction the function to use for calculating digests.
*/
public InMemoryFileSystem(DigestHashFunction hashFunction) {
this(new JavaClock(), hashFunction);
}
/**
+ * Creates a new InMemoryFileSystem with scope checking disabled (all
+ * paths are considered to be within scope).
+ */
+ public InMemoryFileSystem(Clock clock) {
+ this(clock, (PathFragment) null);
+ }
+
+ /**
* Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
* within scope).
*/
@@ -90,8 +99,7 @@ public class InMemoryFileSystem extends FileSystem {
* Creates a new InMemoryFileSystem with scope checking bound to scopeRoot, i.e. any path that's
* not below scopeRoot is considered to be out of scope.
*/
- public InMemoryFileSystem(Clock clock, PathFragment scopeRoot, DigestHashFunction hashFunction) {
- super(hashFunction);
+ public InMemoryFileSystem(Clock clock, PathFragment scopeRoot) {
this.scopeRoot = scopeRoot;
this.clock = clock;
this.rootInode = newRootInode(clock);