radiator 0.3.0dev5 → 0.3.0dev6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0300379f694e6b5d2fe18be77196a8f9b4b9f37
4
- data.tar.gz: 00b66899ce104b1c808e29f7eb54c4db3c62972a
3
+ metadata.gz: 8803f44d2a11ce39405501770a010b630293b59d
4
+ data.tar.gz: 0a6b77288fe61ba6f3f0fb876c3e2fb87ae62043
5
5
  SHA512:
6
- metadata.gz: 5ae0d2cc76c491041bcdcc438fbe32bede7173ce9249a2b170990a605bd9a95aba01901589e7acc452a42776eefbb71767f52313004f5638ffdfc1e376164f0b
7
- data.tar.gz: 348db9e3128b82025986f9972199fd8063bf46266fbfcf6e1424d973c879cca7c96ab20fc3c8c0cfec720d570ff91f697a413bc197cd917be9c60356e84c5ed6
6
+ metadata.gz: 8f425356209ba6b4fffc261b01959bce1d10130b5fec58ba76b126409bda7e6fa55065c09212acab5a65208a02974ae6a7d8d11e4f740554e6e7ce59780d155c
7
+ data.tar.gz: e547e2ec25f5b756748becabb856bdfb72e64ccb04389ca868b21a4c65dd322bcef90d97562ccca237f8c6fa37fe08755cfac18843d3af0fbdcfa9607f813c37
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiator (0.3.0dev5)
4
+ radiator (0.3.0dev6)
5
5
  bitcoin-ruby (= 0.0.11)
6
6
  ffi (= 1.9.18)
7
7
  hashie (~> 3.5, >= 3.5.5)
@@ -29,39 +29,37 @@ GEM
29
29
  ffi (1.9.18)
30
30
  hashdiff (0.3.6)
31
31
  hashie (3.5.6)
32
- json (2.0.2)
32
+ json (2.1.0)
33
33
  little-plugger (1.1.4)
34
34
  logging (2.2.2)
35
35
  little-plugger (~> 1.1)
36
36
  multi_json (~> 1.10)
37
- method_source (0.8.2)
37
+ method_source (0.9.0)
38
38
  minitest (5.10.3)
39
39
  minitest-line (0.6.4)
40
40
  minitest (~> 5.0)
41
41
  multi_json (1.12.2)
42
42
  multipart-post (2.0.0)
43
43
  net-http-persistent (2.9.4)
44
- pry (0.10.4)
44
+ pry (0.11.1)
45
45
  coderay (~> 1.1.0)
46
- method_source (~> 0.8.1)
47
- slop (~> 3.4)
48
- public_suffix (3.0.0)
49
- rake (11.3.0)
46
+ method_source (~> 0.9.0)
47
+ public_suffix (2.0.5)
48
+ rake (12.1.0)
50
49
  safe_yaml (1.0.4)
51
50
  simplecov (0.15.1)
52
51
  docile (~> 1.1.0)
53
52
  json (>= 1.8, < 3)
54
53
  simplecov-html (~> 0.10.0)
55
54
  simplecov-html (0.10.2)
56
- slop (3.6.0)
57
55
  typhoeus (1.3.0)
58
56
  ethon (>= 0.9.0)
59
- vcr (2.9.3)
60
- webmock (2.3.2)
57
+ vcr (3.0.3)
58
+ webmock (2.1.0)
61
59
  addressable (>= 2.3.6)
62
60
  crack (>= 0.3.2)
63
61
  hashdiff
64
- yard (0.8.7.6)
62
+ yard (0.9.9)
65
63
 
66
64
  PLATFORMS
67
65
  ruby
@@ -73,14 +71,14 @@ DEPENDENCIES
73
71
  faraday (~> 0.9.2)
74
72
  minitest (~> 5.9, >= 5.9.0)
75
73
  minitest-line (~> 0.6.3)
76
- pry (~> 0.10.3)
74
+ pry (~> 0.11.1)
77
75
  radiator!
78
- rake (~> 11.2, >= 11.2.2)
76
+ rake (~> 12.1, >= 12.1.0)
79
77
  simplecov (~> 0.15.1)
80
78
  typhoeus (~> 1.0, >= 1.0.2)
81
- vcr (~> 2.9, >= 2.9.2)
79
+ vcr (~> 3.0, >= 3.0.3)
82
80
  webmock (~> 2.1, >= 2.1.0)
