class FuseFS::PathMapperFS::MNode
Represents a mapped file or directory
Attributes
@return [Hash<String,MNode>] list of files in a directory, nil for file nodes
@return [Hash] metadata for this node
Useful when mapping a file to store attributes against the parent directory @return [MNode] parent directory
@return [String] path to backing file, or nil for directory nodes
Public Class Methods
@!visibility private
# File lib/fusefs/pathmapper.rb, line 76 def initialize(parent_dir,stats) @parent = parent_dir @files = {} @options = {} @stats = stats @stats_size = 0 @stats.adjust(0,1) end
Public Instance Methods
Compatibility and convenience method @param [:pm_real_path,String,Symbol] key @return [String] #real_path} if key == :pm_real_path @return [MNode] the node representing the file named key @return [Object] shortcut for {#options
# File lib/fusefs/pathmapper.rb, line 119 def[](key) case key when :pm_real_path real_path when String files[key] else options[key] end end
Convenience method to set metadata into {#options}
# File lib/fusefs/pathmapper.rb, line 131 def[]=(key,value) options[key]=value end
# File lib/fusefs/pathmapper.rb, line 139 def deleted @stats.adjust(-@stats_size,-1) @stats_size = 0 end
@return [Boolean] true if node represents a directory, otherwise false
# File lib/fusefs/pathmapper.rb, line 105 def directory? files && true end
@return [Boolean] true if node represents a file, otherwise false
# File lib/fusefs/pathmapper.rb, line 100 def file? real_path && true end
# File lib/fusefs/pathmapper.rb, line 94 def init_dir(options) @options.merge!(options) self end
@!visibility private
# File lib/fusefs/pathmapper.rb, line 86 def init_file(real_path,options) @options.merge!(options) @real_path = real_path @files = nil updated self end
@return [Boolean] true if node is the root directory
# File lib/fusefs/pathmapper.rb, line 110 def root? @parent.nil? end
# File lib/fusefs/pathmapper.rb, line 144 def updated new_size = File.size(real_path) @stats.adjust(new_size - @stats_size) @stats_size = new_size end
# File lib/fusefs/pathmapper.rb, line 135 def xattr @xattr ||= XAttr.new(self) end