Class: Pmux::Gatherer

Inherits:
Object
  • Object
show all
Defined in:
lib/pmux/gatherer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(writer = nil) ⇒ Gatherer

Returns a new instance of Gatherer.



6
7
8
9
10
# File 'lib/pmux/gatherer.rb', line 6

def initialize writer=nil
  @writer = writer
  @mf = MR::MultiFuture.new
  @mf.on_success {|f| writer.write f.get}
end

Instance Attribute Details

#mfObject (readonly)

Returns the value of attribute mf.



4
5
6
# File 'lib/pmux/gatherer.rb', line 4

def mf
  @mf
end

#writerObject

Returns the value of attribute writer.



3
4
5
# File 'lib/pmux/gatherer.rb', line 3

def writer
  @writer
end

Instance Method Details

#gather(msession, node_addr, remote, local, options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/pmux/gatherer.rb', line 12

def gather msession, node_addr, remote, local, options={}
  future = msession.scp_download node_addr, remote, local,
    :set_result=>local
  @mf.add future
end

#join_allObject



18
19
20
21
# File 'lib/pmux/gatherer.rb', line 18

def join_all
  @mf.join_all
  @writer.finish
end