tresse 1.1.2 → 1.1.3
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/tresse.rb +18 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a79478c19e535535d6939c00b57f34348dc024d3
|
4
|
+
data.tar.gz: f614a4fbc5b34a37617e3bb09863d09c5a1a95c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59dc4a2a63a63dfe420ae6ffb65b0a7e5083f55da03f630d74e42cb4f3c174081bf430e668820d55af76a6843f0db7b954f24a45e57978b8a33cb5ae2f1d5b24
|
7
|
+
data.tar.gz: e35f1a82c2c2e5aa65c5b17e0ca76d2aef068b9c9177b6f9a79f9fa2622ba2100e9663117ec333e0f70687a8383ba6d990fd844176dcfad03d958fe81cf91d3f
|
data/CHANGELOG.md
CHANGED
data/lib/tresse.rb
CHANGED
@@ -4,7 +4,7 @@ require 'thread'
|
|
4
4
|
|
5
5
|
module Tresse
|
6
6
|
|
7
|
-
VERSION = '1.1.
|
7
|
+
VERSION = '1.1.3'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
@@ -93,6 +93,7 @@ module Tresse
|
|
93
93
|
|
94
94
|
attr_reader :group
|
95
95
|
attr_reader :map_index
|
96
|
+
attr_reader :completed
|
96
97
|
attr_accessor :value
|
97
98
|
|
98
99
|
def initialize(group, block_or_group)
|
@@ -102,6 +103,7 @@ module Tresse
|
|
102
103
|
|
103
104
|
@map_index = -1
|
104
105
|
@value = nil
|
106
|
+
@completed = false
|
105
107
|
end
|
106
108
|
|
107
109
|
def process
|
@@ -121,12 +123,16 @@ module Tresse
|
|
121
123
|
|
122
124
|
@value = r if type == :map
|
123
125
|
end
|
126
|
+
|
127
|
+
def complete
|
128
|
+
|
129
|
+
@completed = true
|
130
|
+
end
|
124
131
|
end
|
125
132
|
|
126
133
|
class Group
|
127
134
|
|
128
135
|
attr_accessor :name
|
129
|
-
#attr_reader :batches
|
130
136
|
|
131
137
|
def initialize(name=nil)
|
132
138
|
|
@@ -137,7 +143,7 @@ module Tresse
|
|
137
143
|
@maps = [ nil ]
|
138
144
|
|
139
145
|
@reduce = nil
|
140
|
-
@
|
146
|
+
@reduce_mutex = Mutex.new
|
141
147
|
@reduction_queue = Queue.new
|
142
148
|
end
|
143
149
|
|
@@ -242,15 +248,18 @@ module Tresse
|
|
242
248
|
|
243
249
|
def queue_for_reduction(batch)
|
244
250
|
|
245
|
-
@
|
251
|
+
@reduce_mutex.synchronize do
|
246
252
|
|
247
|
-
|
248
|
-
return unless @reduce
|
253
|
+
batch.complete
|
249
254
|
|
250
|
-
|
251
|
-
|
255
|
+
return unless @reduce
|
256
|
+
return if @batches.find { |b| ! b.completed }
|
252
257
|
|
253
|
-
|
258
|
+
es = @batches.collect(&:value)
|
259
|
+
target, block = @reduce
|
260
|
+
|
261
|
+
@reduction_queue << es.inject(target, &block)
|
262
|
+
end
|
254
263
|
end
|
255
264
|
end
|
256
265
|
end
|