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-26 14:38:51 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-26 14:40:16 -0700
commit7e87730de985b7099b9b683571d58efdaab70890 (patch)
tree42f4bba0c0f6d99455a68fc6beead8d2edb8fc08 /src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs
parent0ccfde8b8bb646166a4f45c8630e8fe174f764f4 (diff)
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: 206223521
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, 12 insertions, 10 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 f24a3d99a8..a83d6ab047 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,6 +13,7 @@
// 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;
@@ -58,20 +59,20 @@ public class InMemoryFileSystem extends FileSystem {
// Maximum number of traversals before ELOOP is thrown.
private static final int MAX_TRAVERSALS = 256;
- /**
- * Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
- * within scope) and a default clock.
- */
+ // TODO(b/109764197): Remove the no-arg constructor from Jadep and then remove it here.
+ @VisibleForTesting
public InMemoryFileSystem() {
- this(new JavaClock());
+ this(new JavaClock(), DigestHashFunction.MD5);
}
/**
- * Creates a new InMemoryFileSystem with scope checking disabled (all
- * paths are considered to be within scope).
+ * Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
+ * within scope) and a default clock.
+ *
+ * @param hashFunction
*/
- public InMemoryFileSystem(Clock clock) {
- this(clock, (PathFragment) null);
+ public InMemoryFileSystem(DigestHashFunction hashFunction) {
+ this(new JavaClock(), hashFunction);
}
/**
@@ -89,7 +90,8 @@ 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) {
+ public InMemoryFileSystem(Clock clock, PathFragment scopeRoot, DigestHashFunction hashFunction) {
+ super(hashFunction);
this.scopeRoot = scopeRoot;
this.clock = clock;
this.rootInode = newRootInode(clock);