class VirtFS::CamcorderFS::FS

Directory class methods - called by VirtFS::Dir. Makes recordable call to corresponding CcDelegate method.

Directory instance methods - called by CamcorderFS::Dir instances - thick interface. Makes recordable call to corresponding CcDelegate method.

File class methods - called by VirtFS::File. Makes recordable call to corresponding CcDelegate method.

File instance methods - called by CamcorderFS::File instances - thick interface. Makes recordable call to corresponding CcDelegate method.

Attributes

mount_point[RW]
name[RW]
recording_path[R]
root[RW]

Public Class Methods

new(recording_path = nil, root = VfsRealFile::SEPARATOR) click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 16
def initialize(recording_path = nil, root = VfsRealFile::SEPARATOR)
  @mount_point  = nil
  @name         = self.class.name
  @root         = root

  if recording_path.nil?
    @cc_delegate = CcDelegate.new
  else
    start_recorder(recording_path)
  end
end

Public Instance Methods

start_recorder(recording_path) click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 28
def start_recorder(recording_path)
  @recording_path = recording_path
  @recorder       = Camcorder::Recorder.new(@recording_path)

  @cc_delegate = Camcorder.proxy_class(CcDelegate, @recorder) do
    #
    # Dir class methods.
    #
    methods_with_side_effects :dir_chdir, :dir_delete, :dir_mkdir, :dir_new

    #
    # Dir instance methods.
    #
    methods_with_side_effects :dir_i_close, :dir_i_each

    #
    # File class methods.
    #
    methods_with_side_effects :file_atime,  :file_chmod,    :file_chown,    :file_ctime,
                              :file_delete, :file_lchmod,   :file_lchown,   :file_link,
                              :file_lstat,  :file_mtime,    :file_new,      :file_rename,
                              :file_stat,   :file_symlink?, :file_symlink,  :file_truncate,
                              :file_utime

    #
    # File instance methods.
    #
    methods_with_side_effects :file_i_atime,          :file_i_chmod,       :file_i_chown,
                              :file_i_ctime,          :file_i_flock,       :file_i_lstat,
                              :file_i_mtime,          :file_i_truncate,    :file_i_close,
                              :file_i_close_on_exec=, :file_i_close_read,  :file_i_close_write,
                              :file_i_fcntl,          :file_i_ioctl,       :file_i_raw_read,
                              :file_i_raw_write,      :file_i_readpartial, :file_i_read_nonblock,
                              :file_i_write_nonblock
  end.new

  @recorder.start
end
thin_interface?() click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 67
def thin_interface?
  true
end
umount() click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 71
def umount
  @recorder.commit unless @recorder.nil?
  @mount_point = nil
end

Private Instance Methods

apply_root(path) click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 76
def apply_root(path)
  VfsRealFile.join(@root, path)
end
ccd_call(method, *args) click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 81
def ccd_call(method, *args)
  @cc_delegate.send(method, *args)
rescue SystemCallError => scerr
  #
  # The errno is lost when the exception is YAML.dump'd but the
  # sub-class is correct. We get the errno from the sub-class
  # and instantiate a new exception to raise.
  #
  # Passing the whole message from the original exception isn't
  # the right thing to do. We need to find a way to extract the
  # target name from the original message.
  #
  raise SystemCallError.new(scerr.message, scerr.class::Errno)
rescue
  raise
end
return_enum(array, block, rv = nil) click to toggle source
# File lib/virtfs/camcorderfs/fs.rb, line 99
def return_enum(array, block, rv = nil)
  return array.each if block.nil? # return Enumerator.
  array.each(&block)
  rv
end