FuseMountManager

public class FuseMountManager
extends Object

java.lang.Object
   ↳ com.android.tradefed.build.FuseMountManager


Summary

Public constructors

FuseMountManager(IFuseDriverProfile driverProfile)

Creates a new FuseMountManager with the given driver profile and default run util and mount root.

FuseMountManager(IFuseDriverProfile driverProfile, IRunUtil runUtil, Path mountRoot)

Creates a new FuseMountManager with the given driver profile, run util, and mount root.

Public methods

static boolean cleanUp(Path mountPoint, IRunUtil runUtil)

Cleans up the mount point directory.

Path mount(Path sourceDataPath)

Mounts the given source data path to a uniquely created mount point.

void unmount(Path sourceDataPath)

Unmounts the filesystem associated with the given source data path.

void unmountAll()

Unmounts all tracked filesystems in parallel.

Public constructors

FuseMountManager

public FuseMountManager (IFuseDriverProfile driverProfile)

Creates a new FuseMountManager with the given driver profile and default run util and mount root.

Parameters
driverProfile IFuseDriverProfile: The driver profile to use.

FuseMountManager

public FuseMountManager (IFuseDriverProfile driverProfile, 
                IRunUtil runUtil, 
                Path mountRoot)

Creates a new FuseMountManager with the given driver profile, run util, and mount root.

Parameters
driverProfile IFuseDriverProfile: The driver profile to use.

runUtil IRunUtil: The run util to use.

mountRoot Path: The base path for creation of mount points.

Public methods

cleanUp

public static boolean cleanUp (Path mountPoint, 
                IRunUtil runUtil)

Cleans up the mount point directory. This method logs any exceptions but does not throw, as this is a best-effort cleanup.

This method retries the lazy unmount and deletion of the mount point directory. If the directory still exists, it retries the lazy unmount and deletion until the deadline is reached.

Parameters
mountPoint Path: The mount point to delete.

runUtil IRunUtil: The IRunUtil to use for running commands.

Returns
boolean

mount

public Path mount (Path sourceDataPath)

Mounts the given source data path to a uniquely created mount point. This method is idempotent: if the same source path is already mounted, it returns the existing mount point.

Parameters
sourceDataPath Path: The source data path to mount.

Returns
Path The Path to the new mount point where the source is available.

Throws
IOException If the mount process fails to start or times out.
InterruptedException If the mounting thread is interrupted.

unmount

public void unmount (Path sourceDataPath)

Unmounts the filesystem associated with the given source data path. This gracefully terminates the FUSE process and cleans up the mount point directory.

Parameters
sourceDataPath Path: The source data path to unmount.

unmountAll

public void unmountAll ()

Unmounts all tracked filesystems in parallel.

This method unmounts all tracked filesystems in parallel using a thread pool. It is intended to be used when all filesystems need to be unmounted, such as when shutting down the FuseMountManager.