Class: Innodb::Page::Inode
- Inherits:
-
Innodb::Page
- Object
- Innodb::Page
- Innodb::Page::Inode
- Defined in:
- lib/innodb/page/inode.rb
Overview
A specialized class for handling INODE pages, which contain index FSEG (file segment) information. This allows all extents and individual pages assigned to each index to be found.
Constant Summary
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
-
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
-
#each_inode ⇒ Object
Iterate through all Inodes in the inode array.
-
#inode_at(cursor) ⇒ Object
Read a single Inode entry from the provided byte offset by creating a cursor and reading the inode using the inode method.
-
#inodes_per_page ⇒ Object
The number of Inode entries that fit on a page.
-
#list_entry ⇒ Object
Return the list entry.
-
#next_address ⇒ Object
Return the “next” address pointer from the list entry.
-
#pos_inode_array ⇒ Object
Return the byte offset of the Inode array in the page, which immediately follows the list entry.
-
#pos_list_entry ⇒ Object
Return the byte offset of the list node, which immediately follows the FIL header.
-
#prev_address ⇒ Object
Return the “previous” address pointer from the list entry.
-
#size_list_entry ⇒ Object
Return the size of the list node.
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
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/innodb/page/inode.rb', line 72 def dump super puts "list entry:" pp list_entry puts puts "inodes:" each_inode do |inode| inode.dump end puts end |
#each_inode ⇒ Object
Iterate through all Inodes in the inode array.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/innodb/page/inode.rb', line 57 def each_inode unless block_given? return enum_for(:each_inode) end inode_cursor = cursor(pos_inode_array) inodes_per_page.times do |n| inode_cursor.name("inode[#{n}]") do |c| this_inode = Innodb::Inode.new_from_cursor(@space, c) yield this_inode if this_inode.allocated? end end end |
#inode_at(cursor) ⇒ Object
Read a single Inode entry from the provided byte offset by creating a cursor and reading the inode using the inode method.
52 53 54 |
# File 'lib/innodb/page/inode.rb', line 52 def inode_at(cursor) cursor.name("inode") { |c| Innodb::Inode.new_from_cursor(@space, c) } end |
#inodes_per_page ⇒ Object
The number of Inode entries that fit on a page.
27 28 29 |
# File 'lib/innodb/page/inode.rb', line 27 def inodes_per_page (size - pos_inode_array - 10) / Innodb::Inode::SIZE end |
#list_entry ⇒ Object
Return the list entry.
32 33 34 35 36 |
# File 'lib/innodb/page/inode.rb', line 32 def list_entry cursor(pos_list_entry).name("list") do |c| Innodb::List.get_node(c) end end |
#next_address ⇒ Object
Return the “next” address pointer from the list entry. This is used by Innodb::List::Inode to iterate through Inode lists.
46 47 48 |
# File 'lib/innodb/page/inode.rb', line 46 def next_address list_entry[:next] end |
#pos_inode_array ⇒ Object
Return the byte offset of the Inode array in the page, which immediately follows the list entry.
22 23 24 |
# File 'lib/innodb/page/inode.rb', line 22 def pos_inode_array pos_list_entry + size_list_entry end |
#pos_list_entry ⇒ Object
Return the byte offset of the list node, which immediately follows the FIL header.
11 12 13 |
# File 'lib/innodb/page/inode.rb', line 11 def pos_list_entry pos_fil_header + size_fil_header end |
#prev_address ⇒ Object
Return the “previous” address pointer from the list entry. This is used by Innodb::List::Inode to iterate through Inode lists.
40 41 42 |
# File 'lib/innodb/page/inode.rb', line 40 def prev_address list_entry[:prev] end |