diff options
Diffstat (limited to 'src/buildstream/_elementsources.py')
-rw-r--r-- | src/buildstream/_elementsources.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/buildstream/_elementsources.py b/src/buildstream/_elementsources.py index a15d20ecb..a3e510543 100644 --- a/src/buildstream/_elementsources.py +++ b/src/buildstream/_elementsources.py @@ -293,7 +293,7 @@ class ElementSources: length = min(len(key), context.log_key_length) return key[:length] - # cached(): + # query_cache(): # # Check if the element sources are cached in CAS, generating the source # cache keys if needed. @@ -301,10 +301,7 @@ class ElementSources: # Returns: # (bool): True if the element sources are cached # - def cached(self): - if self._cached is not None: - return self._cached - + def query_cache(self): cas = self._context.get_cascache() elementsourcescache = self._elementsourcescache @@ -321,6 +318,18 @@ class ElementSources: self._cached = True return True + # cached() + # + # Return whether the element sources are cached in CAS. This must be + # called only when all sources are resolved. + # + # Returns: + # (bool): True if the element sources are cached + # + def cached(self): + assert self._cached is not None + return self._cached + # is_resolved(): # # Get whether all sources of the element are resolved @@ -368,6 +377,8 @@ class ElementSources: unique_key = self.get_unique_key() self._cache_key = _cachekey.generate_key(unique_key) + self.query_cache() + # preflight(): # # A internal wrapper for calling the abstract preflight() method on |