cuboid 0.0.3alpha → 0.1.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/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +14 -13
- data/cuboid.gemspec +1 -1
- data/lib/cuboid/application.rb +10 -10
- data/lib/cuboid/option_groups/agent.rb +54 -0
- data/lib/cuboid/option_groups/paths.rb +13 -4
- data/lib/cuboid/options.rb +1 -1
- data/lib/cuboid/processes/{dispatchers.rb → agents.rb} +40 -26
- data/lib/cuboid/processes/executables/agent.rb +5 -0
- data/lib/cuboid/processes/helpers/agents.rb +23 -0
- data/lib/cuboid/processes/helpers/instances.rb +4 -4
- data/lib/cuboid/processes/helpers.rb +1 -1
- data/lib/cuboid/processes/instances.rb +22 -10
- data/lib/cuboid/processes/schedulers.rb +16 -3
- data/lib/cuboid/processes.rb +2 -2
- data/lib/cuboid/rest/server/instance_helpers.rb +13 -13
- data/lib/cuboid/rest/server/routes/dispatcher.rb +11 -11
- data/lib/cuboid/rest/server/routes/grid.rb +8 -8
- data/lib/cuboid/rest/server/routes/instances.rb +1 -1
- data/lib/cuboid/rest/server.rb +5 -5
- data/lib/cuboid/rpc/client/{dispatcher.rb → agent.rb} +4 -4
- data/lib/cuboid/rpc/client/instance.rb +2 -2
- data/lib/cuboid/rpc/client.rb +1 -1
- data/lib/cuboid/rpc/server/agent/node.rb +247 -0
- data/lib/cuboid/rpc/server/{dispatcher → agent}/service.rb +13 -13
- data/lib/cuboid/rpc/server/{dispatcher.rb → agent.rb} +62 -32
- data/lib/cuboid/rpc/server/application_wrapper.rb +5 -4
- data/lib/cuboid/rpc/server/instance.rb +4 -4
- data/lib/cuboid/rpc/server/scheduler.rb +13 -12
- data/lib/version +1 -1
- data/spec/cuboid/option_groups/dispatcher_spec.rb +2 -2
- data/spec/cuboid/option_groups/paths_spec.rb +6 -3
- data/spec/cuboid/rest/server_spec.rb +45 -45
- data/spec/cuboid/rpc/client/dispatcher_spec.rb +2 -2
- data/spec/cuboid/rpc/server/dispatcher/node_spec.rb +65 -65
- data/spec/cuboid/rpc/server/dispatcher/service_spec.rb +16 -16
- data/spec/cuboid/rpc/server/dispatcher_spec.rb +187 -72
- data/spec/cuboid/rpc/server/scheduler_spec.rb +8 -8
- data/spec/support/fixtures/executables/node.rb +3 -3
- data/spec/support/fixtures/mock_app/test_service.rb +8 -8
- data/spec/support/fixtures/mock_app.rb +1 -1
- data/spec/support/fixtures/services/echo.rb +6 -6
- data/spec/support/helpers/resets.rb +1 -1
- data/spec/support/lib/web_server_client.rb +2 -2
- data/spec/support/lib/web_server_dispatcher.rb +1 -1
- metadata +18 -58
- data/lib/cuboid/option_groups/dispatcher.rb +0 -38
- data/lib/cuboid/processes/executables/dispatcher.rb +0 -5
- data/lib/cuboid/processes/helpers/dispatchers.rb +0 -23
- data/lib/cuboid/rpc/server/dispatcher/node.rb +0 -247
- data/spec/support/logs/Dispatcher - 51489-29703.log +0 -6
- data/spec/support/logs/Scheduler - 51474-42556.log +0 -3
- data/spec/support/logs/Scheduler - 51477-63074.log +0 -6
- data/spec/support/logs/Scheduler - 51496-16039.log +0 -3
- data/spec/support/logs/Scheduler - 51499-40309.log +0 -6
- data/spec/support/logs/Scheduler - 51521-54983.log +0 -4
- data/spec/support/logs/Scheduler - 51533-50145.log +0 -1
- data/spec/support/logs/Scheduler - 51537-26476.log +0 -3
- data/spec/support/logs/Scheduler - 51541-33347.log +0 -6
- data/spec/support/logs/Scheduler - 51556-5765.log +0 -3
- data/spec/support/logs/Scheduler - 51559-22349.log +0 -6
- data/spec/support/logs/Scheduler - 51567-20476.log +0 -3
- data/spec/support/logs/Scheduler - 51570-37548.log +0 -6
- data/spec/support/logs/Scheduler - 52668-26175.log +0 -3
- data/spec/support/reports/3480c2e4463df854d3457b247e3ba679.crf +0 -0
- data/spec/support/reports/45958408cb49a7f3391a973e05bf673b.crf +0 -0
- data/spec/support/reports/62a7f8d6c8914bb086e7e5f8c418d974.crf +0 -0
- data/spec/support/reports/6363927e13ec27b5cbd973b86bd8e52c.crf +0 -0
- data/spec/support/reports/b68f94be3aa96d0c27477dcfe1e25143.crf +0 -0
- data/spec/support/reports/bbb7496056393de17e72855a63d3acfb.crf +0 -0
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuboid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 5.
|
145
|
+
version: 5.5.2
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 5.
|
152
|
+
version: 5.5.2
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rack
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -278,8 +278,8 @@ files:
|
|
278
278
|
- lib/cuboid/error.rb
|
279
279
|
- lib/cuboid/option_group.rb
|
280
280
|
- lib/cuboid/option_groups.rb
|
281
|
+
- lib/cuboid/option_groups/agent.rb
|
281
282
|
- lib/cuboid/option_groups/datastore.rb
|
282
|
-
- lib/cuboid/option_groups/dispatcher.rb
|
283
283
|
- lib/cuboid/option_groups/output.rb
|
284
284
|
- lib/cuboid/option_groups/paths.rb
|
285
285
|
- lib/cuboid/option_groups/report.rb
|
@@ -289,14 +289,14 @@ files:
|
|
289
289
|
- lib/cuboid/option_groups/system.rb
|
290
290
|
- lib/cuboid/options.rb
|
291
291
|
- lib/cuboid/processes.rb
|
292
|
-
- lib/cuboid/processes/
|
292
|
+
- lib/cuboid/processes/agents.rb
|
293
|
+
- lib/cuboid/processes/executables/agent.rb
|
293
294
|
- lib/cuboid/processes/executables/base.rb
|
294
|
-
- lib/cuboid/processes/executables/dispatcher.rb
|
295
295
|
- lib/cuboid/processes/executables/instance.rb
|
296
296
|
- lib/cuboid/processes/executables/rest_service.rb
|
297
297
|
- lib/cuboid/processes/executables/scheduler.rb
|
298
298
|
- lib/cuboid/processes/helpers.rb
|
299
|
-
- lib/cuboid/processes/helpers/
|
299
|
+
- lib/cuboid/processes/helpers/agents.rb
|
300
300
|
- lib/cuboid/processes/helpers/instances.rb
|
301
301
|
- lib/cuboid/processes/helpers/processes.rb
|
302
302
|
- lib/cuboid/processes/helpers/schedulers.rb
|
@@ -311,18 +311,18 @@ files:
|
|
311
311
|
- lib/cuboid/rest/server/routes/instances.rb
|
312
312
|
- lib/cuboid/rest/server/routes/scheduler.rb
|
313
313
|
- lib/cuboid/rpc/client.rb
|
314
|
+
- lib/cuboid/rpc/client/agent.rb
|
314
315
|
- lib/cuboid/rpc/client/base.rb
|
315
|
-
- lib/cuboid/rpc/client/dispatcher.rb
|
316
316
|
- lib/cuboid/rpc/client/instance.rb
|
317
317
|
- lib/cuboid/rpc/client/instance/service.rb
|
318
318
|
- lib/cuboid/rpc/client/scheduler.rb
|
319
319
|
- lib/cuboid/rpc/serializer.rb
|
320
320
|
- lib/cuboid/rpc/server/active_options.rb
|
321
|
+
- lib/cuboid/rpc/server/agent.rb
|
322
|
+
- lib/cuboid/rpc/server/agent/node.rb
|
323
|
+
- lib/cuboid/rpc/server/agent/service.rb
|
321
324
|
- lib/cuboid/rpc/server/application_wrapper.rb
|
322
325
|
- lib/cuboid/rpc/server/base.rb
|
323
|
-
- lib/cuboid/rpc/server/dispatcher.rb
|
324
|
-
- lib/cuboid/rpc/server/dispatcher/node.rb
|
325
|
-
- lib/cuboid/rpc/server/dispatcher/service.rb
|
326
326
|
- lib/cuboid/rpc/server/instance.rb
|
327
327
|
- lib/cuboid/rpc/server/output.rb
|
328
328
|
- lib/cuboid/rpc/server/scheduler.rb
|
@@ -457,20 +457,6 @@ files:
|
|
457
457
|
- spec/support/lib/web_server_client.rb
|
458
458
|
- spec/support/lib/web_server_dispatcher.rb
|
459
459
|
- spec/support/lib/web_server_manager.rb
|
460
|
-
- spec/support/logs/Dispatcher - 51489-29703.log
|
461
|
-
- spec/support/logs/Scheduler - 51474-42556.log
|
462
|
-
- spec/support/logs/Scheduler - 51477-63074.log
|
463
|
-
- spec/support/logs/Scheduler - 51496-16039.log
|
464
|
-
- spec/support/logs/Scheduler - 51499-40309.log
|
465
|
-
- spec/support/logs/Scheduler - 51521-54983.log
|
466
|
-
- spec/support/logs/Scheduler - 51533-50145.log
|
467
|
-
- spec/support/logs/Scheduler - 51537-26476.log
|
468
|
-
- spec/support/logs/Scheduler - 51541-33347.log
|
469
|
-
- spec/support/logs/Scheduler - 51556-5765.log
|
470
|
-
- spec/support/logs/Scheduler - 51559-22349.log
|
471
|
-
- spec/support/logs/Scheduler - 51567-20476.log
|
472
|
-
- spec/support/logs/Scheduler - 51570-37548.log
|
473
|
-
- spec/support/logs/Scheduler - 52668-26175.log
|
474
460
|
- spec/support/logs/placeholder
|
475
461
|
- spec/support/pems/cacert.pem
|
476
462
|
- spec/support/pems/client/cert.pem
|
@@ -479,12 +465,6 @@ files:
|
|
479
465
|
- spec/support/pems/client/key.pem
|
480
466
|
- spec/support/pems/server/cert.pem
|
481
467
|
- spec/support/pems/server/key.pem
|
482
|
-
- spec/support/reports/3480c2e4463df854d3457b247e3ba679.crf
|
483
|
-
- spec/support/reports/45958408cb49a7f3391a973e05bf673b.crf
|
484
|
-
- spec/support/reports/62a7f8d6c8914bb086e7e5f8c418d974.crf
|
485
|
-
- spec/support/reports/6363927e13ec27b5cbd973b86bd8e52c.crf
|
486
|
-
- spec/support/reports/b68f94be3aa96d0c27477dcfe1e25143.crf
|
487
|
-
- spec/support/reports/bbb7496056393de17e72855a63d3acfb.crf
|
488
468
|
- spec/support/reports/placeholder
|
489
469
|
- spec/support/shared/application.rb
|
490
470
|
- spec/support/shared/component.rb
|
@@ -499,7 +479,7 @@ homepage: https://github.com/qadron/cuboid
|
|
499
479
|
licenses:
|
500
480
|
- MIT
|
501
481
|
metadata: {}
|
502
|
-
post_install_message:
|
482
|
+
post_install_message:
|
503
483
|
rdoc_options:
|
504
484
|
- "--charset=UTF-8"
|
505
485
|
require_paths:
|
@@ -511,12 +491,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
511
491
|
version: '0'
|
512
492
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
513
493
|
requirements:
|
514
|
-
- - "
|
494
|
+
- - ">="
|
515
495
|
- !ruby/object:Gem::Version
|
516
|
-
version:
|
496
|
+
version: '0'
|
517
497
|
requirements: []
|
518
|
-
rubygems_version: 3.
|
519
|
-
signing_key:
|
498
|
+
rubygems_version: 3.3.3
|
499
|
+
signing_key:
|
520
500
|
specification_version: 4
|
521
501
|
summary: An application-centric, decentralised and distributed computing solution.
|
522
502
|
test_files:
|
@@ -597,20 +577,6 @@ test_files:
|
|
597
577
|
- spec/support/lib/web_server_client.rb
|
598
578
|
- spec/support/lib/web_server_dispatcher.rb
|
599
579
|
- spec/support/lib/web_server_manager.rb
|
600
|
-
- spec/support/logs/Dispatcher - 51489-29703.log
|
601
|
-
- spec/support/logs/Scheduler - 51474-42556.log
|
602
|
-
- spec/support/logs/Scheduler - 51477-63074.log
|
603
|
-
- spec/support/logs/Scheduler - 51496-16039.log
|
604
|
-
- spec/support/logs/Scheduler - 51499-40309.log
|
605
|
-
- spec/support/logs/Scheduler - 51521-54983.log
|
606
|
-
- spec/support/logs/Scheduler - 51533-50145.log
|
607
|
-
- spec/support/logs/Scheduler - 51537-26476.log
|
608
|
-
- spec/support/logs/Scheduler - 51541-33347.log
|
609
|
-
- spec/support/logs/Scheduler - 51556-5765.log
|
610
|
-
- spec/support/logs/Scheduler - 51559-22349.log
|
611
|
-
- spec/support/logs/Scheduler - 51567-20476.log
|
612
|
-
- spec/support/logs/Scheduler - 51570-37548.log
|
613
|
-
- spec/support/logs/Scheduler - 52668-26175.log
|
614
580
|
- spec/support/logs/placeholder
|
615
581
|
- spec/support/pems/cacert.pem
|
616
582
|
- spec/support/pems/client/cert.pem
|
@@ -619,12 +585,6 @@ test_files:
|
|
619
585
|
- spec/support/pems/client/key.pem
|
620
586
|
- spec/support/pems/server/cert.pem
|
621
587
|
- spec/support/pems/server/key.pem
|
622
|
-
- spec/support/reports/3480c2e4463df854d3457b247e3ba679.crf
|
623
|
-
- spec/support/reports/45958408cb49a7f3391a973e05bf673b.crf
|
624
|
-
- spec/support/reports/62a7f8d6c8914bb086e7e5f8c418d974.crf
|
625
|
-
- spec/support/reports/6363927e13ec27b5cbd973b86bd8e52c.crf
|
626
|
-
- spec/support/reports/b68f94be3aa96d0c27477dcfe1e25143.crf
|
627
|
-
- spec/support/reports/bbb7496056393de17e72855a63d3acfb.crf
|
628
588
|
- spec/support/reports/placeholder
|
629
589
|
- spec/support/shared/application.rb
|
630
590
|
- spec/support/shared/component/options/base.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Cuboid::OptionGroups
|
2
|
-
|
3
|
-
# Holds options for {RPC::Server::Dispatcher} servers.
|
4
|
-
#
|
5
|
-
# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
|
6
|
-
class Dispatcher < Cuboid::OptionGroup
|
7
|
-
|
8
|
-
# @return [String]
|
9
|
-
# URL of a {RPC::Server::Dispatcher}.
|
10
|
-
attr_accessor :url
|
11
|
-
|
12
|
-
# @return [Array<Integer>]
|
13
|
-
# Range of ports to use when spawning instances, first entry should be
|
14
|
-
# the lowest port number, last the max port number.
|
15
|
-
attr_accessor :instance_port_range
|
16
|
-
|
17
|
-
# @return [String]
|
18
|
-
# The URL of a neighbouring {RPC::Server::Dispatcher}, applicable when
|
19
|
-
# {RPC::Server::Dispatcher} are connected to each other to form a Grid.
|
20
|
-
#
|
21
|
-
# @see RPC::Server::Dispatcher::Node
|
22
|
-
attr_accessor :neighbour
|
23
|
-
|
24
|
-
# @return [Float]
|
25
|
-
# How regularly to check for neighbour statuses.
|
26
|
-
attr_accessor :ping_interval
|
27
|
-
|
28
|
-
# @return [String]
|
29
|
-
# Dispatcher name.
|
30
|
-
attr_accessor :name
|
31
|
-
|
32
|
-
set_defaults(
|
33
|
-
ping_interval: 5.0,
|
34
|
-
instance_port_range: [1025, 65535]
|
35
|
-
)
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# @param (see Cuboid::Processes::Dispatchers#spawn)
|
2
|
-
# @return (see Cuboid::Processes::Dispatchers#spawn)
|
3
|
-
def dispatcher_spawn( *args )
|
4
|
-
Cuboid::Processes::Dispatchers.spawn( *args )
|
5
|
-
end
|
6
|
-
|
7
|
-
# @param (see Cuboid::Processes::Dispatchers#kill)
|
8
|
-
# @return (see Cuboid::Processes::Dispatchers#kill)
|
9
|
-
def dispatcher_kill( *args )
|
10
|
-
Cuboid::Processes::Dispatchers.kill( *args )
|
11
|
-
end
|
12
|
-
|
13
|
-
# @param (see Cuboid::Processes::Dispatchers#killall)
|
14
|
-
# @return (see Cuboid::Processes::Dispatchers#killall)
|
15
|
-
def dispatcher_killall
|
16
|
-
Cuboid::Processes::Dispatchers.killall
|
17
|
-
end
|
18
|
-
|
19
|
-
# @param (see Cuboid::Processes::Dispatchers#connect)
|
20
|
-
# @return (see Cuboid::Processes::Dispatchers#connect)
|
21
|
-
def dispatcher_connect( *args )
|
22
|
-
Cuboid::Processes::Dispatchers.connect( *args )
|
23
|
-
end
|
@@ -1,247 +0,0 @@
|
|
1
|
-
module Cuboid
|
2
|
-
|
3
|
-
require Options.paths.lib + 'rpc/server/output'
|
4
|
-
|
5
|
-
module RPC
|
6
|
-
|
7
|
-
# Dispatcher node class, helps maintain a list of all available Dispatchers in
|
8
|
-
# the grid and announce itself to neighbouring Dispatchers.
|
9
|
-
#
|
10
|
-
# As soon as a new Node is fired up it checks-in with its neighbour and grabs
|
11
|
-
# a list of all available peers.
|
12
|
-
#
|
13
|
-
# As soon as it receives the peer list it then announces itself to them.
|
14
|
-
#
|
15
|
-
# Upon convergence there will be a grid of Dispatchers each one with its own
|
16
|
-
# copy of all available Dispatcher URLs.
|
17
|
-
#
|
18
|
-
# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
|
19
|
-
class Server::Dispatcher::Node
|
20
|
-
include UI::Output
|
21
|
-
|
22
|
-
# Initializes the node by:
|
23
|
-
#
|
24
|
-
# * Adding the neighbour (if the user has supplied one) to the peer list.
|
25
|
-
# * Getting the neighbour's peer list and appending them to its own.
|
26
|
-
# * Announces itself to the neighbour and instructs it to propagate our URL
|
27
|
-
# to the others.
|
28
|
-
#
|
29
|
-
# @param [Cuboid::Options] options
|
30
|
-
# @param [Server::Base] server
|
31
|
-
# Dispatcher's RPC server.
|
32
|
-
# @param [String] logfile
|
33
|
-
# Where to send the output.
|
34
|
-
def initialize( options, server, logfile = nil )
|
35
|
-
@options = options
|
36
|
-
@server = server
|
37
|
-
@url = @server.url
|
38
|
-
|
39
|
-
reroute_to_file( logfile ) if logfile
|
40
|
-
|
41
|
-
print_status 'Initializing grid node...'
|
42
|
-
|
43
|
-
@dead_nodes = Set.new
|
44
|
-
@neighbours = Set.new
|
45
|
-
@nodes_info_cache = []
|
46
|
-
|
47
|
-
if (neighbour = @options.dispatcher.neighbour)
|
48
|
-
# Grab the neighbour's neighbours.
|
49
|
-
connect_to_peer( neighbour ).neighbours do |urls|
|
50
|
-
if urls.rpc_exception?
|
51
|
-
add_dead_neighbour( neighbour )
|
52
|
-
print_info "Neighbour seems dead: #{neighbour}"
|
53
|
-
add_dead_neighbour( neighbour )
|
54
|
-
next
|
55
|
-
end
|
56
|
-
|
57
|
-
# Add neighbour and announce it to everyone.
|
58
|
-
add_neighbour( neighbour, true )
|
59
|
-
|
60
|
-
urls.each { |url| @neighbours << url if url != @url }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
print_status 'Node ready.'
|
65
|
-
|
66
|
-
log_updated_neighbours
|
67
|
-
|
68
|
-
Arachni::Reactor.global.at_interval( @options.dispatcher.ping_interval ) do
|
69
|
-
ping
|
70
|
-
check_for_comebacks
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# @return [Boolean]
|
75
|
-
# `true` if grid member, `false` otherwise.
|
76
|
-
def grid_member?
|
77
|
-
@neighbours.any?
|
78
|
-
end
|
79
|
-
|
80
|
-
def unplug
|
81
|
-
@neighbours.each do |peer|
|
82
|
-
connect_to_peer( peer ).remove_neighbour( @url ) {}
|
83
|
-
end
|
84
|
-
|
85
|
-
@neighbours.clear
|
86
|
-
@dead_nodes.clear
|
87
|
-
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
|
91
|
-
# Adds a neighbour to the peer list.
|
92
|
-
#
|
93
|
-
# @param [String] node_url
|
94
|
-
# URL of a neighbouring node.
|
95
|
-
# @param [Boolean] propagate
|
96
|
-
# Whether or not to announce the new node to the peers.
|
97
|
-
def add_neighbour( node_url, propagate = false )
|
98
|
-
# we don't want ourselves in the Set
|
99
|
-
return false if node_url == @url
|
100
|
-
return false if @neighbours.include?( node_url )
|
101
|
-
|
102
|
-
print_status "Adding neighbour: #{node_url}"
|
103
|
-
|
104
|
-
@neighbours << node_url
|
105
|
-
log_updated_neighbours
|
106
|
-
announce( node_url ) if propagate
|
107
|
-
|
108
|
-
connect_to_peer( node_url ).add_neighbour( @url, propagate ) do |res|
|
109
|
-
next if !res.rpc_exception?
|
110
|
-
add_dead_neighbour( node_url )
|
111
|
-
print_status "Neighbour seems dead: #{node_url}"
|
112
|
-
end
|
113
|
-
true
|
114
|
-
end
|
115
|
-
|
116
|
-
def remove_neighbour( url )
|
117
|
-
@neighbours.delete url
|
118
|
-
@dead_nodes.delete url
|
119
|
-
nil
|
120
|
-
end
|
121
|
-
|
122
|
-
# @return [Array]
|
123
|
-
# Neighbour/node/peer URLs.
|
124
|
-
def neighbours
|
125
|
-
@neighbours.to_a
|
126
|
-
end
|
127
|
-
|
128
|
-
def neighbours_with_info( &block )
|
129
|
-
fail 'This method requires a block!' if !block_given?
|
130
|
-
|
131
|
-
@neighbours_cmp = ''
|
132
|
-
|
133
|
-
if @nodes_info_cache.empty? || @neighbours_cmp != neighbours.to_s
|
134
|
-
@neighbours_cmp = neighbours.to_s
|
135
|
-
|
136
|
-
each = proc do |neighbour, iter|
|
137
|
-
connect_to_peer( neighbour ).info do |info|
|
138
|
-
if info.rpc_exception?
|
139
|
-
print_info "Neighbour seems dead: #{neighbour}"
|
140
|
-
add_dead_neighbour( neighbour )
|
141
|
-
log_updated_neighbours
|
142
|
-
|
143
|
-
iter.return( nil )
|
144
|
-
else
|
145
|
-
iter.return( info )
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
after = proc do |nodes|
|
151
|
-
@nodes_info_cache = nodes.compact
|
152
|
-
block.call( @nodes_info_cache )
|
153
|
-
end
|
154
|
-
|
155
|
-
Arachni::Reactor.global.create_iterator( neighbours ).map( each, after )
|
156
|
-
else
|
157
|
-
block.call( @nodes_info_cache )
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
# @return [Hash]
|
162
|
-
#
|
163
|
-
# * `url` -- This node's URL.
|
164
|
-
# * `name` -- Nickname
|
165
|
-
# * `neighbours` -- Array of neighbours.
|
166
|
-
def info
|
167
|
-
{
|
168
|
-
'url' => @url,
|
169
|
-
'name' => @options.dispatcher.name,
|
170
|
-
'neighbours' => @neighbours.to_a,
|
171
|
-
'unreachable_neighbours' => @dead_nodes.to_a
|
172
|
-
}
|
173
|
-
end
|
174
|
-
|
175
|
-
def alive?
|
176
|
-
true
|
177
|
-
end
|
178
|
-
|
179
|
-
private
|
180
|
-
|
181
|
-
def add_dead_neighbour( url )
|
182
|
-
remove_neighbour( url )
|
183
|
-
@dead_nodes << url
|
184
|
-
end
|
185
|
-
|
186
|
-
def log_updated_neighbours
|
187
|
-
print_info 'Updated neighbours:'
|
188
|
-
|
189
|
-
if !neighbours.empty?
|
190
|
-
neighbours.each { |node| print_info( '---- ' + node ) }
|
191
|
-
else
|
192
|
-
print_info '<empty>'
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
def ping
|
197
|
-
neighbours.each do |neighbour|
|
198
|
-
connect_to_peer( neighbour ).alive? do |res|
|
199
|
-
next if !res.rpc_exception?
|
200
|
-
add_dead_neighbour( neighbour )
|
201
|
-
print_status "Found dead neighbour: #{neighbour} "
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def check_for_comebacks
|
207
|
-
@dead_nodes.dup.each do |url|
|
208
|
-
neighbour = connect_to_peer( url )
|
209
|
-
neighbour.alive? do |res|
|
210
|
-
next if res.rpc_exception?
|
211
|
-
|
212
|
-
print_status "Dispatcher came back to life: #{url}"
|
213
|
-
([@url] | neighbours).each do |node|
|
214
|
-
neighbour.add_neighbour( node ){}
|
215
|
-
end
|
216
|
-
|
217
|
-
add_neighbour( url )
|
218
|
-
@dead_nodes.delete url
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
# Announces the node to the ones in the peer list
|
224
|
-
#
|
225
|
-
# @param [String] node
|
226
|
-
# URL
|
227
|
-
def announce( node )
|
228
|
-
print_status "Advertising: #{node}"
|
229
|
-
|
230
|
-
neighbours.each do |peer|
|
231
|
-
next if peer == node
|
232
|
-
|
233
|
-
print_info '---- to: ' + peer
|
234
|
-
connect_to_peer( peer ).add_neighbour( node ) do |res|
|
235
|
-
add_dead_neighbour( peer ) if res.rpc_exception?
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
def connect_to_peer( url )
|
241
|
-
@rpc_clients ||= {}
|
242
|
-
@rpc_clients[url] ||= Client::Dispatcher.new( url ).node
|
243
|
-
end
|
244
|
-
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:47:26 2021] [status] Starting the RPC Server...
|
2
|
-
[Sun Jun 13 13:47:26 2021] [status] Initializing grid node...
|
3
|
-
[Sun Jun 13 13:47:26 2021] [status] Node ready.
|
4
|
-
[Sun Jun 13 13:47:26 2021] [info] Updated neighbours:
|
5
|
-
[Sun Jun 13 13:47:26 2021] [info] <empty>
|
6
|
-
[Sun Jun 13 13:47:26 2021] [status] Ready
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:47:09 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:47:10 2021] [status] [6363927e13ec27b5cbd973b86bd8e52c] Got Instance: 127.0.0.1:17977/e610c59b0aa7a307b431b61efa883ac0
|
3
|
-
[Sun Jun 13 13:47:10 2021] [status] [6363927e13ec27b5cbd973b86bd8e52c] Instance started.
|
4
|
-
[Sun Jun 13 13:47:19 2021] [status] [6363927e13ec27b5cbd973b86bd8e52c] Grabbing report.
|
5
|
-
[Sun Jun 13 13:47:19 2021] [status] [6363927e13ec27b5cbd973b86bd8e52c] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/6363927e13ec27b5cbd973b86bd8e52c.crf
|
6
|
-
[Sun Jun 13 13:47:19 2021] [status] [6363927e13ec27b5cbd973b86bd8e52c] Completed.
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:47:41 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:47:42 2021] [status] [b68f94be3aa96d0c27477dcfe1e25143] Got Instance: 127.0.0.1:7851/49330a40129711b1e0df8f6165975d75
|
3
|
-
[Sun Jun 13 13:47:42 2021] [status] [b68f94be3aa96d0c27477dcfe1e25143] Instance started.
|
4
|
-
[Sun Jun 13 13:47:51 2021] [status] [b68f94be3aa96d0c27477dcfe1e25143] Grabbing report.
|
5
|
-
[Sun Jun 13 13:47:51 2021] [status] [b68f94be3aa96d0c27477dcfe1e25143] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/b68f94be3aa96d0c27477dcfe1e25143.crf
|
6
|
-
[Sun Jun 13 13:47:51 2021] [status] [b68f94be3aa96d0c27477dcfe1e25143] Completed.
|
@@ -1,4 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:47:53 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:47:59 2021] [status] [62a7f8d6c8914bb086e7e5f8c418d974] Grabbing report.
|
3
|
-
[Sun Jun 13 13:47:59 2021] [status] [62a7f8d6c8914bb086e7e5f8c418d974] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/62a7f8d6c8914bb086e7e5f8c418d974.crf
|
4
|
-
[Sun Jun 13 13:47:59 2021] [status] [62a7f8d6c8914bb086e7e5f8c418d974] Completed.
|
@@ -1 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:48:06 2021] [status] Ready
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:48:15 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:48:16 2021] [status] [bbb7496056393de17e72855a63d3acfb] Got Instance: 127.0.0.1:41407/12cd58e1c57385cbd6f7cb3bc6296ab7
|
3
|
-
[Sun Jun 13 13:48:16 2021] [status] [bbb7496056393de17e72855a63d3acfb] Instance started.
|
4
|
-
[Sun Jun 13 13:48:25 2021] [status] [bbb7496056393de17e72855a63d3acfb] Grabbing report.
|
5
|
-
[Sun Jun 13 13:48:25 2021] [status] [bbb7496056393de17e72855a63d3acfb] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/bbb7496056393de17e72855a63d3acfb.crf
|
6
|
-
[Sun Jun 13 13:48:25 2021] [status] [bbb7496056393de17e72855a63d3acfb] Completed.
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:48:41 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:48:42 2021] [status] [45958408cb49a7f3391a973e05bf673b] Got Instance: 127.0.0.1:45676/c4c69dad5b76f1a221862ecf84327fb9
|
3
|
-
[Sun Jun 13 13:48:42 2021] [status] [45958408cb49a7f3391a973e05bf673b] Instance started.
|
4
|
-
[Sun Jun 13 13:48:51 2021] [status] [45958408cb49a7f3391a973e05bf673b] Grabbing report.
|
5
|
-
[Sun Jun 13 13:48:51 2021] [status] [45958408cb49a7f3391a973e05bf673b] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/45958408cb49a7f3391a973e05bf673b.crf
|
6
|
-
[Sun Jun 13 13:48:51 2021] [status] [45958408cb49a7f3391a973e05bf673b] Completed.
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[Sun Jun 13 13:48:59 2021] [status] Ready
|
2
|
-
[Sun Jun 13 13:49:01 2021] [status] [3480c2e4463df854d3457b247e3ba679] Got Instance: 127.0.0.1:27498/5be27ef9735a138bbb6e1aa718562e14
|
3
|
-
[Sun Jun 13 13:49:01 2021] [status] [3480c2e4463df854d3457b247e3ba679] Instance started.
|
4
|
-
[Sun Jun 13 13:49:09 2021] [status] [3480c2e4463df854d3457b247e3ba679] Grabbing report.
|
5
|
-
[Sun Jun 13 13:49:09 2021] [status] [3480c2e4463df854d3457b247e3ba679] Report saved at: /Users/zapotek/workspace/qadron/cuboid/spec/support/reports/3480c2e4463df854d3457b247e3ba679.crf
|
6
|
-
[Sun Jun 13 13:49:10 2021] [status] [3480c2e4463df854d3457b247e3ba679] Completed.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|