Skip to content
Snippets Groups Projects
Commit affe9164 authored by Nathaniel Manista's avatar Nathaniel Manista
Browse files

Add at CANCELLATION back-to-front ticket kind

This addresses issue #752.
parent e2e443c1
No related branches found
No related tags found
No related merge requests found
......@@ -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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment