Class: Baykit::BayServer::Protocol::ProtocolHandlerStore
- Inherits:
-
Util::ObjectStore
- Object
- Util::ObjectStore
- Baykit::BayServer::Protocol::ProtocolHandlerStore
- Defined in:
- lib/baykit/bayserver/protocol/protocol_handler_store.rb
Defined Under Namespace
Classes: AgentListener, ProtocolInfo
Class Attribute Summary collapse
-
.proto_map ⇒ Object
readonly
Returns the value of attribute proto_map.
Instance Attribute Summary collapse
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#server_mode ⇒ Object
readonly
Returns the value of attribute server_mode.
Attributes inherited from Util::ObjectStore
#active_list, #factory, #free_list
Class Method Summary collapse
- .construct_protocol(protocol, svr_mode) ⇒ Object
- .get_store(protocol, svr_mode, agent_id) ⇒ Object
- .get_stores(agent_id) ⇒ Object
-
.init ⇒ Object
class methods.
- .register_protocol(protocol, svr_mode, proto_hnd_factory) ⇒ Object
Instance Method Summary collapse
-
#initialize(proto, svr_mode, proto_hnd_factory, pkt_store) ⇒ ProtocolHandlerStore
constructor
A new instance of ProtocolHandlerStore.
- #print_usage(indent) ⇒ Object
Methods inherited from Util::ObjectStore
Constructor Details
#initialize(proto, svr_mode, proto_hnd_factory, pkt_store) ⇒ ProtocolHandlerStore
Returns a new instance of ProtocolHandlerStore.
61 62 63 64 65 66 67 68 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 61 def initialize(proto, svr_mode, proto_hnd_factory, pkt_store) super() @protocol = proto @server_mode = svr_mode @factory = -> do return proto_hnd_factory.create_protocol_handler(pkt_store) end end |
Class Attribute Details
.proto_map ⇒ Object (readonly)
Returns the value of attribute proto_map.
53 54 55 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 53 def proto_map @proto_map end |
Instance Attribute Details
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
58 59 60 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 58 def protocol @protocol end |
#server_mode ⇒ Object (readonly)
Returns the value of attribute server_mode.
59 60 61 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 59 def server_mode @server_mode end |
Class Method Details
.construct_protocol(protocol, svr_mode) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 100 def self.construct_protocol(protocol, svr_mode) if(svr_mode) return protocol + "-s" else return protocol + "-c" end end |
.get_store(protocol, svr_mode, agent_id) ⇒ Object
82 83 84 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 82 def self.get_store(protocol, svr_mode, agent_id) return @proto_map[construct_protocol(protocol, svr_mode)].stores[agent_id] end |
.get_stores(agent_id) ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 86 def self.get_stores(agent_id) store_list = [] @proto_map.values.each do |ifo| store_list.append(ifo.stores[agent_id]) end return store_list end |
.init ⇒ Object
class methods
78 79 80 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 78 def self.init() GrandAgent.add_lifecycle_listener(AgentListener.new()) end |
.register_protocol(protocol, svr_mode, proto_hnd_factory) ⇒ Object
94 95 96 97 98 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 94 def self.register_protocol(protocol, svr_mode, proto_hnd_factory) if !@proto_map.include?(construct_protocol(protocol, svr_mode)) @proto_map[construct_protocol(protocol, svr_mode)] = ProtocolInfo.new(protocol, svr_mode, proto_hnd_factory) end end |
Instance Method Details
#print_usage(indent) ⇒ Object
70 71 72 73 |
# File 'lib/baykit/bayserver/protocol/protocol_handler_store.rb', line 70 def print_usage(indent) BayLog.info("%sProtocolHandlerStore(%s%s) Usage:", StringUtil.indent(indent), @protocol, @server_mode ? "s" : "c") super(indent+1) end |