summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFinn <finn.ball@codethink.co.uk>2018-12-04 16:16:04 +0000
committerFinn <finn.ball@codethink.co.uk>2018-12-07 14:26:03 +0000
commit617b581e39e6253d7f43e86cc91e527e5a18c861 (patch)
tree0990b2a09c6e016adf41ae21cc38a60d95671190
parent04b872e4a5b1933d29988f00fbd430dcc13e08af (diff)
downloadbuildstream-617b581e39e6253d7f43e86cc91e527e5a18c861.tar.gz
Refactored capabilities stub.
-rw-r--r--buildstream/_artifactcache/cascache.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 78b53efd4..96d938987 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -1140,9 +1140,9 @@ class CASRemote():
self.cas = None
self.batch_update_supported = None
self.batch_read_supported = None
- self.capabilities = None
self.max_batch_total_size_bytes = None
+ self._capabilities_stub = None
self._ref_storage_stub = None
def init(self):
@@ -1181,13 +1181,13 @@ class CASRemote():
self.bytestream = bytestream_pb2_grpc.ByteStreamStub(self.channel)
self.cas = remote_execution_pb2_grpc.ContentAddressableStorageStub(self.channel)
- self.capabilities = remote_execution_pb2_grpc.CapabilitiesStub(self.channel)
+ self._capabilities_stub = remote_execution_pb2_grpc.CapabilitiesStub(self.channel)
self._ref_storage_stub = buildstream_pb2_grpc.ReferenceStorageStub(self.channel)
self.max_batch_total_size_bytes = _MAX_PAYLOAD_BYTES
try:
request = remote_execution_pb2.GetCapabilitiesRequest()
- response = self.capabilities.GetCapabilities(request)
+ response = self._capabilities_stub.GetCapabilities(request)
server_max_batch_total_size_bytes = response.cache_capabilities.max_batch_total_size_bytes
if 0 < server_max_batch_total_size_bytes < self.max_batch_total_size_bytes:
self.max_batch_total_size_bytes = server_max_batch_total_size_bytes
@@ -1219,6 +1219,10 @@ class CASRemote():
self._initialized = True
+ def get_capabilities(self):
+ request = remote_execution_pb2.GetCapabilitiesRequest()
+ return self._capabilities_stub.GetCapabilities(request)
+
def get_reference(self, key):
request = buildstream_pb2.GetReferenceRequest()
request.key = key