Class: Innodb::Page::SysDataDictionaryHeader
- Inherits:
-
Innodb::Page
- Object
- Innodb::Page
- Innodb::Page::SysDataDictionaryHeader
- Defined in:
- lib/innodb/page/sys_data_dictionary_header.rb
Constant Summary collapse
- RECORD_DESCRIBERS =
{ :SYS_TABLES => { :PRIMARY => Innodb::DataDictionary::SYS_TABLES_PRIMARY, :ID => Innodb::DataDictionary::SYS_TABLES_ID }, :SYS_COLUMNS => { :PRIMARY => Innodb::DataDictionary::SYS_COLUMNS_PRIMARY }, :SYS_INDEXES => { :PRIMARY => Innodb::DataDictionary::SYS_INDEXES_PRIMARY }, :SYS_FIELDS => { :PRIMARY => Innodb::DataDictionary::SYS_FIELDS_PRIMARY }, }
Constants inherited from Innodb::Page
PAGE_TYPE, PAGE_TYPE_BY_VALUE, SPECIALIZED_CLASSES
Instance Attribute Summary
Attributes inherited from Innodb::Page
Instance Method Summary collapse
-
#data_dictionary_header ⇒ Object
Parse the data dictionary header from the page.
- #dump ⇒ Object
-
#each_index ⇒ Object
Iterate through all indexes in the data dictionary, yielding the table name, index name, and the index itself as an Innodb::Index.
- #index(table_name, index_name) ⇒ Object
-
#pos_data_dictionary_header ⇒ Object
The position of the data dictionary header within the page.
-
#size_data_dictionary_header ⇒ Object
The size of the data dictionary header.
Methods inherited from Innodb::Page
#calculate_checksum, #checksum, #corrupt?, #cursor, #data, #fil_header, handle, #initialize, #inspect, #lsn, maybe_undefined, #next, #offset, parse, #pos_fil_header, #pos_fil_trailer, #pos_page_body, #prev, #size, #size_fil_header, #size_fil_trailer, #type
Constructor Details
This class inherits a constructor from Innodb::Page
Instance Method Details
#data_dictionary_header ⇒ Object
Parse the data dictionary header from the page.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 27 def data_dictionary_header cursor(pos_data_dictionary_header).name("data_dictionary_header") do |c| { :max_row_id => c.name("max_row_id") { c.get_uint64 }, :max_table_id => c.name("max_table_id") { c.get_uint64 }, :max_index_id => c.name("max_index_id") { c.get_uint64 }, :max_space_id => c.name("max_space_id") { c.get_uint32 }, :unused_mix_id_low => c.name("unused_mix_id_low") { c.get_uint32 }, :indexes => c.name("indexes") {{ :SYS_TABLES => c.name("SYS_TABLES") {{ :PRIMARY => c.name("PRIMARY") { c.get_uint32 }, :ID => c.name("ID") { c.get_uint32 }, }}, :SYS_COLUMNS => c.name("SYS_COLUMNS") {{ :PRIMARY => c.name("PRIMARY") { c.get_uint32 }, }}, :SYS_INDEXES => c.name("SYS_INDEXES") {{ :PRIMARY => c.name("PRIMARY") { c.get_uint32 }, }}, :SYS_FIELDS => c.name("SYS_FIELDS") {{ :PRIMARY => c.name("PRIMARY") { c.get_uint32 }, }} }}, :unused_space => c.name("unused_space") { c.get_bytes(4) }, :fseg => c.name("fseg") { Innodb::FsegEntry.get_inode(@space, c) }, } end end |
#dump ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 86 def dump super puts puts "data_dictionary header:" pp data_dictionary_header end |
#each_index ⇒ Object
Iterate through all indexes in the data dictionary, yielding the table name, index name, and the index itself as an Innodb::Index.
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 74 def each_index unless block_given? return enum_for(:each_index) end data_dictionary_header[:indexes].each do |table_name, indexes| indexes.each do |index_name, root_page_number| yield table_name, index_name, index(table_name, index_name) end end end |
#index(table_name, index_name) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 56 def index(table_name, index_name) unless table_entry = data_dictionary_header[:indexes][table_name] raise "Unknown data dictionary table #{table_name}" end unless index_root_page = table_entry[index_name] raise "Unknown data dictionary index #{table_name}.#{index_name}" end # If we have a record describer for this index, load it. record_describer = RECORD_DESCRIBERS[table_name] && RECORD_DESCRIBERS[table_name][index_name] @space.index(index_root_page, record_describer.new) end |
#pos_data_dictionary_header ⇒ Object
The position of the data dictionary header within the page.
17 18 19 |
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 17 def pos_data_dictionary_header pos_fil_header + size_fil_header end |