rql_download.fuse.fuse_mount.VirtualDirectory¶
-
class
rql_download.fuse.fuse_mount.
VirtualDirectory
(root_data_dir)[source]¶ Build an internal representation of a full virtual directory to allow easy and fast usge of this directory with fuse.
Methods
__init__
(root_data_dir)Creates an empty virtual directory. add_file
(path, real_path, uid, gid)Create a virtual file ‘pointing to’ a real file. get_real_path
(path)For a file, returns the real path for a given virtual path. listdir
(path)Return a generator yielding the content of a virtual directory. make_directory
(path, uid, gid, time)Create a virtual directory. stat
(path)Return a dictionary similar to the result of os.fstat for the given virtual path. -
__module__
= 'rql_download.fuse.fuse_mount'¶
-
add_file
(path, real_path, uid, gid)[source]¶ Create a virtual file ‘pointing to’ a real file.
The parent directory must have been created before. The virtual file will be owned by the given uid and gid. Its access mode will be the same as the real file without write access.
Parameters: path: str (mandatory) :
the virtual file path we want to create.
real_path: str (mandatory) :
the real file location, where the virtual file point to.
uid: str (mandatory) :
the user identifier.
gid: str (mandatory) :
the user group identifier.
-
get_real_path
(path)[source]¶ For a file, returns the real path for a given virtual path.
Note
raise a ‘FuseOSError’ exception if the path does not exist or the path is not a file.
Parameters: path: str (mandatory) :
a virtual file from which we want to extract his real path.
-
listdir
(path)[source]¶ Return a generator yielding the content of a virtual directory.
Behave much like os.listdir() but the result also contains ‘.’ and ‘..’ at the begining.
Note
raise a ‘FuseOSError’ exception if the path does not exist or the path is not a directory.
Parameters: path: str (mandatory) :
a virtual path we want to list.
-
make_directory
(path, uid, gid, time)[source]¶ Create a virtual directory.
The parent directory must have been created before. The new directory will be owned by the given uid and gid. Its access mode will be 0500 (read and executable for user only). At each access, a modification times will be set to the given time.
Parameters: path: str (mandatory) :
the virtual path we want to create.
uid: str (mandatory) :
the user identifier.
gid: str (mandatory) :
the user group identifier.
time: str (mandatory) :
the create time that will be set to the created path.
-