zold 0.31.10 → 0.32.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 +4 -4
- data/.0pdd.yml +2 -19
- data/.github/typos.toml +11 -0
- data/.github/workflows/actionlint.yml +5 -21
- data/.github/workflows/bashate.yml +25 -0
- data/.github/workflows/codecov.yml +11 -24
- data/.github/workflows/copyrights.yml +6 -21
- data/.github/workflows/hadolint.yml +14 -0
- data/.github/workflows/markdown-lint.yml +19 -0
- data/.github/workflows/pdd.yml +5 -20
- data/.github/workflows/rake.yml +8 -22
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/shellcheck.yml +19 -0
- data/.github/workflows/typos.yml +21 -0
- data/.github/workflows/xcop.yml +5 -20
- data/.github/workflows/yamllint.yml +5 -20
- data/.gitignore +9 -6
- data/.rubocop.yml +16 -20
- data/.ruby-version +1 -1
- data/.rultor.yml +6 -22
- data/Dockerfile +11 -27
- data/Gemfile +21 -33
- data/Gemfile.lock +181 -126
- data/Guardfile +0 -0
- data/INSTALL.md +80 -59
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +183 -154
- data/REUSE.toml +40 -0
- data/Rakefile +4 -38
- data/bin/zold +7 -37
- data/cucumber.yml +2 -19
- data/deploy.sh +4 -22
- data/features/cli.feature +2 -0
- data/features/gem_package.feature +2 -0
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/fixtures/merge/asserts.rb +3 -19
- data/fixtures/merge/into_no_wallet/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/missed_wallets/0123456789abcdef.z +0 -2
- data/fixtures/merge/missed_wallets/assert.rb +2 -19
- data/fixtures/merge/missed_wallets/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/negative_overwriting/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/0123456789abcdef.z +0 -1
- data/fixtures/merge/negatives_in_between/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/2.zc +0 -1
- data/fixtures/merge/negatives_in_between/opts +1 -1
- data/fixtures/merge/random_expenses/assert.rb +2 -19
- data/fixtures/merge/random_expenses/opts +1 -1
- data/fixtures/merge/simple_case/assert.rb +2 -19
- data/fixtures/merge/simple_case/opts +1 -1
- data/fixtures/merge/unconfirmed_income/assert.rb +2 -19
- data/fixtures/scripts/_head.sh +16 -33
- data/fixtures/scripts/calculate-scores.sh +3 -20
- data/fixtures/scripts/distribute-wallet.sh +26 -43
- data/fixtures/scripts/print-helps.sh +5 -23
- data/fixtures/scripts/pull-on-start.sh +12 -29
- data/fixtures/scripts/push-and-pull.sh +10 -27
- data/fixtures/scripts/redeploy-on-upgrade.sh +18 -34
- data/fixtures/scripts/spread-wallets.sh +24 -40
- data/lib/zold/age.rb +3 -20
- data/lib/zold/amount.rb +3 -20
- data/lib/zold/cached_wallets.rb +3 -20
- data/lib/zold/commands/alias.rb +4 -21
- data/lib/zold/commands/args.rb +4 -21
- data/lib/zold/commands/calculate.rb +5 -22
- data/lib/zold/commands/clean.rb +6 -23
- data/lib/zold/commands/create.rb +5 -22
- data/lib/zold/commands/diff.rb +5 -22
- data/lib/zold/commands/fetch.rb +6 -23
- data/lib/zold/commands/invoice.rb +5 -22
- data/lib/zold/commands/list.rb +5 -22
- data/lib/zold/commands/merge.rb +7 -24
- data/lib/zold/commands/next.rb +5 -22
- data/lib/zold/commands/node.rb +4 -21
- data/lib/zold/commands/pay.rb +6 -23
- data/lib/zold/commands/propagate.rb +5 -22
- data/lib/zold/commands/pull.rb +5 -22
- data/lib/zold/commands/push.rb +5 -22
- data/lib/zold/commands/remote.rb +7 -24
- data/lib/zold/commands/remove.rb +5 -22
- data/lib/zold/commands/routines/audit.rb +4 -21
- data/lib/zold/commands/routines/gc.rb +6 -23
- data/lib/zold/commands/routines/reconcile.rb +5 -22
- data/lib/zold/commands/routines/reconnect.rb +4 -21
- data/lib/zold/commands/routines/retire.rb +4 -21
- data/lib/zold/commands/routines/spread.rb +5 -22
- data/lib/zold/commands/routines.rb +3 -20
- data/lib/zold/commands/show.rb +5 -22
- data/lib/zold/commands/taxes.rb +5 -22
- data/lib/zold/commands/thread_badge.rb +3 -20
- data/lib/zold/copies.rb +6 -25
- data/lib/zold/dir_items.rb +3 -20
- data/lib/zold/endless.rb +5 -22
- data/lib/zold/gem.rb +3 -20
- data/lib/zold/hands.rb +6 -23
- data/lib/zold/head.rb +4 -21
- data/lib/zold/hexnum.rb +3 -20
- data/lib/zold/http.rb +3 -20
- data/lib/zold/hungry_wallets.rb +6 -23
- data/lib/zold/id.rb +3 -20
- data/lib/zold/json_page.rb +5 -22
- data/lib/zold/key.rb +3 -20
- data/lib/zold/metronome.rb +5 -22
- data/lib/zold/node/async_entrance.rb +6 -23
- data/lib/zold/node/entrance.rb +7 -24
- data/lib/zold/node/farm.rb +5 -22
- data/lib/zold/node/farmers.rb +15 -32
- data/lib/zold/node/front.rb +6 -23
- data/lib/zold/node/journaled_pipeline.rb +8 -25
- data/lib/zold/node/nodup_entrance.rb +6 -23
- data/lib/zold/node/nospam_entrance.rb +6 -23
- data/lib/zold/node/pipeline.rb +6 -23
- data/lib/zold/node/safe_entrance.rb +4 -22
- data/lib/zold/node/soft_error.rb +3 -20
- data/lib/zold/node/spread_entrance.rb +5 -22
- data/lib/zold/node/sync_entrance.rb +5 -22
- data/lib/zold/node/trace.rb +3 -20
- data/lib/zold/patch.rb +6 -23
- data/lib/zold/prefixes.rb +3 -20
- data/lib/zold/remotes.rb +5 -22
- data/lib/zold/signature.rb +3 -20
- data/lib/zold/size.rb +3 -20
- data/lib/zold/sync_wallets.rb +5 -22
- data/lib/zold/tax.rb +4 -21
- data/lib/zold/thread_pool.rb +4 -21
- data/lib/zold/tree_wallets.rb +3 -20
- data/lib/zold/txn.rb +4 -21
- data/lib/zold/txns.rb +4 -21
- data/lib/zold/upgrades.rb +4 -21
- data/lib/zold/verbose_thread.rb +5 -22
- data/lib/zold/version.rb +4 -21
- data/lib/zold/version_file.rb +4 -21
- data/lib/zold/wallet.rb +6 -23
- data/lib/zold/wallets.rb +5 -23
- data/lib/zold.rb +3 -21
- data/resources/banned-wallets.log +6 -6
- data/test/commands/routines/test_audit.rb +3 -21
- data/test/commands/routines/test_gc.rb +3 -21
- data/test/commands/routines/test_reconcile.rb +3 -21
- data/test/commands/routines/test_reconnect.rb +3 -21
- data/test/commands/routines/test_retire.rb +3 -21
- data/test/commands/test_alias.rb +2 -20
- data/test/commands/test_calculate.rb +5 -23
- data/test/commands/test_clean.rb +5 -23
- data/test/commands/test_create.rb +6 -24
- data/test/commands/test_diff.rb +4 -22
- data/test/commands/test_fetch.rb +3 -21
- data/test/commands/test_invoice.rb +3 -21
- data/test/commands/test_list.rb +3 -21
- data/test/commands/test_merge.rb +12 -35
- data/test/commands/test_node.rb +3 -21
- data/test/commands/test_pay.rb +5 -23
- data/test/commands/test_propagate.rb +6 -24
- data/test/commands/test_pull.rb +4 -22
- data/test/commands/test_push.rb +3 -21
- data/test/commands/test_remote.rb +10 -28
- data/test/commands/test_remove.rb +7 -25
- data/test/commands/test_show.rb +3 -21
- data/test/commands/test_taxes.rb +5 -23
- data/test/fake_home.rb +5 -22
- data/test/node/fake_entrance.rb +3 -20
- data/test/node/fake_node.rb +5 -22
- data/test/node/test_async_entrance.rb +3 -21
- data/test/node/test_entrance.rb +7 -25
- data/test/node/test_farm.rb +15 -33
- data/test/node/test_farmers.rb +3 -21
- data/test/node/test_front.rb +22 -42
- data/test/node/test_nodup_entrance.rb +4 -22
- data/test/node/test_nospam_entrance.rb +6 -24
- data/test/node/test_safe_entrance.rb +3 -21
- data/test/node/test_spread_entrance.rb +4 -22
- data/test/node/test_sync_entrance.rb +4 -22
- data/test/node/test_trace.rb +4 -22
- data/test/test__helper.rb +32 -31
- data/test/test_age.rb +5 -23
- data/test/test_amount.rb +15 -34
- data/test/test_cached_wallets.rb +3 -21
- data/test/test_copies.rb +10 -28
- data/test/test_dir_items.rb +4 -22
- data/test/test_gem.rb +3 -21
- data/test/test_hands.rb +3 -21
- data/test/test_hexnum.rb +3 -21
- data/test/test_http.rb +9 -27
- data/test/test_hungry_wallets.rb +6 -24
- data/test/test_id.rb +10 -28
- data/test/test_json_page.rb +3 -21
- data/test/test_key.rb +5 -23
- data/test/test_metronome.rb +6 -24
- data/test/test_patch.rb +10 -28
- data/test/test_prefixes.rb +3 -21
- data/test/test_remotes.rb +17 -35
- data/test/test_signature.rb +3 -21
- data/test/test_size.rb +3 -21
- data/test/test_sync_wallets.rb +3 -21
- data/test/test_tax.rb +6 -24
- data/test/test_thread_pool.rb +6 -24
- data/test/test_tree_wallets.rb +4 -22
- data/test/test_txn.rb +3 -21
- data/test/test_upgrades.rb +3 -21
- data/test/test_verbose_thread.rb +6 -24
- data/test/test_version.rb +2 -20
- data/test/test_wallet.rb +15 -33
- data/test/test_wallets.rb +4 -22
- data/test/test_zold.rb +7 -25
- data/test/upgrades/test_delete_banned_wallets.rb +4 -22
- data/test/upgrades/test_protocol_up.rb +3 -21
- data/upgrades/2.rb +3 -20
- data/upgrades/delete_banned_wallets.rb +3 -20
- data/upgrades/move_wallets_into_tree.rb +3 -20
- data/upgrades/protocol_up.rb +3 -20
- data/upgrades/rename_foreign_wallets.rb +3 -20
- data/views/journal.haml +25 -0
- data/views/layout.haml +25 -0
- data/views/wallet.haml +25 -0
- data/zold.gemspec +5 -21
- metadata +33 -15
- data/.simplecov +0 -36
- data/lib/zold/log.rb +0 -139
- data/test/test_log.rb +0 -49
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'concurrent'
|
|
24
7
|
require 'futex'
|
|
@@ -33,12 +16,12 @@ require_relative 'soft_error'
|
|
|
33
16
|
|
|
34
17
|
# The async entrance of the web front.
|
|
35
18
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
36
|
-
# Copyright:: Copyright (c) 2018-
|
|
19
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
37
20
|
# License:: MIT
|
|
38
21
|
module Zold
|
|
39
22
|
# The entrance
|
|
40
23
|
class AsyncEntrance
|
|
41
|
-
def initialize(entrance, dir, log:
|
|
24
|
+
def initialize(entrance, dir, log: Loog::NULL,
|
|
42
25
|
threads: [Concurrent.processor_count, 8].max, queue_limit: 8)
|
|
43
26
|
@entrance = entrance
|
|
44
27
|
@dir = File.expand_path(dir)
|
|
@@ -69,7 +52,7 @@ module Zold
|
|
|
69
52
|
File.delete(file)
|
|
70
53
|
end
|
|
71
54
|
end
|
|
72
|
-
@log.info("#{@queue.size} wallets pre-loaded into
|
|
55
|
+
@log.info("#{@queue.size} wallets pre-loaded into async_entrance from #{@dir}") unless @queue.empty?
|
|
73
56
|
@entrance.start do
|
|
74
57
|
(0..@threads).map do |i|
|
|
75
58
|
@pool.add do
|
|
@@ -135,7 +118,7 @@ module Zold
|
|
|
135
118
|
FileUtils.rm_f(item[:file])
|
|
136
119
|
@entrance.push(item[:id], body)
|
|
137
120
|
@log.debug("Pushed #{item[:id]}/#{Size.new(body.length)} to #{@entrance.class.name} \
|
|
138
|
-
in #{Age.new(start, limit: 0.1)}#{
|
|
121
|
+
in #{Age.new(start, limit: 0.1)}#{"(#{@queue.size} still in the queue)" unless @queue.empty?}")
|
|
139
122
|
end
|
|
140
123
|
end
|
|
141
124
|
end
|
data/lib/zold/node/entrance.rb
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'tempfile'
|
|
24
7
|
require 'time'
|
|
25
|
-
|
|
8
|
+
require 'loog'
|
|
26
9
|
|
|
27
10
|
# The entrance of the web front.
|
|
28
11
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
29
|
-
# Copyright:: Copyright (c) 2018-
|
|
12
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
30
13
|
# License:: MIT
|
|
31
14
|
module Zold
|
|
32
15
|
# The entrance
|
|
33
16
|
class Entrance
|
|
34
|
-
def initialize(wallets, pipeline, log:
|
|
17
|
+
def initialize(wallets, pipeline, log: Loog::NULL)
|
|
35
18
|
@wallets = wallets
|
|
36
19
|
@pipeline = pipeline
|
|
37
20
|
@log = log
|
|
@@ -49,12 +32,12 @@ module Zold
|
|
|
49
32
|
{
|
|
50
33
|
history: @history.join(', '),
|
|
51
34
|
history_size: @history.count,
|
|
52
|
-
speed: @speed.empty? ? 0 : (@speed.
|
|
35
|
+
speed: @speed.empty? ? 0 : (@speed.sum / @speed.count),
|
|
53
36
|
pipeline: @pipeline.to_json
|
|
54
37
|
}
|
|
55
38
|
end
|
|
56
39
|
|
|
57
|
-
# Returns a list of
|
|
40
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
58
41
|
def push(id, body)
|
|
59
42
|
raise 'Id can\'t be nil' if id.nil?
|
|
60
43
|
raise 'Id must be of type Id' unless id.is_a?(Id)
|
data/lib/zold/node/farm.rb
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'time'
|
|
24
7
|
require 'open3'
|
|
@@ -27,7 +10,7 @@ require 'futex'
|
|
|
27
10
|
require 'concurrent'
|
|
28
11
|
require 'json'
|
|
29
12
|
require 'zold/score'
|
|
30
|
-
|
|
13
|
+
require 'loog'
|
|
31
14
|
require_relative '../thread_pool'
|
|
32
15
|
require_relative '../age'
|
|
33
16
|
require_relative '../endless'
|
|
@@ -35,7 +18,7 @@ require_relative 'farmers'
|
|
|
35
18
|
|
|
36
19
|
# The farm of scores.
|
|
37
20
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
38
|
-
# Copyright:: Copyright (c) 2018-
|
|
21
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
39
22
|
# License:: MIT
|
|
40
23
|
module Zold
|
|
41
24
|
# Farm
|
|
@@ -58,7 +41,7 @@ module Zold
|
|
|
58
41
|
# <tt>lifetime</tt> is the amount of seconds for a score to live in the farm, by default
|
|
59
42
|
# it's the entire day, since the Score expires in 24 hours; can be decreased for the
|
|
60
43
|
# purpose of unit testing.
|
|
61
|
-
def initialize(invoice, cache = File.join(Dir.pwd, 'farm'), log:
|
|
44
|
+
def initialize(invoice, cache = File.join(Dir.pwd, 'farm'), log: Loog::NULL,
|
|
62
45
|
farmer: Farmers::Plain.new, lifetime: 24 * 60 * 60, strength: Score::STRENGTH)
|
|
63
46
|
@log = log
|
|
64
47
|
@cache = File.expand_path(cache)
|
data/lib/zold/node/farmers.rb
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'open3'
|
|
24
7
|
require 'backtrace'
|
|
25
8
|
require 'zold/score'
|
|
26
9
|
require 'shellwords'
|
|
27
|
-
|
|
10
|
+
require 'loog'
|
|
28
11
|
require_relative '../age'
|
|
29
12
|
|
|
30
13
|
# Farmers.
|
|
31
14
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2018-
|
|
15
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
33
16
|
# License:: MIT
|
|
34
17
|
module Zold
|
|
35
18
|
# Farmer
|
|
@@ -44,7 +27,7 @@ module Zold
|
|
|
44
27
|
|
|
45
28
|
# Plain and simple
|
|
46
29
|
class Plain
|
|
47
|
-
def initialize(log:
|
|
30
|
+
def initialize(log: Loog::NULL)
|
|
48
31
|
@log = log
|
|
49
32
|
end
|
|
50
33
|
|
|
@@ -55,7 +38,7 @@ module Zold
|
|
|
55
38
|
|
|
56
39
|
# In a child process using fork
|
|
57
40
|
class Fork
|
|
58
|
-
def initialize(log:
|
|
41
|
+
def initialize(log: Loog::NULL)
|
|
59
42
|
@log = log
|
|
60
43
|
end
|
|
61
44
|
|
|
@@ -80,7 +63,7 @@ for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
|
|
|
80
63
|
|
|
81
64
|
# In a child process
|
|
82
65
|
class Spawn
|
|
83
|
-
def initialize(log:
|
|
66
|
+
def initialize(log: Loog::NULL)
|
|
84
67
|
@log = log
|
|
85
68
|
end
|
|
86
69
|
|
|
@@ -99,10 +82,10 @@ for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
|
|
|
99
82
|
'next',
|
|
100
83
|
Shellwords.escape(score)
|
|
101
84
|
].join(' ')
|
|
102
|
-
Open3.popen2e(cmd) do |stdin, stdout,
|
|
103
|
-
Thread.current.thread_variable_set(:pid,
|
|
104
|
-
at_exit { Farmers.kill(@log,
|
|
105
|
-
@log.debug("Scoring started in proc ##{
|
|
85
|
+
Open3.popen2e(cmd) do |stdin, stdout, thread|
|
|
86
|
+
Thread.current.thread_variable_set(:pid, thread.pid.to_s)
|
|
87
|
+
at_exit { Farmers.kill(@log, thread.pid, start) }
|
|
88
|
+
@log.debug("Scoring started in proc ##{thread.pid} \
|
|
106
89
|
for #{score.value}/#{score.strength} at #{score.host}:#{score.port}")
|
|
107
90
|
begin
|
|
108
91
|
stdin.close
|
|
@@ -116,20 +99,20 @@ for #{score.value}/#{score.strength} at #{score.host}:#{score.port}")
|
|
|
116
99
|
@log.error(buffer)
|
|
117
100
|
raise e
|
|
118
101
|
end
|
|
119
|
-
break if buffer.end_with?("\n") &&
|
|
102
|
+
break if buffer.end_with?("\n") && thread.value.to_i.zero?
|
|
120
103
|
if stdout.closed?
|
|
121
|
-
raise "Failed to calculate the score (##{
|
|
104
|
+
raise "Failed to calculate the score (##{thread.value}): #{buffer}" unless thread.value.to_i.zero?
|
|
122
105
|
break
|
|
123
106
|
end
|
|
124
107
|
sleep(1)
|
|
125
108
|
Thread.current.thread_variable_set(:buffer, buffer.length.to_s)
|
|
126
109
|
end
|
|
127
110
|
after = Score.parse(buffer.strip)
|
|
128
|
-
@log.debug("Next score #{after.value}/#{after.strength} found in proc ##{
|
|
111
|
+
@log.debug("Next score #{after.value}/#{after.strength} found in proc ##{thread.pid} \
|
|
129
112
|
for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
|
|
130
113
|
after
|
|
131
114
|
ensure
|
|
132
|
-
Farmers.kill(@log,
|
|
115
|
+
Farmers.kill(@log, thread.pid, start)
|
|
133
116
|
end
|
|
134
117
|
end
|
|
135
118
|
end
|
data/lib/zold/node/front.rb
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
$stdout.sync = true
|
|
24
7
|
|
|
@@ -38,7 +21,7 @@ require_relative '../size'
|
|
|
38
21
|
require_relative '../wallet'
|
|
39
22
|
require_relative '../age'
|
|
40
23
|
require_relative '../copies'
|
|
41
|
-
|
|
24
|
+
require 'loog'
|
|
42
25
|
require_relative '../dir_items'
|
|
43
26
|
require_relative '../tax'
|
|
44
27
|
require_relative '../id'
|
|
@@ -47,7 +30,7 @@ require_relative 'soft_error'
|
|
|
47
30
|
|
|
48
31
|
# The web front of the node.
|
|
49
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
50
|
-
# Copyright:: Copyright (c) 2018-
|
|
33
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
51
34
|
# License:: MIT
|
|
52
35
|
module Zold
|
|
53
36
|
# Web front
|
|
@@ -234,11 +217,11 @@ this is not a normal behavior, you may want to report a bug to our GitHub reposi
|
|
|
234
217
|
0.0
|
|
235
218
|
end,
|
|
236
219
|
total_mem: total_mem,
|
|
237
|
-
threads: "#{Thread.list.
|
|
220
|
+
threads: "#{Thread.list.count { |t| t.status == 'run' }}/#{Thread.list.count}",
|
|
238
221
|
wallets: total_wallets,
|
|
239
222
|
journal: DirItems.new(settings.journal_dir).fetch.count,
|
|
240
223
|
remotes: all_remotes.count,
|
|
241
|
-
nscore: all_remotes.
|
|
224
|
+
nscore: all_remotes.sum { |r| r[:score] } || 0,
|
|
242
225
|
farm: settings.farm.to_json,
|
|
243
226
|
entrance: settings.entrance.to_json,
|
|
244
227
|
date: Time.now.utc.iso8601,
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'tempfile'
|
|
24
7
|
require 'diffy'
|
|
25
8
|
require 'fileutils'
|
|
26
9
|
require_relative 'pipeline'
|
|
27
|
-
|
|
10
|
+
require 'loog'
|
|
11
|
+
require 'loog/tee'
|
|
12
|
+
require 'logger'
|
|
28
13
|
require_relative '../age'
|
|
29
14
|
|
|
30
15
|
# The pipeline with journals.
|
|
31
16
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2018-
|
|
17
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
33
18
|
# License:: MIT
|
|
34
19
|
module Zold
|
|
35
20
|
# The entrance that keeps a journal for each wallet
|
|
@@ -74,7 +59,7 @@ module Zold
|
|
|
74
59
|
)
|
|
75
60
|
end
|
|
76
61
|
|
|
77
|
-
# Returns a list of
|
|
62
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
78
63
|
def push(id, body, wallets, log, lifetime: 6)
|
|
79
64
|
DirItems.new(@dir).fetch.each do |f|
|
|
80
65
|
f = File.join(@dir, f)
|
|
@@ -82,12 +67,10 @@ module Zold
|
|
|
82
67
|
end
|
|
83
68
|
journal = File.join(@dir, "#{Time.now.utc.iso8601.gsub(/[^0-9]/, '-')}-#{id}")
|
|
84
69
|
jlog = Logger.new(journal)
|
|
85
|
-
jlog.level = Logger::DEBUG
|
|
86
|
-
jlog.formatter = Log::COMPACT
|
|
87
70
|
jlog.info("push(#{id}, #{body.length} bytes): starting...")
|
|
88
71
|
jlog.info("Time: #{Time.now.utc.iso8601}")
|
|
89
72
|
jlog.info("Zold gem version: #{Zold::VERSION}")
|
|
90
|
-
modified = @pipeline.push(id, body, JournaledPipeline::Wallets.new(wallets, jlog),
|
|
73
|
+
modified = @pipeline.push(id, body, JournaledPipeline::Wallets.new(wallets, jlog), Loog::Tee.new(log, jlog))
|
|
91
74
|
jlog.info("push(#{id}): done")
|
|
92
75
|
FileUtils.mv(journal, "#{journal}-done")
|
|
93
76
|
modified
|
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'tempfile'
|
|
24
7
|
require 'openssl'
|
|
25
|
-
|
|
8
|
+
require 'loog'
|
|
26
9
|
require_relative '../size'
|
|
27
10
|
require_relative '../wallet'
|
|
28
11
|
|
|
29
12
|
# The entrance that ignores duplicates.
|
|
30
13
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
31
|
-
# Copyright:: Copyright (c) 2018-
|
|
14
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
32
15
|
# License:: MIT
|
|
33
16
|
module Zold
|
|
34
17
|
# The entrance that ignores dups
|
|
35
18
|
class NoDupEntrance
|
|
36
|
-
def initialize(entrance, wallets, log:
|
|
19
|
+
def initialize(entrance, wallets, log: Loog::NULL)
|
|
37
20
|
@entrance = entrance
|
|
38
21
|
@wallets = wallets
|
|
39
22
|
@log = log
|
|
@@ -48,7 +31,7 @@ module Zold
|
|
|
48
31
|
@entrance.to_json
|
|
49
32
|
end
|
|
50
33
|
|
|
51
|
-
# Returns a list of
|
|
34
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
52
35
|
def push(id, body)
|
|
53
36
|
before = @wallets.acq(id) { |w| w.exists? ? w.digest : '' }
|
|
54
37
|
after = OpenSSL::Digest::SHA256.new(body).hexdigest
|
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'tempfile'
|
|
24
7
|
require 'openssl'
|
|
25
8
|
require 'zache'
|
|
26
|
-
|
|
9
|
+
require 'loog'
|
|
27
10
|
require_relative '../size'
|
|
28
11
|
require_relative '../age'
|
|
29
12
|
|
|
30
13
|
# The entrance that ignores something we've seen already.
|
|
31
14
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2018-
|
|
15
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
33
16
|
# License:: MIT
|
|
34
17
|
module Zold
|
|
35
18
|
# The no-spam entrance
|
|
36
19
|
class NoSpamEntrance
|
|
37
|
-
def initialize(entrance, period: 60 * 60, log:
|
|
20
|
+
def initialize(entrance, period: 60 * 60, log: Loog::NULL)
|
|
38
21
|
@entrance = entrance
|
|
39
22
|
@log = log
|
|
40
23
|
@period = period
|
|
@@ -50,7 +33,7 @@ module Zold
|
|
|
50
33
|
@entrance.to_json
|
|
51
34
|
end
|
|
52
35
|
|
|
53
|
-
# Returns a list of
|
|
36
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
54
37
|
def push(id, body)
|
|
55
38
|
before = @zache.get(id.to_s, lifetime: @period) { '' }
|
|
56
39
|
after = hash(id, body)
|
data/lib/zold/node/pipeline.rb
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'tempfile'
|
|
24
7
|
require 'shellwords'
|
|
25
|
-
|
|
8
|
+
require 'loog'
|
|
26
9
|
require_relative '../remotes'
|
|
27
10
|
require_relative '../copies'
|
|
28
11
|
require_relative '../tax'
|
|
@@ -34,12 +17,12 @@ require_relative '../commands/push'
|
|
|
34
17
|
|
|
35
18
|
# The pipeline that accepts new wallets and merges them.
|
|
36
19
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
37
|
-
# Copyright:: Copyright (c) 2018-
|
|
20
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
38
21
|
# License:: MIT
|
|
39
22
|
module Zold
|
|
40
23
|
# The pipeline
|
|
41
24
|
class Pipeline
|
|
42
|
-
def initialize(remotes, copies, address, ledger:
|
|
25
|
+
def initialize(remotes, copies, address, ledger: File::NULL, network: 'test')
|
|
43
26
|
@remotes = remotes
|
|
44
27
|
@copies = copies
|
|
45
28
|
@address = address
|
|
@@ -57,7 +40,7 @@ module Zold
|
|
|
57
40
|
}
|
|
58
41
|
end
|
|
59
42
|
|
|
60
|
-
# Returns a list of
|
|
43
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
61
44
|
def push(id, body, wallets, log)
|
|
62
45
|
start = Time.now
|
|
63
46
|
copies = Copies.new(File.join(@copies, id.to_s))
|
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'concurrent'
|
|
24
7
|
require 'tempfile'
|
|
25
8
|
require_relative 'soft_error'
|
|
26
|
-
require_relative '../log'
|
|
27
9
|
require_relative '../remotes'
|
|
28
10
|
require_relative '../copies'
|
|
29
11
|
require_relative '../tax'
|
|
@@ -33,7 +15,7 @@ require_relative '../commands/push'
|
|
|
33
15
|
|
|
34
16
|
# The entrance thav validate the incoming wallet first.
|
|
35
17
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
36
|
-
# Copyright:: Copyright (c) 2018-
|
|
18
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
37
19
|
# License:: MIT
|
|
38
20
|
module Zold
|
|
39
21
|
# The safe entrance
|
|
@@ -54,7 +36,7 @@ module Zold
|
|
|
54
36
|
@entrance.to_json
|
|
55
37
|
end
|
|
56
38
|
|
|
57
|
-
# Returns a list of
|
|
39
|
+
# Returns a list of modified wallets (as Zold::Id)
|
|
58
40
|
def push(id, body)
|
|
59
41
|
raise 'Id can\'t be nil' if id.nil?
|
|
60
42
|
raise 'Id must be of type Id' unless id.is_a?(Id)
|
data/lib/zold/node/soft_error.rb
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
# Soft error.
|
|
24
7
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
25
|
-
# Copyright:: Copyright (c) 2018-
|
|
8
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
26
9
|
# License:: MIT
|
|
27
10
|
module Zold
|
|
28
11
|
# Soft error
|