示例#1
0
 def adaptation(operator, operation_context):
   rendezvous = _control.Rendezvous(operator, operation_context)
   subscription = utilities.full_subscription(
       rendezvous, _control.protocol_receiver(rendezvous))
   outcome = operation_context.add_termination_callback(rendezvous.set_outcome)
   if outcome is None:
     pool.submit(_control.pool_wrap(in_pool, operation_context), rendezvous)
     return subscription
   else:
     raise abandonment.Abandoned()
示例#2
0
def _invoke(
    end, group, method, timeout, protocol_options, initial_metadata, payload,
    complete):
  rendezvous = _control.Rendezvous(None, None)
  subscription = utilities.full_subscription(
      rendezvous, _control.protocol_receiver(rendezvous))
  operation_context, operator = end.operate(
      group, method, subscription, timeout, protocol_options=protocol_options,
      initial_metadata=initial_metadata, payload=payload,
      completion=_EMPTY_COMPLETION if complete else None)
  rendezvous.set_operator_and_context(operator, operation_context)
  outcome = operation_context.add_termination_callback(rendezvous.set_outcome)
  if outcome is not None:
    rendezvous.set_outcome(outcome)
  return rendezvous, operation_context, outcome
示例#3
0
 def adaptation(group, method, operator, operation_context):
   rendezvous = _control.Rendezvous(operator, operation_context)
   subscription = utilities.full_subscription(
       rendezvous, _control.protocol_receiver(rendezvous))
   outcome = operation_context.add_termination_callback(rendezvous.set_outcome)
   if outcome is None:
     def in_pool():
       request_consumer = multi_method.service(
           group, method, rendezvous, _ServicerContext(rendezvous))
       for request in rendezvous:
         request_consumer.consume(request)
       request_consumer.terminate()
     pool.submit(_control.pool_wrap(in_pool, operation_context), rendezvous)
     return subscription
   else:
     raise abandonment.Abandoned()
示例#4
0
def _invoke(end, group, method, timeout, protocol_options, initial_metadata,
            payload, complete):
    rendezvous = _control.Rendezvous(None, None)
    subscription = utilities.full_subscription(
        rendezvous, _control.protocol_receiver(rendezvous))
    operation_context, operator = end.operate(
        group,
        method,
        subscription,
        timeout,
        protocol_options=protocol_options,
        initial_metadata=initial_metadata,
        payload=payload,
        completion=_EMPTY_COMPLETION if complete else None)
    rendezvous.set_operator_and_context(operator, operation_context)
    outcome = operation_context.add_termination_callback(
        rendezvous.set_outcome)
    if outcome is not None:
        rendezvous.set_outcome(outcome)
    return rendezvous, operation_context, outcome