floom 0.0.1

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.
@@ -0,0 +1,21 @@
1
+ module Floom
2
+ class Report
3
+
4
+ class << self
5
+
6
+ def parse(report)
7
+ new(report.stringMetrics.merge(report.longMetrics).merge(report.doubleMetrics)).to_hash
8
+ end
9
+
10
+ end
11
+
12
+ def initialize(report = {})
13
+ @metrics = report
14
+ end
15
+
16
+ def to_hash
17
+ @metrics.dup
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ module Floom
2
+ class Request
3
+
4
+ attr_reader :connection, :payload
5
+
6
+ def initialize(connection, type, *args)
7
+ @connection = connection
8
+ @type = type
9
+ @command = FlumeMasterCommandThrift.new(command: type.to_s, arguments: args)
10
+ end
11
+
12
+ def fetch
13
+ @response = connection.submit @command
14
+ self
15
+ end
16
+
17
+ def parse(options = {})
18
+ state = connection.getCmdStatus(@response).state
19
+
20
+ while state == "EXECING"
21
+ state = connection.getCmdStatus(@response).state
22
+ end
23
+
24
+ connection.getCmdStatus(@response)
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ module Floom
2
+ class Status
3
+
4
+ class << self
5
+
6
+ def parse(status)
7
+ new(state: status.state,
8
+ version: status.version,
9
+ last_seen: status.lastseen,
10
+ host: status.host,
11
+ physical_node: status.physicalNode,
12
+ delta: status.lastSeenDeltaMillis).to_hash
13
+ end
14
+
15
+ end
16
+
17
+ def initialize(options = {})
18
+ @state = options[:node_state]
19
+ @version = options[:version]
20
+ @last_seen = options[:last_seen]
21
+ @host = options[:host]
22
+ @physical_node = options[:physical_node]
23
+ @delta = options[:delta]
24
+ end
25
+
26
+ def to_hash
27
+ self.instance_variables.inject({}){ |hsh, var| hsh[var.to_s.slice(1..-1).to_sym] = self.instance_variable_get(var) ; hsh }
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module Floom
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,8 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'flume_types'
8
+
@@ -0,0 +1,454 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.8.0)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'mastercontrol_types'
9
+
10
+ module FlumeMasterAdminServer
11
+ class Client
12
+ include ::Thrift::Client
13
+
14
+ def submit(command)
15
+ send_submit(command)
16
+ return recv_submit()
17
+ end
18
+
19
+ def send_submit(command)
20
+ send_message('submit', Submit_args, :command => command)
21
+ end
22
+
23
+ def recv_submit()
24
+ result = receive_message(Submit_result)
25
+ return result.success unless result.success.nil?
26
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'submit failed: unknown result')
27
+ end
28
+
29
+ def isSuccess(cmdid)
30
+ send_isSuccess(cmdid)
31
+ return recv_isSuccess()
32
+ end
33
+
34
+ def send_isSuccess(cmdid)
35
+ send_message('isSuccess', IsSuccess_args, :cmdid => cmdid)
36
+ end
37
+
38
+ def recv_isSuccess()
39
+ result = receive_message(IsSuccess_result)
40
+ return result.success unless result.success.nil?
41
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'isSuccess failed: unknown result')
42
+ end
43
+
44
+ def isFailure(cmdid)
45
+ send_isFailure(cmdid)
46
+ return recv_isFailure()
47
+ end
48
+
49
+ def send_isFailure(cmdid)
50
+ send_message('isFailure', IsFailure_args, :cmdid => cmdid)
51
+ end
52
+
53
+ def recv_isFailure()
54
+ result = receive_message(IsFailure_result)
55
+ return result.success unless result.success.nil?
56
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'isFailure failed: unknown result')
57
+ end
58
+
59
+ def getNodeStatuses()
60
+ send_getNodeStatuses()
61
+ return recv_getNodeStatuses()
62
+ end
63
+
64
+ def send_getNodeStatuses()
65
+ send_message('getNodeStatuses', GetNodeStatuses_args)
66
+ end
67
+
68
+ def recv_getNodeStatuses()
69
+ result = receive_message(GetNodeStatuses_result)
70
+ return result.success unless result.success.nil?
71
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getNodeStatuses failed: unknown result')
72
+ end
73
+
74
+ def getConfigs()
75
+ send_getConfigs()
76
+ return recv_getConfigs()
77
+ end
78
+
79
+ def send_getConfigs()
80
+ send_message('getConfigs', GetConfigs_args)
81
+ end
82
+
83
+ def recv_getConfigs()
84
+ result = receive_message(GetConfigs_result)
85
+ return result.success unless result.success.nil?
86
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getConfigs failed: unknown result')
87
+ end
88
+
89
+ def hasCmdId(cmdid)
90
+ send_hasCmdId(cmdid)
91
+ return recv_hasCmdId()
92
+ end
93
+
94
+ def send_hasCmdId(cmdid)
95
+ send_message('hasCmdId', HasCmdId_args, :cmdid => cmdid)
96
+ end
97
+
98
+ def recv_hasCmdId()
99
+ result = receive_message(HasCmdId_result)
100
+ return result.success unless result.success.nil?
101
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'hasCmdId failed: unknown result')
102
+ end
103
+
104
+ def getCmdStatus(cmdid)
105
+ send_getCmdStatus(cmdid)
106
+ return recv_getCmdStatus()
107
+ end
108
+
109
+ def send_getCmdStatus(cmdid)
110
+ send_message('getCmdStatus', GetCmdStatus_args, :cmdid => cmdid)
111
+ end
112
+
113
+ def recv_getCmdStatus()
114
+ result = receive_message(GetCmdStatus_result)
115
+ return result.success unless result.success.nil?
116
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getCmdStatus failed: unknown result')
117
+ end
118
+
119
+ def getMappings(physicalNode)
120
+ send_getMappings(physicalNode)
121
+ return recv_getMappings()
122
+ end
123
+
124
+ def send_getMappings(physicalNode)
125
+ send_message('getMappings', GetMappings_args, :physicalNode => physicalNode)
126
+ end
127
+
128
+ def recv_getMappings()
129
+ result = receive_message(GetMappings_result)
130
+ return result.success unless result.success.nil?
131
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getMappings failed: unknown result')
132
+ end
133
+
134
+ end
135
+
136
+ class Processor
137
+ include ::Thrift::Processor
138
+
139
+ def process_submit(seqid, iprot, oprot)
140
+ args = read_args(iprot, Submit_args)
141
+ result = Submit_result.new()
142
+ result.success = @handler.submit(args.command)
143
+ write_result(result, oprot, 'submit', seqid)
144
+ end
145
+
146
+ def process_isSuccess(seqid, iprot, oprot)
147
+ args = read_args(iprot, IsSuccess_args)
148
+ result = IsSuccess_result.new()
149
+ result.success = @handler.isSuccess(args.cmdid)
150
+ write_result(result, oprot, 'isSuccess', seqid)
151
+ end
152
+
153
+ def process_isFailure(seqid, iprot, oprot)
154
+ args = read_args(iprot, IsFailure_args)
155
+ result = IsFailure_result.new()
156
+ result.success = @handler.isFailure(args.cmdid)
157
+ write_result(result, oprot, 'isFailure', seqid)
158
+ end
159
+
160
+ def process_getNodeStatuses(seqid, iprot, oprot)
161
+ args = read_args(iprot, GetNodeStatuses_args)
162
+ result = GetNodeStatuses_result.new()
163
+ result.success = @handler.getNodeStatuses()
164
+ write_result(result, oprot, 'getNodeStatuses', seqid)
165
+ end
166
+
167
+ def process_getConfigs(seqid, iprot, oprot)
168
+ args = read_args(iprot, GetConfigs_args)
169
+ result = GetConfigs_result.new()
170
+ result.success = @handler.getConfigs()
171
+ write_result(result, oprot, 'getConfigs', seqid)
172
+ end
173
+
174
+ def process_hasCmdId(seqid, iprot, oprot)
175
+ args = read_args(iprot, HasCmdId_args)
176
+ result = HasCmdId_result.new()
177
+ result.success = @handler.hasCmdId(args.cmdid)
178
+ write_result(result, oprot, 'hasCmdId', seqid)
179
+ end
180
+
181
+ def process_getCmdStatus(seqid, iprot, oprot)
182
+ args = read_args(iprot, GetCmdStatus_args)
183
+ result = GetCmdStatus_result.new()
184
+ result.success = @handler.getCmdStatus(args.cmdid)
185
+ write_result(result, oprot, 'getCmdStatus', seqid)
186
+ end
187
+
188
+ def process_getMappings(seqid, iprot, oprot)
189
+ args = read_args(iprot, GetMappings_args)
190
+ result = GetMappings_result.new()
191
+ result.success = @handler.getMappings(args.physicalNode)
192
+ write_result(result, oprot, 'getMappings', seqid)
193
+ end
194
+
195
+ end
196
+
197
+ # HELPER FUNCTIONS AND STRUCTURES
198
+
199
+ class Submit_args
200
+ include ::Thrift::Struct, ::Thrift::Struct_Union
201
+ COMMAND = 1
202
+
203
+ FIELDS = {
204
+ COMMAND => {:type => ::Thrift::Types::STRUCT, :name => 'command', :class => FlumeMasterCommandThrift}
205
+ }
206
+
207
+ def struct_fields; FIELDS; end
208
+
209
+ def validate
210
+ end
211
+
212
+ ::Thrift::Struct.generate_accessors self
213
+ end
214
+
215
+ class Submit_result
216
+ include ::Thrift::Struct, ::Thrift::Struct_Union
217
+ SUCCESS = 0
218
+
219
+ FIELDS = {
220
+ SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}
221
+ }
222
+
223
+ def struct_fields; FIELDS; end
224
+
225
+ def validate
226
+ end
227
+
228
+ ::Thrift::Struct.generate_accessors self
229
+ end
230
+
231
+ class IsSuccess_args
232
+ include ::Thrift::Struct, ::Thrift::Struct_Union
233
+ CMDID = 1
234
+
235
+ FIELDS = {
236
+ CMDID => {:type => ::Thrift::Types::I64, :name => 'cmdid'}
237
+ }
238
+
239
+ def struct_fields; FIELDS; end
240
+
241
+ def validate
242
+ end
243
+
244
+ ::Thrift::Struct.generate_accessors self
245
+ end
246
+
247
+ class IsSuccess_result
248
+ include ::Thrift::Struct, ::Thrift::Struct_Union
249
+ SUCCESS = 0
250
+
251
+ FIELDS = {
252
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
253
+ }
254
+
255
+ def struct_fields; FIELDS; end
256
+
257
+ def validate
258
+ end
259
+
260
+ ::Thrift::Struct.generate_accessors self
261
+ end
262
+
263
+ class IsFailure_args
264
+ include ::Thrift::Struct, ::Thrift::Struct_Union
265
+ CMDID = 1
266
+
267
+ FIELDS = {
268
+ CMDID => {:type => ::Thrift::Types::I64, :name => 'cmdid'}
269
+ }
270
+
271
+ def struct_fields; FIELDS; end
272
+
273
+ def validate
274
+ end
275
+
276
+ ::Thrift::Struct.generate_accessors self
277
+ end
278
+
279
+ class IsFailure_result
280
+ include ::Thrift::Struct, ::Thrift::Struct_Union
281
+ SUCCESS = 0
282
+
283
+ FIELDS = {
284
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
285
+ }
286
+
287
+ def struct_fields; FIELDS; end
288
+
289
+ def validate
290
+ end
291
+
292
+ ::Thrift::Struct.generate_accessors self
293
+ end
294
+
295
+ class GetNodeStatuses_args
296
+ include ::Thrift::Struct, ::Thrift::Struct_Union
297
+
298
+ FIELDS = {
299
+
300
+ }
301
+
302
+ def struct_fields; FIELDS; end
303
+
304
+ def validate
305
+ end
306
+
307
+ ::Thrift::Struct.generate_accessors self
308
+ end
309
+
310
+ class GetNodeStatuses_result
311
+ include ::Thrift::Struct, ::Thrift::Struct_Union
312
+ SUCCESS = 0
313
+
314
+ FIELDS = {
315
+ SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => FlumeNodeStatusThrift}}
316
+ }
317
+
318
+ def struct_fields; FIELDS; end
319
+
320
+ def validate
321
+ end
322
+
323
+ ::Thrift::Struct.generate_accessors self
324
+ end
325
+
326
+ class GetConfigs_args
327
+ include ::Thrift::Struct, ::Thrift::Struct_Union
328
+
329
+ FIELDS = {
330
+
331
+ }
332
+
333
+ def struct_fields; FIELDS; end
334
+
335
+ def validate
336
+ end
337
+
338
+ ::Thrift::Struct.generate_accessors self
339
+ end
340
+
341
+ class GetConfigs_result
342
+ include ::Thrift::Struct, ::Thrift::Struct_Union
343
+ SUCCESS = 0
344
+
345
+ FIELDS = {
346
+ SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => ThriftFlumeConfigData}}
347
+ }
348
+
349
+ def struct_fields; FIELDS; end
350
+
351
+ def validate
352
+ end
353
+
354
+ ::Thrift::Struct.generate_accessors self
355
+ end
356
+
357
+ class HasCmdId_args
358
+ include ::Thrift::Struct, ::Thrift::Struct_Union
359
+ CMDID = 1
360
+
361
+ FIELDS = {
362
+ CMDID => {:type => ::Thrift::Types::I64, :name => 'cmdid'}
363
+ }
364
+
365
+ def struct_fields; FIELDS; end
366
+
367
+ def validate
368
+ end
369
+
370
+ ::Thrift::Struct.generate_accessors self
371
+ end
372
+
373
+ class HasCmdId_result
374
+ include ::Thrift::Struct, ::Thrift::Struct_Union
375
+ SUCCESS = 0
376
+
377
+ FIELDS = {
378
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'}
379
+ }
380
+
381
+ def struct_fields; FIELDS; end
382
+
383
+ def validate
384
+ end
385
+
386
+ ::Thrift::Struct.generate_accessors self
387
+ end
388
+
389
+ class GetCmdStatus_args
390
+ include ::Thrift::Struct, ::Thrift::Struct_Union
391
+ CMDID = 1
392
+
393
+ FIELDS = {
394
+ CMDID => {:type => ::Thrift::Types::I64, :name => 'cmdid'}
395
+ }
396
+
397
+ def struct_fields; FIELDS; end
398
+
399
+ def validate
400
+ end
401
+
402
+ ::Thrift::Struct.generate_accessors self
403
+ end
404
+
405
+ class GetCmdStatus_result
406
+ include ::Thrift::Struct, ::Thrift::Struct_Union
407
+ SUCCESS = 0
408
+
409
+ FIELDS = {
410
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CommandStatusThrift}
411
+ }
412
+
413
+ def struct_fields; FIELDS; end
414
+
415
+ def validate
416
+ end
417
+
418
+ ::Thrift::Struct.generate_accessors self
419
+ end
420
+
421
+ class GetMappings_args
422
+ include ::Thrift::Struct, ::Thrift::Struct_Union
423
+ PHYSICALNODE = 1
424
+
425
+ FIELDS = {
426
+ PHYSICALNODE => {:type => ::Thrift::Types::STRING, :name => 'physicalNode'}
427
+ }
428
+
429
+ def struct_fields; FIELDS; end
430
+
431
+ def validate
432
+ end
433
+
434
+ ::Thrift::Struct.generate_accessors self
435
+ end
436
+
437
+ class GetMappings_result
438
+ include ::Thrift::Struct, ::Thrift::Struct_Union
439
+ SUCCESS = 0
440
+
441
+ FIELDS = {
442
+ SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRING}}}
443
+ }
444
+
445
+ def struct_fields; FIELDS; end
446
+
447
+ def validate
448
+ end
449
+
450
+ ::Thrift::Struct.generate_accessors self
451
+ end
452
+
453
+ end
454
+