Class: Innodb::Space::DataFile

Inherits:
Object
  • Object
show all
Defined in:
lib/innodb/space.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, offset) ⇒ DataFile

Returns a new instance of DataFile.



44
45
46
47
48
# File 'lib/innodb/space.rb', line 44

def initialize(filename, offset)
  @file = File.open(filename)
  @size = @file.stat.size
  @offset = offset
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



40
41
42
# File 'lib/innodb/space.rb', line 40

def file
  @file
end

#offsetObject (readonly)

Returns the value of attribute offset.



42
43
44
# File 'lib/innodb/space.rb', line 42

def offset
  @offset
end

#sizeObject (readonly)

Returns the value of attribute size.



41
42
43
# File 'lib/innodb/space.rb', line 41

def size
  @size
end

Instance Method Details

#nameObject



50
51
52
53
54
55
# File 'lib/innodb/space.rb', line 50

def name
  prefix = ""
  prefix = "#{File.basename(File.dirname(file.path))}/" if File.extname(file.path) == ".ibd"

  prefix + File.basename(file.path)
end