diff options
Diffstat (limited to 'buildstream/_artifactcache/artifactcache.py')
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 6be654210..e8ec28abc 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -87,21 +87,36 @@ class ArtifactCache(): ref = buildref(element, key) return _ostree.exists(self.repo, ref) - # remote_contains(): + # remote_contains_key(): # # Check whether the artifact for the specified Element is already available # in the remote artifact cache. # # Args: # element (Element): The Element to check - # strength (_KeyStrength): Either STRONG or WEAK key strength, or None + # key (str): The key to use # # Returns: True if the artifact is in the cache, False otherwise # - def remote_contains(self, element, strength=None): + def remote_contains_key(self, element, key): if not self.__remote_refs: return False + ref = buildref(element, key) + return ref in self.__remote_refs + + # remote_contains(): + # + # Check whether the artifact for the specified Element is already available + # in the remote artifact cache. + # + # Args: + # element (Element): The Element to check + # strength (_KeyStrength): Either STRONG or WEAK key strength, or None + # + # Returns: True if the artifact is in the cache, False otherwise + # + def remote_contains(self, element, strength=None): if strength is None: strength = _KeyStrength.STRONG if self.context.strict_build_plan else _KeyStrength.WEAK @@ -109,8 +124,7 @@ class ArtifactCache(): if not key: return False - ref = buildref(element, key) - return ref in self.__remote_refs + return self.remote_contains_key(element, key) # remove(): # |