當前位置: 首頁>>代碼示例>>Python>>正文


Python MessageController.subscriptions方法代碼示例

本文整理匯總了Python中ovs.lib.messaging.MessageController.subscriptions方法的典型用法代碼示例。如果您正苦於以下問題:Python MessageController.subscriptions方法的具體用法?Python MessageController.subscriptions怎麽用?Python MessageController.subscriptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ovs.lib.messaging.MessageController的用法示例。


在下文中一共展示了MessageController.subscriptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: retrieve

# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 別名]
 def retrieve(self, pk):
     """
     Retrieves the subscriptions for a given subscriber
     """
     try:
         pk = int(pk)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     return Response(MessageController.subscriptions(pk), status=status.HTTP_200_OK)
開發者ID:BillTheBest,項目名稱:openvstorage,代碼行數:11,代碼來源:messaging.py

示例2: wait

# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 別名]
 def wait(self, pk, message_id):
     """
     Wait for messages to appear for a given subscriber
     """
     try:
         pk = int(pk)
         message_id = int(message_id)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     thread = gevent.spawn(MessagingViewSet._wait, pk, message_id)
     gevent.joinall([thread])
     messages, last_message_id = thread.value
     return Response({'messages'       : messages,
                      'last_message_id': last_message_id,
                      'subscriptions'  : MessageController.subscriptions(pk)}, status=status.HTTP_200_OK)
開發者ID:BillTheBest,項目名稱:openvstorage,代碼行數:17,代碼來源:messaging.py

示例3: wait

# 需要導入模塊: from ovs.lib.messaging import MessageController [as 別名]
# 或者: from ovs.lib.messaging.MessageController import subscriptions [as 別名]
 def wait(self, pk, message_id):
     """
     Wait for messages to appear for a given subscriber
     :param pk: Primary key of subscriber
     :type pk: int
     :param message_id: The last message_id that was already received
     :type message_id: str
     """
     try:
         pk = int(pk)
         message_id = int(message_id)
     except (ValueError, TypeError):
         return Response(status=status.HTTP_400_BAD_REQUEST)
     thread = gevent.spawn(MessagingViewSet._wait, pk, message_id)
     gevent.joinall([thread])
     result = thread.value
     if result is None:
         messages = []
         last_message_id = message_id
     else:
         messages, last_message_id = thread.value
     return Response({'messages': messages,
                      'last_message_id': last_message_id,
                      'subscriptions': MessageController.subscriptions(pk)}, status=status.HTTP_200_OK)
開發者ID:grimpy,項目名稱:openvstorage,代碼行數:26,代碼來源:messaging.py


注:本文中的ovs.lib.messaging.MessageController.subscriptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。