Class: Contrek::Concurrent::StreamingMerger

Inherits:
VerticalMerger show all
Defined in:
lib/contrek/finder/concurrent/streaming_merger.rb

Instance Attribute Summary

Attributes inherited from Merger

#tiles

Attributes included from Poolable

#number_of_threads

Attributes inherited from Finder

#maximum_width, #options

Instance Method Summary collapse

Methods included from Poolable

#enqueue!, #wait!

Constructor Details

#initialize(stream_to:, total_width:, total_height:, options: {}) ⇒ StreamingMerger

Returns a new instance of StreamingMerger.



6
7
8
9
10
11
12
# File 'lib/contrek/finder/concurrent/streaming_merger.rb', line 6

def initialize(stream_to:, total_width:, total_height:, options: {})
  @stream = stream_to
  @total_width = total_width
  @total_height = total_height
  @moved = 0
  super(options: options)
end

Instance Method Details

#add_tile(result, flush = false) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/contrek/finder/concurrent/streaming_merger.rb', line 14

def add_tile(result, flush = false)
  super(result)

  if @tiles.size == 2
    process_tiles!(nil, height: @height)
    @tiles << @whole_tile
    stream_polygons!(@whole_tile, flush)
  end
end

#process_infoObject



24
25
26
27
28
# File 'lib/contrek/finder/concurrent/streaming_merger.rb', line 24

def process_info
  result = super
  result.[:groups] = @moved
  result
end