From 51d0cd1b7bf4c34e545a0776ebc6e660e839d3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Wed, 27 Feb 2019 11:17:05 +0100 Subject: _casbaseddirectory.py: Rename `ref` field to `__digest` External access should use `_get_digest()`. This is in preparation for lazy digest calculation. --- buildstream/storage/_casbaseddirectory.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'buildstream') 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]) -- cgit v1.2.1