summaryrefslogtreecommitdiff
path: root/buildstream/storage
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-27 11:17:05 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-01 05:11:55 +0000
commit51d0cd1b7bf4c34e545a0776ebc6e660e839d3dd (patch)
tree7a60528d93b70abda7ec8837be825714bf2bdd03 /buildstream/storage
parente825138e34433526f9b840807a2040bb16614b02 (diff)
downloadbuildstream-51d0cd1b7bf4c34e545a0776ebc6e660e839d3dd.tar.gz
_casbaseddirectory.py: Rename `ref` field to `__digest`
External access should use `_get_digest()`. This is in preparation for lazy digest calculation.
Diffstat (limited to 'buildstream/storage')
-rw-r--r--buildstream/storage/_casbaseddirectory.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index 45b0b8dfe..e7f39e256 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -114,7 +114,7 @@ class CasBasedDirectory(Directory):
with open(self.cas_cache.objpath(digest), 'rb') as f:
self.pb2_directory.ParseFromString(f.read())
- self.ref = digest
+ self.__digest = digest
self.index = {}
self.parent = parent
self._directory_read = False
@@ -141,7 +141,7 @@ class CasBasedDirectory(Directory):
if caller:
old_dir = self._find_pb2_entry(caller.filename)
self.cas_cache.add_object(digest=old_dir.digest, buffer=caller.pb2_directory.SerializeToString())
- self.ref = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
+ self.__digest = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
if self.parent:
self.parent._recalculate_recursing_up(self)
@@ -159,9 +159,9 @@ class CasBasedDirectory(Directory):
subdir._recalculate_recursing_down(entry)
if parent:
- self.ref = self.cas_cache.add_object(digest=parent.digest, buffer=self.pb2_directory.SerializeToString())
+ self.__digest = self.cas_cache.add_object(digest=parent.digest, buffer=self.pb2_directory.SerializeToString())
else:
- self.ref = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
+ self.__digest = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
# We don't need to do anything more than that; files were already added ealier, and symlinks are
# part of the directory structure.
@@ -588,9 +588,9 @@ class CasBasedDirectory(Directory):
# (Digest): The Digest protobuf object for the Directory protobuf
#
def _get_digest(self):
- if not self.ref:
- self.ref = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
- return self.ref
+ if not self.__digest:
+ self.__digest = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
+ return self.__digest
def _objpath(self, path):
subdir = self.descend(path[:-1])