Parent Issue
Part of #118 (FUSE-based Archive & Remote Browsing Feature)
Summary
Create tnc/mount.py with MountManager class containing core infrastructure for FUSE-based mounting.
Tasks
Data Structures
MountManager Class
Data Structures Detail
@dataclass
class ToolAvailability:
archivemount: bool = False
fuse_archive: bool = False
sshfs: bool = False
rclone: bool = False
p7zip: bool = False
unrar: bool = False
@dataclass
class MountInfo:
mount_point: Path
source: str
mount_type: str # 'archive', 'sftp', 'rclone'
timestamp: float
@dataclass
class MountResult:
success: bool
mount_point: Path | None = None
error: str = ''
Archive Extensions
ARCHIVE_EXTENSIONS = {
'.tar.gz', '.tar.bz2', '.tar.xz', '.tgz', '.tbz2', '.txz',
'.zip', '.7z', '.rar',
}
Testing
- Test ToolAvailability defaults to all False
- Test MountInfo stores values correctly
- Test tool detection with mocked
shutil.which()
- Test
is_archive() for all supported extensions
- Test
is_archive() returns False for non-archives
- Test
_generate_mount_hash() generates consistent, filesystem-safe hashes
- Test
can_mount_archive() returns True when archivemount or fuse-archive available
Files
- Create:
tnc/mount.py
- Create:
tests/test_mount.py
Parent Issue
Part of #118 (FUSE-based Archive & Remote Browsing Feature)
Summary
Create
tnc/mount.pywith MountManager class containing core infrastructure for FUSE-based mounting.Tasks
Data Structures
ToolAvailabilitydataclass to track available toolsMountInfodataclass to store mount informationMountResultdataclass for mount operation resultsMountManager Class
MOUNT_BASE = Path('/tmp/tnc-mounts')ARCHIVE_EXTENSIONSset with supported formats__init__()that calls_detect_tools()and_cleanup_stale_mounts()_detect_tools()usingshutil.which()for each toolis_archive(path)to check if path is supported archive format_generate_mount_hash(source)for unique mount point namingcan_mount_archive()to check if archivemount or fuse-archive availableData Structures Detail
Archive Extensions
Testing
shutil.which()is_archive()for all supported extensionsis_archive()returns False for non-archives_generate_mount_hash()generates consistent, filesystem-safe hashescan_mount_archive()returns True when archivemount or fuse-archive availableFiles
tnc/mount.pytests/test_mount.py