class Innodb::Page::Inode
Public Instance Methods
Dump the contents of a page for debugging purposes.
Innodb::Page#dump
# File lib/innodb/page/inode.rb, line 117 def dump super puts "list entry:" pp list_entry puts puts "inodes:" each_inode(&:dump) puts end
Iterate through all allocated inodes in the inode array.
# File lib/innodb/page/inode.rb, line 75 def each_allocated_inode return enum_for(:each_allocated_inode) unless block_given? each_inode do |this_inode| yield this_inode if this_inode.allocated? end end
Iterate through all Inodes in the inode array.
# File lib/innodb/page/inode.rb, line 63 def each_inode return enum_for(:each_inode) unless block_given? inode_cursor = cursor(pos_inode_array) inodes_per_page.times do |n| inode_cursor.name("inode[#{n}]") do |c| yield Innodb::Inode.new_from_cursor(@space, c) end end end
Innodb::Page#each_region
# File lib/innodb/page/inode.rb, line 83 def each_region(&block) return enum_for(:each_region) unless block_given? super yield Region.new( offset: pos_list_entry, length: size_list_entry, name: :list_entry, info: "Inode List Entry" ) each_inode do |inode| if inode.allocated? yield Region.new( offset: inode.offset, length: Innodb::Inode::SIZE, name: :inode_used, info: "Inode (used)" ) else yield Region.new( offset: inode.offset, length: Innodb::Inode::SIZE, name: :inode_free, info: "Inode (free)" ) end end nil end
Read a single Inode
entry from the provided byte offset by creating a cursor and reading the inode using the inode method.
# File lib/innodb/page/inode.rb, line 58 def inode_at(cursor) cursor.name("inode[#{cursor.position}]") { |c| Innodb::Inode.new_from_cursor(@space, c) } end
The number of Inode
entries that fit on a page.
# File lib/innodb/page/inode.rb, line 31 def inodes_per_page (size - pos_inode_array - 10) / Innodb::Inode::SIZE end
Return the list entry.
# File lib/innodb/page/inode.rb, line 40 def list_entry cursor(pos_list_entry).name("list") { |c| Innodb::List.get_node(c) } end
Return the “next” address pointer from the list entry. This is used by Innodb::List::Inode
to iterate through Inode
lists.
# File lib/innodb/page/inode.rb, line 52 def next_address list_entry.next end
Return the byte offset of the Inode
array in the page, which immediately follows the list entry.
# File lib/innodb/page/inode.rb, line 26 def pos_inode_array pos_list_entry + size_list_entry end
Return the byte offset of the list node, which immediately follows the FIL header.
# File lib/innodb/page/inode.rb, line 15 def pos_list_entry pos_page_body end
Return the “previous” address pointer from the list entry. This is used by Innodb::List::Inode
to iterate through Inode
lists.
# File lib/innodb/page/inode.rb, line 46 def prev_address list_entry.prev end
# File lib/innodb/page/inode.rb, line 35 def size_inode_array inodes_per_page * Innodb::Inode::SIZE end
Return the size of the list node.
# File lib/innodb/page/inode.rb, line 20 def size_list_entry Innodb::List::NODE_SIZE end