Example #1
0
def submit_peer_connection_event(event_type: str, node_id: str, peer_ip: str,
                                 peer_port: int):
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=event_type,
                       peer_ip=peer_ip,
                       peer_port=peer_port))
Example #2
0
def submit_peer_connection_event(event_type: NodeEventType,
                                 node_id: str,
                                 peer_ip: str,
                                 peer_port: int,
                                 payload: Optional[str] = None) -> None:
    submit_node_event(
        # pyre-fixme[6]: Expected `str` for 5th param but got `Optional[str]`.
        NodeEventModel(node_id=node_id,
                       event_type=event_type,
                       peer_ip=peer_ip,
                       peer_port=peer_port,
                       payload=payload))
Example #3
0
def submit_node_event(node_event_model: NodeEventModel):
    node_event_model.timestamp = str(time.time())
    logger.trace("Submitting event for node {0} {1}", node_event_model.node_id,
                 json_utils.serialize(node_event_model))
    url = SdnRoutes.node_event.format(node_event_model.node_id)
    http_service.post_json(url, node_event_model)
Example #4
0
def submit_node_txs_sync_in_network(node_id: str, networks: List[int]):
    # TODO: Send these events over socket connection instead of HTTP
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.TX_SERVICE_SYNCED_IN_NETWORK,
                       tx_sync_networks=networks))
Example #5
0
def submit_sync_txs_event(node_id: str):
    # TODO: Send these events over socket connection instead of HTTP
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.TX_SERVICE_FULLY_SYNCED))
Example #6
0
def submit_node_offline_event(node_id: str) -> None:
    submit_node_event(
        NodeEventModel(node_id=node_id, event_type=NodeEventType.OFFLINE))
Example #7
0
def submit_sid_space_full_event(node_id: str) -> None:
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.SID_SPACE_FULL))
Example #8
0
def submit_tx_not_synced_event(node_id: str) -> None:
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.TX_SERVICE_NOT_SYNCED))
Example #9
0
def submit_gateway_switching_relays_event(node_id: str) -> None:
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.SWITCHING_RELAYS))
Example #10
0
def submit_sid_space_switch(node_id: str) -> None:
    submit_node_event(
        NodeEventModel(node_id=node_id,
                       event_type=NodeEventType.SID_SPACE_SWITCH))