Island: Add comment/documentation about delete_file()'s idempotence

This commit is contained in:
Mike Salvatore 2022-04-27 09:27:54 -04:00
parent 1e9627470c
commit 3bf0695a66
2 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,7 @@ class DirectoryFileStorageService(IFileStorageService):
logger.debug(f"Deleting {safe_file_path}") logger.debug(f"Deleting {safe_file_path}")
safe_file_path.unlink() safe_file_path.unlink()
except FileNotFoundError: except FileNotFoundError:
# This method is idempotent.
pass pass
def _get_safe_file_path(self, unsafe_file_name: str): def _get_safe_file_path(self, unsafe_file_name: str):

View File

@ -38,6 +38,9 @@ class IFileStorageService(metaclass=abc.ABCMeta):
""" """
Delete a file Delete a file
This method will delete the file specified by `unsafe_file_name`. This operation is
idempotent and will succeed if the file to be deleted does not exist.
:param unsafe_file_name: An unsanitized file name that identifies the file to be deleted :param unsafe_file_name: An unsanitized file name that identifies the file to be deleted
""" """
pass pass