def _down_completion(self): if self._down_terminal_metadata.kind is _Transitory.Kind.NOT_YET_SEEN: terminal_metadata = None self._down_terminal_metadata = _GONE elif self._down_terminal_metadata.kind is _Transitory.Kind.PRESENT: terminal_metadata = self._down_terminal_metadata.value self._down_terminal_metadata = _GONE else: terminal_metadata = None if self._down_code.kind is _Transitory.Kind.NOT_YET_SEEN: code = None self._down_code = _GONE elif self._down_code.kind is _Transitory.Kind.PRESENT: code = self._down_code.value self._down_code = _GONE else: code = None if self._down_details.kind is _Transitory.Kind.NOT_YET_SEEN: details = None self._down_details = _GONE elif self._down_details.kind is _Transitory.Kind.PRESENT: details = self._down_details.value self._down_details = _GONE else: details = None return utilities.completion(terminal_metadata, code, details)
def _process_one(self, ticket): if ticket.sequence_number == 0: self._ingestion_manager.set_group_and_method(ticket.group, ticket.method) if ticket.timeout is not None: self._expiration_manager.change_timeout(ticket.timeout) if ticket.termination is None: completion = None else: completion = utilities.completion( ticket.terminal_metadata, ticket.code, ticket.message) self._ingestion_manager.advance( ticket.initial_metadata, ticket.payload, completion, ticket.allowance) if ticket.allowance is not None: self._transmission_manager.allowance(ticket.allowance)
def _process_one(self, ticket): if ticket.sequence_number == 0: self._ingestion_manager.set_group_and_method( ticket.group, ticket.method) if ticket.timeout is not None: self._expiration_manager.change_timeout(ticket.timeout) if ticket.termination is None: completion = None else: completion = utilities.completion(ticket.terminal_metadata, ticket.code, ticket.message) self._ingestion_manager.advance(ticket.initial_metadata, ticket.payload, completion, ticket.allowance) if ticket.allowance is not None: self._transmission_manager.allowance(ticket.allowance)
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Utility functions for invoking RPCs.""" from grpc.framework.crust import _control from grpc.framework.interfaces.base import utilities from grpc.framework.interfaces.face import face _ITERATOR_EXCEPTION_LOG_MESSAGE = 'Exception iterating over requests!' _EMPTY_COMPLETION = utilities.completion(None, None, None) def _invoke(end, group, method, timeout, initial_metadata, payload, complete): rendezvous = _control.Rendezvous(None, None) operation_context, operator = end.operate( group, method, utilities.full_subscription(rendezvous), timeout, 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
def service_completion(self): return utilities.completion(self._service_terminal_metadata, None, None)
def invocation_completion(self): return utilities.completion(self._invocation_terminal_metadata, None, None)
def service_completion(self): return utilities.completion( grpc_test_common.SERVICE_TERMINAL_METADATA, beta_interfaces.StatusCode.OK, grpc_test_common.DETAILS)
def invocation_completion(self): return utilities.completion(None, None, None)
def service_completion(self): return utilities.completion(_SERVICE_TERMINAL_METADATA, _CODE, _MESSAGE)
def service_completion(self): return utilities.completion( grpc_test_common.SERVICE_TERMINAL_METADATA, _CODE, grpc_test_common.DETAILS)