Skip to content

Commit

Permalink
Sandboxes: cleanup: Hide Set implementation detail for "dirsToCreate"
Browse files Browse the repository at this point in the history
The LinkedHashSet implementation detail needs to only be known at
construction time. All further users can just rely on the interface
definition.

PiperOrigin-RevId: 608724381
Change-Id: I816cdb6344236250a55c951f8edb7cad6a02ee71
  • Loading branch information
metti authored and copybara-github committed Feb 20, 2024
1 parent cd2a09b commit c575c06
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void createFileSystem() throws IOException, InterruptedException {
// First compute all the inputs and directories that we need. This is based only on
// `workerFiles`, `inputs` and `outputs` and won't do any I/O.
Set<PathFragment> inputsToCreate = new LinkedHashSet<>();
LinkedHashSet<PathFragment> dirsToCreate = new LinkedHashSet<>();
Set<PathFragment> dirsToCreate = new LinkedHashSet<>();
Set<PathFragment> writableSandboxDirs =
writableDirs.stream()
.filter(p -> p.startsWith(sandboxExecRoot))
Expand Down Expand Up @@ -145,7 +145,7 @@ public void createFileSystem() throws IOException, InterruptedException {
}

protected void filterInputsAndDirsToCreate(
Set<PathFragment> inputsToCreate, LinkedHashSet<PathFragment> dirsToCreate)
Set<PathFragment> inputsToCreate, Set<PathFragment> dirsToCreate)
throws IOException, InterruptedException {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -262,7 +261,7 @@ static Optional<PathFragment> getExpectedSymlinkDestination(
public static void populateInputsAndDirsToCreate(
Set<PathFragment> writableDirs,
Set<PathFragment> inputsToCreate,
LinkedHashSet<PathFragment> dirsToCreate,
Set<PathFragment> dirsToCreate,
Iterable<PathFragment> inputFiles,
SandboxOutputs outputs) {
// Add all worker files, input files, and the parent directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -73,7 +72,7 @@ public SymlinkedSandboxedSpawn(

@Override
public void filterInputsAndDirsToCreate(
Set<PathFragment> inputsToCreate, LinkedHashSet<PathFragment> dirsToCreate)
Set<PathFragment> inputsToCreate, Set<PathFragment> dirsToCreate)
throws IOException, InterruptedException {
boolean gotStash =
SandboxStash.takeStashedSandbox(sandboxPath, mnemonic, getEnvironment(), outputs);
Expand Down

0 comments on commit c575c06

Please sign in to comment.