Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.4.0] Ensure disk cache root exists #19225

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ private static DiskCacheClient createDiskCache(
throws IOException {
Path cacheDir =
workingDirectory.getRelative(Preconditions.checkNotNull(diskCachePath, "diskCachePath"));
if (!cacheDir.exists()) {
cacheDir.createDirectoryAndParents();
}
return new DiskCacheClient(cacheDir, verifyDownloads, checkActionResult, digestUtil);
}

Expand All @@ -153,12 +150,6 @@ private static RemoteCacheClient createDiskAndHttpCache(
AuthAndTLSOptions authAndTlsOptions,
DigestUtil digestUtil)
throws IOException {
Path cacheDir =
workingDirectory.getRelative(Preconditions.checkNotNull(diskCachePath, "diskCachePath"));
if (!cacheDir.exists()) {
cacheDir.createDirectoryAndParents();
}

RemoteCacheClient httpCache = createHttp(options, cred, authAndTlsOptions, digestUtil);
return createDiskAndRemoteClient(
workingDirectory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DiskCacheClient implements RemoteCacheClient {
* is {@code true} and blobs referenced by the AC are missing, ignore the AC.
*/
public DiskCacheClient(
Path root, boolean verifyDownloads, boolean checkActionResult, DigestUtil digestUtil) {
Path root, boolean verifyDownloads, boolean checkActionResult, DigestUtil digestUtil) throws IOException {
this.verifyDownloads = verifyDownloads;
this.checkActionResult = checkActionResult;
this.digestUtil = digestUtil;
Expand All @@ -71,6 +71,8 @@ public DiskCacheClient(
root.getChild(
Ascii.toLowerCase(digestUtil.getDigestFunction().getValueDescriptor().getName()));
}

this.root.createDirectoryAndParents();
}

/** Returns {@code true} if the provided {@code key} is stored in the CAS. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class OnDiskBlobStoreCache extends RemoteCache {
.setSymlinkAbsolutePathStrategy(SymlinkAbsolutePathStrategy.Value.ALLOWED)
.build();

public OnDiskBlobStoreCache(RemoteOptions options, Path cacheDir, DigestUtil digestUtil) {
public OnDiskBlobStoreCache(RemoteOptions options, Path cacheDir, DigestUtil digestUtil)
throws IOException {
super(
CAPABILITIES,
new DiskCacheClient(
Expand Down