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


Python dispatcher.DefaultRPCAccessPolicy方法代碼示例

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


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

示例1: test_get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def test_get_server(self, mock_get, mock_ser):
        rpc.TRANSPORT = mock.Mock()
        ser = mock.Mock()
        tgt = mock.Mock()
        ends = mock.Mock()
        mock_ser.return_value = ser
        mock_get.return_value = 'server'
        access_policy = dispatcher.DefaultRPCAccessPolicy

        server = rpc.get_server(tgt, ends, serializer='foo')

        mock_ser.assert_called_once_with('foo')
        mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends,
                                         executor='eventlet', serializer=ser,
                                         access_policy=access_policy)
        self.assertEqual('server', server) 
開發者ID:openstack,項目名稱:masakari,代碼行數:18,代碼來源:test_rpc.py

示例2: test_get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def test_get_server(self, mock_get, mock_ser):
        rpc.TRANSPORT = mock.Mock()
        ser = mock.Mock()
        tgt = mock.Mock()
        ends = mock.Mock()
        mock_ser.return_value = ser
        mock_get.return_value = 'server'

        server = rpc.get_server(tgt, ends, serializer='foo')

        mock_ser.assert_called_once_with('foo')
        access_policy = dispatcher.DefaultRPCAccessPolicy
        mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends,
                                         'eventlet', ser,
                                         access_policy=access_policy)
        self.assertEqual('server', server) 
開發者ID:openstack,項目名稱:neutron-lib,代碼行數:18,代碼來源:test_rpc.py

示例3: __init__

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def __init__(self, topic, server, endpoints, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        access_policy = dispatcher.DefaultRPCAccessPolicy
        # TODO(asalkeld) add support for version='x.y'
        target = messaging.Target(topic=topic, server=server)
        self.endpoints = endpoints
        self._server = messaging.get_rpc_server(transport, target, endpoints,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
開發者ID:openstack,項目名稱:zun,代碼行數:16,代碼來源:rpc_service.py

示例4: __init__

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def __init__(self, worker_id, conf):
        super(ConsumerService, self).__init__(worker_id)
        self.conf = conf
        self.topic = conf.oslo_messaging.topic
        self.server = conf.host
        self.endpoints = []
        self.access_policy = dispatcher.DefaultRPCAccessPolicy
        self.message_listener = None 
開發者ID:openstack,項目名稱:octavia,代碼行數:10,代碼來源:consumer.py

示例5: __init__

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def __init__(self, worker_id, conf):
        super(ConsumerService, self).__init__(worker_id)
        self.conf = conf
        self.topic = constants.TOPIC_AMPHORA_V2
        self.server = conf.host
        self.endpoints = []
        self.access_policy = dispatcher.DefaultRPCAccessPolicy
        self.message_listener = None 
開發者ID:openstack,項目名稱:octavia,代碼行數:10,代碼來源:consumer.py

示例6: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, executor='threading',
               access_policy=dispatcher.DefaultRPCAccessPolicy,
               serializer=None):
    if TRANSPORT is None:
        init()

    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor=executor,
                                    serializer=serializer,
                                    access_policy=access_policy) 
開發者ID:openstack,項目名稱:octavia,代碼行數:14,代碼來源:rpc.py

示例7: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, serializer=None):
    if TRANSPORT is None:
        raise AssertionError("'TRANSPORT' must not be None")
    if serializer is None:
        serializer = DesignateObjectSerializer()
    serializer = RequestContextSerializer(serializer)
    access_policy = rpc_dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(
        TRANSPORT,
        target,
        endpoints,
        executor='eventlet',
        serializer=serializer,
        access_policy=access_policy
    ) 
開發者ID:openstack,項目名稱:designate,代碼行數:17,代碼來源:rpc.py

示例8: test_get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def test_get_server(self, mock_get, mock_ser):
        rpc.TRANSPORT = mock.Mock()
        ser = mock.Mock()
        tgt = mock.Mock()
        ends = mock.Mock()
        mock_ser.return_value = ser
        mock_get.return_value = 'server'
        access_policy = dispatcher.DefaultRPCAccessPolicy
        server = rpc.get_server(tgt, ends, serializer='foo')

        mock_ser.assert_called_once_with('foo')
        mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends,
                                         executor='eventlet', serializer=ser,
                                         access_policy=access_policy)
        self.assertEqual('server', server) 
開發者ID:openstack,項目名稱:magnum,代碼行數:17,代碼來源:test_rpc.py

示例9: test_get_server_profiler_enabled

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def test_get_server_profiler_enabled(self, mock_get, mock_ser):
        rpc.TRANSPORT = mock.Mock()
        ser = mock.Mock()
        tgt = mock.Mock()
        ends = mock.Mock()
        mock_ser.return_value = ser
        mock_get.return_value = 'server'
        access_policy = dispatcher.DefaultRPCAccessPolicy
        server = rpc.get_server(tgt, ends, serializer='foo')

        mock_ser.assert_called_once_with('foo')
        mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends,
                                         executor='eventlet', serializer=ser,
                                         access_policy=access_policy)
        self.assertEqual('server', server) 
開發者ID:openstack,項目名稱:magnum,代碼行數:17,代碼來源:test_rpc.py

示例10: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    if profiler:
        serializer = ProfilerRequestContextSerializer(serializer)
    else:
        serializer = RequestContextSerializer(serializer)

    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
開發者ID:openstack,項目名稱:magnum,代碼行數:16,代碼來源:rpc.py

示例11: __init__

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def __init__(self, topic, server, handlers, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        # TODO(asalkeld) add support for version='x.y'
        access_policy = dispatcher.DefaultRPCAccessPolicy
        target = messaging.Target(topic=topic, server=server)
        self._server = messaging.get_rpc_server(transport, target, handlers,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
開發者ID:openstack,項目名稱:magnum,代碼行數:15,代碼來源:rpc_service.py

示例12: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
開發者ID:openstack,項目名稱:manila,代碼行數:12,代碼來源:rpc.py

示例13: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, transport, serializer=None):
    assert transport is not None

    if profiler:
        LOG.debug('profiler enabled for RPC server')
        serializer = ProfilerContextSerializer(serializer=serializer)

    access_policy = dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(transport,
                                    target,
                                    endpoints,
                                    serializer=serializer,
                                    access_policy=access_policy) 
開發者ID:openstack,項目名稱:vitrage,代碼行數:15,代碼來源:rpc.py

示例14: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target=None, endpoints=None):
    access_policy = dispatcher.DefaultRPCAccessPolicy
    transport = get_transport()
    if not target:
        target = get_target()
    return oslo_messaging.get_rpc_server(transport, target,
                                         endpoints, executor='threading',
                                         access_policy=access_policy) 
開發者ID:openstack,項目名稱:cloudkitty,代碼行數:10,代碼來源:messaging.py

示例15: get_server

# 需要導入模塊: from oslo_messaging.rpc import dispatcher [as 別名]
# 或者: from oslo_messaging.rpc.dispatcher import DefaultRPCAccessPolicy [as 別名]
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    serializer = RequestContextSerializer(serializer)
    access_policy = dispatcher.DefaultRPCAccessPolicy
    return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
                                         'eventlet', serializer,
                                         access_policy=access_policy) 
開發者ID:openstack,項目名稱:tacker,代碼行數:9,代碼來源:rpc.py


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