83
- yard (~> 0.8.7.6)
81
+ yard (~> 0.9.9)
84
82
 
85
83
  BUNDLED WITH
86
84
  1.15.4
data/README.md CHANGED
@@ -52,6 +52,8 @@ If you don't have `bundler`, see the next section.
52
52
 
53
53
  ### Prerequisites
54
54
 
55
+ `minimum ruby version: 2.2`
56
+
55
57
  #### Linux
56
58
 
57
59
  ```bash
@@ -23,6 +23,8 @@ module Radiator
23
23
  require 'radiator/network_broadcast_api'
24
24
  require 'radiator/chain_stats_api'
25
25
  require 'radiator/account_by_key_api'
26
+ require 'radiator/condenser_api'
27
+ require 'radiator/block_api'
26
28
  require 'radiator/stream'
27
29
  require 'radiator/operation_ids'
28
30
  require 'radiator/operation_types'
@@ -135,7 +135,6 @@ module Radiator
135
135
 
136
136
  DEFAULT_FAILOVER_URLS = [
137
137
  DEFAULT_URL,
138
- 'https://steemd.steemitdev.com',
139
138
  'https://steemd-int.steemit.com',
140
139
  'https://steemd.steemitstage.com',
141
140
  'https://gtg.steem.house:8090',
@@ -167,13 +166,19 @@ module Radiator
167
166
  @password = options[:password]
168
167
  @url = options[:url] || DEFAULT_URL
169
168
  @preferred_url = @url.dup
170
- @failover_urls = options[:failover_urls] || (DEFAULT_FAILOVER_URLS - [@url])
171
- @preferred_failover_urls = @failover_urls.dup
169
+ @failover_urls = options[:failover_urls]
172
170
  @debug = !!options[:debug]
173
171
  @logger = options[:logger] || Radiator.logger
174
172
  @hashie_logger = options[:hashie_logger] || Logger.new(nil)
175
173
  @max_requests = options[:max_requests] || 30
176
174
 
175
+ if @failover_urls.nil?
176
+ @failover_urls = DEFAULT_FAILOVER_URLS - [@url]
177
+ end
178
+
179
+ @failover_urls = [@failover_urls].flatten.compact
180
+ @preferred_failover_urls = @failover_urls.dup
181
+
177
182
  unless @hashie_logger.respond_to? :warn
178
183
  @hashie_logger = Logger.new(@hashie_logger)
179
184
  end
@@ -213,11 +218,11 @@ module Radiator
213
218
 
214
219
  if !!block
215
220
  block_number.each do |i|
216
- yield api.get_block(i).result, i
221
+ yield block_api.get_block(i).result, i
217
222
  end
218
223
  else
219
224
  block_number.map do |i|
220
- api.get_block(i).result
225
+ block_api.get_block(i).result
221
226
  end
222
227
  end
223
228
  end
@@ -311,6 +316,8 @@ module Radiator
311
316
  @http = nil
312
317
  @api.shutdown if !!@api && @api != self
313
318
  @api = nil
319
+ @block_api.shutdown if !!@block_api && @block_api != self
320
+ @block_api = nil
314
321
  end
315
322
 
316
323
  # @private
@@ -450,7 +457,11 @@ module Radiator
450
457
  def api
451
458
  @api ||= self.class == Api ? self : Api.new(@api_options)
452
459
  end
453
-
460
+
461
+ def block_api
462
+ @block_api ||= self.class == BlockApi ? self : BlockApi.new(@api_options)
463
+ end
464
+
454
465
  def rpc_id
455
466
  @rpc_id ||= 0
456
467
  @rpc_id = @rpc_id + 1
@@ -0,0 +1,14 @@
1
+ module Radiator
2
+ class BlockApi < Api
3
+ def method_names
4
+ @method_names ||= [
5
+ :get_block_header,
6
+ :get_block
7
+ ].freeze
8
+ end
9
+
10
+ def api_name
11
+ :block_api
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,25 @@
1
+ module Radiator
2
+ class CondenserApi < Api
3
+ def method_names
4
+ @method_names ||= [
5
+ :get_state,
6
+ :get_next_scheduled_hardfork,
7
+ :get_reward_fund,
8
+ :get_accounts,
9
+ :lookup_account_names,
10
+ :lookup_accounts,
11
+ :get_account_count,
12
+ :get_savings_withdraw_to,
13
+ :get_witnesses,
14
+ :get_witness_count,
15
+ :get_open_orders,
16
+ :get_account_votes,
17
+ :lookup_witness_accounts
18
+ ].freeze
19
+ end
20
+
21
+ def api_name
22
+ :condenser_api
23
+ end
24
+ end
25
+ end
@@ -225,8 +225,9 @@ module Radiator
225
225
  head_block = api.get_dynamic_global_properties do |properties|
226
226
  if properties.head_block_number.nil?
227
227
  # This can happen if a reverse proxy is acting up.
228
- warning "Bad block sequence after height: #{latest_block_number}"
229
- throw :sequence
228
+ standby "Bad block sequence after height: #{latest_block_number}", {
229
+ and: {throw: :sequence}
230
+ }
230
231
  end
231
232
 
232
233
  case mode.to_sym
@@ -242,9 +243,9 @@ module Radiator
242
243
  throw :sequence
243
244
  elsif head_block < latest_block_number
244
245
  # This can happen if a reverse proxy is acting up.
245
- warning "Invalid block sequence at height: #{head_block}"
246
- sleep 0.5
247
- throw :sequence
246
+ standby "Invalid block sequence at height: #{head_block}", {
247
+ and: {backoff: api, throw: :sequence}
248
+ }
248
249
  end
249
250
 
250
251
  start ||= head_block
@@ -253,7 +254,7 @@ module Radiator
253
254
  if range.size > 400
254
255
  # When the range is 400 blocks, the stream will be behind by about
255
256
  # 20 minutes. Time to warn.
256
- warning "Stream behind by #{range.size} blocks (about #{(range.size * 3) / 60.0} minutes)."
257
+ standby "Stream behind by #{range.size} blocks (about #{(range.size * 3) / 60.0} minutes)."
257
258
  end
258
259
 
259
260
  [*range].each do |n|
@@ -262,14 +263,16 @@ module Radiator
262
263
  counter = 0
263
264
  end
264
265
 
265
- api.get_block(n) do |current_block, error|
266
+ block_api.get_block(n) do |current_block, error|
266
267
  if current_block.nil?
267
- warning "Node responded with: empty block, retrying ..."
268
- throw :sequence
268
+ standby "Node responded with: empty block, retrying ...", {
269
+ and: {throw: :sequence}
270
+ }
269
271
  elsif !!error
270
- warning "Node responded with: #{error.message || 'unknown error'}, retrying ..."
271
- ap error
272
- throw :sequence
272
+ standby "Node responded with: #{error.message || 'unknown error'}, retrying ...", {
273
+ error: error,
274
+ and: {throw: :sequence}
275
+ }
273
276
  end
274
277
 
275
278
  latest_block_number = n
@@ -397,5 +400,18 @@ module Radiator
397
400
 
398
401
  (Radiator::OperationTypes::TYPES.keys && type).any?
399
402
  end
403
+
404
+ def standby(message, options = {})
405
+ error = options[:error]
406
+ secondary = options[:and] || {}
407
+ backoff_api = secondary[:backoff]
408
+ throwable = secondary[:throw]
409
+
410
+ warning message
411
+
412
+ ap error if !!error
413
+ backoff_api.send :backoff if !!backoff_api
414
+ throw throwable if !!throwable
415
+ end
400
416
  end
401
- end
417
+ end
@@ -1,7 +1,29 @@
1
1
  module Radiator
2
2
  class TagApi < Api
3
3
  def method_names
4
- @method_names ||= [:get_tags].freeze
4
+ @method_names ||= [
5
+ :get_tags, # deprecated
6
+ :get_trending_tags,
7
+ :get_tags_used_by_author,
8
+ :get_discussion,
9
+ :get_content_replies,
10
+ :get_post_discussions_by_payout,
11
+ :get_comment_discussions_by_payout,
12
+ :get_discussions_by_trending,
13
+ :get_discussions_by_created,
14
+ :get_discussions_by_active,
15
+ :get_discussions_by_cashout,
16
+ :get_discussions_by_votes,
17
+ :get_discussions_by_children,
18
+ :get_discussions_by_hot,
19
+ :get_discussions_by_feed,
20
+ :get_discussions_by_blog,
21
+ :get_discussions_by_comments,
22
+ :get_discussions_by_promoted,
23
+ :get_replies_by_last_update,
24
+ :get_discussions_by_author_before_date,
25
+ :get_active_votes
26
+ ].freeze
5
27
  end
6
28
 
7
29
  def api_name
@@ -1,3 +1,3 @@
1
1
  module Radiator
2
- VERSION = '0.3.0dev5'
2
+ VERSION = '0.3.0dev6'
3
3
  end
@@ -18,17 +18,17 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 1.15', '>= 1.15.4'
21
- spec.add_development_dependency 'rake', '~> 11.2', '>= 11.2.2'
21
+ spec.add_development_dependency 'rake', '~> 12.1', '>= 12.1.0'
22
22
  spec.add_development_dependency 'minitest', '~> 5.9', '>= 5.9.0'
23
23
  spec.add_development_dependency 'minitest-line', '~> 0.6.3'
24
24
  spec.add_development_dependency 'webmock', '~> 2.1', '>= 2.1.0'
25
25
  spec.add_development_dependency 'simplecov', '~> 0.15.1'
26
26
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5.2'
27
- spec.add_development_dependency 'vcr', '~> 2.9', '>= 2.9.2'
27
+ spec.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
28
28
  spec.add_development_dependency 'faraday', '~> 0.9.2'
29
29
  spec.add_development_dependency 'typhoeus', '~> 1.0', '>= 1.0.2'
30
- spec.add_development_dependency 'yard', '~> 0.8.7.6'
31
- spec.add_development_dependency 'pry', '~> 0.10.3'
30
+ spec.add_development_dependency 'yard', '~> 0.9.9'
31
+ spec.add_development_dependency 'pry', '~> 0.11.1'
32
32
  spec.add_development_dependency 'awesome_print', '~> 1.7', '>= 1.7.0'
33
33
 
34
34
  # Maximum for net-http-persistent is 2.9.4, required by ruby-2.0.0-p645, which
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0dev5
4
+ version: 0.3.0dev6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '11.2'
39
+ version: '12.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 11.2.2
42
+ version: 12.1.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '11.2'
49
+ version: '12.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 11.2.2
52
+ version: 12.1.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: minitest
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -138,20 +138,20 @@ dependencies:
138
138
  requirements:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: '2.9'
141
+ version: '3.0'
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 2.9.2
144
+ version: 3.0.3
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '2.9'
151
+ version: '3.0'
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: 2.9.2
154
+ version: 3.0.3
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: faraday
157
157
  requirement: !ruby/object:Gem::Requirement
@@ -192,28 +192,28 @@ dependencies:
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: 0.8.7.6
195
+ version: 0.9.9
196
196
  type: :development
197
197
  prerelease: false
198
198
  version_requirements: !ruby/object:Gem::Requirement
199
199
  requirements:
200
200
  - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: 0.8.7.6
202
+ version: 0.9.9
203
203
  - !ruby/object:Gem::Dependency
204
204
  name: pry
205
205
  requirement: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: 0.10.3
209
+ version: 0.11.1
210
210
  type: :development
211
211
  prerelease: false
212
212
  version_requirements: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - "~>"
215
215
  - !ruby/object:Gem::Version
216
- version: 0.10.3
216
+ version: 0.11.1
217
217
  - !ruby/object:Gem::Dependency
218
218
  name: awesome_print
219
219
  requirement: !ruby/object:Gem::Requirement
@@ -362,9 +362,11 @@ files:
362
362
  - lib/radiator/account_by_key_api.rb
363
363
  - lib/radiator/api.rb
364
364
  - lib/radiator/base_error.rb
365
+ - lib/radiator/block_api.rb
365
366
  - lib/radiator/broadcast_operations.json
366
367
  - lib/radiator/chain_config.rb
367
368
  - lib/radiator/chain_stats_api.rb
369
+ - lib/radiator/condenser_api.rb
368
370
  - lib/radiator/database_api.rb
369
371
  - lib/radiator/follow_api.rb
370
372
  - lib/radiator/logger.rb
@@ -415,4 +417,3 @@ signing_key:
415
417
  specification_version: 4
416
418
  summary: STEEM RPC Ruby Client
417
419
  test_files: []
418
- has_rdoc: