bayserver-core 2.3.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/baykit/bayserver/agent/accept_handler.rb +0 -26
- data/lib/baykit/bayserver/agent/channel_listener.rb +6 -6
- data/lib/baykit/bayserver/agent/command_receiver.rb +97 -38
- data/lib/baykit/bayserver/agent/grand_agent.rb +444 -134
- data/lib/baykit/bayserver/agent/letter.rb +30 -0
- data/lib/baykit/bayserver/agent/lifecycle_listener.rb +9 -7
- data/lib/baykit/bayserver/agent/monitor/grand_agent_monitor.rb +298 -0
- data/lib/baykit/bayserver/agent/multiplexer/job_multiplexer.rb +257 -0
- data/lib/baykit/bayserver/agent/multiplexer/job_multiplexer_base.rb +52 -0
- data/lib/baykit/bayserver/agent/multiplexer/multiplexer_base.rb +150 -0
- data/lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb +129 -0
- data/lib/baykit/bayserver/agent/multiplexer/rudder_state.rb +81 -0
- data/lib/baykit/bayserver/agent/multiplexer/secure_transporter.rb +50 -0
- data/lib/baykit/bayserver/agent/multiplexer/spider_multiplexer.rb +561 -0
- data/lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb +311 -0
- data/lib/baykit/bayserver/agent/multiplexer/taxi_multiplexer.rb +194 -0
- data/lib/baykit/bayserver/agent/multiplexer/transporter.rb +61 -0
- data/lib/baykit/bayserver/agent/multiplexer/write_unit.rb +30 -0
- data/lib/baykit/bayserver/agent/non_blocking_handler.rb +0 -319
- data/lib/baykit/bayserver/agent/signal/signal_agent.rb +2 -1
- data/lib/baykit/bayserver/agent/timer_handler.rb +1 -1
- data/lib/baykit/bayserver/agent/transporter/data_listener.rb +7 -7
- data/lib/baykit/bayserver/agent/transporter/package.rb +0 -3
- data/lib/baykit/bayserver/agent/transporter/transporter.rb +5 -139
- data/lib/baykit/bayserver/bay_log.rb +1 -0
- data/lib/baykit/bayserver/bayserver.rb +32 -28
- data/lib/baykit/bayserver/{util → common}/groups.rb +1 -1
- data/lib/baykit/bayserver/common/inbound_handler.rb +12 -0
- data/lib/baykit/bayserver/{docker/base → common}/inbound_ship.rb +94 -19
- data/lib/baykit/bayserver/{docker/base → common}/inbound_ship_store.rb +7 -9
- data/lib/baykit/bayserver/common/multiplexer.rb +98 -0
- data/lib/baykit/bayserver/common/postpone.rb +15 -0
- data/lib/baykit/bayserver/common/read_only_ship.rb +42 -0
- data/lib/baykit/bayserver/common/recipient.rb +24 -0
- data/lib/baykit/bayserver/common/vehicle.rb +24 -0
- data/lib/baykit/bayserver/common/vehicle_runner.rb +127 -0
- data/lib/baykit/bayserver/{docker/warp → common}/warp_data.rb +18 -10
- data/lib/baykit/bayserver/common/warp_handler.rb +27 -0
- data/lib/baykit/bayserver/{docker/warp → common}/warp_ship.rb +107 -27
- data/lib/baykit/bayserver/{docker/warp → common}/warp_ship_store.rb +3 -8
- data/lib/baykit/bayserver/docker/base/inbound_data_listener.rb +2 -2
- data/lib/baykit/bayserver/docker/base/port_base.rb +59 -27
- data/lib/baykit/bayserver/docker/{warp/warp_docker.rb → base/warp_base.rb} +43 -50
- data/lib/baykit/bayserver/docker/built_in/built_in_harbor_docker.rb +118 -31
- data/lib/baykit/bayserver/docker/built_in/built_in_log_docker.rb +60 -63
- data/lib/baykit/bayserver/docker/built_in/built_in_permission_docker.rb +11 -10
- data/lib/baykit/bayserver/docker/built_in/built_in_secure_docker.rb +13 -4
- data/lib/baykit/bayserver/docker/city.rb +27 -13
- data/lib/baykit/bayserver/docker/club.rb +8 -8
- data/lib/baykit/bayserver/docker/docker.rb +9 -1
- data/lib/baykit/bayserver/docker/harbor.rb +184 -22
- data/lib/baykit/bayserver/docker/permission.rb +7 -6
- data/lib/baykit/bayserver/docker/port.rb +39 -11
- data/lib/baykit/bayserver/docker/secure.rb +11 -9
- data/lib/baykit/bayserver/docker/send_file/file_content_handler.rb +99 -4
- data/lib/baykit/bayserver/docker/send_file/send_file_docker.rb +6 -2
- data/lib/baykit/bayserver/docker/send_file/send_file_ship.rb +92 -0
- data/lib/baykit/bayserver/docker/town.rb +31 -15
- data/lib/baykit/bayserver/docker/trouble.rb +17 -5
- data/lib/baykit/bayserver/docker/warp.rb +34 -0
- data/lib/baykit/bayserver/mem_usage.rb +9 -9
- data/lib/baykit/bayserver/protocol/command_packer.rb +1 -8
- data/lib/baykit/bayserver/protocol/packet_packer.rb +7 -11
- data/lib/baykit/bayserver/protocol/packet_store.rb +4 -4
- data/lib/baykit/bayserver/protocol/protocol_handler.rb +26 -8
- data/lib/baykit/bayserver/protocol/protocol_handler_store.rb +5 -5
- data/lib/baykit/bayserver/rudders/io_rudder.rb +62 -0
- data/lib/baykit/bayserver/rudders/rudder.rb +29 -0
- data/lib/baykit/bayserver/{watercraft → ships}/ship.rb +65 -41
- data/lib/baykit/bayserver/taxi/taxi.rb +15 -10
- data/lib/baykit/bayserver/taxi/taxi_runner.rb +9 -94
- data/lib/baykit/bayserver/tours/read_file_taxi.rb +2 -2
- data/lib/baykit/bayserver/tours/req_content_handler.rb +16 -13
- data/lib/baykit/bayserver/tours/tour.rb +2 -2
- data/lib/baykit/bayserver/tours/tour_handler.rb +36 -0
- data/lib/baykit/bayserver/tours/tour_req.rb +14 -24
- data/lib/baykit/bayserver/tours/tour_res.rb +5 -89
- data/lib/baykit/bayserver/tours/tour_store.rb +5 -5
- data/lib/baykit/bayserver/train/train_runner.rb +17 -13
- data/lib/baykit/bayserver/util/data_consume_listener.rb +1 -1
- data/lib/baykit/bayserver/util/executor_service.rb +11 -7
- data/lib/baykit/bayserver/util/ip_matcher.rb +9 -39
- data/lib/baykit/bayserver/util/locale.rb +1 -1
- data/lib/baykit/bayserver/util/selector.rb +24 -5
- data/lib/baykit/bayserver/util/sys_util.rb +6 -6
- data/lib/baykit/bayserver/version.rb +1 -1
- metadata +37 -18
- data/lib/baykit/bayserver/agent/grand_agent_monitor.rb +0 -231
- data/lib/baykit/bayserver/agent/transporter/plain_transporter.rb +0 -55
- data/lib/baykit/bayserver/agent/transporter/secure_transporter.rb +0 -81
- data/lib/baykit/bayserver/docker/base/inbound_handler.rb +0 -42
- data/lib/baykit/bayserver/docker/warp/package.rb +0 -4
- data/lib/baykit/bayserver/docker/warp/warp_data_listener.rb +0 -112
- data/lib/baykit/bayserver/docker/warp/warp_handler.rb +0 -38
- /data/lib/baykit/bayserver/{util → common}/cities.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38bca64c229f0bad4d592192eeff7d6daefdc188399675a1fc60f8ba768294ef
|
4
|
+
data.tar.gz: 2020fd1e4f422ce497dd12b8c6107101a4c3e15cc22fda349edc689d8542a4d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b8d633c192766082c8e9d9cfa5b161aa982803b55d0f5c3e6a09c86b3aac65b549254f9dca34fd4f8cf4b1f68d4cb1c6ae2d1f9f5236ade26b753eedd62c607
|
7
|
+
data.tar.gz: 58458cf12a212850c552c08827cdee15e6e7bd78fdf4bd9b87e22505fe034c843494fc008566b7b73a4c3a4b4c72e150f810e8b320caa6670f941667afbde12a
|
@@ -23,32 +23,6 @@ module Baykit
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def on_acceptable(server_skt)
|
26
|
-
port_dkr = @port_map[server_skt]
|
27
|
-
|
28
|
-
begin
|
29
|
-
client_skt, = server_skt.accept_nonblock
|
30
|
-
rescue IO::WaitReadable
|
31
|
-
# Maybe another agent get socket
|
32
|
-
BayLog.debug("Accept failed (must wait readable)")
|
33
|
-
return
|
34
|
-
end
|
35
|
-
|
36
|
-
BayLog.debug("Accepted: skt=%d", client_skt.fileno)
|
37
|
-
|
38
|
-
begin
|
39
|
-
port_dkr.check_admitted(client_skt)
|
40
|
-
rescue => e
|
41
|
-
BayLog.error_e(e)
|
42
|
-
client_skt.close()
|
43
|
-
return
|
44
|
-
end
|
45
|
-
|
46
|
-
client_skt.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
|
47
|
-
|
48
|
-
tp = port_dkr.new_transporter(@agent, client_skt)
|
49
|
-
@agent.non_blocking_handler.ask_to_start(client_skt)
|
50
|
-
@agent.non_blocking_handler.ask_to_read(client_skt)
|
51
|
-
@ch_count += 1
|
52
26
|
end
|
53
27
|
|
54
28
|
def on_closed()
|
@@ -5,27 +5,27 @@ module Baykit
|
|
5
5
|
module ChannelListener # interface
|
6
6
|
|
7
7
|
def on_readable(chk_ch)
|
8
|
-
raise NotImplementedError
|
8
|
+
raise NotImplementedError.new
|
9
9
|
end
|
10
10
|
|
11
11
|
def on_writable(chk_ch)
|
12
|
-
raise NotImplementedError
|
12
|
+
raise NotImplementedError.new
|
13
13
|
end
|
14
14
|
|
15
15
|
def on_connectable(chk_ch)
|
16
|
-
raise NotImplementedError
|
16
|
+
raise NotImplementedError.new
|
17
17
|
end
|
18
18
|
|
19
19
|
def on_error(chk_ch, e)
|
20
|
-
raise NotImplementedError
|
20
|
+
raise NotImplementedError.new
|
21
21
|
end
|
22
22
|
|
23
23
|
def on_closed(chk_ch)
|
24
|
-
raise NotImplementedError
|
24
|
+
raise NotImplementedError.new
|
25
25
|
end
|
26
26
|
|
27
27
|
def check_timeout(chk_ch, duration)
|
28
|
-
raise NotImplementedError
|
28
|
+
raise NotImplementedError.new
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
require 'baykit/bayserver/agent/monitor/grand_agent_monitor'
|
3
|
+
require 'baykit/bayserver/ships/ship'
|
3
4
|
|
4
5
|
module Baykit
|
5
6
|
module BayServer
|
@@ -7,66 +8,124 @@ module Baykit
|
|
7
8
|
#
|
8
9
|
# CommandReceiver receives commands from GrandAgentMonitor
|
9
10
|
#
|
10
|
-
class CommandReceiver
|
11
|
+
class CommandReceiver < Baykit::BayServer::Ships::Ship
|
12
|
+
|
13
|
+
include Baykit::BayServer
|
14
|
+
include Baykit::BayServer::Agent::Monitor
|
11
15
|
include Baykit::BayServer::Util
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(agent, com_ch)
|
17
|
-
@agent = agent
|
18
|
-
@communication_channel = com_ch
|
19
|
-
@aborted = false
|
16
|
+
|
17
|
+
|
18
|
+
def init(agt_id, rd, tp)
|
19
|
+
super
|
20
20
|
end
|
21
21
|
|
22
22
|
def to_s()
|
23
|
-
return "ComReceiver##{@
|
23
|
+
return "ComReceiver##{@agent_id}"
|
24
|
+
end
|
25
|
+
|
26
|
+
#########################################
|
27
|
+
# Implements Ship
|
28
|
+
#########################################
|
29
|
+
def notify_handshake_done(proto)
|
30
|
+
raise Sink.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def notify_connect
|
34
|
+
raise Sink.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def notify_read(buf)
|
38
|
+
BayLog.debug("%s notify_read", self)
|
39
|
+
cmd = GrandAgentMonitor.buffer_to_int(buf)
|
40
|
+
on_read_command(cmd)
|
41
|
+
return NextSocketAction::CONTINUE
|
42
|
+
end
|
43
|
+
|
44
|
+
def notify_eof
|
45
|
+
BayLog.debug("%s notify_eof", self)
|
46
|
+
return NextSocketAction::CLOSE
|
47
|
+
end
|
48
|
+
|
49
|
+
def notify_error(e)
|
50
|
+
BayLog.error_e(e)
|
51
|
+
end
|
52
|
+
|
53
|
+
def notify_protocol_error(e)
|
54
|
+
raise Sink.new
|
24
55
|
end
|
25
56
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
57
|
+
def notify_close
|
58
|
+
end
|
59
|
+
|
60
|
+
def check_timeout(duration_sec)
|
61
|
+
return false
|
62
|
+
end
|
63
|
+
|
64
|
+
#########################################
|
65
|
+
# Custom methods
|
66
|
+
#########################################
|
67
|
+
def on_read_command(cmd)
|
68
|
+
agt = GrandAgent.get(@agent_id)
|
69
|
+
|
70
|
+
BayLog.debug("%s receive command %d rd=%s", self, cmd, @rudder)
|
71
|
+
begin
|
72
|
+
if cmd == nil
|
73
|
+
BayLog.debug("%s pipe closed", self)
|
74
|
+
agt.abort_agent
|
75
|
+
else
|
34
76
|
case cmd
|
35
77
|
when GrandAgent::CMD_RELOAD_CERT
|
36
|
-
|
78
|
+
agt.reload_cert
|
37
79
|
when GrandAgent::CMD_MEM_USAGE
|
38
|
-
|
80
|
+
agt.print_usage
|
39
81
|
when GrandAgent::CMD_SHUTDOWN
|
40
|
-
|
41
|
-
@aborted = true
|
82
|
+
agt.req_shutdown
|
42
83
|
when GrandAgent::CMD_ABORT
|
43
|
-
|
44
|
-
|
84
|
+
send_command_to_monitor(agt, GrandAgent::CMD_OK, true)
|
85
|
+
agt.abort_agent
|
86
|
+
return
|
87
|
+
when GrandAgent::CMD_CATCHUP
|
88
|
+
agt.catch_up
|
45
89
|
return
|
46
90
|
else
|
47
91
|
BayLog.error("Unknown command: %d", cmd)
|
48
92
|
end
|
49
|
-
|
50
|
-
|
51
|
-
BayLog.debug("%s Read failed (maybe agent shut down): %s", self, e)
|
52
|
-
ensure
|
53
|
-
BayLog.debug("%s Command ended", self)
|
93
|
+
|
94
|
+
send_command_to_monitor(agt, GrandAgent::CMD_OK, false)
|
54
95
|
end
|
96
|
+
rescue IOError => e
|
97
|
+
BayLog.error_e(e, "%s Command thread aborted(end)", self)
|
98
|
+
close
|
99
|
+
ensure
|
100
|
+
BayLog.debug("%s Command ended", self)
|
55
101
|
end
|
56
102
|
end
|
57
103
|
|
58
|
-
def
|
59
|
-
|
104
|
+
def send_command_to_monitor(agt, cmd, sync)
|
105
|
+
buf = GrandAgentMonitor.int_to_buffer(cmd)
|
106
|
+
if sync
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def end
|
112
|
+
BayLog.debug("%s send end to monitor", self)
|
60
113
|
begin
|
61
|
-
|
62
|
-
rescue => e
|
63
|
-
BayLog.error_e(e
|
114
|
+
send_command_to_monitor(nil, GrandAgent::CMD_CLOSE, true)
|
115
|
+
rescue IOError => e
|
116
|
+
BayLog.error_e(e)
|
64
117
|
end
|
65
|
-
|
118
|
+
|
119
|
+
close
|
66
120
|
end
|
67
121
|
|
68
|
-
def close
|
69
|
-
@
|
122
|
+
def close
|
123
|
+
if @closed
|
124
|
+
return
|
125
|
+
end
|
126
|
+
|
127
|
+
@rudder.close
|
128
|
+
@closed = true
|
70
129
|
end
|
71
130
|
|
72
131
|
end
|