Class: CacheXML::CacheEmitterDetail::CacheEmitter

Inherits:
Object
  • Object
show all
Defined in:
lib/thinp_xml/cache/emit.rb

Instance Method Summary collapse

Constructor Details

#initialize(out) ⇒ CacheEmitter

Returns a new instance of CacheEmitter.



9
10
11
# File 'lib/thinp_xml/cache/emit.rb', line 9

def initialize(out)
  @e = ThinpXML::Base::Emitter.new(out)
end

Instance Method Details

#emit_hints(hs) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/thinp_xml/cache/emit.rb', line 27

def emit_hints(hs)
  return if no_entries(hs)

  block = lambda do
    hs.each {|h| emit_hint(h)}
  end

  @e.emit_tag(hs, 'hints', &block)
end

#emit_mappings(ms) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/thinp_xml/cache/emit.rb', line 17

def emit_mappings(ms)
  return if no_entries(ms)

  block = lambda do
    ms.each {|m| emit_mapping(m)}
  end

  @e.emit_tag(ms, 'mappings', &block)
end

#emit_superblock(sb, &block) ⇒ Object



13
14
15
# File 'lib/thinp_xml/cache/emit.rb', line 13

def emit_superblock(sb, &block)
  @e.emit_tag(sb, 'superblock', :uuid, :block_size, :nr_cache_blocks, :policy, :hint_width, &block)
end