Class: Innodb::System
- Inherits:
-
Object
- Object
- Innodb::System
- Defined in:
- lib/innodb/system.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#spaces ⇒ Object
Returns the value of attribute spaces.
Instance Method Summary collapse
- #add_space(space) ⇒ Object
- #add_space_file(space_file) ⇒ Object
- #each_index ⇒ Object
- #each_record_from_data_dictionary_index(table, index) ⇒ Object
- #each_table ⇒ Object
-
#initialize(system_space_file) ⇒ System
constructor
A new instance of System.
- #system_space ⇒ Object
Constructor Details
#initialize(system_space_file) ⇒ System
Returns a new instance of System.
7 8 9 10 11 12 13 |
# File 'lib/innodb/system.rb', line 7 def initialize(system_space_file) @config = { :datadir => ".", } @spaces = {} @spaces[0] = Innodb::Space.new(system_space_file) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/innodb/system.rb', line 4 def config @config end |
#spaces ⇒ Object
Returns the value of attribute spaces.
5 6 7 |
# File 'lib/innodb/system.rb', line 5 def spaces @spaces end |
Instance Method Details
#add_space(space) ⇒ Object
51 52 53 |
# File 'lib/innodb/system.rb', line 51 def add_space(space) @spaces[space.space_id] = space end |
#add_space_file(space_file) ⇒ Object
55 56 57 |
# File 'lib/innodb/system.rb', line 55 def add_space_file(space_file) add_space(Innodb::Space.new(space_file)) end |
#each_index ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/innodb/system.rb', line 41 def each_index unless block_given? return enum_for(:each_index) end each_record_from_data_dictionary_index(:SYS_INDEXES, :PRIMARY) do |record| yield record.fields end end |
#each_record_from_data_dictionary_index(table, index) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/innodb/system.rb', line 19 def each_record_from_data_dictionary_index(table, index) unless block_given? return enum_for(:each_record_from_data_dictionary_index, table, index) end index = system_space.data_dictionary.index(table, index) index.each_record do |record| yield record end nil end |
#each_table ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/innodb/system.rb', line 31 def each_table unless block_given? return enum_for(:each_table) end each_record_from_data_dictionary_index(:SYS_TABLES, :PRIMARY) do |record| yield record.fields end end |
#system_space ⇒ Object
15 16 17 |
# File 'lib/innodb/system.rb', line 15 def system_space @spaces[0] end |