summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-12-09 17:26:10 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2019-12-09 18:41:02 +0000
commit370d6704b5cc1ee1dafdaffe3ba0702f8de9646e (patch)
tree4365b574e83f3b2af575fe9167700d1f9a816771
parent0e537c2a33532f0960e8e6fe281e3399ba3440da (diff)
downloadbuildstream-bschubert/optimize-consistency-no-fetch-optimized.tar.gz
types.py: Completely remove 'Consistency'bschubert/optimize-consistency-no-fetch-optimized
'Consistency' is not needed anymore, now that we have everything in place to not use it
-rw-r--r--src/buildstream/element.py19
-rw-r--r--src/buildstream/types.py29
2 files changed, 9 insertions, 39 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index fee05ba2b..73c7dccbb 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -100,7 +100,7 @@ from .plugin import Plugin
from .sandbox import SandboxFlags, SandboxCommandError
from .sandbox._config import SandboxConfig
from .sandbox._sandboxremote import SandboxRemote
-from .types import Consistency, CoreWarnings, Scope, _CacheBuildTrees, _KeyStrength
+from .types import CoreWarnings, Scope, _CacheBuildTrees, _KeyStrength
from ._artifact import Artifact
from .storage.directory import Directory
@@ -257,7 +257,7 @@ class Element(Plugin):
self.__strict_cache_key = None # Our cached cache key for strict builds
self.__artifacts = context.artifactcache # Artifact cache
self.__sourcecache = context.sourcecache # Source cache
- self.__consistency = Consistency.INCONSISTENT # Cached overall consistency state
+ self.__is_resolved = False # Whether the source is fully resolved or not
self.__assemble_scheduled = False # Element is scheduled to be assembled
self.__assemble_done = False # Element is assembled
self.__pull_done = False # Whether pull was attempted
@@ -1277,7 +1277,7 @@ class Element(Plugin):
# pull/build, however should not occur during initialization
# (since we will eventualyl visit reverse dependencies during
# our initialization anyway).
- self.__update_source_state()
+ self.__update_resolved_state()
# _get_display_key():
#
@@ -1326,7 +1326,7 @@ class Element(Plugin):
def _tracking_done(self):
# Tracking may change the sources' refs, and therefore the
# source state. We need to update source state.
- self.__update_source_state()
+ self.__update_resolved_state()
# Check whether sources are now cached.
# This is done here so that we don't throw an exception trying to show the pipeline at the end
@@ -2191,7 +2191,7 @@ class Element(Plugin):
# Get whether all sources of the element are resolved
#
def _has_all_sources_resolved(self):
- return self.__consistency >= Consistency.RESOLVED
+ return self.__is_resolved
# _has_all_sources_cached()
#
@@ -2353,19 +2353,18 @@ class Element(Plugin):
# __update_source_state()
#
- # Updates source consistency state
+ # Updates source's resolved state
#
# An element's source state must be resolved before it may compute
# cache keys, because the source's ref, whether defined in yaml or
# from the workspace, is a component of the element's cache keys.
#
- def __update_source_state(self):
- # Determine overall consistency of the element
+ def __update_resolved_state(self):
for source in self.__sources:
if not source.is_resolved():
break
else:
- self.__consistency = Consistency.RESOLVED
+ self.__is_resolved = True
self.__update_cache_keys()
# __can_build_incrementally()
@@ -3011,7 +3010,7 @@ class Element(Plugin):
# Note that it does not update *all* cache keys - In non-strict mode, the
# strong cache key is updated in __update_cache_key_non_strict()
#
- # If the element's consistency is Consistency.INCONSISTENT this is
+ # If the element's is not resolved, this is
# a no-op (since inconsistent elements cannot have cache keys).
#
# The weak and strict cache keys will be calculated if not already
diff --git a/src/buildstream/types.py b/src/buildstream/types.py
index dadadb9ec..6e88672b8 100644
--- a/src/buildstream/types.py
+++ b/src/buildstream/types.py
@@ -116,35 +116,6 @@ class Scope(FastEnum):
"""
-class Consistency(FastEnum):
- """Defines the various consistency states of a :class:`.Source`.
- """
-
- INCONSISTENT = 0
- """Inconsistent
-
- Inconsistent sources have no explicit reference set. They cannot
- produce a cache key, be fetched or staged. They can only be tracked.
- """
-
- RESOLVED = 1
- """Resolved
-
- Resolved sources have a reference and can produce a cache key and
- be fetched, however they cannot be staged.
- """
-
- def __ge__(self, other):
- if self.__class__ is not other.__class__:
- raise ValueError("Unexpected comparison between {} and {}".format(self, repr(other)))
- return self.value >= other.value
-
- def __lt__(self, other):
- if self.__class__ is not other.__class__:
- raise ValueError("Unexpected comparison between {} and {}".format(self, repr(other)))
- return self.value < other.value
-
-
class CoreWarnings:
"""CoreWarnings()