Class: FFI::Libfuse::Filesystem::PassThroughDir
- Inherits:
-
Object
- Object
- FFI::Libfuse::Filesystem::PassThroughDir
- Includes:
- Adapter::Debug, MappedFiles, Utils
- Defined in:
- lib/ffi/libfuse/filesystem/pass_through_dir.rb
Overview
A Filesystem that maps paths to an underlying directory
Constant Summary
Constants included from Adapter::Debug
Adapter::Debug::DEFAULT_FORMAT
Constants included from MappedFiles
Instance Attribute Summary collapse
-
#base_dir ⇒ String
The base directory.
Attributes included from MappedFiles
FUSE Callbacks collapse
-
#create(path, perms = 0o644, ffi = nil) ⇒ Object
Creates the File at #map_path(path).
-
#mkdir(path, mode) ⇒ Object
Creates the directory at #map_path(path).
-
#opendir(path, _ffi) ⇒ Dir
The directory at #map_path(path).
-
#rmdir(path) ⇒ Object
Removes the directory at #map_path(path).
Instance Method Summary collapse
-
#map_path(path) ⇒ String
#base_dir + path.
Methods included from Utils
#directory?, #empty_dir?, #empty_file?, #exists?, #file?, #mkdir_p, #stat
Methods included from Adapter::Debug
debug, #debug?, debug_callback, #debug_config, debug_error, debug_format, error_message
Methods included from Adapter::Safe
Methods included from MappedFiles
#getattr, #getxattr, #listxattr, #open, #read, #read_buf, #stat_mask, #statfs, #truncate, #unlink, #utimens, #write, #write_buf
Instance Attribute Details
#base_dir ⇒ String
Returns The base directory.
15 16 17 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 15 def base_dir @base_dir end |
Instance Method Details
#create(path, perms = 0o644, ffi = nil) ⇒ Object
Creates the File at #map_path(path)
41 42 43 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 41 def create(path, perms = 0o644, ffi = nil) File.open(map_path(path), ffi&.flags, perms) end |
#map_path(path) ⇒ String
Returns #base_dir + path.
48 49 50 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 48 def map_path(path) root?(path) ? @base_dir : "#{@base_dir}#{path}" end |
#mkdir(path, mode) ⇒ Object
Creates the directory at #map_path(path)
33 34 35 36 37 38 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 33 def mkdir(path, mode) return Dir.mkdir(map_path(path), mode) unless root?(path) accounting&.adjust(0, +1) self end |
#opendir(path, _ffi) ⇒ Dir
Returns the directory at #map_path(path).
20 21 22 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 20 def opendir(path, _ffi) Dir.new(map_path(path)) end |
#rmdir(path) ⇒ Object
Removes the directory at #map_path(path)
25 26 27 28 29 30 |
# File 'lib/ffi/libfuse/filesystem/pass_through_dir.rb', line 25 def rmdir(path) return Dir.rmdir(map_path(path)) unless root?(path) accounting&.adjust(0, -1) if root?(path) self end |