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))
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))
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)
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))
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))
def submit_node_offline_event(node_id: str) -> None: submit_node_event( NodeEventModel(node_id=node_id, event_type=NodeEventType.OFFLINE))
def submit_sid_space_full_event(node_id: str) -> None: submit_node_event( NodeEventModel(node_id=node_id, event_type=NodeEventType.SID_SPACE_FULL))
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))
def submit_gateway_switching_relays_event(node_id: str) -> None: submit_node_event( NodeEventModel(node_id=node_id, event_type=NodeEventType.SWITCHING_RELAYS))
def submit_sid_space_switch(node_id: str) -> None: submit_node_event( NodeEventModel(node_id=node_id, event_type=NodeEventType.SID_SPACE_SWITCH))