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:
kind = tickets.BackToFrontPacket.Kind.COMPLETION
elif event.status.code is _low.Code.CANCELLED:
# TODO(issue 752): Use a CANCELLATION ticket kind here.
kind = tickets.BackToFrontPacket.Kind.SERVICER_FAILURE
kind = tickets.BackToFrontPacket.Kind.CANCELLATION
elif event.status.code is _low.Code.EXPIRED:
kind = tickets.BackToFrontPacket.Kind.EXPIRATION
else:

@ -244,7 +244,9 @@ class _FrontReceiver(_Receiver):
A base_interfaces.Outcome value describing operation abortion if the
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
elif packet.kind is packets.BackToFrontPacket.Kind.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 = {
interfaces.Outcome.CANCELLED:
packets.BackToFrontPacket.Kind.CANCELLATION,
interfaces.Outcome.EXPIRED:
packets.BackToFrontPacket.Kind.EXPIRATION,
interfaces.Outcome.RECEPTION_FAILURE:

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

Loading…
Cancel
Save