summaryrefslogtreecommitdiff
path: root/buildstream/_artifactcache/cascache.py
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2018-07-17 13:05:51 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-07-18 15:07:24 +0900
commitdc17de387961ba54c4742ba504ba7314c7da16aa (patch)
treec7f225c3586ee02419a4be03e288bd604af1020d /buildstream/_artifactcache/cascache.py
parent7229d2e5d03227f174ac359fd1a73ef50c071c5a (diff)
downloadbuildstream-dc17de387961ba54c4742ba504ba7314c7da16aa.tar.gz
Clean the artifact cache when we hit the cache quota
When the cache quota is hit, we will remove any elements not required for the current build, until our cache is only filled halfway.
Diffstat (limited to 'buildstream/_artifactcache/cascache.py')
-rw-r--r--buildstream/_artifactcache/cascache.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 4f1d8ac18..1e84c282f 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -450,6 +450,12 @@ class CASCache(ArtifactCache):
except FileNotFoundError as e:
raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e
+ def update_atime(self, ref):
+ try:
+ os.utime(self._refpath(ref))
+ except FileNotFoundError as e:
+ raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e
+
def calculate_cache_size(self):
if self.cache_size is None:
self.cache_size = utils._get_dir_size(self.casdir)