Class: Innodb::Page::Blob
Constant Summary
Constants inherited
from Innodb::Page
PAGE_TYPE, PAGE_TYPE_BY_VALUE, SPECIALIZED_CLASSES
Instance Attribute Summary
Attributes inherited from Innodb::Page
#space
Instance Method Summary
collapse
#calculate_checksum, #checksum, #corrupt?, #cursor, #fil_header, handle, #initialize, #inspect, #lsn, maybe_undefined, #name, #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
#blob_data ⇒ Object
25
26
27
28
29
|
# File 'lib/innodb/page/blob.rb', line 25
def blob_data
cursor(pos_blob_data).name("blob_data") do |c|
c.get_bytes([:length])
end
end
|
16
17
18
19
20
21
22
23
|
# File 'lib/innodb/page/blob.rb', line 16
def
cursor().name("blob_header") do |c|
{
:length => c.name("length") { c.get_uint32 },
:next => c.name("next") { Innodb::Page.maybe_undefined(c.get_uint32) },
}
end
end
|
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/innodb/page/blob.rb', line 71
def dump
super
puts "blob header:"
pp
puts
puts "blob data:"
dump_hex(blob_data)
puts
puts
end
|
#dump_hex(string) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/innodb/page/blob.rb', line 31
def dump_hex(string)
slice_size = 16
bytes = string.split("").map { |s| s.ord }
string.split("").each_slice(slice_size).each_with_index do |slice_bytes, slice_count|
puts "%08i %-23s %-23s |%-16s|" % [
(slice_count * slice_size),
slice_bytes[0..8].map { |n| "%02x" % n.ord }.join(" "),
slice_bytes[8..16].map { |n| "%02x" % n.ord }.join(" "),
slice_bytes.join(""),
]
end
end
|
#each_region {|{
:offset => pos_blob_header,
:length => size_blob_header,
:name => :blob_header,
:info => "Blob Header",
}| ... } ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/innodb/page/blob.rb', line 44
def each_region
unless block_given?
return enum_for(:each_region)
end
super do |region|
yield region
end
yield({
:offset => ,
:length => ,
:name => :blob_header,
:info => "Blob Header",
})
yield({
:offset => pos_blob_data,
:length => [:length],
:name => :blob_data,
:info => "Blob Data",
})
nil
end
|
#pos_blob_data ⇒ Object
12
13
14
|
# File 'lib/innodb/page/blob.rb', line 12
def pos_blob_data
+
end
|
4
5
6
|
# File 'lib/innodb/page/blob.rb', line 4
def
+
end
|
8
9
10
|
# File 'lib/innodb/page/blob.rb', line 8
def
4 + 4
end
|