Class: VirtFS::ThinFileDelegator

Inherits:
Object
  • Object
show all
Includes:
ThinIODelegatorMethods
Defined in:
lib/virtfs/thin_file_delegator.rb

Overview

Dispatches File calls to/from VirtFS and the ‘Thin’ subsystem

Constant Summary

Constants included from ThinIODelegatorMethodsBufferio

VirtFS::ThinIODelegatorMethodsBufferio::MAX_CHAR_LEN, VirtFS::ThinIODelegatorMethodsBufferio::MIN_READ_BUF_SZ

Instance Attribute Summary collapse

Attributes included from ThinIODelegatorMethodsBufferio

#end_byte_addr, #fs_io_obj, #min_read_buf_sz, #read_buffer

Instance Method Summary collapse

Methods included from ThinIODelegatorMethods

#autoclose=, #autoclose?, #binmode, #binmode?, #close, #close_on_exec=, #close_on_exec?, #close_read, #close_write, #closed?, #disable_finalizer, #enable_finalizer, #eof, #external_encoding, #fcntl, #fdatasync, #fileno, finalize, #flush, #fsync, #internal_encoding, #ioctl, #isatty, #pid, #pos, #pos=, #readpartial, #reopen, #rewind, #seek, #set_encoding, #stat, #sysread, #sysseek, #syswrite, #to_io, #write_nonblock

Methods included from ThinIODelegatorMethodsBufferio

#<<, #bytes, #chars, #each, #each_byte, #each_char, #each_codepoint, #each_common, #getbyte, #getc, #gets, #lineno, #lineno=, #lines, #print, #printf, #putc, #puts, #read, #readbyte, #readchar, #readline, #readlines, #sync, #sync=, #ungetbyte, #ungetc, #write

Constructor Details

#initialize(fs_file_obj, creation_path, fs_path, parsed_args) ⇒ ThinFileDelegator

Instance methods



12
13
14
15
16
17
18
# File 'lib/virtfs/thin_file_delegator.rb', line 12

def initialize(fs_file_obj, creation_path, fs_path, parsed_args)
  super(fs_file_obj, parsed_args) # Initialize IO instance.
  # @size          = @fs_io_obj.size
  @creation_path = creation_path
  @full_path     = VfsRealFile.join(@fs_io_obj.fs.mount_point, fs_path)
  @fs_path       = fs_path
end

Instance Attribute Details

#fs_file_objObject (readonly)

Returns the value of attribute fs_file_obj.



7
8
9
# File 'lib/virtfs/thin_file_delegator.rb', line 7

def fs_file_obj
  @fs_file_obj
end

Instance Method Details

#atimeObject



27
28
29
30
# File 'lib/virtfs/thin_file_delegator.rb', line 27

def atime
  file_open
  @fs_io_obj.atime
end

#chmod(permission) ⇒ Object



32
33
34
35
# File 'lib/virtfs/thin_file_delegator.rb', line 32

def chmod(permission)
  file_open
  @fs_io_obj.chmod(permission)
end

#chown(owner, group) ⇒ Object



37
38
39
40
# File 'lib/virtfs/thin_file_delegator.rb', line 37

def chown(owner, group)
  file_open
  @fs_io_obj.chown(owner, group)
end

#ctimeObject



42
43
44
45
# File 'lib/virtfs/thin_file_delegator.rb', line 42

def ctime
  file_open
  @fs_io_obj.ctime
end

#flock(locking_constant) ⇒ Object



47
48
49
50
# File 'lib/virtfs/thin_file_delegator.rb', line 47

def flock(locking_constant)
  file_open
  @fs_io_obj.flock(locking_constant)
end

#lstatObject



52
53
54
55
# File 'lib/virtfs/thin_file_delegator.rb', line 52

def lstat
  file_open
  @fs_io_obj.lstat
end

#mtimeObject



57
58
59
60
# File 'lib/virtfs/thin_file_delegator.rb', line 57

def mtime
  file_open
  @fs_io_obj.mtime
end

#pathObject Also known as: to_path



62
63
64
# File 'lib/virtfs/thin_file_delegator.rb', line 62

def path
  @creation_path
end

#re_initialize(io_obj) ⇒ Object



20
21
22
23
24
25
# File 'lib/virtfs/thin_file_delegator.rb', line 20

def re_initialize(io_obj)
  super(io_obj) # re-initialize IO
  @creation_path = io_obj.instance_variable_get(:@creation_path)
  @full_path     = io_obj.instance_variable_get(:@full_path)
  @fs_path       = io_obj.instance_variable_get(:@fs_path)
end

#sizeObject



67
68
69
70
# File 'lib/virtfs/thin_file_delegator.rb', line 67

def size
  file_open
  @size
end

#truncate(len) ⇒ Object



72
73
74
75
# File 'lib/virtfs/thin_file_delegator.rb', line 72

def truncate(len)
  file_open
  @fs_io_obj.truncate(len)
end