Class: Contrek::Concurrent::StreamingMerger

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

Direct Known Subclasses

GeoJsonStreamingMerger, SvgStreamingMerger

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 inherited from VerticalMerger

#transpose?

Methods included from Poolable

#enqueue!, #wait!

Methods inherited from Finder

#transpose?

Constructor Details

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

Returns a new instance of StreamingMerger.



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

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

Instance Method Details

#add_tile(result, flush = false) ⇒ Object



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

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



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

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