Skip to content

FUSE: Implement archive mounting operations #10

@efimsky

Description

@efimsky

Parent Issue

Part of #118 (FUSE-based Archive & Remote Browsing Feature)

Summary

Implement archive mounting, unmounting, and cleanup operations in MountManager.

Dependencies

Requires #119 (MountManager core infrastructure)

Tasks

Mount Operations

  • Implement mount_archive(archive_path) - Mount archive using archivemount or fuse-archive
    • Check if already mounted (reuse existing mount)
    • Generate mount point path using hash
    • Create mount point directory
    • Execute archivemount or fuse-archive via subprocess
    • Track mount in active_mounts
    • Return mount point Path or None on failure

Unmount Operations

  • Implement unmount(mount_point) - Unmount a single mount

    • Call fusermount -u on Linux or umount on macOS
    • Remove from active_mounts
    • Clean up mount point directory
    • Return success boolean
  • Implement unmount_all() - Unmount all active mounts

    • Iterate over copy of active_mounts keys
    • Call unmount() for each

Cleanup Operations

  • Implement _cleanup_stale_mounts() - Clean crashed session leftovers

    • Check if MOUNT_BASE exists
    • Iterate over subdirectories
    • Try to unmount each (may not be mounted)
    • Remove directories
  • Implement _try_unmount(mount_point) - Best-effort unmount without tracking

Utility Methods

  • Implement is_in_mount(path) - Check if path is inside any active mount
  • Implement get_mount_for_path(path) - Get MountInfo for path if in mount

Testing

  • Test mount_archive() creates mount point directory
  • Test mount_archive() calls archivemount with correct args
  • Test mount_archive() tracks mount in active_mounts
  • Test mount_archive() returns None on subprocess failure
  • Test mount_archive() reuses existing mount for same archive
  • Test mount_archive() uses fuse-archive as fallback
  • Test unmount() calls fusermount/umount
  • Test unmount() removes from active_mounts
  • Test unmount() removes mount point directory
  • Test unmount() returns False for unknown mount
  • Test unmount_all() unmounts all active mounts
  • Test is_in_mount() for paths inside/outside mounts
  • Test get_mount_for_path() returns correct MountInfo

Files

  • Modify: tnc/mount.py
  • Modify: tests/test_mount.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions