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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/lib/baykit/bayserver/agent/accept_handler.rb +0 -26
  3. data/lib/baykit/bayserver/agent/channel_listener.rb +6 -6
  4. data/lib/baykit/bayserver/agent/command_receiver.rb +97 -38
  5. data/lib/baykit/bayserver/agent/grand_agent.rb +444 -134
  6. data/lib/baykit/bayserver/agent/letter.rb +30 -0
  7. data/lib/baykit/bayserver/agent/lifecycle_listener.rb +9 -7
  8. data/lib/baykit/bayserver/agent/monitor/grand_agent_monitor.rb +298 -0
  9. data/lib/baykit/bayserver/agent/multiplexer/job_multiplexer.rb +257 -0
  10. data/lib/baykit/bayserver/agent/multiplexer/job_multiplexer_base.rb +52 -0
  11. data/lib/baykit/bayserver/agent/multiplexer/multiplexer_base.rb +150 -0
  12. data/lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb +129 -0
  13. data/lib/baykit/bayserver/agent/multiplexer/rudder_state.rb +81 -0
  14. data/lib/baykit/bayserver/agent/multiplexer/secure_transporter.rb +50 -0
  15. data/lib/baykit/bayserver/agent/multiplexer/spider_multiplexer.rb +561 -0
  16. data/lib/baykit/bayserver/agent/multiplexer/spin_multiplexer.rb +311 -0
  17. data/lib/baykit/bayserver/agent/multiplexer/taxi_multiplexer.rb +194 -0
  18. data/lib/baykit/bayserver/agent/multiplexer/transporter.rb +61 -0
  19. data/lib/baykit/bayserver/agent/multiplexer/write_unit.rb +30 -0
  20. data/lib/baykit/bayserver/agent/non_blocking_handler.rb +0 -319
  21. data/lib/baykit/bayserver/agent/signal/signal_agent.rb +2 -1
  22. data/lib/baykit/bayserver/agent/timer_handler.rb +1 -1
  23. data/lib/baykit/bayserver/agent/transporter/data_listener.rb +7 -7
  24. data/lib/baykit/bayserver/agent/transporter/package.rb +0 -3
  25. data/lib/baykit/bayserver/agent/transporter/transporter.rb +5 -139
  26. data/lib/baykit/bayserver/bay_log.rb +1 -0
  27. data/lib/baykit/bayserver/bayserver.rb +32 -28
  28. data/lib/baykit/bayserver/{util → common}/groups.rb +1 -1
  29. data/lib/baykit/bayserver/common/inbound_handler.rb +12 -0
  30. data/lib/baykit/bayserver/{docker/base → common}/inbound_ship.rb +94 -19
  31. data/lib/baykit/bayserver/{docker/base → common}/inbound_ship_store.rb +7 -9
  32. data/lib/baykit/bayserver/common/multiplexer.rb +98 -0
  33. data/lib/baykit/bayserver/common/postpone.rb +15 -0
  34. data/lib/baykit/bayserver/common/read_only_ship.rb +42 -0
  35. data/lib/baykit/bayserver/common/recipient.rb +24 -0
  36. data/lib/baykit/bayserver/common/vehicle.rb +24 -0
  37. data/lib/baykit/bayserver/common/vehicle_runner.rb +127 -0
  38. data/lib/baykit/bayserver/{docker/warp → common}/warp_data.rb +18 -10
  39. data/lib/baykit/bayserver/common/warp_handler.rb +27 -0
  40. data/lib/baykit/bayserver/{docker/warp → common}/warp_ship.rb +107 -27
  41. data/lib/baykit/bayserver/{docker/warp → common}/warp_ship_store.rb +3 -8
  42. data/lib/baykit/bayserver/docker/base/inbound_data_listener.rb +2 -2
  43. data/lib/baykit/bayserver/docker/base/port_base.rb +59 -27
  44. data/lib/baykit/bayserver/docker/{warp/warp_docker.rb → base/warp_base.rb} +43 -50
  45. data/lib/baykit/bayserver/docker/built_in/built_in_harbor_docker.rb +118 -31
  46. data/lib/baykit/bayserver/docker/built_in/built_in_log_docker.rb +60 -63
  47. data/lib/baykit/bayserver/docker/built_in/built_in_permission_docker.rb +11 -10
  48. data/lib/baykit/bayserver/docker/built_in/built_in_secure_docker.rb +13 -4
  49. data/lib/baykit/bayserver/docker/city.rb +27 -13
  50. data/lib/baykit/bayserver/docker/club.rb +8 -8
  51. data/lib/baykit/bayserver/docker/docker.rb +9 -1
  52. data/lib/baykit/bayserver/docker/harbor.rb +184 -22
  53. data/lib/baykit/bayserver/docker/permission.rb +7 -6
  54. data/lib/baykit/bayserver/docker/port.rb +39 -11
  55. data/lib/baykit/bayserver/docker/secure.rb +11 -9
  56. data/lib/baykit/bayserver/docker/send_file/file_content_handler.rb +99 -4
  57. data/lib/baykit/bayserver/docker/send_file/send_file_docker.rb +6 -2
  58. data/lib/baykit/bayserver/docker/send_file/send_file_ship.rb +92 -0
  59. data/lib/baykit/bayserver/docker/town.rb +31 -15
  60. data/lib/baykit/bayserver/docker/trouble.rb +17 -5
  61. data/lib/baykit/bayserver/docker/warp.rb +34 -0
  62. data/lib/baykit/bayserver/mem_usage.rb +9 -9
  63. data/lib/baykit/bayserver/protocol/command_packer.rb +1 -8
  64. data/lib/baykit/bayserver/protocol/packet_packer.rb +7 -11
  65. data/lib/baykit/bayserver/protocol/packet_store.rb +4 -4
  66. data/lib/baykit/bayserver/protocol/protocol_handler.rb +26 -8
  67. data/lib/baykit/bayserver/protocol/protocol_handler_store.rb +5 -5
  68. data/lib/baykit/bayserver/rudders/io_rudder.rb +62 -0
  69. data/lib/baykit/bayserver/rudders/rudder.rb +29 -0
  70. data/lib/baykit/bayserver/{watercraft → ships}/ship.rb +65 -41
  71. data/lib/baykit/bayserver/taxi/taxi.rb +15 -10
  72. data/lib/baykit/bayserver/taxi/taxi_runner.rb +9 -94
  73. data/lib/baykit/bayserver/tours/read_file_taxi.rb +2 -2
  74. data/lib/baykit/bayserver/tours/req_content_handler.rb +16 -13
  75. data/lib/baykit/bayserver/tours/tour.rb +2 -2
  76. data/lib/baykit/bayserver/tours/tour_handler.rb +36 -0
  77. data/lib/baykit/bayserver/tours/tour_req.rb +14 -24
  78. data/lib/baykit/bayserver/tours/tour_res.rb +5 -89
  79. data/lib/baykit/bayserver/tours/tour_store.rb +5 -5
  80. data/lib/baykit/bayserver/train/train_runner.rb +17 -13
  81. data/lib/baykit/bayserver/util/data_consume_listener.rb +1 -1
  82. data/lib/baykit/bayserver/util/executor_service.rb +11 -7
  83. data/lib/baykit/bayserver/util/ip_matcher.rb +9 -39
  84. data/lib/baykit/bayserver/util/locale.rb +1 -1
  85. data/lib/baykit/bayserver/util/selector.rb +24 -5
  86. data/lib/baykit/bayserver/util/sys_util.rb +6 -6
  87. data/lib/baykit/bayserver/version.rb +1 -1
  88. metadata +37 -18
  89. data/lib/baykit/bayserver/agent/grand_agent_monitor.rb +0 -231
  90. data/lib/baykit/bayserver/agent/transporter/plain_transporter.rb +0 -55
  91. data/lib/baykit/bayserver/agent/transporter/secure_transporter.rb +0 -81
  92. data/lib/baykit/bayserver/docker/base/inbound_handler.rb +0 -42
  93. data/lib/baykit/bayserver/docker/warp/package.rb +0 -4
  94. data/lib/baykit/bayserver/docker/warp/warp_data_listener.rb +0 -112
  95. data/lib/baykit/bayserver/docker/warp/warp_handler.rb +0 -38
  96. /data/lib/baykit/bayserver/{util → common}/cities.rb +0 -0
@@ -8,10 +8,13 @@ require 'baykit/bayserver/version'
8
8
  require 'baykit/bayserver/mem_usage'
9
9
  require 'baykit/bayserver/sink'
10
10
 
11
+ require 'baykit/bayserver/rudders/io_rudder'
12
+
11
13
  require 'baykit/bayserver/agent/signal/signal_agent'
12
14
  require 'baykit/bayserver/agent/signal/signal_sender'
13
15
  require 'baykit/bayserver/agent/signal/signal_sender'
14
16
  require 'baykit/bayserver/agent/grand_agent'
17
+ require 'baykit/bayserver/agent/monitor/grand_agent_monitor'
15
18
 
16
19
  require 'baykit/bayserver/bcf/package'
17
20
 
@@ -24,8 +27,8 @@ require 'baykit/bayserver/taxi/taxi_runner'
24
27
  require 'baykit/bayserver/protocol/protocol_handler_store'
25
28
 
26
29
  require 'baykit/bayserver/docker/package'
27
- require 'baykit/bayserver/docker/base/inbound_ship_store'
28
- require 'baykit/bayserver/docker/warp/warp_ship_store'
30
+ require 'baykit/bayserver/common/inbound_ship_store'
31
+ require 'baykit/bayserver/common/warp_ship_store'
29
32
 
30
33
  require 'baykit/bayserver/util/locale'
31
34
  require 'baykit/bayserver/util/md5_password'
@@ -33,9 +36,10 @@ require 'baykit/bayserver/util/string_util'
33
36
  require 'baykit/bayserver/util/mimes'
34
37
  require 'baykit/bayserver/util/reusable'
35
38
  require 'baykit/bayserver/util/http_status'
36
- require 'baykit/bayserver/util/cities'
37
39
  require 'baykit/bayserver/util/selector'
38
40
 
41
+ require 'baykit/bayserver/common/cities'
42
+
39
43
  module Baykit
40
44
  module BayServer
41
45
 
@@ -46,12 +50,14 @@ module Baykit
46
50
  include Baykit::BayServer::Train
47
51
  include Baykit::BayServer::Taxi
48
52
  include Baykit::BayServer::Agent::Signal
53
+ include Baykit::BayServer::Agent::Monitor
49
54
  include Baykit::BayServer::Protocol
50
55
  include Baykit::BayServer::WaterCraft
51
56
  include Baykit::BayServer::Tours
52
57
  include Baykit::BayServer::Docker
53
58
  include Baykit::BayServer::Docker::Base
54
- include Baykit::BayServer::Docker::Warp
59
+ include Baykit::BayServer::Common
60
+ include Baykit::BayServer::Rudders
55
61
 
56
62
  ENV_BSERV_HOME = "BSERV_HOME"
57
63
  ENV_BSERV_LIB = "BSERV_LIB"
@@ -68,12 +74,12 @@ module Baykit
68
74
  attr :my_host_name
69
75
  attr :my_host_addr
70
76
  attr :dockers
77
+ attr :software_name
78
+ attr :cities
71
79
  attr :ports
72
80
  attr :harbor
73
- attr :bay_agent
74
- attr :cities
75
- attr :ractor_local_map
76
- attr :software_name
81
+ attr :anchorable_port_map
82
+ attr :unanchorable_port_map
77
83
  attr :rack_app
78
84
  attr :derived_port_nos
79
85
  attr :monitor_port
@@ -88,8 +94,8 @@ module Baykit
88
94
  @harbor = nil
89
95
  @any_city = nil
90
96
  @cities = Cities.new()
91
- @ractor_local_map = {}
92
- @rack_app = nil
97
+ @anchorable_port_map = {}
98
+ @unanchorable_port_map = {}
93
99
 
94
100
  def self.get_version
95
101
  return Version::VERSION
@@ -212,7 +218,7 @@ module Baykit
212
218
  #
213
219
  def self.start(agt_id)
214
220
  begin
215
- BayMessage.init(@bserv_lib + "/conf/messages", Locale.new('ja', 'JP'))
221
+ BayMessage.init(@bserv_lib + "/conf/messages", Locale.default())
216
222
 
217
223
  @dockers = BayDockers.new
218
224
  @dockers.init(@bserv_lib + "/conf/dockers.bcf")
@@ -267,6 +273,8 @@ module Baykit
267
273
  child_start(agt_id)
268
274
  end
269
275
 
276
+ return
277
+
270
278
  while not GrandAgentMonitor.monitors.empty?
271
279
  sel = Selector.new()
272
280
  pip_to_mon_map = {}
@@ -326,6 +334,8 @@ module Baykit
326
334
  raise e
327
335
  end
328
336
 
337
+ @anchorable_port_map[IORudder.new(skt)] = dkr
338
+
329
339
  skt.listen(0)
330
340
 
331
341
  #skt = port_dkr.new_server_socket skt
@@ -365,10 +375,7 @@ module Baykit
365
375
  # Thread mode
366
376
  GrandAgent.init(
367
377
  (1..@harbor.grand_agents).to_a,
368
- anchored_port_map,
369
- unanchored_port_map,
370
- @harbor.max_ships,
371
- @harbor.multi_core)
378
+ @harbor.max_ships)
372
379
 
373
380
  invoke_runners()
374
381
  end
@@ -376,17 +383,18 @@ module Baykit
376
383
  SignalAgent.init(@harbor.control_port)
377
384
  GrandAgentMonitor.init(@harbor.grand_agents, anchored_port_map)
378
385
  create_pid_file(Process.pid)
386
+ GrandAgentMonitor.join
379
387
  end
380
388
 
381
389
  def self.child_start(agt_id)
382
390
 
383
391
  invoke_runners()
384
392
 
385
- anchored_port_map = {}
393
+ @anchorable_port_map = {}
386
394
  unanchored_port_map = {}
387
395
 
388
396
  if(SysUtil.run_on_windows())
389
- open_ports(anchored_port_map, unanchored_port_map)
397
+ open_ports(@anchorable_port_map, unanchored_port_map)
390
398
  else
391
399
  @derived_port_nos.each do |no|
392
400
  # Rebuild server socket
@@ -402,27 +410,23 @@ module Baykit
402
410
  end
403
411
 
404
412
  if portDkr == nil
405
- BayLog.fatal("Cannot find port docker: %d", port)
413
+ BayLog.fatal("Cannot find port docker: %d", portDkr.port)
406
414
  exit(1)
407
415
  end
408
416
 
409
- anchored_port_map[skt] = portDkr
417
+ BayLog.debug("agt#%d server port=%d socket=%s(%d)", agt_id, portDkr.port, skt, no)
418
+ @anchorable_port_map[IORudder.new(skt)] = portDkr
410
419
  end
411
420
  end
412
421
 
413
- skt= TCPSocket.new("localhost", @monitor_port)
414
422
 
415
- GrandAgent.init(
416
- [agt_id],
417
- anchored_port_map,
418
- nil,
419
- @harbor.max_ships,
420
- @harbor.multi_core
421
- )
423
+ GrandAgent.init([agt_id], @harbor.max_ships)
422
424
  agt = GrandAgent.get(agt_id)
423
425
 
424
- agt.run_command_receiver(skt)
426
+ skt= TCPSocket.new("localhost", @monitor_port)
427
+ rd = IORudder.new(skt)
425
428
 
429
+ agt.add_command_receiver(rd)
426
430
  agt.run()
427
431
  end
428
432
 
@@ -3,7 +3,7 @@ require 'baykit/bayserver/bcf/package'
3
3
 
4
4
  module Baykit
5
5
  module BayServer
6
- module Util
6
+ module Common
7
7
  class Groups
8
8
  include Baykit::BayServer::Bcf
9
9
 
@@ -0,0 +1,12 @@
1
+ require 'baykit/bayserver/tours/tour_handler'
2
+
3
+ module Baykit
4
+ module BayServer
5
+ module Common
6
+ module InboundHandler # interface
7
+ include Baykit::BayServer::Tours::TourHandler # extends
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -1,17 +1,21 @@
1
+ require 'baykit/bayserver/sink'
2
+
1
3
  require 'baykit/bayserver/agent/next_socket_action'
2
- require 'baykit/bayserver/watercraft/ship'
4
+ require 'baykit/bayserver/rudders/io_rudder'
5
+ require 'baykit/bayserver/ships/ship'
3
6
  require 'baykit/bayserver/tours/package'
4
7
 
5
8
  module Baykit
6
9
  module BayServer
7
- module Docker
8
- module Base
9
- class InboundShip < Baykit::BayServer::WaterCraft::Ship
10
+ module Common
11
+ class InboundShip < Baykit::BayServer::Ships::Ship
10
12
 
13
+ include Baykit::BayServer
11
14
  include Baykit::BayServer::Agent
12
15
  include Baykit::BayServer::Tours
13
- include Baykit::BayServer::WaterCraft
14
16
  include Baykit::BayServer::Util
17
+ include Baykit::BayServer::Rudders
18
+ include Baykit::BayServer::Ships
15
19
 
16
20
  # class variables
17
21
  class << self
@@ -23,27 +27,29 @@ module Baykit
23
27
 
24
28
  attr :port_docker
25
29
 
26
- attr :tour_store
30
+ attr :protocol_handler
27
31
  attr_accessor :need_end
28
32
  attr :socket_timeout_sec
29
- attr :lock
33
+ attr :tour_store
30
34
  attr :active_tours
35
+ attr :lock
31
36
 
32
37
  def initialize()
33
38
  super
34
- @lock = Monitor.new()
39
+ @lock = ::Monitor.new
35
40
  @active_tours = []
36
41
  end
37
42
 
38
43
  def to_s
39
- return "#{@agent} ship##{@ship_id}/#{@object_id}[#{protocol()}]"
44
+ proto = @protocol_handler != nil ? "[" + @protocol_handler.protocol + "]" : ""
45
+ return "agt##{@agent_id} ship##{@ship_id}/#{@object_id}#{proto}"
40
46
  end
41
47
 
42
- def init_inbound(skt, agt, postman, port, proto_hnd)
43
- self.init(skt, agt, postman)
44
- @port_docker = port
48
+ def init_inbound(rd, agt_id, tp, port_dkr, proto_hnd)
49
+ self.init(agt_id, rd, tp)
50
+ @port_docker = port_dkr
45
51
  @socket_timeout_sec = @port_docker.timeout_sec >= 0 ? @port_docker.timeout_sec : BayServer.harbor.socket_timeout_sec
46
- @tour_store = TourStore.get_store(agt.agent_id)
52
+ @tour_store = TourStore.get_store(agt_id)
47
53
  set_protocol_handler(proto_hnd)
48
54
  end
49
55
 
@@ -61,10 +67,74 @@ module Baykit
61
67
  @need_end = false
62
68
  end
63
69
 
70
+ ######################################################
71
+ # Implements Ship
72
+ ######################################################
73
+
74
+ def notify_handshake_done(proto)
75
+ return NextSocketAction::CONTINUE
76
+ end
77
+
78
+ def notify_connect
79
+ raise Sink.new
80
+ end
81
+
82
+ def notify_read(buf)
83
+ return @protocol_handler.bytes_received(buf)
84
+ end
85
+
86
+ def notify_eof
87
+ BayLog.debug("%s EOF detected", self)
88
+ return NextSocketAction::CLOSE
89
+ end
90
+
91
+ def notify_error(e)
92
+ BayLog.debug_e(e, "%s Error notified", self)
93
+ end
94
+
95
+ def notify_protocol_error(e)
96
+ BayLog.debug_e(e)
97
+ return tour_handler.on_protocol_error(e)
98
+ end
99
+
100
+ def notify_close
101
+ BayLog.debug("%s notifyClose", self)
102
+
103
+ abort_tours
104
+
105
+ if @active_tours.length > 0
106
+ # cannot close because there are some running tours
107
+ BayLog.debug("%s cannot end ship because there are some running tours (ignore)", self)
108
+ @need_end = true
109
+ else
110
+ end_ship
111
+ end
112
+ end
113
+
114
+ def check_timeout(duration_sec)
115
+ if @socket_timeout_sec <= 0
116
+ timeout = false
117
+ elsif @keeping
118
+ timeout = duration_sec >= BayServer.harbor.keep_timeout_sec
119
+ else
120
+ timeout = duration_sec >= @socket_timeout_sec
121
+ end
122
+
123
+ BayLog.debug("%s Check timeout: dur=%d, timeout=%s, keeping=%s limit=%d keeplim=%d",
124
+ self, duration_sec, timeout, @keeping, @socket_timeout_sec, BayServer.harbor.keep_timeout_sec)
125
+ return timeout;
126
+ end
127
+
64
128
  ######################################################
65
129
  # Other methods
66
130
  ######################################################
67
131
 
132
+ def set_protocol_handler(proto_handler)
133
+ @protocol_handler = proto_handler
134
+ proto_handler.init(self)
135
+ BayLog.debug("%s protocol handler is set", self)
136
+ end
137
+
68
138
  def get_tour(tur_key, force=false, rent=true)
69
139
  tur = nil
70
140
  store_key = InboundShip.uniq_key(@ship_id, tur_key)
@@ -98,6 +168,7 @@ module Baykit
98
168
 
99
169
  if tur.zombie? || tur.aborted?
