diff --git a/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java b/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java index 71b3f2ccf8c0a3..2d8b9f45a040db 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java +++ b/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java @@ -266,11 +266,6 @@ private ListenableFuture handleStatus( MoreExecutors.directExecutor()); } - @Override - public CacheCapabilities getCacheCapabilities() throws IOException { - return channel.getServerCapabilities().getCacheCapabilities(); - } - @Override public ServerCapabilities getServerCapabilities() throws IOException { return channel.getServerCapabilities(); diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java index 0262fe1a5fb9d5..77cd11016428c6 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java @@ -108,10 +108,7 @@ public RemoteCache( } public CacheCapabilities getRemoteCacheCapabilities() throws IOException { - if (remoteCacheClient == null) { - return CacheCapabilities.getDefaultInstance(); - } - return remoteCacheClient.getCacheCapabilities(); + return getServerCapabilities().getCacheCapabilities(); } public ListenableFuture getRemoteAuthority() { diff --git a/src/main/java/com/google/devtools/build/lib/remote/common/RemoteCacheClient.java b/src/main/java/com/google/devtools/build/lib/remote/common/RemoteCacheClient.java index d0fc235e8ffd48..627267b09c9fed 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/common/RemoteCacheClient.java +++ b/src/main/java/com/google/devtools/build/lib/remote/common/RemoteCacheClient.java @@ -34,8 +34,6 @@ *

Implementations must be thread-safe. */ public interface RemoteCacheClient extends MissingDigestsFinder { - CacheCapabilities getCacheCapabilities() throws IOException; - ServerCapabilities getServerCapabilities() throws IOException; ListenableFuture getAuthority(); diff --git a/src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java b/src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java index 5afed543d5203d..bc09adcc0ecba7 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java +++ b/src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java @@ -246,17 +246,13 @@ private void checkActionResult(ActionResult actionResult) throws IOException { } @Override - public CacheCapabilities getCacheCapabilities() { - return CacheCapabilities.newBuilder() + public ServerCapabilities getServerCapabilities() { + var cacheCapabilities = CacheCapabilities.newBuilder() .setActionCacheUpdateCapabilities( ActionCacheUpdateCapabilities.newBuilder().setUpdateEnabled(true).build()) .setSymlinkAbsolutePathStrategy(SymlinkAbsolutePathStrategy.Value.ALLOWED) .build(); - } - - @Override - public ServerCapabilities getServerCapabilities() { - return ServerCapabilities.newBuilder().setCacheCapabilities(getCacheCapabilities()).build(); + return ServerCapabilities.newBuilder().setCacheCapabilities(cacheCapabilities).build(); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/remote/http/HttpCacheClient.java b/src/main/java/com/google/devtools/build/lib/remote/http/HttpCacheClient.java index b83f2afb8fb792..2667dc0f44c603 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/http/HttpCacheClient.java +++ b/src/main/java/com/google/devtools/build/lib/remote/http/HttpCacheClient.java @@ -607,17 +607,13 @@ private void getAfterCredentialRefresh(DownloadCommand cmd, SettableFuture } @Override - public CacheCapabilities getCacheCapabilities() { - return CacheCapabilities.newBuilder() + public ServerCapabilities getServerCapabilities() { + var cacheCapabilities = CacheCapabilities.newBuilder() .setActionCacheUpdateCapabilities( ActionCacheUpdateCapabilities.newBuilder().setUpdateEnabled(true).build()) .setSymlinkAbsolutePathStrategy(SymlinkAbsolutePathStrategy.Value.ALLOWED) .build(); - } - - @Override - public ServerCapabilities getServerCapabilities() { - return ServerCapabilities.newBuilder().setCacheCapabilities(getCacheCapabilities()).build(); + return ServerCapabilities.newBuilder().setCacheCapabilities(cacheCapabilities).build(); } @Override diff --git a/src/test/java/com/google/devtools/build/lib/remote/util/InMemoryCacheClient.java b/src/test/java/com/google/devtools/build/lib/remote/util/InMemoryCacheClient.java index fb8261a09f7c67..c11e0031de722e 100644 --- a/src/test/java/com/google/devtools/build/lib/remote/util/InMemoryCacheClient.java +++ b/src/test/java/com/google/devtools/build/lib/remote/util/InMemoryCacheClient.java @@ -110,17 +110,13 @@ public ListenableFuture downloadBlob( } @Override - public CacheCapabilities getCacheCapabilities() { - return CacheCapabilities.newBuilder() + public ServerCapabilities getServerCapabilities() { + var cacheCapabilities = CacheCapabilities.newBuilder() .setActionCacheUpdateCapabilities( ActionCacheUpdateCapabilities.newBuilder().setUpdateEnabled(true).build()) .setSymlinkAbsolutePathStrategy(SymlinkAbsolutePathStrategy.Value.ALLOWED) .build(); - } - - @Override - public ServerCapabilities getServerCapabilities() { - return ServerCapabilities.getDefaultInstance(); + return ServerCapabilities.newBuilder().setCacheCapabilities(cacheCapabilities).build(); } @Override