# Path: pylm/servers.py
# class Hub(ServerTemplate, BaseMaster):
#     """
#     A Hub is a pipelined Master.
# 
#     :param name: Name of the server
#     :param sub_address: Valid address for the sub service
#     :param pub_address: Valid address for the pub service
#     :param worker_pull_address: Valid address for the pull-from-workers service
#     :param worker_push_address: Valid address for the push-to-workers service
#     :param db_address: Valid address to bind the Cache service
#     :param previous: Name of the previous server to subscribe to the queue.
#     :param pipelined: The stream is pipelined to another server.
#     :param cache: Key-value embeddable database. Pick from one of the supported ones
#     :param log_level: Logging level
# 
#     """
#     def __init__(self, name: str, sub_address: str, pub_address: str,
#                  worker_pull_address: str, worker_push_address: str, db_address: str,
#                  previous: str, pipelined: bool=False, cache: object = DictDB(),
#                  log_level: int = logging.INFO):
# 
#         super(Hub, self).__init__(logging_level=log_level)
#         self.name = name
#         self.cache = cache
#         self.pipelined = pipelined
# 
#         self.register_inbound(
#             SubConnection, 'Sub', sub_address, route='WorkerPush',
#             previous=previous)
#         self.register_inbound(
#             WorkerPullService, 'WorkerPull', worker_pull_address, route='Pub')
#         self.register_outbound(
#             WorkerPushService, 'WorkerPush', worker_push_address)
#         self.register_outbound(
#             PubService, 'Pub', pub_address, log='to_sink', pipelined=pipelined)
#         self.register_bypass(
#             CacheService, 'Cache', db_address)
#         self.preset_cache(name=name,
#                           db_address=db_address,
#                           sub_address=sub_address,
#                           pub_address=pub_address,
#                           worker_pull_address=worker_pull_address,
#                           worker_push_address=worker_push_address)
# 
#         # Monkey patches the scatter and gather functions to the
#         # scatter function of Push and Pull parts respectively.
#         self.inbound_components['Sub'].scatter = self.scatter
#         self.outbound_components['Pub'].scatter = self.gather
#         self.outbound_components['Pub'].handle_stream = self.handle_stream


from pylm.servers import Hub
import logging


server = Hub(name='hub',
             sub_address='tcp://127.0.0.1:5557',
             pub_address='tcp://127.0.0.1:5558',
             worker_pull_address='tcp://127.0.0.1:5559',
             worker_push_address='tcp://127.0.0.1:5560',
             db_address='tcp://127.0.0.1:5561',
             previous='server',

# Path: pylm/servers.py
# class Hub(ServerTemplate, BaseMaster):
#     """
#     A Hub is a pipelined Master.
# 
#     :param name: Name of the server
#     :param sub_address: Valid address for the sub service
#     :param pub_address: Valid address for the pub service
#     :param worker_pull_address: Valid address for the pull-from-workers service
#     :param worker_push_address: Valid address for the push-to-workers service
#     :param db_address: Valid address to bind the Cache service
#     :param previous: Name of the previous server to subscribe to the queue.
#     :param pipelined: The stream is pipelined to another server.
#     :param cache: Key-value embeddable database. Pick from one of the supported ones
#     :param log_level: Logging level
# 
#     """
#     def __init__(self, name: str, sub_address: str, pub_address: str,
#                  worker_pull_address: str, worker_push_address: str, db_address: str,
#                  previous: str, pipelined: bool=False, cache: object = DictDB(),
#                  log_level: int = logging.INFO):
# 
#         super(Hub, self).__init__(logging_level=log_level)
#         self.name = name
#         self.cache = cache
#         self.pipelined = pipelined
# 
#         self.register_inbound(
#             SubConnection, 'Sub', sub_address, route='WorkerPush',
#             previous=previous)
#         self.register_inbound(
#             WorkerPullService, 'WorkerPull', worker_pull_address, route='Pub')
#         self.register_outbound(
#             WorkerPushService, 'WorkerPush', worker_push_address)
#         self.register_outbound(
#             PubService, 'Pub', pub_address, log='to_sink', pipelined=pipelined)
#         self.register_bypass(
#             CacheService, 'Cache', db_address)
#         self.preset_cache(name=name,
#                           db_address=db_address,
#                           sub_address=sub_address,
#                           pub_address=pub_address,
#                           worker_pull_address=worker_pull_address,
#                           worker_push_address=worker_push_address)
# 
#         # Monkey patches the scatter and gather functions to the
#         # scatter function of Push and Pull parts respectively.
#         self.inbound_components['Sub'].scatter = self.scatter
#         self.outbound_components['Pub'].scatter = self.gather
#         self.outbound_components['Pub'].handle_stream = self.handle_stream


# Path: examples/server_hub/hub.py
from pylm.servers import Hub
import logging



server = Hub(name='hub',
             sub_address='tcp://127.0.0.1:5557',
             pub_address='tcp://127.0.0.1:5558',
             worker_pull_address='tcp://127.0.0.1:5559',
             worker_push_address='tcp://127.0.0.1:5560',
             db_address='tcp://127.0.0.1:5561',
             previous='server',

             pipelined=False)