zold 0.23.9 → 0.23.10

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
  SHA256:
3
- metadata.gz: 6adc05e3a39654916c6db0930e0cc0e2040c911ae82224e43e8fd08f534977ef
4
- data.tar.gz: 5426a3ef89226b32836cbe793949d05e352af6f33e0dbfc09dc0618a72cb71ed
3
+ metadata.gz: f5719b8dfeb390eb155df8e38deaa12243ae7223f31c51a86dbc1a56abd1174d
4
+ data.tar.gz: 2c83351b136b14629b2640897d1eecf8bc7a7d3907e1b7b21b3c8ddaa4d9c44d
5
5
  SHA512:
6
- metadata.gz: 97154e00aef0b0a65f1d13a72f2577c8aec2e0d820c852f0c855b008c0e51512cffa962ab9634dc80e0661d8b6cc57d28e35ae94c89f046ea2b61d2de91256c5
7
- data.tar.gz: 77d6c919564d1412e65bfe7344006408e08d3994457c9ab6fb37c02284073146f16cfa099ca6f7274dfb12ee26b052df237d80f59e42ebafba17232f9091f9f7
6
+ metadata.gz: 85ede5d5163fb9dcb2f14796258ab4efcfd3f1017f1c82f226c695ca66ae74ea6bb9b13aa7f91ef85c05ec225579a3345ead7d2876a6120424e04efe46bb3f31
7
+ data.tar.gz: e2b44d53856b92af6503e1c505e044aa76329137bd016b1be2eaabfdbeb2ae514e8dc0bdbf0e4d1e70f75899bd50d73666f7c564ff5d5d61b189418034d75a1a
data/INSTALL.md CHANGED
@@ -63,9 +63,15 @@ Without homebrew:
63
63
  ## Windows
64
64
 
