zold 0.16.23 → 0.16.24

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: d5128884745aa60eecc3b94b20b184ce5e297cf96d9550f12a20bccfa5445b01
4
- data.tar.gz: 4e1403a766b2e41e99de13956a38a32fc299cc77e81047bc96c80019cb3feb53
3
+ metadata.gz: be5fb06b537fc4c9e80b30fadf5f6cd1e1a344e7604dfecdc1ac78ed46176063
4
+ data.tar.gz: 9fbb3d142ca8047324eac09dc35beac86ba0cca2c72649034de550c220553cc5
5
5
  SHA512:
6
- metadata.gz: 9821efb88ba25bd9836794cba697a2342978cfda9281c7507f4d08a5b44d6b4c68535da47311b3cfe44a0cab05e6a94fec7a773414e73242ba98862abd3c2f91
7
- data.tar.gz: 2e3ff0c904aab956251070dfb01573022da6af3bfb9904df325c384d25795c184266c3b25826130eb91f01ce421db9cc6db5435e917f7a013180d076d9511597
6
+ metadata.gz: 2c90d865cabb1b36ae83ed263f2779d725ff98a15fd93606a94ca088522853aea674f2b8a1142e865849b4f2fee2522275adcb8bc918a0a021ca992a6be78409
7
+ data.tar.gz: 9fa78df566ec34dd99ebfb8ae24160295232245a2e75ee55be033d5c53a77f897cb52ce1e28609d15b5187de2861b0766699734c471b4c73c93e12216cf035ae
data/bin/zold CHANGED
@@ -28,6 +28,7 @@ start = Time.now
28
28
  require 'slop'
29
29
  require 'rainbow'
30
30
  require 'backtrace'
31
+ require 'memory_profiler'
31
32
  require_relative '../lib/zold'
32
33
  require_relative '../lib/zold/version'
33
34
  require_relative '../lib/zold/wallet'
@@ -110,6 +111,7 @@ Available options:"
110
111
  default: Zold::Wallet::MAIN_NETWORK
111
112
  o.bool '-h', '--help', 'Show these instructions'
112
113
  o.bool '--trace', 'Show full stack trace in case of a problem'
114
+ o.bool '--memory-dump', 'Dump memory snapshot afterwards, to the console', default: false
113
115
  o.bool '--skip-upgrades', 'Don\'t upgrade the storage', default: false
114
116
  o.bool '--ignore-global-config', 'Don\'t read options from the ~/.zold file'
115
117
  o.on '--no-colors', 'Disable colors in the ouput' do
@@ -183,66 +185,74 @@ Available options:"
183
185
 
184
186
  log.debug("Network: #{opts['network']} (#{opts['network'] == Zold::Wallet::MAIN_NETWORK ? 'main' : 'test'} net)")
185
187
 
