コード例 #1
0
def endpoints(request, n=5):
    """ A collection on endpoints (default 5). """
    # Create N endpoints.
    names = map(lambda x: "endpoint-%d" % x, range(n))
    r = reactor(request)
    for name in names:
        # Save all with an empty configuration.
        r.endpoints().create(name, {})

    # Create the collection of endpoints.
    from reactor.endpoint import Endpoint
    endpoints = map(lambda x: Endpoint(r.endpoints().get(x)[0]), names)

    # Ensure all watches have fired to
    # synchronize manager's active state.
    zk_conn(request).sync()

    return endpoints
コード例 #2
0
ファイル: endpoint.py プロジェクト: rmahmood/reactor-core
 def __init__(self, scale_manager):
     self.scale_manager = scale_manager
     Endpoint.__init__(self, "api", self.api_config(), scale_manager)
     # Make sure that this service is running.
     self.update_state(None)
コード例 #3
0
ファイル: endpoint.py プロジェクト: rmahmood/reactor-core
 def update_config(self, config_str):
     new_config = EndpointConfig(config_str)
     Endpoint.update_config(self, str(self.api_config(new_config)))