diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-08 09:06:33 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-08-09 09:50:15 +0000 |
commit | 65238dfb61408b31cefe692dda206bc8fd346ae8 (patch) | |
tree | 69554314e978fd0ef0a4bae722fa22314902c8fc | |
parent | b8d801269939bb17d2f2e22e371019a9a418a44d (diff) | |
download | buildstream-65238dfb61408b31cefe692dda206bc8fd346ae8.tar.gz |
cascache.py: Add new contains_file() method
-rw-r--r-- | src/buildstream/_cas/cascache.py | 12 |
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, |