100
170
  # Don't send peer any data
171
+ BayLog.debug("%s zombie tur", tur)
101
172
  return
102
173
  end
103
174
 
@@ -137,7 +208,8 @@ module Baykit
137
208
  @port_docker.additional_headers.each do |nv|
138
209
  tur.res.headers.add(nv[0], nv[1])
139
210
  end
140
- @protocol_handler.send_res_headers(tur)
211
+ BayLog.debug("%s send_res_headers", tur)
212
+ tour_handler.send_res_headers(tur)
141
213
  end
142
214
  end
143
215
 
@@ -156,15 +228,15 @@ module Baykit
156
228
  def send_res_content(check_id, tur, bytes, ofs, len, &callback)
157
229
 
158
230
  BayLog.debug("%s send_res_content bytes: %d", self, len)
159
-
160
231
  check_ship_id(check_id)
161
232
 
162
233
  max_len = @protocol_handler.max_res_packet_data_size();
234
+ BayLog.debug("%s max_len=%d", self, max_len)
163
235
  if len > max_len
164
236
  send_res_content(Ship::SHIP_ID_NOCHECK, tur, bytes, ofs, max_len)
165
237
  send_res_content(Ship::SHIP_ID_NOCHECK, tur, bytes, ofs + max_len, len - max_len, &callback)
166
238
  else
167
- @protocol_handler.send_res_content(tur, bytes, ofs, len, &callback)
239
+ tour_handler.send_res_content(tur, bytes, ofs, len, &callback)
168
240
  end
169
241
  end
170
242
 
@@ -191,7 +263,7 @@ module Baykit
191
263
  end
192
264
  end
193
265
 
194
- @protocol_handler.send_end_tour(tur, keep_alive, &callback)
266
+ tour_handler.send_end_tour(tur, keep_alive, &callback)
195
267
  end
196
268
  end
197
269
 
@@ -236,7 +308,7 @@ module Baykit
236
308
 
237
309
  def end_ship()
238
310
  BayLog.debug("%s endShip", self)
239
- @port_docker.return_protocol_handler(@agent, @protocol_handler)
311
+ @port_docker.return_protocol_handler(@agent_id, @protocol_handler)
240
312
  @port_docker.return_ship(self)
241
313
  end
242
314
 
@@ -259,6 +331,10 @@ module Baykit
259
331
  end
260
332
  end
261
333
 
334
+ def tour_handler
335
+ return @protocol_handler.command_handler
336
+ end
337
+
262
338
  protected
263
339
  def send_error_content(chk_id, tour, content)
264
340
 
@@ -306,7 +382,6 @@ module Baykit
306
382
  end
307
383
  end
308
384
  end
309
- end
310
385
  end
311
386
  end
312
387
  end
@@ -1,16 +1,15 @@
1
1
  require 'baykit/bayserver/agent/grand_agent'
2
2
  require 'baykit/bayserver/agent/lifecycle_listener'
3
3
 
4
- require 'baykit/bayserver/docker/base/inbound_ship'
5
- require 'baykit/bayserver/docker/base/inbound_ship_store'
4
+ require 'baykit/bayserver/common/inbound_ship'
5
+ require 'baykit/bayserver/common/inbound_ship_store'
6
6
 
7
7
  require 'baykit/bayserver/util/object_store'
8
8
  require 'baykit/bayserver/util/string_util'
9
9
 
10
10
  module Baykit
11
11
  module BayServer
12
- module Docker
13
- module Base
12
+ module Common
14
13
  class InboundShipStore < Baykit::BayServer::Util::ObjectStore
15
14
  include Baykit::BayServer::WaterCraft
16
15
  include Baykit::BayServer::Util
@@ -19,12 +18,12 @@ module Baykit
19
18
  class AgentListener
20
19
  include Baykit::BayServer::Agent::LifecycleListener # implements
21
20
 
22
- def add(agt)
23
- InboundShipStore.stores[agt.agent_id] = InboundShipStore.new();
21
+ def add(agt_id)
22
+ InboundShipStore.stores[agt_id] = InboundShipStore.new();
24
23
  end
25
24
 
26
- def remove(agt)
27
- InboundShipStore.stores.delete(agt.agent_id);
25
+ def remove(agt_id)
26
+ InboundShipStore.stores.delete(agt_id);
28
27
  end
29
28
  end
30
29
 
@@ -60,7 +59,6 @@ module Baykit
60
59
  end
