diff options
author | Jürg Billeter <j@bitron.ch> | 2019-07-17 17:44:31 +0200 |
---|---|---|
committer | Darius Makovsky <traveltissues@protonmail.com> | 2019-08-19 12:27:54 +0100 |
commit | 5924dcb8c4e6d815b0ce813f663cc5b789773a7f (patch) | |
tree | ac1035a2591db465571a35acd4062a3e978a5716 | |
parent | 33f2655738cf216545d0221c7e64a1d4aae94950 (diff) | |
download | buildstream-5924dcb8c4e6d815b0ce813f663cc5b789773a7f.tar.gz |
cascache.py: Pass cache quota to casd
-rw-r--r-- | src/buildstream/_cas/cascache.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index c39167b6d..8a508da17 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -51,7 +51,7 @@ CACHE_SIZE_FILE = "cache_size" # class CASCache(): - def __init__(self, path, *, casd=True): + def __init__(self, path, *, casd=True, cache_quota=None, protect_session_blobs=True): self.casdir = os.path.join(path, 'cas') self.tmpdir = os.path.join(path, 'tmp') os.makedirs(os.path.join(self.casdir, 'refs', 'heads'), exist_ok=True) @@ -70,8 +70,18 @@ class CASCache(): pass if casd: - casd_path = utils.get_host_tool('buildbox-casd') - self._casd_process = subprocess.Popen([casd_path, '--bind=unix:' + casd_socket_name, path], cwd=path) + casd_args = [utils.get_host_tool('buildbox-casd')] + casd_args.append('--bind=unix:' + casd_socket_name) + + if cache_quota is not None: + casd_args.append('--quota-high={}'.format(int(cache_quota))) + casd_args.append('--quota-low={}'.format(int(cache_quota / 2))) + + if protect_session_blobs: + casd_args.append('--protect-session-blobs') + + casd_args.append(path) + self._casd_process = subprocess.Popen(casd_args, cwd=path) else: self._casd_process = None |