This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch jennis/cache_quota
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 7a2560034ad1178f11c09b34d4bb0acccd8ebe51
Author: James Ennis <[email protected]>
AuthorDate: Thu Apr 25 13:00:50 2019 +0100

    cascache.py: Clearly separate CASCache's public and local private methods
---
 buildstream/_cas/cascache.py | 116 +++++++++++++++++++++----------------------
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py
index 7933fa6..499c091 100644
--- a/buildstream/_cas/cascache.py
+++ b/buildstream/_cas/cascache.py
@@ -1229,64 +1229,6 @@ class CASQuota:
 
         return False
 
-    ################################################
-    #             Local Private Methods            #
-    ################################################
-
-    # _read_cache_size()
-    #
-    # Reads and returns the size of the artifact cache that's stored in the
-    # cache's size file
-    #
-    # Returns:
-    #    (int): The size of the artifact cache, as recorded in the file
-    #
-    def _read_cache_size(self):
-        size_file_path = os.path.join(self.casdir, CACHE_SIZE_FILE)
-
-        if not os.path.exists(size_file_path):
-            return None
-
-        with open(size_file_path, "r") as f:
-            size = f.read()
-
-        try:
-            num_size = int(size)
-        except ValueError as e:
-            raise CASCacheError("Size '{}' parsed from '{}' was not an 
integer".format(
-                size, size_file_path)) from e
-
-        return num_size
-
-    # _write_cache_size()
-    #
-    # Writes the given size of the artifact to the cache's size file
-    #
-    # Args:
-    #    size (int): The size of the artifact cache to record
-    #
-    def _write_cache_size(self, size):
-        assert isinstance(size, int)
-        size_file_path = os.path.join(self.casdir, CACHE_SIZE_FILE)
-        with utils.save_file_atomic(size_file_path, "w", 
tempdir=self.cas.tmpdir) as f:
-            f.write(str(size))
-
-    # _get_cache_volume_size()
-    #
-    # Get the available space and total space for the volume on
-    # which the artifact cache is located.
-    #
-    # Returns:
-    #    (int): The total number of bytes on the volume
-    #    (int): The number of available bytes on the volume
-    #
-    # NOTE: We use this stub to allow the test cases
-    #       to override what an artifact cache thinks
-    #       about it's disk size and available bytes.
-    #
-    def _get_cache_volume_size(self):
-        return utils._get_volume_size(self.casdir)
-
     # calculate_cache_quota()
     #
     # Calculates and sets the cache quota and lower threshold based on the
@@ -1503,6 +1445,64 @@ class CASQuota:
     def add_remove_callbacks(self, callback):
         self._remove_callbacks.append(callback)
 
+    ################################################
+    #             Local Private Methods            #
+    ################################################
+
+    # _read_cache_size()
+    #
+    # Reads and returns the size of the artifact cache that's stored in the
+    # cache's size file
+    #
+    # Returns:
+    #    (int): The size of the artifact cache, as recorded in the file
+    #
+    def _read_cache_size(self):
+        size_file_path = os.path.join(self.casdir, CACHE_SIZE_FILE)
+
+        if not os.path.exists(size_file_path):
+            return None
+
+        with open(size_file_path, "r") as f:
+            size = f.read()
+
+        try:
+            num_size = int(size)
+        except ValueError as e:
+            raise CASCacheError("Size '{}' parsed from '{}' was not an 
integer".format(
+                size, size_file_path)) from e
+
+        return num_size
+
+    # _write_cache_size()
+    #
+    # Writes the given size of the artifact to the cache's size file
+    #
+    # Args:
+    #    size (int): The size of the artifact cache to record
+    #
+    def _write_cache_size(self, size):
+        assert isinstance(size, int)
+        size_file_path = os.path.join(self.casdir, CACHE_SIZE_FILE)
+        with utils.save_file_atomic(size_file_path, "w", 
tempdir=self.cas.tmpdir) as f:
+            f.write(str(size))
+
+    # _get_cache_volume_size()
+    #
+    # Get the available space and total space for the volume on
+    # which the artifact cache is located.
+    #
+    # Returns:
+    #    (int): The total number of bytes on the volume
+    #    (int): The number of available bytes on the volume
+    #
+    # NOTE: We use this stub to allow the test cases
+    #       to override what an artifact cache thinks
+    #       about it's disk size and available bytes.
+    #
+    def _get_cache_volume_size(self):
+        return utils._get_volume_size(self.casdir)
+
 
 def _grouper(iterable, n):
     while True:

Reply via email to