You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:54:11 UTC

[buildstream] 02/10: cascache.py: use buildbox-casd when checking whether a file is cached

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch juerg/public-data
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d1bdfc4acaaa7934e7367c299df22b02eca5bddb
Author: Abderrahim Kitouni <ak...@gnome.org>
AuthorDate: Wed Mar 25 17:22:24 2020 +0100

    cascache.py: use buildbox-casd when checking whether a file is cached
    
    this lets buildbox-casd know it is needed and not delete it when pruning
---
 src/buildstream/_cas/cascache.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 48b700c..03be75c 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -175,7 +175,13 @@ class CASCache:
     # Returns: True if the file is in the cache, False otherwise
     #
     def contains_file(self, digest):
-        return os.path.exists(self.objpath(digest))
+        cas = self.get_cas()
+
+        request = remote_execution_pb2.FindMissingBlobsRequest()
+        request.blob_digests.append(digest)
+
+        response = cas.FindMissingBlobs(request)
+        return len(response.missing_blob_digests) == 0
 
     # contains_directory():
     #