class Tilt::Fs::FileSystem::Core

Attributes

logger[R]
mount_point[R]
root_dir[R]
src_path[R]
template_data_file[R]

Public Class Methods

new(new_mount_point, new_src_path = "./") click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 11
def initialize(new_mount_point, new_src_path = "./")
  @logger = FS_LOGGER
  @src_path = new_src_path
  @template_data_file = ::File.join(::Dir.pwd, FS_DEFAULT_DATA_FILE)
  @root_dir = Dir.new(src_path, template_data_file)
  @mount_point = new_mount_point

  logger.debug "core#new(): created"
  logger.info "Mounted into #{mount_point} from #{src_path}"
  logger.info "Template data path = #{template_data_file}"
end

Public Instance Methods

getattr(ctx, path) click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 50
def getattr(ctx, path)
  logger.debug "Core#getattr(): path = #{path}"
  root_dir.find(path).attr
end
init(ctx, rfuse_info) click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 23
def init(ctx, rfuse_info)
  logger.info "Tilt::Fs started."
end
open(ctx, path, ffi) click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 40
def open(ctx, path, ffi)
  logger.debug "Core#open(): path = #{path}"
end
read(ctx, path, size, offset, ffi) click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 44
def read(ctx, path, size, offset, ffi)
  logger.info "READ_FILE: #{::File.join mount_point, path}"
  logger.debug "Core#read(): path = #{path}, size = #{size}"
  root_dir.find(path).content
end
readdir(ctx, path, filter, offset, ffi) click to toggle source
# File lib/tilt/fs/file_system/core.rb, line 27
def readdir(ctx, path, filter, offset, ffi)
  logger.info "READ_DIR: #{::File.join mount_point, path}"
  logger.debug "Core#readdir(): ctx = #{ctx}, path = #{path}"
  dir = root_dir.find(path)

  raise ::Errno::ENOTDIR.new(path) unless dir.is_dir?

  token = ::Pathname.new(path).basename.to_s
  dir.search(token).each do |entry|
    filter.push entry.name, entry.attr, 0
  end
end