innodb_ruby 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ class Innodb::Page::FspHdrXdes < Innodb::Page
5
5
  XDES_BITMAP_SIZE = (64 * XDES_BITS_PER_PAGE) / 8
6
6
  XDES_SIZE = 8 + Innodb::FreeList::NODE_SIZE + 4 + XDES_BITMAP_SIZE
7
7
 
8
- XDES_N_ARRAY_ENTRIES = 10
8
+ XDES_N_ARRAY_ENTRIES = 256
9
9
 
10
10
  def pos_fsp_header
11
11
  pos_fil_header + size_fil_header
@@ -28,6 +28,7 @@ class Innodb::Page::FspHdrXdes < Innodb::Page
28
28
  :free_limit => c.get_uint32,
29
29
  :flags => c.get_uint32,
30
30
  :frag_n_used => c.get_uint32,
31
+ :free => Innodb::FreeList::get_base_node(c),
31
32
  :free_frag => Innodb::FreeList::get_base_node(c),
32
33
  :full_frag => Innodb::FreeList::get_base_node(c),
33
34
  :first_unused_seg => c.get_uint64,
@@ -46,9 +47,10 @@ class Innodb::Page::FspHdrXdes < Innodb::Page
46
47
  def read_xdes(cursor)
47
48
  {
48
49
  :xdes_id => cursor.get_uint64,
50
+ :position => cursor.position,
49
51
  :free_list => Innodb::FreeList::get_node(cursor),
50
52
  :state => XDES_STATES[cursor.get_uint32],
51
- :bitmap => cursor.get_bytes(XDES_BITMAP_SIZE),
53
+ :bitmap => cursor.get_hex(XDES_BITMAP_SIZE),
52
54
  }
53
55
  end
54
56
 
@@ -6,37 +6,50 @@ class Innodb::Page::Inode < Innodb::Page
6
6
 
7
7
  MAGIC_N_VALUE = 97937874
8
8
 
9
- def pos_inode_header
9
+ def pos_inode_list
10
10
  pos_fil_header + size_fil_header + Innodb::FreeList::NODE_SIZE
11
11
  end
12
12
 
13
- def size_inode_header
13
+ def size_inode
14
14
  (16 + (3 * Innodb::FreeList::BASE_NODE_SIZE) +
15
15
  (FRAG_ARRAY_N_SLOTS * FRAG_SLOT_SIZE))
16
16
  end
17
17
 
18
+ def inodes_per_page
19
+ (size - pos_inode_list - 10) / size_inode
20
+ end
21
+
18
22
  def uint32_array(size, cursor)
19
23
  size.times.map { |n| cursor.get_uint32 }
20
24
  end
21
25
 
22
- def inode_header
23
- c = cursor(pos_inode_header)
26
+ def inode(cursor)
24
27
  {
25
- :fseg_id => c.get_uint64,
26
- :not_full_n_used => c.get_uint32,
27
- :free => Innodb::FreeList.get_base_node(c),
28
- :not_full => Innodb::FreeList.get_base_node(c),
29
- :full => Innodb::FreeList.get_base_node(c),
30
- :magic_n => c.get_uint32,
31
- :frag_array => uint32_array(FRAG_ARRAY_N_SLOTS, c),
28
+ :fseg_id => cursor.get_uint64,
29
+ :not_full_n_used => cursor.get_uint32,
30
+ :free => Innodb::FreeList.get_base_node(cursor),
31
+ :not_full => Innodb::FreeList.get_base_node(cursor),
32
+ :full => Innodb::FreeList.get_base_node(cursor),
33
+ :magic_n => cursor.get_uint32,
34
+ :frag_array => uint32_array(FRAG_ARRAY_N_SLOTS, cursor),
32
35
  }
33
36
  end
34
37
 
38
+ def each_inode
39
+ inode_cursor = cursor(pos_inode_list)
40
+ inodes_per_page.times do
41
+ this_inode = inode(inode_cursor)
42
+ yield this_inode if this_inode[:fseg_id] != 0
43
+ end
44
+ end
45
+
35
46
  def dump
36
47
  super
37
48
 
38
- puts "inode header:"
39
- pp inode_header
49
+ puts "inodes:"
50
+ each_inode do |i|
51
+ pp i
52
+ end
40
53
  puts
41
54
  end
42
55
  end
@@ -1,3 +1,3 @@
1
1
  module Innodb
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: innodb_ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeremy Cole
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-04 00:00:00 Z
18
+ date: 2012-12-05 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Library for parsing InnoDB data files in Ruby