65
65
  Download and install [RubyInstaller (with Devkit)](https://rubyinstaller.org/downloads/).
66
- If Windows Defender (or antivirus software) throws an error, ignore it and allow the file. This file is known to trigger [false positives](https://groups.google.com/forum/#!topic/rubyinstaller/LCR-CbBoGOI).
66
+ If Windows Defender (or antivirus software) throws an error, ignore it and allow the file.
67
+ This file is known to trigger [false positives](https://groups.google.com/forum/#!topic/rubyinstaller/LCR-CbBoGOI).
67
68
  Download and install [RubyGems](https://rubygems.org/pages/download). Manual install `ruby setup.rb` works.
68
- Install [Zold gem](https://rubygems.org/gems/zold) `gem install --no-ri --no-rdoc zold`
69
+
70
+ Install [Zold gem](https://rubygems.org/gems/zold):
71
+
72
+ ```
73
+ gem install zold
74
+ ```
69
75
 
70
76
  ## CentOS 7.5
71
77
 
@@ -74,7 +74,7 @@ Available commands:
74
74
  #{Rainbow('remote trim').green}
75
75
  Remove the least reliable nodes
76
76
  #{Rainbow('remote select [options]').green}
77
- Select the strongest n nodes.
77
+ Select the most reliable N nodes.
78
78
  #{Rainbow('remote update').green}
79
79
  Check each registered remote node for availability
80
80
  Available options:"
@@ -211,16 +211,16 @@ Available options:"
211
211
  end
212
212
  return unless ping(host, port, opts)
213
213
  if @remotes.exists?(host, port)
214
- @log.info("#{host}:#{port} already exists among #{@remotes.all.count} others")
214
+ @log.debug("#{host}:#{port} already exists among #{@remotes.all.count} others")
215
215
  else
216
216
  @remotes.add(host, port)
217
- @log.info("#{host}:#{port} added to the list, #{@remotes.all.count} total")
217
+ @log.debug("#{host}:#{port} added to the list, #{@remotes.all.count} total")
218
218
  end
219
219
  end
220
220
 
221
221
  def remove(host, port, _)
222
222
  @remotes.remove(host, port)
223
- @log.info("#{host}:#{port} removed from the list, #{@remotes.all.count} total")
223
+ @log.debug("#{host}:#{port} removed from the list, #{@remotes.all.count} total")
224
224
  end
225
225
 
226
226
  # Returns an array of Zold::Score
@@ -256,9 +256,9 @@ Available options:"
256
256
  all.each do |r|
257
257
  next if r[:errors] <= opts['tolerate']
258
258
  @remotes.remove(r[:host], r[:port]) if !opts['masters-too'] || !r[:master]
259
- @log.info("#{r[:host]}:#{r[:port]} removed because of #{r[:errors]} errors (over #{opts['tolerate']})")
259
+ @log.debug("#{r[:host]}:#{r[:port]} removed because of #{r[:errors]} errors (over #{opts['tolerate']})")
260
260
  end
261
- @log.info("The list of #{all.count} remotes trimmed, #{@remotes.all.count} nodes left there")
261
+ @log.info("The list of #{all.count} remotes trimmed down to #{@remotes.all.count} nodes")
262
262
  end
263
263
 
264
264
  def update(opts)
@@ -284,7 +284,7 @@ Available options:"
284
284
  add(s['host'], s['port'], opts)
285
285
  end
286
286
  capacity << { host: score.host, port: score.port, count: json['all'].count }
287
- @log.info("#{r}: the score is #{Rainbow(score.value).green} (#{json['version']}) in #{Age.new(start)}")
287
+ @log.debug("#{r}: the score is #{Rainbow(score.value).green} (#{json['version']}) in #{Age.new(start)}")
288
288
  end
289
289
  end
290
290
  end
@@ -345,13 +345,13 @@ it's recommended to reboot, but I don't do it because of --never-reboot")
345
345
  end
346
346
 
347
347
  def select(opts)
348
- @remotes.all.sort_by { |r| r[:score] }.reverse.each_with_index do |r, idx|
348
+ @remotes.all.sort_by { |r| r[:errors] }.reverse.each_with_index do |r, idx|
349
349
  next if idx < opts['max-nodes']
350
350
  next if r[:master] && !opts['masters-too']
351
351
  @remotes.remove(r[:host], r[:port])
352
- @log.info("Remote #{r[:host]}:#{r[:port]}/#{r[:score]} removed from the list, #{@remotes.all.count} left")
352
+ @log.debug("Remote #{r[:host]}:#{r[:port]}/#{r[:score]}/#{r[:errors]}e removed from the list")
353
353
  end
354
- @log.info("#{@remotes.all.count} remote nodes left in the list")
354
+ @log.info("#{@remotes.all.count} remote nodes were selected to stay in the list")
355
355
  end
356
356
 
357
357
  def terminate
data/lib/zold/remotes.rb CHANGED
@@ -189,7 +189,6 @@ module Zold
189
189
  modify do |list|
190
190
  list.reject { |r| r[:host] == host.downcase && r[:port] == port }
191
191
  end
192
- unerror(host, port)
193
192
  end
194
193
 
195
194
  # Go through the list of remotes and call a provided block for each
@@ -230,7 +229,6 @@ module Zold
230
229
 
231
230
  def unerror(host, port = PORT)
232
231
  assert_host_info(host, port)
233
-
234
232
  if_present(host, port) do |remote|
235
233
  remote[:errors] -= 1 if (remote[:errors]).positive?
236
234
  end
data/lib/zold/version.rb CHANGED
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.23.9'
28
+ VERSION = '0.23.10'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  end
@@ -183,11 +183,12 @@ class TestRemote < Zold::Test
183
183
  (1..11).each do |i|
184
184
  cmd.run(%W[remote add localhost #{i} --skip-ping])
185
185
  remotes.rescore('localhost', i, i)
186
+ i.times { remotes.error('localhost', i) }
186
187
  end
187
188
  cmd.run(%w[remote select --max-nodes=5])
188
189
  assert_equal(5, remotes.all.count)
189
190
  scores = remotes.all.map { |r| r[:score] }
190
- assert_equal([11, 10, 9, 8, 7], scores)
191
+ assert_equal([7, 8, 9, 10, 11], scores.sort)
191
192
  end
192
193
  end
193
194
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.9
4
+ version: 0.23.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -753,7 +753,7 @@ licenses:
753
753
  - MIT
754
754
  metadata: {}
755
755
  post_install_message: |-
756
- Thanks for installing Zold 0.23.9!
756
+ Thanks for installing Zold 0.23.10!
757
757
  Study our White Paper: https://papers.zold.io/wp.pdf
758
758
  Read our blog posts: https://blog.zold.io
759
759
  Try ZLD online wallet at: https://wts.zold.io