concord-ruby 0.2.3 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68be6f3feb36885d9317cd9d4103c1f7e7a722ff
4
- data.tar.gz: 7b3c5a893642ded74f1c8d661bd5df470ab5d783
3
+ metadata.gz: d376f3d054dc1c91ec2138d090f3d950c60cd5f3
4
+ data.tar.gz: 309c1dbfde4f3a5ad0289063f76ab8571c15f5ce
5
5
  SHA512:
6
- metadata.gz: 8bf83837433087365b91e77b9e7d737e106ff3ee9968e208f2264c4be37afca623387281bc3fe857fe24dfb4f82490c7a4d37e62e161dd3bdb3c74d5e1a3e9b5
7
- data.tar.gz: 3aa9bbfd83ad54580c0c3f5bdadc9ceed7fbad3fcbe737979f237afe657a4975debc82546521343f49beea6b37fe8994c87900089d1d92f131e2c949ef3fdbd8
6
+ metadata.gz: 8c583473bc854995be0305764363578bec40ec720c35bd618678b2bfbe850c75b2f3a5e9250c7818125e7bfbe2f21357f718281ca6a246a96bc198c452802f36
7
+ data.tar.gz: 3b8433f9bcb10309e71cffe71c52a1cfdb6cacc9658df2129b2e91f066f22823e22a4c0765cec7157e7a04de41bf6d00ebb5ca2dbb03c8118056fa6703a9294c
data/lib/concord.rb CHANGED
@@ -128,15 +128,19 @@ module Concord
128
128
  server.serve
129
129
  end
130
130
 
131
- # Process an upstream record. Wraps the user method in a transaction, which
132
- # is returned to the proxy upon completion.
133
- # @param record [Concord::Thrift::Record] The record to process
134
- def boltProcessRecord(record)
135
- ctx = ComputationContext.new(self)
136
- log_failure do
137
- handler.process_record(ctx, record)
131
+ # Process records from upstream. Wraps the user method in transactions,
132
+ # which are returned to the proxy upon completion.
133
+ # @param records [Concord::Thrift::Record] The record to process
134
+ def boltProcessRecords(records)
135
+ txs = []
136
+ records.each do |record|
137
+ ctx = ComputationContext.new(self)
138
+ log_failure do
139
+ handler.process_record(ctx, record)
140
+ end
141
+ txs.push(ctx.transaction)
138
142
  end
139
- ctx.transaction
143
+ txs
140
144
  end
141
145
 
142
146
  # Process a timer callback from the proxy. Wraps the user method in a
@@ -14,36 +14,19 @@ module Concord
14
14
  class Client < ::Concord::Thrift::MutableEphemeralStateService::Client
15
15
  include ::Thrift::Client
16
16
 
17
- def registerRichStream(r)
18
- send_registerRichStream(r)
19
- return recv_registerRichStream()
17
+ def updateTopology(topology)
18
+ send_updateTopology(topology)
19
+ recv_updateTopology()
20
20
  end
21
21
 
22
- def send_registerRichStream(r)
23
- send_message('registerRichStream', RegisterRichStream_args, :r => r)
22
+ def send_updateTopology(topology)
23
+ send_message('updateTopology', UpdateTopology_args, :topology => topology)
24
24
  end
25
25
 
26
- def recv_registerRichStream()
27
- result = receive_message(RegisterRichStream_result)
28
- return result.success unless result.success.nil?
26
+ def recv_updateTopology()
27
+ result = receive_message(UpdateTopology_result)
29
28
  raise result.e unless result.e.nil?
30
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'registerRichStream failed: unknown result')
31
- end
32
-
33
- def deregisterRichStream(r)
34
- send_deregisterRichStream(r)
35
- return recv_deregisterRichStream()
36
- end
37
-
38
- def send_deregisterRichStream(r)
39
- send_message('deregisterRichStream', DeregisterRichStream_args, :r => r)
40
- end
41
-
42
- def recv_deregisterRichStream()
43
- result = receive_message(DeregisterRichStream_result)
44
- return result.success unless result.success.nil?
45
- raise result.e unless result.e.nil?
46
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'deregisterRichStream failed: unknown result')
29
+ return
47
30
  end
48
31
 
49
32
  def dispatchRecords(records)
@@ -88,26 +71,15 @@ module Concord
88
71
  class Processor < ::Concord::Thrift::MutableEphemeralStateService::Processor
89
72
  include ::Thrift::Processor
90
73
 
91
- def process_registerRichStream(seqid, iprot, oprot)
92
- args = read_args(iprot, RegisterRichStream_args)
93
- result = RegisterRichStream_result.new()
74
+ def process_updateTopology(seqid, iprot, oprot)
75
+ args = read_args(iprot, UpdateTopology_args)
76
+ result = UpdateTopology_result.new()
94
77
  begin
95
- result.success = @handler.registerRichStream(args.r)
78
+ @handler.updateTopology(args.topology)
96
79
  rescue ::Concord::Thrift::BoltError => e
97
80
  result.e = e
98
81
  end
99
- write_result(result, oprot, 'registerRichStream', seqid)
100
- end
101
-
102
- def process_deregisterRichStream(seqid, iprot, oprot)
103
- args = read_args(iprot, DeregisterRichStream_args)
104
- result = DeregisterRichStream_result.new()
105
- begin
106
- result.success = @handler.deregisterRichStream(args.r)
107
- rescue ::Concord::Thrift::BoltError => e
108
- result.e = e
109
- end
110
- write_result(result, oprot, 'deregisterRichStream', seqid)
82
+ write_result(result, oprot, 'updateTopology', seqid)
111
83
  end
112
84
 
113
85
  def process_dispatchRecords(seqid, iprot, oprot)
@@ -142,46 +114,12 @@ module Concord
142
114
 
143
115
  # HELPER FUNCTIONS AND STRUCTURES
144
116
 
145
- class RegisterRichStream_args
146
- include ::Thrift::Struct, ::Thrift::Struct_Union
147
- R = 1
148
-
149
- FIELDS = {
150
- R => {:type => ::Thrift::Types::STRUCT, :name => 'r', :class => ::Concord::Thrift::RichStream}
151
- }
152
-
153
- def struct_fields; FIELDS; end
154
-
155
- def validate
156
- end
157
-
158
- ::Thrift::Struct.generate_accessors self
159
- end
160
-
161
- class RegisterRichStream_result
162
- include ::Thrift::Struct, ::Thrift::Struct_Union
163
- SUCCESS = 0
164
- E = 1
165
-
166
- FIELDS = {
167
- SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
168
- E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => ::Concord::Thrift::BoltError}
169
- }
170
-
171
- def struct_fields; FIELDS; end
172
-
173
- def validate
174
- end
175
-
176
- ::Thrift::Struct.generate_accessors self
177
- end
178
-
179
- class DeregisterRichStream_args
117
+ class UpdateTopology_args
180
118
  include ::Thrift::Struct, ::Thrift::Struct_Union
181
- R = 1
119
+ TOPOLOGY = 1
182
120
 
183
121
  FIELDS = {
184
- R => {:type => ::Thrift::Types::STRUCT, :name => 'r', :class => ::Concord::Thrift::RichStream}
122
+ TOPOLOGY => {:type => ::Thrift::Types::STRUCT, :name => 'topology', :class => ::Concord::Thrift::TopologyMetadata}
185
123
  }
186
124
 
187
125
  def struct_fields; FIELDS; end
@@ -192,13 +130,11 @@ module Concord
192
130
  ::Thrift::Struct.generate_accessors self
193
131
  end
194
132
 
195
- class DeregisterRichStream_result
133
+ class UpdateTopology_result
196
134
  include ::Thrift::Struct, ::Thrift::Struct_Union
197
- SUCCESS = 0
198
135
  E = 1
199
136
 
200
137
  FIELDS = {
201
- SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
202
138
  E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => ::Concord::Thrift::BoltError}
203
139
  }
204
140
 
@@ -46,7 +46,7 @@ module Concord
46
46
 
47
47
  def registerComputation(computation)
48
48
  send_registerComputation(computation)
49
- recv_registerComputation()
49
+ return recv_registerComputation()
50
50
  end
51
51
 
52
52
  def send_registerComputation(computation)
@@ -55,8 +55,9 @@ module Concord
55
55
 
56
56
  def recv_registerComputation()
57
57
  result = receive_message(RegisterComputation_result)
58
+ return result.success unless result.success.nil?
58
59
  raise result.e unless result.e.nil?
59
- return
60
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'registerComputation failed: unknown result')
60
61
  end
61
62
 
62
63
  def scaleComputation(computationName, instances)
@@ -120,7 +121,7 @@ module Concord
120
121
  args = read_args(iprot, RegisterComputation_args)
121
122
  result = RegisterComputation_result.new()
122
123
  begin
123
- @handler.registerComputation(args.computation)
124
+ result.success = @handler.registerComputation(args.computation)
124
125
  rescue ::Concord::Thrift::BoltError => e
125
126
  result.e = e
126
127
  end
@@ -237,9 +238,11 @@ module Concord
237
238
 
238
239
  class RegisterComputation_result
239
240
  include ::Thrift::Struct, ::Thrift::Struct_Union
241
+ SUCCESS = 0
240
242
  E = 1
241
243
 
242
244
  FIELDS = {
245
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Concord::Thrift::TopologyMetadata},
243
246
  E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => ::Concord::Thrift::BoltError}
244
247
  }
245
248
 
@@ -29,20 +29,20 @@ module Concord
29
29
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'init failed: unknown result')
30
30
  end
31
31
 
32
- def boltProcessRecord(record)
33
- send_boltProcessRecord(record)
34
- return recv_boltProcessRecord()
32
+ def boltProcessRecords(records)
33
+ send_boltProcessRecords(records)
34
+ return recv_boltProcessRecords()
35
35
  end
36
36
 
37
- def send_boltProcessRecord(record)
38
- send_message('boltProcessRecord', BoltProcessRecord_args, :record => record)
37
+ def send_boltProcessRecords(records)
38
+ send_message('boltProcessRecords', BoltProcessRecords_args, :records => records)
39
39
  end
40
40
 
41
- def recv_boltProcessRecord()
42
- result = receive_message(BoltProcessRecord_result)
41
+ def recv_boltProcessRecords()
42
+ result = receive_message(BoltProcessRecords_result)
43
43
  return result.success unless result.success.nil?
44
44
  raise result.e unless result.e.nil?
45
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'boltProcessRecord failed: unknown result')
45
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'boltProcessRecords failed: unknown result')
46
46
  end
47
47
 
48
48
  def boltProcessTimer(key, time)
@@ -93,15 +93,15 @@ module Concord
93
93
  write_result(result, oprot, 'init', seqid)
94
94
  end
95
95
 
96
- def process_boltProcessRecord(seqid, iprot, oprot)
97
- args = read_args(iprot, BoltProcessRecord_args)
98
- result = BoltProcessRecord_result.new()
96
+ def process_boltProcessRecords(seqid, iprot, oprot)
97
+ args = read_args(iprot, BoltProcessRecords_args)
98
+ result = BoltProcessRecords_result.new()
99
99
  begin
100
- result.success = @handler.boltProcessRecord(args.record)
100
+ result.success = @handler.boltProcessRecords(args.records)
101
101
  rescue ::Concord::Thrift::BoltError => e
102
102
  result.e = e
103
103
  end
104
- write_result(result, oprot, 'boltProcessRecord', seqid)
104
+ write_result(result, oprot, 'boltProcessRecords', seqid)
105
105
  end
106
106
 
107
107
  def process_boltProcessTimer(seqid, iprot, oprot)
@@ -163,12 +163,12 @@ module Concord
163
163
  ::Thrift::Struct.generate_accessors self
164
164
  end
165
165
 
166
- class BoltProcessRecord_args
166
+ class BoltProcessRecords_args
167
167
  include ::Thrift::Struct, ::Thrift::Struct_Union