61
60
 
62
61
  end
63
- end
64
62
  end
65
63
  end
66
64
  end
@@ -0,0 +1,98 @@
1
+
2
+
3
+ module Baykit
4
+ module BayServer
5
+ module Common
6
+ module Multiplexer # interface
7
+
8
+ def add_rudder_state(rd, st)
9
+ raise NotImplementedError.new
10
+ end
11
+
12
+ def get_rudder_state(rd)
13
+ raise NotImplementedError.new
14
+ end
15
+
16
+ def get_transporter(rd)
17
+ raise NotImplementedError.new
18
+ end
19
+
20
+ def req_accept(rd)
21
+ raise NotImplementedError.new
22
+ end
23
+
24
+ def req_connect(rd, adr)
25
+ raise NotImplementedError.new
26
+ end
27
+
28
+ def req_read(rd)
29
+ raise NotImplementedError.new
30
+ end
31
+
32
+ def req_write(rd, buf, adr, tag, lis)
33
+ raise NotImplementedError.new
34
+ end
35
+
36
+ def req_end(rd)
37
+ raise NotImplementedError.new
38
+ end
39
+
40
+ def req_close(rd)
41
+
42
+ end
43
+
44
+ def cancel_read(st)
45
+ raise NotImplementedError.new
46
+ end
47
+
48
+ def cancel_write(st)
49
+ raise NotImplementedError.new
50
+ end
51
+
52
+ def next_accept(st)
53
+ raise NotImplementedError.new
54
+ end
55
+
56
+ def next_read(st)
57
+ raise NotImplementedError.new
58
+ end
59
+
60
+ def next_write(st)
61
+ raise NotImplementedError.new
62
+ end
63
+
64
+ def shutdown()
65
+ raise NotImplementedError.new
66
+ end
67
+
68
+ def is_non_blocking()
69
+ raise NotImplementedError.new
70
+ end
71
+
72
+ def use_async_api()
73
+ raise NotImplementedError.new
74
+ end
75
+
76
+ def consume_oldest_unit(st)
77
+ raise NotImplementedError.new
78
+ end
79
+
80
+ def close_rudder(st)
81
+ raise NotImplementedError.new
82
+ end
83
+
84
+ def is_busy
85
+ raise NotImplementedError.new
86
+ end
87
+
88
+ def on_busy
89
+ raise NotImplementedError.new
90
+ end
91
+
92
+ def on_free
93
+ raise NotImplementedError.new
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,15 @@
1
+
2
+
3
+ module Baykit
4
+ module BayServer
5
+ module Common
6
+ module Postpone # interface
7
+
8
+ def run
9
+ raise NotImplementedError.new
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,42 @@
1
+ require 'baykit/bayserver/ships/ship'
2
+ require 'baykit/bayserver/sink'
3
+
4
+
5
+ module Baykit
6
+ module BayServer
7
+ module Common
8
+
9
+ class ReadOnlyShip < Baykit::BayServer::Ships::Ship
10
+
11
+ include Baykit::BayServer
12
+
13
+ #########################################
14
+ # Implements Reusable
15
+ #########################################
16
+ def reset
17
+ super
18
+ end
19
+
20
+
21
+ #########################################
22
+ # Implements Ship
23
+ #########################################
24
+
25
+ def notify_handshake_done(proto)
26
+ raise Sink.new
27
+ end
28
+
29
+ def notify_connect
30
+ raise Sink.new
31
+ end
32
+
33
+ def notify_protocol_error(e)
34
+ raise Sink.new
35
+ end
36
+
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -0,0 +1,24 @@
1
+
2
+
3
+ module Baykit
4
+ module BayServer
5
+ module Common
6
+ module Recipient # interface
7
+
8
+ #
9
+ # Receive letters
10
+ #
11
+ def receive(wait)
12
+ raise NotImplementedError.new
13
+ end
14
+
15
+ #
16
+ # Wake up the recipient
17
+ #
18
+ def wakeup()
19
+ raise NotImplementedError.new
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+
2
+
3
+ module Baykit
4
+ module BayServer
5
+ module Common
6
+ class Vehicle # abstract class
7
+
8
+ attr :id
9
+
10
+ def initialize(id)
11
+ @id = id
12
+ end
13
+ def run()
14
+ raise NotImplementedError.new
15
+ end
16
+
17
+ def on_timer()
18
+ raise NotImplementedError.new
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end