186
- case command
187
- when 'node'
188
- require_relative '../lib/zold/commands/node'
189
- Zold::Node.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
190
- when 'create'
191
- require_relative '../lib/zold/commands/create'
192
- Zold::Create.new(wallets: wallets, log: log).run(args)
193
- when 'remote'
194
- require_relative '../lib/zold/commands/remote'
195
- Zold::Remote.new(remotes: remotes, log: log).run(args)
196
- when 'invoice'
197
- require_relative '../lib/zold/commands/invoice'
198
- Zold::Invoice.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
199
- when 'pay'
200
- require_relative '../lib/zold/commands/pay'
201
- Zold::Pay.new(wallets: wallets, remotes: remotes, log: log).run(args)
202
- when 'show'
203
- require_relative '../lib/zold/commands/show'
204
- Zold::Show.new(wallets: wallets, log: log).run(args)
205
- when 'list'
206
- require_relative '../lib/zold/commands/list'
207
- Zold::List.new(wallets: wallets, log: log).run(args)
208
- when 'fetch'
209
- require_relative '../lib/zold/commands/fetch'
210
- Zold::Fetch.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
211
- when 'clean'
212
- require_relative '../lib/zold/commands/clean'
213
- Zold::Clean.new(wallets: wallets, copies: copies, log: log).run(args)
214
- when 'remove'
215
- require_relative '../lib/zold/commands/remove'
216
- Zold::Remove.new(wallets: wallets, log: log).run(args)
217
- when 'diff'
218
- require_relative '../lib/zold/commands/diff'
219
- Zold::Diff.new(wallets: wallets, copies: copies, log: log).run(args)
220
- when 'merge'
221
- require_relative '../lib/zold/commands/merge'
222
- Zold::Merge.new(wallets: wallets, copies: copies, log: log).run(args)
223
- when 'propagate'
224
- require_relative '../lib/zold/commands/propagate'
225
- Zold::Propagate.new(wallets: wallets, log: log).run(args)
226
- when 'pull'
227
- require_relative '../lib/zold/commands/pull'
228
- Zold::Pull.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
229
- when 'taxes'
230
- require_relative '../lib/zold/commands/taxes'
231
- Zold::Taxes.new(wallets: wallets, remotes: remotes, log: log).run(args)
232
- when 'push'
233
- require_relative '../lib/zold/commands/push'
234
- Zold::Push.new(wallets: wallets, remotes: remotes, log: log).run(args)
235
- when 'alias'
236
- require_relative '../lib/zold/commands/alias'
237
- Zold::Alias.new(wallets: wallets, log: log).run(args)
238
- when 'score'
239
- require_relative '../lib/zold/commands/calculate'
240
- Zold::Calculate.new(log: log).run(args)
241
- when 'next'
242
- require_relative '../lib/zold/commands/next'
243
- Zold::Next.new(log: log).run(args)
188
+ cmd = lambda do
189
+ case command
190
+ when 'node'
191
+ require_relative '../lib/zold/commands/node'
192
+ Zold::Node.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
193
+ when 'create'
194
+ require_relative '../lib/zold/commands/create'
195
+ Zold::Create.new(wallets: wallets, log: log).run(args)
196
+ when 'remote'
197
+ require_relative '../lib/zold/commands/remote'
198
+ Zold::Remote.new(remotes: remotes, log: log).run(args)
199
+ when 'invoice'
200
+ require_relative '../lib/zold/commands/invoice'
201
+ Zold::Invoice.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
202
+ when 'pay'
203
+ require_relative '../lib/zold/commands/pay'
204
+ Zold::Pay.new(wallets: wallets, remotes: remotes, log: log).run(args)
205
+ when 'show'
206
+ require_relative '../lib/zold/commands/show'
207
+ Zold::Show.new(wallets: wallets, log: log).run(args)
208
+ when 'list'
209
+ require_relative '../lib/zold/commands/list'
210
+ Zold::List.new(wallets: wallets, log: log).run(args)
211
+ when 'fetch'
212
+ require_relative '../lib/zold/commands/fetch'
213
+ Zold::Fetch.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
214
+ when 'clean'
215
+ require_relative '../lib/zold/commands/clean'
216
+ Zold::Clean.new(wallets: wallets, copies: copies, log: log).run(args)
217
+ when 'remove'
218
+ require_relative '../lib/zold/commands/remove'
219
+ Zold::Remove.new(wallets: wallets, log: log).run(args)
220
+ when 'diff'
221
+ require_relative '../lib/zold/commands/diff'
222
+ Zold::Diff.new(wallets: wallets, copies: copies, log: log).run(args)
223
+ when 'merge'
224
+ require_relative '../lib/zold/commands/merge'
225
+ Zold::Merge.new(wallets: wallets, copies: copies, log: log).run(args)
226
+ when 'propagate'
227
+ require_relative '../lib/zold/commands/propagate'
228
+ Zold::Propagate.new(wallets: wallets, log: log).run(args)
229
+ when 'pull'
230
+ require_relative '../lib/zold/commands/pull'
231
+ Zold::Pull.new(wallets: wallets, remotes: remotes, copies: copies, log: log).run(args)
232
+ when 'taxes'
233
+ require_relative '../lib/zold/commands/taxes'
234
+ Zold::Taxes.new(wallets: wallets, remotes: remotes, log: log).run(args)
235
+ when 'push'
236
+ require_relative '../lib/zold/commands/push'
237
+ Zold::Push.new(wallets: wallets, remotes: remotes, log: log).run(args)
238
+ when 'alias'
239
+ require_relative '../lib/zold/commands/alias'
240
+ Zold::Alias.new(wallets: wallets, log: log).run(args)
241
+ when 'score'
242
+ require_relative '../lib/zold/commands/calculate'
243
+ Zold::Calculate.new(log: log).run(args)
244
+ when 'next'
245
+ require_relative '../lib/zold/commands/next'
246
+ Zold::Next.new(log: log).run(args)
247
+ else
248
+ raise "Command '#{command}' is not supported"
249
+ end
250
+ end
251
+
252
+ if opts['memory-dump']
253
+ MemoryProfiler.report(top: 20) { cmd.call }.pretty_print
244
254
  else
245
- raise "Command '#{command}' is not supported"
255
+ cmd.call
246
256
  end
247
257
  rescue StandardError => ex
248
258
  log.error("#{ex.message} (#{ex.class.name})")
