| Class | FuseFS::FuseDir |
| In: |
lib/fuse/fusedir.rb
|
| Parent: | Object |
This class is equivalent to using Object.new() as the virtual directory for target for {FuseFS.start}. It exists primarily to document the API but can also be used as a superclass for your filesystem providing sensible defaults
FUSE itself will generally stat referenced files and validate the results before performing any file/directory operations so this sequence is called very often
FUSE confirms the path is a directory (via stat above) before we call {contents}
FUSE will generally go on to stat each directory entry in the results
FUSE confirms path is a file before we call {read_file}
For fine control of file access see {raw_open}, {raw_read}, {raw_close}
FUSE confirms path for the new file is a directory
See also {raw_open}, {raw_truncate}, {raw_write}, {raw_sync}, {raw_close}
FUSE confirms path is a file before we call {can_delete?} then {delete}
FUSE confirms parent is a directory before we call {can_mkdir?} then {mkdir}
FUSE confirms path is a directory before we call {can_rmdir?} then {rmdir}
FUSE confirms the rename is valid (eg. not renaming a directory to a file)
The filesystem can handle a signal by providing a `sig<name>` method. eg ‘sighup’ {sigint} and {sigterm} are handled by default to provide a means to exit the filesystem
| INIT_TIMES | = | Array.new(3,0) |
@!method sigterm()
@return [void] Handle the TERM signal and exit the filesystem |
@abstract FuseFS api @return [Array<String>] array of file and directory names within path
Close the file previously opened at path (or filehandle raw) @abstract FuseFS api @return [void]
Raw file access @abstract FuseFS api @param mode [String] "r","w" or "rw", with "a" if file is opened for append @param rfusefs [Boolean] will be "true" if RFuseFS extensions are available @return [nil] to indicate raw operations are not implemented @return [Object] a filehandle
Under RFuseFS this object will be passed back in to the other raw
methods as the optional parameter _raw_
Sync buffered data to your filesystem @param [String] path @param [Boolena] datasync only sync user data, not metadata @param [Object] raw the filehandle return by {raw_open}
RFuseFS extension. @abstract FuseFS api
@overload raw_truncate(path,offset,raw)
Truncate an open file to offset bytes
@param [String] path
@param [Integer] offset
@param [Object] raw the filehandle returned from {#raw_open}
@return [void]
@overload raw_truncate(path,offset)
Optionally truncate a file to offset bytes directly
@param [String] path
@param [Integer] offset
@return [Boolean]
if truncate has been performed, otherwise the truncation will be performed with {#read_file} and {#write_to}
Write sz bytes from file at path (or filehandle raw) starting at offset off @abstract FuseFS api @return [void]
base,*rest = scan_path(path)
@return [Array<String>] all directory and file elements in path. Useful
when encapsulating an entire fs into one object
base,rest = split_path(path)
@return [Array<String,String>] base,rest. base is the first directory in
path, and rest is nil> or the remaining path.
Typically if rest is not nil? you should
recurse the paths
RFuseFS extensions. File system statistics @param [String] path @return [Array<Integer>] the statistics
used_space (in bytes), used_files, max_space, max_files
See {StatsHelper}
@return [RFuse::StatVfs] or raw statistics @abstract FuseFS api
Neat toy. Called when a file is touched or has its timestamp explicitly modified @abstract FuseFS api @return [void]
RFuseFS extension. Extended attributes. @param [String] path @return [Hash] extended attributes for this path.
The returned object will be manipulated directly using :[] :[]=,, :keys and :delete so the default (a new empty hash on every call) will not retain attributes that are set
@abstract FuseFS api