summaryrefslogtreecommitdiff
path: root/src/buildstream/_cas/cascache.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/_cas/cascache.py')
-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,