예제 #1
0
    def register_endpoint(self, node):
        txn = endpoint_registry.EndpointRegistryTransaction.register_node(
            node, httpport=self._endpoint_http_port)
        txn.sign_from_node(node)

        msg = endpoint_registry.EndpointRegistryTransactionMessage()
        msg.Transaction = txn

        logger.info('register endpoint %s with name %s', node.Identifier[:8],
                    node.Name)
        self.gossip.broadcast_message(msg)
예제 #2
0
 def unregister_endpoint(self, node):
     txn = endpoint_registry.EndpointRegistryTransaction \
         .unregister_node(node)
     txn.sign_from_node(node)
     # Since unregister is often called on shutdown, we really need to make
     # this a system message for the purpose of sending it out from our own
     # queue
     msg = endpoint_registry.EndpointRegistryTransactionMessage()
     msg.Transaction = txn
     logger.info('unregister endpoint %s with name %s', node.Identifier[:8],
                 node.Name)
     self.gossip.broadcast_message(msg)
예제 #3
0
    def register_endpoint(self, endpoint, domain='/'):
        txn = endpoint_registry.EndpointRegistryTransaction.create_from_node(
            endpoint, domain)
        txn.sign_from_node(endpoint)

        msg = endpoint_registry.EndpointRegistryTransactionMessage()
        msg.Transaction = txn
        msg.SenderID = str(endpoint.Identifier)
        msg.sign_from_node(endpoint)

        logger.info('register endpoint %s with name %s through HTTP server',
                    endpoint.Identifier, endpoint.Name)
        self.LedgerWebClient.post_message(msg)
예제 #4
0
    def register_endpoint(self, node, domain='/'):
        txn = endpoint_registry.EndpointRegistryTransaction.register_node(
            node, domain, httpport=self._endpoint_http_port)
        txn.sign_from_node(node)

        msg = endpoint_registry.EndpointRegistryTransactionMessage()
        msg.Transaction = txn
        msg.SenderID = str(node.Identifier)
        msg.sign_from_node(node)

        logger.info('register endpoint %s with name %s', node.Identifier[:8],
                    node.Name)
        self.Ledger.handle_message(msg)
예제 #5
0
    def unregister_endpoint(self, node, domain='/'):
        update = endpoint_registry.update.create_from_node(node, domain)
        update.Verb = 'unr'

        txn = endpoint_registry.EndpointRegistryTransaction()
        txn.Updates.append(update)
        txn.sign_from_node(node)

        # Since unregister is often called on shutdown, we really need to make
        # this a system message for the purpose of sending it out from our own
        # queue
        msg = endpoint_registry.EndpointRegistryTransactionMessage()
        msg.IsSystemMessage = True
        msg.Transaction = txn
        msg.SenderID = str(node.Identifier)
        msg.sign_from_node(node)

        logger.info('unregister endpoint %s with name %s through HTTP server',
                    node.Identifier, node.Name)
        self.LedgerWebClient.post_message(msg)