Exemple #1
0
def get_server(target,
               endpoints,
               key,
               serializer=None,
               secure_serializer=ssz.SecureSerializer):
    assert TRANSPORT is not None

    # Thread module is not monkeypatched if remote debugging is enabled.
    # Using eventlet executor without monkepatching thread module will
    # lead to unpredictable results.
    from trove.common import debug_utils
    debug_utils.setup()

    executor = "blocking" if debug_utils.enabled() else "eventlet"

    # BUG(1650518): Cleanup in the Pike release
    # uncomment this (following) line in the pike release
    # assert key is not None
    serializer = secure_serializer(
        sz.TroveRequestContextSerializer(serializer), key)

    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor=executor,
                                    serializer=serializer)
Exemple #2
0
def init(conf):
    global TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_transport(conf, allowed_remote_exmods=exmods)

    serializer = sz.TroveRequestContextSerializer(
        messaging.JsonPayloadSerializer())
    NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer)
Exemple #3
0
def get_client(target,
               key,
               version_cap=None,
               serializer=None,
               secure_serializer=ssz.SecureSerializer):
    assert TRANSPORT is not None
    # BUG(1650518): Cleanup in the Pike release
    # uncomment this (following) line in the pike release
    # assert key is not None
    serializer = secure_serializer(
        sz.TroveRequestContextSerializer(serializer), key)
    return messaging.RPCClient(TRANSPORT,
                               target,
                               version_cap=version_cap,
                               serializer=serializer)