summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-08-08 09:06:33 +0100
committerJames Ennis <james.ennis@codethink.com>2019-08-09 07:48:17 +0000
commit5a214396a8569471cae58468a5829b4cdb3a94b1 (patch)
tree498ab7076ba3a126f185ddc80fcd9db9b56f0962
parent1df45eaf26e8829fff4fff7381de15b3e35b10ad (diff)
downloadbuildstream-5a214396a8569471cae58468a5829b4cdb3a94b1.tar.gz
cascache.py: Add new contains_file() method
-rw-r--r--src/buildstream/_cas/cascache.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 192d7992b..ff16480b1 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -116,6 +116,18 @@ class CASCache():
# This assumes that the repository doesn't have any dangling pointers
return os.path.exists(refpath)
+ # contains_file():
+ #
+ # Check whether a digest corresponds to a file which exists in CAS
+ #
+ # Args:
+ # digest (Digest): The file digest to check
+ #
+ # Returns: True if the file is in the cache, False otherwise
+ #
+ def contains_file(self, digest):
+ return os.path.exists(self.objpath(digest))
+
# contains_directory():
#
# Check whether the specified directory and subdirectories are in the cache,