You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 08:02:46 UTC

[buildstream] 13/16: cascache: refactor, extract "connection_string"

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch aevri/win32_receive_signals
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit e1c16f309ec2c55892207c04fa04d94f9c241a05
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Mon Oct 14 13:53:00 2019 +0100

    cascache: refactor, extract "connection_string"
    
    Prepare for other kinds of connection, by reducing repetition and having
    a single point for configuring the connection string.
---
 src/buildstream/_cas/cascache.py           | 2 +-
 src/buildstream/_cas/casdprocessmanager.py | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 3e8edce..4114d9f 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -100,7 +100,7 @@ class CASCache():
         assert self._casd_process_manager, "CASCache was instantiated without buildbox-casd"
 
         if not self._casd_channel:
-            self._casd_channel = grpc.insecure_channel('unix:' + self._casd_process_manager.socket_path)
+            self._casd_channel = grpc.insecure_channel(self._casd_process_manager.connection_string)
             self._casd_cas = remote_execution_pb2_grpc.ContentAddressableStorageStub(self._casd_channel)
             self._local_cas = local_cas_pb2_grpc.LocalContentAddressableStorageStub(self._casd_channel)
 
diff --git a/src/buildstream/_cas/casdprocessmanager.py b/src/buildstream/_cas/casdprocessmanager.py
index 6c40725..2f28910 100644
--- a/src/buildstream/_cas/casdprocessmanager.py
+++ b/src/buildstream/_cas/casdprocessmanager.py
@@ -50,10 +50,11 @@ class CASDProcessManager:
         # Place socket in global/user temporary directory to avoid hitting
         # the socket path length limit.
         self._socket_tempdir = tempfile.mkdtemp(prefix='buildstream')
-        self.socket_path = os.path.join(self._socket_tempdir, 'casd.sock')
+        socket_path = os.path.join(self._socket_tempdir, 'casd.sock')
+        self.connection_string = "unix:" + socket_path
 
         casd_args = [utils.get_host_tool('buildbox-casd')]
-        casd_args.append('--bind=unix:' + self.socket_path)
+        casd_args.append('--bind=' + self.connection_string)
         casd_args.append('--log-level=' + log_level.value)
 
         if cache_quota is not None: