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



28
29
30
31
32
# File 'lib/innodb/space.rb', line 28

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.



24
25
26
# File 'lib/innodb/space.rb', line 24

def file
  @file
end

#offsetObject (readonly)

Returns the value of attribute offset.



26
27
28
# File 'lib/innodb/space.rb', line 26

def offset
  @offset
end

#sizeObject (readonly)

Returns the value of attribute size.



25
26
27
# File 'lib/innodb/space.rb', line 25

def size
  @size
end

Instance Method Details

#nameObject



34
35
36
37
38
39
40
41
# File 'lib/innodb/space.rb', line 34

def name
  prefix = ""
  if File.extname(file.path) == ".ibd"
    prefix = File.basename(File.dirname(file.path)) + "/"
  end

  prefix + File.basename(file.path)
end