summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2019-04-24 11:53:37 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2019-04-24 11:53:47 +0100
commitc58f503bc62f58d4cc3f9483c50505ed90bccd4d (patch)
tree3b1a4e0a715531d1a24f57a172b00b1cacabf236
parent87cf8e95c848c350518882bdb0d9b94c69388721 (diff)
downloadbuildstream-shared/split_out_update_state.tar.gz
Fixes: Move is_cached out of StrictCacheKey, eliminate settingshared/split_out_update_state
weak_cached
-rw-r--r--buildstream/_cachekey/cachekey.py15
-rw-r--r--buildstream/_cachekey/strictcachekey.py20
2 files changed, 13 insertions, 22 deletions
diff --git a/buildstream/_cachekey/cachekey.py b/buildstream/_cachekey/cachekey.py
index 3a714586f..0279ba382 100644
--- a/buildstream/_cachekey/cachekey.py
+++ b/buildstream/_cachekey/cachekey.py
@@ -56,8 +56,6 @@ class CacheKey():
def maybe_schedule_assemble(self):
raise ImplError("CacheKey does not implement maybe_schedule_assemble()")
- def is_cached(self, strength):
- raise ImplError("CacheKey does not implement is_cached()")
def tracking_done(self):
raise ImplError("CacheKey does not implement tracking_done()")
@@ -68,6 +66,19 @@ class CacheKey():
def assemble_done(self):
raise ImplError("CacheKey does not implement assemble_done()")
+ # PUBLIC METHODS
+
+ def is_cached(self, strength):
+ if strength == _KeyStrength.STRONG:
+ return self._strong_cached
+ elif strength == _KeyStrength.STRICT:
+ # TODO: Understand difference between strict cached and strong cached
+ raise AssertionError("I have no idea why it's strong_cached and not strict_cached")
+ elif strength == _KeyStrength.WEAK:
+ return self._weak_cached
+ else:
+ raise AssertionError("Bad key strength value {}".format(strength))
+
# PRIVATE METHODS
def _update_weak_cached(self):
diff --git a/buildstream/_cachekey/strictcachekey.py b/buildstream/_cachekey/strictcachekey.py
index e984886a7..3ab54e3d3 100644
--- a/buildstream/_cachekey/strictcachekey.py
+++ b/buildstream/_cachekey/strictcachekey.py
@@ -48,11 +48,6 @@ class StrictCacheKey(CacheKey):
self._update_strong_cached()
- # TODO: Figure out why _weak_cached is only set if it's identical
- # NOTE: Elements with no dependencies have identical strict and weak keys.
- if self._strict_key == self._weak_key:
- self._update_weak_cached()
-
self._element._check_ready_for_runtime()
def get_key(self, strength):
@@ -75,17 +70,6 @@ class StrictCacheKey(CacheKey):
not self._element._pull_pending()):
self._element._schedule_assemble()
- def is_cached(self, strength):
- if strength == _KeyStrength.STRONG:
- return self._strong_cached
- elif strength == _KeyStrength.STRICT:
- # TODO: Understand difference between strict cached and strong cached
- raise AssertionError("I have no idea why it's strong_cached and not strict_cached")
- elif strength == _KeyStrength.WEAK:
- return self._weak_cached
- else:
- raise AssertionError("Bad key strength value {}".format(strength))
-
def tracking_done(self):
# this generator includes this corresponding element
for element in self._element._reverse_deps_for_update():
@@ -96,8 +80,6 @@ class StrictCacheKey(CacheKey):
# Cache keys are already known before this.
# Element may become cached.
self._update_strong_cached()
- if self._weak_key == self._strict_key:
- self._update_weak_cached()
# If it failed to pull, it should assemble.
self._element._maybe_schedule_assemble()
@@ -106,5 +88,3 @@ class StrictCacheKey(CacheKey):
# Cache keys are already known before this.
# Element may become cached.
self._update_strong_cached()
- if self._weak_key == self._strict_key:
- self._update_weak_cached()