This is an automated email from the ASF dual-hosted git repository. not-in-ldap pushed a commit to branch jennis/new_artifact_subcommands in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit e992e41cbda69af7453c2903e8c414b5f87951d4 Author: James Ennis <[email protected]> AuthorDate: Fri Jan 11 11:47:47 2019 +0000 artifactcache.py: Add prune() method to ArtifactCache Removal/pruning should be handled by ArtifactCache API. We should not be using CASCache methods to remove BuildStream's artifacts. --- buildstream/_artifactcache.py | 19 ++++++++++++++++--- buildstream/_cas/cascache.py | 1 - 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py index 16bde73..7bd5a53 100644 --- a/buildstream/_artifactcache.py +++ b/buildstream/_artifactcache.py @@ -462,8 +462,7 @@ class ArtifactCache(): # (int|None) The amount of space pruned from the repository in # Bytes, or None if defer_prune is True # - def remove(self, ref): - + def remove(self, ref, *, defer_prune=False): # Remove extract if not used by other ref tree = self.cas.resolve_ref(ref) ref_name, ref_hash = os.path.split(ref) @@ -482,7 +481,21 @@ class ArtifactCache(): if remove_extract: utils._force_rmtree(extract) - return self.cas.remove(ref) + return self.cas.remove(ref, defer_prune=defer_prune) + + # prune(): + # + # Prunes the artifact cache of objects which are unreachable from + # the repo + # + # Args: + # None + # + # Returns: + # (int) The amount of space pruned from the repository in bytes + # + def prune(self): + return self.cas.prune() # extract(): # diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py index adbd34c..f3eeb88 100644 --- a/buildstream/_cas/cascache.py +++ b/buildstream/_cas/cascache.py @@ -543,7 +543,6 @@ class CASCache(): # Bytes, or None if defer_prune is True # def remove(self, ref, *, defer_prune=False): - # Remove cache ref refpath = self._refpath(ref) if not os.path.exists(refpath):
