rsmp 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rsmp/collect/collector.rb +7 -2
- data/lib/rsmp/collect/state_collector.rb +82 -8
- data/lib/rsmp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 429ca780c80b9fd2e2a320256f76a8d1ed37bc6f2ca2045cbebb40c537c6888a
|
4
|
+
data.tar.gz: 9cdb92a02f59e8ee2dd82a60e64e9b097dd6039ef2ca0e331bfe43a8e63a44e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e87d762b71abb1e108b5045c05d97d024b193d683882444851e34af6dc34facffff91b6017fca83309a6f46eeec301f22530d0fd907526f417ce9b3d3b7eef
|
7
|
+
data.tar.gz: fde8b4459dc7cb15a08d2fa2a19584f0a47303f4591c76b390957f7b018f5704205be125d567b7648865a011a239fa52a460a9663b7b03b1daf7f5b0648eb24f
|
data/Gemfile.lock
CHANGED
@@ -279,12 +279,17 @@ module RSMP
|
|
279
279
|
true
|
280
280
|
end
|
281
281
|
|
282
|
+
# return a string describing the types of messages we're collecting
|
283
|
+
def describe_types
|
284
|
+
[@options[:type]].flatten.join('/')
|
285
|
+
end
|
286
|
+
|
282
287
|
# return a string that describes whe number of messages, and type of message we're collecting
|
283
288
|
def describe_num_and_type
|
284
289
|
if @options[:num] && @options[:num] > 1
|
285
|
-
"#{@options[:num]} #{
|
290
|
+
"#{@options[:num]} #{describe_types}s"
|
286
291
|
else
|
287
|
-
|
292
|
+
describe_types
|
288
293
|
end
|
289
294
|
end
|
290
295
|
|
@@ -119,21 +119,95 @@ module RSMP
|
|
119
119
|
|
120
120
|
# return a string that describes the attributes that we're looking for
|
121
121
|
def describe_query
|
122
|
-
|
123
|
-
|
122
|
+
"#{super} matching #{query_want_hash.to_s}"
|
123
|
+
end
|
124
|
+
|
125
|
+
# return a hash that describe the status of all queries
|
126
|
+
def progress_hash
|
127
|
+
h = {}
|
128
|
+
@queries.each do |query|
|
129
|
+
want = query.want
|
130
|
+
if want['cCI']
|
131
|
+
cCI = want['cCI']
|
132
|
+
h[cCI] ||= {}
|
133
|
+
cO = h['cO']
|
134
|
+
n = h['n']
|
135
|
+
v = h['v']
|
136
|
+
h[cCI][cO] ||= {}
|
137
|
+
h[cCI][cO][n] = v
|
138
|
+
elsif want['sCI']
|
139
|
+
sCI = want['sCI']
|
140
|
+
h[sCI] ||= {}
|
141
|
+
n = want['n']
|
142
|
+
s = want['s']
|
143
|
+
if query.got && query.got['s']
|
144
|
+
h[sCI][n] = { {s=>query.got['s']} => query.done? }
|
145
|
+
else
|
146
|
+
h[sCI][n] = {s=>:anything}
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
h
|
124
151
|
end
|
125
152
|
|
126
153
|
# return a string that describe how many many messages have been collected
|
127
154
|
def describe_progress
|
128
155
|
num_queries = @queries.size
|
129
156
|
num_matched = @queries.count { |query| query.done? }
|
157
|
+
".. Matched #{num_matched}/#{num_queries} with #{progress_hash.to_s}"
|
158
|
+
end
|
159
|
+
|
160
|
+
def query_want_hash
|
161
|
+
h = {}
|
162
|
+
@queries.each do |query|
|
163
|
+
item = query.want
|
164
|
+
if item['cCI']
|
165
|
+
cCI = item['cCI']
|
166
|
+
h[cCI] ||= {}
|
167
|
+
cO = item['cO']
|
168
|
+
h[cCI][cO] ||= {}
|
169
|
+
n = item['n']
|
170
|
+
v = item['v']
|
171
|
+
h[cCI][cO][n] = v || :any
|
172
|
+
elsif item['sCI']
|
173
|
+
sCI = item['sCI']
|
174
|
+
h[sCI] ||= {}
|
175
|
+
n = item['n']
|
176
|
+
s = item['s']
|
177
|
+
h[sCI][n] = s || :any
|
178
|
+
end
|
179
|
+
end
|
180
|
+
h
|
181
|
+
end
|
182
|
+
|
183
|
+
# return a hash that describe the end result
|
184
|
+
def query_got_hash
|
185
|
+
h = {}
|
186
|
+
@queries.each do |query|
|
187
|
+
want = query.want
|
188
|
+
got = query.got
|
189
|
+
if got['cCI']
|
190
|
+
cCI = want['cCI']
|
191
|
+
h[cCI] ||= {}
|
192
|
+
cO = want['cO']
|
193
|
+
h[cCI][cO] ||= {}
|
194
|
+
n = want['n']
|
195
|
+
v = got['v']
|
196
|
+
h[cCI][cO][n] = v
|
197
|
+
elsif want['sCI']
|
198
|
+
sCI = want['sCI']
|
199
|
+
h[sCI] ||= {}
|
200
|
+
n = want['n']
|
201
|
+
s = got['s']
|
202
|
+
h[sCI][n] = s
|
203
|
+
end
|
204
|
+
end
|
205
|
+
h
|
206
|
+
end
|
130
207
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
str << ", got #{got.join(', ')}" if got.any?
|
135
|
-
str << ", need #{need.join(', ')}" if need.any?
|
136
|
-
str
|
208
|
+
# log when we end collecting
|
209
|
+
def log_complete
|
210
|
+
@notifier.log "#{identifier}: Completed with #{query_got_hash.to_s}", level: :collect
|
137
211
|
end
|
138
212
|
end
|
139
213
|
end
|
data/lib/rsmp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|