diff options
Diffstat (limited to 'src/buildstream/storage/directory.py')
-rw-r--r-- | src/buildstream/storage/directory.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/buildstream/storage/directory.py b/src/buildstream/storage/directory.py index 55cc717f2..bb9d78f7e 100644 --- a/src/buildstream/storage/directory.py +++ b/src/buildstream/storage/directory.py @@ -196,6 +196,32 @@ class Directory: and effective space used may be lower than this number due to deduplication. """ raise NotImplementedError() + def exists(self, *paths: str, follow_symlinks: bool = False) -> bool: + """ Check whether the specified path exists. + + Args: + *paths: A list of strings which are all path components. + follow_symlinks: True to follow symlinks. + + Returns: + True if the path exists, False otherwise. + """ + raise NotImplementedError() + + def open_file(self, *paths: str, mode: str = "r"): + """ Open file and return a corresponding file object. In text mode, + UTF-8 is used as encoding. + + Args: + *paths: A list of strings which are all path components. + mode (str): An optional string that specifies the mode in which the file is opened. + """ + raise NotImplementedError() + + def _create_empty_file(self, *paths): + with self.open_file(*paths, mode="w"): + pass + # FileType: # |