diff options
author | ccalvarin <ccalvarin@google.com> | 2018-06-21 18:57:26 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-21 18:59:08 -0700 |
commit | bda12a1b239235de0169b14760214e43f839bed8 (patch) | |
tree | ad47596f2e0d52dbaf7faf1fb7239145cbaa8b8f /src/main/java/com/google/devtools/build/lib/unix | |
parent | a8d7357b7dc66e0531c298e4d369e6342fcf94b7 (diff) |
Move HashFunction out of FileSystem, and turn it into a class, instead of an enum.
Now that we aren't using enum names for the hash functions, we also accept the standard names, such as SHA-256.
RELNOTES: None.
PiperOrigin-RevId: 201624286
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/unix')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java index d5a74ebaf6..16d44a1dff 100644 --- a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.profiler.ProfilerTask; import com.google.devtools.build.lib.unix.NativePosixFiles.Dirents; import com.google.devtools.build.lib.unix.NativePosixFiles.ReadTypes; import com.google.devtools.build.lib.vfs.AbstractFileSystemWithCustomStat; +import com.google.devtools.build.lib.vfs.DigestHashFunction; import com.google.devtools.build.lib.vfs.Dirent; import com.google.devtools.build.lib.vfs.FileStatus; import com.google.devtools.build.lib.vfs.Path; @@ -40,7 +41,7 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat { public UnixFileSystem() { } - public UnixFileSystem(HashFunction hashFunction) { + public UnixFileSystem(DigestHashFunction hashFunction) { super(hashFunction); } @@ -398,11 +399,11 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat { } @Override - protected byte[] getDigest(Path path, HashFunction hashFunction) throws IOException { + protected byte[] getDigest(Path path, DigestHashFunction hashFunction) throws IOException { String name = path.toString(); long startTime = Profiler.nanoTimeMaybe(); try { - if (hashFunction == HashFunction.MD5) { + if (hashFunction == DigestHashFunction.MD5) { return NativePosixFiles.md5sum(name).asBytes(); } return super.getDigest(path, hashFunction); |