Simplify the BatchStat interface. The includeDigest and includeLinks parameters are always set to true in existing usages. PiperOrigin-RevId: 567546858 Change-Id: I88698362d08d211b0828a10da76d0e837ef09936
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java index 06bb344..1809130 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
@@ -342,11 +342,7 @@ List<Artifact> artifacts = ImmutableList.copyOf(fileToKeyAndValue.keySet()); List<FileStatusWithDigest> stats; try { - stats = - batchStatter.batchStat( - /* includeDigest= */ true, - /* includeLinks= */ true, - Artifact.asPathFragments(artifacts)); + stats = batchStatter.batchStat(Artifact.asPathFragments(artifacts)); } catch (IOException e) { logger.atWarning().withCause(e).log( "Unable to process batch stat, falling back to individual stats");
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/BatchStat.java b/src/main/java/com/google/devtools/build/lib/vfs/BatchStat.java index 73289b8..e82cdfb 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/BatchStat.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/BatchStat.java
@@ -22,16 +22,14 @@ public interface BatchStat { /** - * @param includeDigest whether to include a file digest in the return values. - * @param includeLinks whether to include a symlink stat in the return values. - * @param paths The input paths to stat(), relative to the exec root. - * @return an array list of FileStatusWithDigest in the same order as the input. May - * contain null values. - * @throws IOException on unexpected failure. + * Calls stat() on a set of paths. + * + * @param paths The input paths to stat(), relative to the exec root. Symlinks are not followed. + * @return A list of {@link FileStatusWithDigest} in the same order as the input. If a path does + * not exist, {@code null} is returned in the corresponding position. + * @throws IOException on I/O errors. * @throws InterruptedException on interrupt. */ - public List<FileStatusWithDigest> batchStat(boolean includeDigest, - boolean includeLinks, - Iterable<PathFragment> paths) + public List<FileStatusWithDigest> batchStat(Iterable<PathFragment> paths) throws IOException, InterruptedException; }
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java index 4018da2..68ac6d0 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
@@ -260,7 +260,7 @@ ENABLED { @Override BatchStat getBatchStat(FileSystem fileSystem) { - return (useDigest, includeLinks, paths) -> { + return (paths) -> { List<FileStatusWithDigest> stats = new ArrayList<>(); for (PathFragment pathFrag : paths) { stats.add( @@ -1228,8 +1228,7 @@ checkDirtyActions( new BatchStat() { @Override - public List<FileStatusWithDigest> batchStat( - boolean useDigest, boolean includeLinks, Iterable<PathFragment> paths) + public List<FileStatusWithDigest> batchStat(Iterable<PathFragment> paths) throws IOException { List<FileStatusWithDigest> stats = new ArrayList<>(); for (PathFragment pathFrag : paths) { @@ -1249,8 +1248,7 @@ checkDirtyActions( new BatchStat() { @Override - public List<FileStatusWithDigest> batchStat( - boolean useDigest, boolean includeLinks, Iterable<PathFragment> paths) + public List<FileStatusWithDigest> batchStat(Iterable<PathFragment> paths) throws IOException { List<FileStatusWithDigest> stats = new ArrayList<>(); for (PathFragment pathFrag : paths) { @@ -1269,8 +1267,7 @@ checkDirtyActions( new BatchStat() { @Override - public List<FileStatusWithDigest> batchStat( - boolean useDigest, boolean includeLinks, Iterable<PathFragment> paths) + public List<FileStatusWithDigest> batchStat(Iterable<PathFragment> paths) throws IOException { throw new IOException("try again"); }