thinp_xml 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/thinp_xml/cache/parse.rb +19 -2
- data/lib/thinp_xml/version.rb +1 -1
- data/spec/cache_parse_spec.rb +33 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGEyOWRlMmFlZjNhNzNjMWZiNWRmZTBlYThkNjliOGEwNDRjMjlkOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2Y3OGM3NDQxYTQ5MzYzN2E5ZDEyYjZlMDE5ZTViMzYzN2E0YzZhZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzM2OGRiNGY0NWE0YWE3YmRmODQ2NWJmODIzN2ZmYzhhNzNjYTAzZDdjYTli
|
10
|
+
ZDUyNTNlYjZkMzE4OGRjYzU3MmIzODQyMzc0YmY2NGJjZjVmZjE3MjdhMDhm
|
11
|
+
MWY1N2U2MDUyYjFiODg2NTE5NzYxZGVkMzcwNTdiODc1MDdkZDE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzU1ZDhhMWU1ZmZmZjFkY2M4NThiMTJhMWEwOWY0MjFkNzliMTg1M2QzZTdh
|
14
|
+
NTczMDQ4ZmNjYzhhYTRiYjdkOThjMDVkZmNkZmRhOWVlMWFhMmRlYjc5N2Nm
|
15
|
+
ZWVjZDE2MGI1NjNjNTc2YmE0NjhlZjUwNzRiZjgzMzIwNmQ4ZGM=
|
@@ -6,16 +6,18 @@ require 'rexml/streamlistener'
|
|
6
6
|
|
7
7
|
#----------------------------------------------------------------
|
8
8
|
|
9
|
-
module
|
9
|
+
module CacheXML
|
10
10
|
module CacheParseDetail
|
11
11
|
class Listener
|
12
|
-
include Base::ListenerUtils
|
12
|
+
include ThinpXML::Base::ListenerUtils
|
13
13
|
include REXML::StreamListener
|
14
14
|
|
15
15
|
attr_reader :metadata
|
16
16
|
|
17
17
|
def initialize
|
18
18
|
@metadata = Metadata.new(nil, [], [])
|
19
|
+
@in_mappings = false
|
20
|
+
@in_hints = false
|
19
21
|
end
|
20
22
|
|
21
23
|
def tag_start(tag, args)
|
@@ -25,11 +27,19 @@ module ThinpXML
|
|
25
27
|
when 'superblock'
|
26
28
|
@metadata.superblock = Superblock.new(*get_fields(attr, SUPERBLOCK_FIELDS))
|
27
29
|
|
30
|
+
when 'mappings'
|
31
|
+
@in_mappings = true
|
32
|
+
|
28
33
|
when 'mapping'
|
34
|
+
raise "not in mappings section" unless @in_mappings
|
29
35
|
m = Mapping.new(*get_fields(attr, MAPPING_FIELDS))
|
30
36
|
@metadata.mappings << m
|
31
37
|
|
38
|
+
when 'hints'
|
39
|
+
@in_hints = true
|
40
|
+
|
32
41
|
when 'hint'
|
42
|
+
raise "not in hints section" unless @in_hints
|
33
43
|
h = Hint.new(*get_fields(attr, HINT_FIELDS))
|
34
44
|
@metadata.hints << h
|
35
45
|
|
@@ -39,6 +49,13 @@ module ThinpXML
|
|
39
49
|
end
|
40
50
|
|
41
51
|
def tag_end(tag)
|
52
|
+
case tag
|
53
|
+
when 'mappings'
|
54
|
+
@in_mappings = false
|
55
|
+
|
56
|
+
when 'hints'
|
57
|
+
@in_hints = false
|
58
|
+
end
|
42
59
|
end
|
43
60
|
end
|
44
61
|
end
|
data/lib/thinp_xml/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'thinp_xml/cache/parse'
|
2
|
+
|
3
|
+
include CacheXML
|
4
|
+
|
5
|
+
#----------------------------------------------------------------
|
6
|
+
|
7
|
+
INPUT=<<EOF
|
8
|
+
<superblock uuid="" block_size="512" nr_cache_blocks="4096" policy="hints" hint_width="4">
|
9
|
+
<mappings>
|
10
|
+
<mapping cache_block="0" origin_block="4095" dirty="false"/>
|
11
|
+
<mapping cache_block="1" origin_block="0" dirty="false"/>
|
12
|
+
<mapping cache_block="2" origin_block="4" dirty="false"/>
|
13
|
+
<mapping cache_block="3" origin_block="1" dirty="false"/>
|
14
|
+
<mapping cache_block="4" origin_block="8" dirty="false"/>
|
15
|
+
</mappings>
|
16
|
+
<hints>
|
17
|
+
<hint cache_block="0" data="AQAAAA=="/>
|
18
|
+
<hint cache_block="1" data="AAAAAA=="/>
|
19
|
+
<hint cache_block="2" data="AgAAAA=="/>
|
20
|
+
<hint cache_block="3" data="AAAAAA=="/>
|
21
|
+
<hint cache_block="4" data="AwAAAA=="/>
|
22
|
+
</hints>
|
23
|
+
</superblock>
|
24
|
+
EOF
|
25
|
+
|
26
|
+
describe "CacheXML::read_xml" do
|
27
|
+
# a sanity check (debugging some namespace issues)
|
28
|
+
it "should work" do
|
29
|
+
read_xml(StringIO.new(INPUT))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#----------------------------------------------------------------
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thinp_xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Thornber
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/thinp_xml/version.rb
|
154
154
|
- spec/builder_spec.rb
|
155
155
|
- spec/cache_builder_spec.rb
|
156
|
+
- spec/cache_parse_spec.rb
|
156
157
|
- spec/distribution_spec.rb
|
157
158
|
- thinp_xml.gemspec
|
158
159
|
homepage: ''
|
@@ -188,4 +189,5 @@ test_files:
|
|
188
189
|
- features/thinp_usage.feature
|
189
190
|
- spec/builder_spec.rb
|
190
191
|
- spec/cache_builder_spec.rb
|
192
|
+
- spec/cache_parse_spec.rb
|
191
193
|
- spec/distribution_spec.rb
|