Add at CANCELLATION back-to-front ticket kind

This addresses issue #752.
pull/1059/head
Nathaniel Manista 10 years ago
parent e2e443c1d4
commit affe916405
  1. 3
      src/python/src/grpc/_adapter/rear.py
  2. 4
      src/python/src/grpc/framework/base/packets/_reception.py
  3. 2
      src/python/src/grpc/framework/base/packets/_transmission.py
  4. 2
      src/python/src/grpc/framework/base/packets/packets.py

@ -191,8 +191,7 @@ class RearLink(ticket_interfaces.RearLink, activated.Activated):
if event.status.code is _low.Code.OK: if event.status.code is _low.Code.OK:
kind = tickets.BackToFrontPacket.Kind.COMPLETION kind = tickets.BackToFrontPacket.Kind.COMPLETION
elif event.status.code is _low.Code.CANCELLED: elif event.status.code is _low.Code.CANCELLED:
# TODO(issue 752): Use a CANCELLATION ticket kind here. kind = tickets.BackToFrontPacket.Kind.CANCELLATION
kind = tickets.BackToFrontPacket.Kind.SERVICER_FAILURE
elif event.status.code is _low.Code.EXPIRED: elif event.status.code is _low.Code.EXPIRED:
kind = tickets.BackToFrontPacket.Kind.EXPIRATION kind = tickets.BackToFrontPacket.Kind.EXPIRATION
else: else:

@ -244,7 +244,9 @@ class _FrontReceiver(_Receiver):
A base_interfaces.Outcome value describing operation abortion if the A base_interfaces.Outcome value describing operation abortion if the
packet is abortive or None if the packet is not abortive. packet is abortive or None if the packet is not abortive.
""" """
if packet.kind is packets.BackToFrontPacket.Kind.EXPIRATION: if packet.kind is packets.BackToFrontPacket.Kind.CANCELLATION:
return base_interfaces.Outcome.CANCELLED
elif packet.kind is packets.BackToFrontPacket.Kind.EXPIRATION:
return base_interfaces.Outcome.EXPIRED return base_interfaces.Outcome.EXPIRED
elif packet.kind is packets.BackToFrontPacket.Kind.SERVICER_FAILURE: elif packet.kind is packets.BackToFrontPacket.Kind.SERVICER_FAILURE:
return base_interfaces.Outcome.SERVICER_FAILURE return base_interfaces.Outcome.SERVICER_FAILURE

@ -63,6 +63,8 @@ _ABORTION_OUTCOME_TO_FRONT_TO_BACK_PACKET_KIND = {
} }
_ABORTION_OUTCOME_TO_BACK_TO_FRONT_PACKET_KIND = { _ABORTION_OUTCOME_TO_BACK_TO_FRONT_PACKET_KIND = {
interfaces.Outcome.CANCELLED:
packets.BackToFrontPacket.Kind.CANCELLATION,
interfaces.Outcome.EXPIRED: interfaces.Outcome.EXPIRED:
packets.BackToFrontPacket.Kind.EXPIRATION, packets.BackToFrontPacket.Kind.EXPIRATION,
interfaces.Outcome.RECEPTION_FAILURE: interfaces.Outcome.RECEPTION_FAILURE:

@ -108,9 +108,9 @@ class BackToFrontPacket(
class Kind(enum.Enum): class Kind(enum.Enum):
"""Identifies the overall kind of a BackToFrontPacket.""" """Identifies the overall kind of a BackToFrontPacket."""
# TODO(issue 752): Add CANCELLATION.
CONTINUATION = 'continuation' CONTINUATION = 'continuation'
COMPLETION = 'completion' COMPLETION = 'completion'
CANCELLATION = 'cancellation'
EXPIRATION = 'expiration' EXPIRATION = 'expiration'
SERVICER_FAILURE = 'servicer failure' SERVICER_FAILURE = 'servicer failure'
SERVICED_FAILURE = 'serviced failure' SERVICED_FAILURE = 'serviced failure'

Loading…
Cancel
Save