This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch jennis/push_pull_artifacts in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit a790b2f3cbf1280980bb95acab9f009d86284640 Author: James Ennis <[email protected]> AuthorDate: Fri Jan 11 15:49:48 2019 +0000 artifactcache.py: API Cleanup - Add contains_ref() method This ensures that we can determine whether an artifact is locally cached (as well as an element) using the ArtifactCache API. --- buildstream/_artifactcache/artifactcache.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 383d173..14d40b7 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -424,18 +424,30 @@ class ArtifactCache(): # contains(): # - # Check whether the artifact for the specified Element is already available - # in the local artifact cache. + # Check whether the (project state) artifact of the specified Element is + # already available in the local artifact cache. # # Args: # element (Element): The Element to check # key (str): The cache key to use # - # Returns: True if the artifact is in the cache, False otherwise + # Returns: True if the Element's (project state) artifact is in the cache, + # False otherwise # def contains(self, element, key): ref = self.get_artifact_fullname(element, key) + return self.contains_ref(ref) + # contains_ref(): + # + # Check whether an artifact is already available in the local artifact cache. + # + # Args: + # ref (str): The ref to check + # + # Returns: True if the artifact is in the cache, False otherwise + # + def contains_ref(self, ref): return self.cas.contains(ref) # contains_subdir_artifact():
