diff options
author | Jürg Billeter <j@bitron.ch> | 2019-07-17 17:44:31 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-08-20 08:09:52 +0200 |
commit | fdd31d8c2b731dc5d2a55f1d632d7709b6462ae9 (patch) | |
tree | d342989ecc017fc341e65b88596a3da8c5fd3f57 | |
parent | 4bb791e1f4c7840058cacef858d7eb99e408b0bb (diff) | |
download | buildstream-fdd31d8c2b731dc5d2a55f1d632d7709b6462ae9.tar.gz |
cascache.py: Pass cache quota to casd
-rw-r--r-- | src/buildstream/_cas/cascache.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 8d2ed02fb..b8d651a0c 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -52,10 +52,11 @@ CACHE_SIZE_FILE = "cache_size" # path (str): The root directory for the CAS repository # casd (bool): True to spawn buildbox-casd (default) or False (testing only) # cache_quota (int): User configured cache quota +# protect_session_blobs (bool): Disable expiry for blobs used in the current session # 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) @@ -71,6 +72,13 @@ class CASCache(): casd_args = [utils.get_host_tool('buildbox-casd')] casd_args.append('--bind=unix:' + self._casd_socket_path) + 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) self._casd_start_time = time.time() |