@@ -7,7 +7,7 @@ function start_node {
7
7
  zold node $3 --nohup --nohup-command='touch restarted' --nohup-log=log --nohup-max-cycles=0 --nohup-log-truncate=10240 \
8
8
  --expose-version=$2 --save-pid=pid --routine-immediately \
9
9
  --verbose --trace --invoice=REDEPLOY@ffffffffffffffff \
10
- --host=127.0.0.1 --port=$1 --bind-port=$1 --threads=1 --strength=20 > /dev/null 2>&1
10
+ --host=127.0.0.1 --port=$1 --bind-port=$1 --threads=1 --strength=20 --memory-dump > /dev/null 2>&1
11
11
  wait_for_port $1
12
12
  cat pid
13
13
  cd ..
@@ -124,18 +124,15 @@ module Zold
124
124
  default: '~/.ssh/id_rsa'
125
125
  o.string '--network',
126
126
  "The name of the network (default: #{Wallet::MAIN_NETWORK})",
127
- require: true,
128
127
  default: Wallet::MAIN_NETWORK
129
128
  o.integer '--nohup-max-cycles',
130
129
  'Maximum amount of nohup re-starts (-1 by default, which means forever)',
131
- require: true,
132
130
  default: -1
133
131
  o.string '--home',
134
132
  "Home directory (default: #{Dir.pwd})",
135
133
  default: Dir.pwd
136
134
  o.bool '--no-metronome',
137
135
  'Don\'t run the metronome',
138
- required: true,
139
136
  default: false
140
137
  o.bool '--disable-push',
141
138
  'Prohibit all PUSH requests',
@@ -144,8 +141,7 @@ module Zold
144
141
  'Prohibit all FETCH requests',
145
142
  default: false
146
143
  o.string '--alias',
147
- 'The alias of the node (default: host:port)',
148
- require: false
144
+ 'The alias of the node (default: host:port)'
149
145
  o.string '--no-spawn',
150
146
  'Don\'t use child processes for the score farm',
151
147
  default: false
@@ -475,5 +475,9 @@ in #{Age.new(@start, limit: 1)}")
475
475
  yield Wallet.new(f.path)
476
476
  end
477
477
  end
478
+
479
+ def running_server?
480
+ false
481
+ end
478
482
  end
479
483
  end
data/lib/zold/version.rb CHANGED
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.16.23'
28
+ VERSION = '0.16.24'
29
29
  PROTOCOL = 2
30
30
  end
data/zold.gemspec CHANGED
@@ -61,6 +61,7 @@ and suggests a different architecture for digital wallet maintenance.'
61
61
  s.add_runtime_dependency 'futex', '0.3.1'
62
62
  s.add_runtime_dependency 'get_process_mem', '0.2.3'
63
63
  s.add_runtime_dependency 'json', '2.1.0'
64
+ s.add_runtime_dependency 'memory_profiler', '0.9.12'
64
65
  s.add_runtime_dependency 'openssl', '2.1.2'
65
66
  s.add_runtime_dependency 'posix-spawn', '0.3.13'
66
67
  s.add_runtime_dependency 'rainbow', '3.0.0'
@@ -78,7 +79,6 @@ and suggests a different architecture for digital wallet maintenance.'
78
79
  s.add_runtime_dependency 'zache', '0.3.1'
79
80
  s.add_runtime_dependency 'zold-score', '0.2.2'
80
81
  s.add_development_dependency 'codecov', '0.1.13'
81
- s.add_development_dependency 'memory_profiler', '0.9.12'
82
82
  s.add_development_dependency 'minitest', '5.11.3'
83
83
  s.add_development_dependency 'minitest-hooks', '1.5.0'
84
84
  s.add_development_dependency 'random-port', '0.3.1'
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.16.23
4
+ version: 0.16.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.1.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: memory_profiler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.9.12
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 0.9.12
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: openssl
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -346,20 +360,6 @@ dependencies:
346
360
  - - '='
347
361
  - !ruby/object:Gem::Version
348
362
  version: 0.1.13
349
- - !ruby/object:Gem::Dependency
350
- name: memory_profiler
351
- requirement: !ruby/object:Gem::Requirement
352
- requirements:
353
- - - '='
354
- - !ruby/object:Gem::Version
355
- version: 0.9.12
356
- type: :development
357
- prerelease: false
358
- version_requirements: !ruby/object:Gem::Requirement
359
- requirements:
360
- - - '='
361
- - !ruby/object:Gem::Version
362
- version: 0.9.12
363
363
  - !ruby/object:Gem::Dependency
364
364
  name: minitest
365
365
  requirement: !ruby/object:Gem::Requirement