@@ -13,13 +13,15 @@ use crate::identifiers::{
1313} ;
1414use crate :: invocation:: client:: {
1515 CancelInvocationResponse , InvocationOutput , KillInvocationResponse , PurgeInvocationResponse ,
16- SubmittedInvocationNotification ,
16+ RestartInvocationResponse , SubmittedInvocationNotification ,
1717} ;
18- use crate :: invocation:: { InvocationQuery , InvocationRequest , InvocationResponse } ;
18+ use crate :: invocation:: restart:: { ApplyToWorkflowRun , IfRunning } ;
19+ use crate :: invocation:: { InvocationEpoch , InvocationQuery , InvocationRequest , InvocationResponse } ;
1920use crate :: journal_v2:: Signal ;
2021use crate :: net:: ServiceTag ;
2122use crate :: net:: { default_wire_codec, define_rpc, define_service} ;
2223use serde:: { Deserialize , Serialize } ;
24+ use std:: time:: Duration ;
2325
2426pub struct PartitionLeaderService ;
2527
@@ -68,10 +70,26 @@ pub enum PartitionProcessorRpcRequestInner {
6870 GetInvocationOutput ( InvocationQuery , GetInvocationOutputResponseMode ) ,
6971 AppendInvocationResponse ( InvocationResponse ) ,
7072 AppendSignal ( InvocationId , Signal ) ,
71- CancelInvocation { invocation_id : InvocationId } ,
72- KillInvocation { invocation_id : InvocationId } ,
73- PurgeInvocation { invocation_id : InvocationId } ,
74- PurgeJournal { invocation_id : InvocationId } ,
73+ CancelInvocation {
74+ invocation_id : InvocationId ,
75+ } ,
76+ KillInvocation {
77+ invocation_id : InvocationId ,
78+ } ,
79+ PurgeInvocation {
80+ invocation_id : InvocationId ,
81+ invocation_epoch : InvocationEpoch ,
82+ } ,
83+ PurgeJournal {
84+ invocation_id : InvocationId ,
85+ invocation_epoch : InvocationEpoch ,
86+ } ,
87+ RestartInvocation {
88+ invocation_id : InvocationId ,
89+ if_running : IfRunning ,
90+ previous_attempt_retention : Option < Duration > ,
91+ apply_to_workflow_run : ApplyToWorkflowRun ,
92+ } ,
7593}
7694
7795impl WithPartitionKey for PartitionProcessorRpcRequestInner {
@@ -87,10 +105,13 @@ impl WithPartitionKey for PartitionProcessorRpcRequestInner {
87105 PartitionProcessorRpcRequestInner :: KillInvocation { invocation_id } => {
88106 invocation_id. partition_key ( )
89107 }
90- PartitionProcessorRpcRequestInner :: PurgeInvocation { invocation_id } => {
108+ PartitionProcessorRpcRequestInner :: PurgeInvocation { invocation_id, .. } => {
91109 invocation_id. partition_key ( )
92110 }
93- PartitionProcessorRpcRequestInner :: PurgeJournal { invocation_id } => {
111+ PartitionProcessorRpcRequestInner :: PurgeJournal { invocation_id, .. } => {
112+ invocation_id. partition_key ( )
113+ }
114+ PartitionProcessorRpcRequestInner :: RestartInvocation { invocation_id, .. } => {
94115 invocation_id. partition_key ( )
95116 }
96117 }
@@ -204,6 +225,42 @@ impl From<PurgeInvocationResponse> for PurgeInvocationRpcResponse {
204225 }
205226}
206227
228+ #[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
229+ pub enum RestartInvocationRpcResponse {
230+ Ok ,
231+ NotFound ,
232+ StillRunning ,
233+ Unsupported ,
234+ MissingInput ,
235+ NotStarted ,
236+ }
237+
238+ impl From < RestartInvocationRpcResponse > for RestartInvocationResponse {
239+ fn from ( value : RestartInvocationRpcResponse ) -> Self {
240+ match value {
241+ RestartInvocationRpcResponse :: Ok => RestartInvocationResponse :: Ok ,
242+ RestartInvocationRpcResponse :: NotFound => RestartInvocationResponse :: NotFound ,
243+ RestartInvocationRpcResponse :: StillRunning => RestartInvocationResponse :: StillRunning ,
244+ RestartInvocationRpcResponse :: Unsupported => RestartInvocationResponse :: Unsupported ,
245+ RestartInvocationRpcResponse :: MissingInput => RestartInvocationResponse :: MissingInput ,
246+ RestartInvocationRpcResponse :: NotStarted => RestartInvocationResponse :: NotStarted ,
247+ }
248+ }
249+ }
250+
251+ impl From < RestartInvocationResponse > for RestartInvocationRpcResponse {
252+ fn from ( value : RestartInvocationResponse ) -> Self {
253+ match value {
254+ RestartInvocationResponse :: Ok => RestartInvocationRpcResponse :: Ok ,
255+ RestartInvocationResponse :: NotFound => RestartInvocationRpcResponse :: NotFound ,
256+ RestartInvocationResponse :: StillRunning => RestartInvocationRpcResponse :: StillRunning ,
257+ RestartInvocationResponse :: Unsupported => RestartInvocationRpcResponse :: Unsupported ,
258+ RestartInvocationResponse :: MissingInput => RestartInvocationRpcResponse :: MissingInput ,
259+ RestartInvocationResponse :: NotStarted => RestartInvocationRpcResponse :: NotStarted ,
260+ }
261+ }
262+ }
263+
207264#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
208265pub enum PartitionProcessorRpcResponse {
209266 Appended ,
@@ -216,4 +273,5 @@ pub enum PartitionProcessorRpcResponse {
216273 KillInvocation ( KillInvocationRpcResponse ) ,
217274 PurgeInvocation ( PurgeInvocationRpcResponse ) ,
218275 PurgeJournal ( PurgeInvocationRpcResponse ) ,
276+ RestartInvocation ( RestartInvocationRpcResponse ) ,
219277}
0 commit comments