dlt.common.storages.file_storage
FileStorage Objects
class FileStorage()
touch_file
def touch_file(relative_path: str) -> None
Touch file, assumes single writer
list_folder_files
def list_folder_files(relative_path: str, to_root: bool = True) -> List[str]
List all files in relative_path folder
Arguments:
relative_pathstr - A path to folder, relative to storage rootto_rootbool, optional - If True returns paths to files in relation to root, if False, returns just file names. Defaults to True.
Returns:
List[str]- A list of file names with optional path as perto_rootparameter
link_hard_with_fallback
@staticmethod
def link_hard_with_fallback(external_file_path: str,
to_file_path: str) -> None
Try to create a hardlink and fallback to copying when filesystem doesn't support links
atomic_rename
def atomic_rename(from_relative_path: str, to_relative_path: str) -> None
Renames a path using os.rename which is atomic on POSIX, Windows and NFS v4.
Method falls back to non-atomic method in following cases:
- On Windows when destination file exists
- If underlying file system does not support atomic rename
- All buckets mapped with FUSE are not atomic
rename_tree
def rename_tree(from_relative_path: str, to_relative_path: str) -> None
Renames a tree using os.rename if possible making it atomic
If we get 'too many open files' or a transient Windows access denied
during directory rename, rename_tree_files is used. On Windows, NTFS
may briefly hold directory handles after file operations inside the
tree, so EACCES/EPERM are retried with a short backoff before falling
back (same strategy as pip).