168
- RECORD = 1
168
+ RECORDS = 1
169
169
 
170
170
  FIELDS = {
171
- RECORD => {:type => ::Thrift::Types::STRUCT, :name => 'record', :class => ::Concord::Thrift::Record}
171
+ RECORDS => {:type => ::Thrift::Types::LIST, :name => 'records', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Concord::Thrift::Record}}
172
172
  }
173
173
 
174
174
  def struct_fields; FIELDS; end
@@ -179,13 +179,13 @@ module Concord
179
179
  ::Thrift::Struct.generate_accessors self
180
180
  end
181
181
 
182
- class BoltProcessRecord_result
182
+ class BoltProcessRecords_result
183
183
  include ::Thrift::Struct, ::Thrift::Struct_Union
184
184
  SUCCESS = 0
185
185
  E = 1
186
186
 
187
187
  FIELDS = {
188
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Concord::Thrift::ComputationTx},
188
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Concord::Thrift::ComputationTx}},
189
189
  E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => ::Concord::Thrift::BoltError}
190
190
  }
191
191
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concord-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Brown
@@ -51,7 +51,6 @@ files:
51
51
  - lib/gen-rb/bolt_constants.rb
52
52
  - lib/gen-rb/mutable_ephemeral_state_service.rb
53
53
  - lib/gen-rb/bolt_trace_aggregator_service.rb
54
- - lib/gen-rb/computation_test_service.rb
55
54
  - lib/gen-rb/bolt_manager_service.rb
56
55
  - lib/gen-rb/computation_service.rb
57
56
  - lib/gen-rb/bolt_proxy_service.rb
@@ -1,89 +0,0 @@
1
- #
2
- # Autogenerated by Thrift Compiler (0.9.2)
3
- #
4
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
- #
6
-
7
- require 'thrift'
8
- require 'computation_service'
9
- require 'bolt_types'
10
-
11
- module Concord
12
- module Thrift
13
- module ComputationTestService
14
- class Client < ::Concord::Thrift::ComputationService::Client
15
- include ::Thrift::Client
16
-
17
- def boltMetrics()
18
- send_boltMetrics()
19
- return recv_boltMetrics()
20
- end
21
-
22
- def send_boltMetrics()
23
- send_message('boltMetrics', BoltMetrics_args)
24
- end
25
-
26
- def recv_boltMetrics()
27
- result = receive_message(BoltMetrics_result)
28
- return result.success unless result.success.nil?
29
- raise result.e unless result.e.nil?
30
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'boltMetrics failed: unknown result')
31
- end
32
-
33
- end
34
-
35
- class Processor < ::Concord::Thrift::ComputationService::Processor
36
- include ::Thrift::Processor
37
-
38
- def process_boltMetrics(seqid, iprot, oprot)
39
- args = read_args(iprot, BoltMetrics_args)
40
- result = BoltMetrics_result.new()
41
- begin
42
- result.success = @handler.boltMetrics()
43
- rescue ::Concord::Thrift::BoltError => e
44
- result.e = e
45
- end
46
- write_result(result, oprot, 'boltMetrics', seqid)
47
- end
48
-
49
- end
50
-
51
- # HELPER FUNCTIONS AND STRUCTURES
52
-
53
- class BoltMetrics_args
54
- include ::Thrift::Struct, ::Thrift::Struct_Union
55
-
56
- FIELDS = {
57
-
58
- }
59
-
60
- def struct_fields; FIELDS; end
61
-
62
- def validate
63
- end
64
-
65
- ::Thrift::Struct.generate_accessors self
66
- end
67
-
68
- class BoltMetrics_result
69
- include ::Thrift::Struct, ::Thrift::Struct_Union
70
- SUCCESS = 0
71
- E = 1
72
-
73
- FIELDS = {
74
- SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
75
- E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => ::Concord::Thrift::BoltError}
76
- }
77
-
78
- def struct_fields; FIELDS; end
79
-
80
- def validate
81
- end
82
-
83
- ::Thrift::Struct.generate_accessors self
84
- end
85
-
86
- end
87
-
88
- end
89
- end