@@ -48,6 +48,7 @@ type Executor interface {
4848
4949type grpcExecutor struct {
5050 protos.UnimplementedTaskHubSidecarServiceServer
51+
5152 workItemQueue chan * protos.WorkItem
5253 pendingOrchestrators * sync.Map // map[api.InstanceID]*ExecutionResults
5354 pendingActivities * sync.Map // map[string]*activityExecutionResult
@@ -488,6 +489,24 @@ func (g *grpcExecutor) StartInstance(ctx context.Context, req *protos.CreateInst
488489 return & protos.CreateInstanceResponse {InstanceId : instanceID }, nil
489490}
490491
492+ // RerunWorkflowFromEvent reruns a workflow from a specific event ID of some
493+ // source instance ID. If not given, a random new instance ID will be
494+ // generated and returned. Can optionally give a new input to the target
495+ // event ID to rerun from.
496+ func (g * grpcExecutor ) RerunWorkflowFromEvent (ctx context.Context , req * protos.RerunWorkflowFromEventRequest ) (* protos.RerunWorkflowFromEventResponse , error ) {
497+ newInstanceID , err := g .backend .RerunWorkflowFromEvent (ctx , req )
498+ if err != nil {
499+ return nil , err
500+ }
501+
502+ _ , err = g .WaitForInstanceStart (ctx , & protos.GetInstanceRequest {InstanceId : newInstanceID .String ()})
503+ if err != nil {
504+ return nil , err
505+ }
506+
507+ return & protos.RerunWorkflowFromEventResponse {NewInstanceID : newInstanceID .String ()}, nil
508+ }
509+
491510// TerminateInstance implements protos.TaskHubSidecarServiceServer
492511func (g * grpcExecutor ) TerminateInstance (ctx context.Context , req * protos.TerminateRequest ) (* protos.TerminateResponse , error ) {
493512 e := & protos.HistoryEvent {
@@ -613,10 +632,6 @@ func (g *grpcExecutor) waitForInstance(ctx context.Context, req *protos.GetInsta
613632 return createGetInstanceResponse (req , metadata ), nil
614633}
615634
616- // mustEmbedUnimplementedTaskHubSidecarServiceServer implements protos.TaskHubSidecarServiceServer
617- func (grpcExecutor ) mustEmbedUnimplementedTaskHubSidecarServiceServer () {
618- }
619-
620635func createGetInstanceResponse (req * protos.GetInstanceRequest , metadata * OrchestrationMetadata ) * protos.GetInstanceResponse {
621636 state := & protos.OrchestrationState {
622637 InstanceId : req .InstanceId ,
@@ -635,3 +650,45 @@ func createGetInstanceResponse(req *protos.GetInstanceRequest, metadata *Orchest
635650
636651 return & protos.GetInstanceResponse {Exists : true , OrchestrationState : state }
637652}
653+
654+ func (g * grpcExecutor ) AbandonTaskActivityWorkItem (ctx context.Context , req * protos.AbandonActivityTaskRequest ) (* protos.AbandonActivityTaskResponse , error ) {
655+ return nil , status .Error (codes .Unimplemented , "" )
656+ }
657+
658+ func (g * grpcExecutor ) AbandonTaskEntityWorkItem (ctx context.Context , req * protos.AbandonEntityTaskRequest ) (* protos.AbandonEntityTaskResponse , error ) {
659+ return nil , status .Error (codes .Unimplemented , "" )
660+ }
661+
662+ func (g * grpcExecutor ) AbandonTaskOrchestratorWorkItem (ctx context.Context , req * protos.AbandonOrchestrationTaskRequest ) (* protos.AbandonOrchestrationTaskResponse , error ) {
663+ return nil , status .Error (codes .Unimplemented , "" )
664+ }
665+
666+ func (g * grpcExecutor ) CleanEntityStorage (ctx context.Context , req * protos.CleanEntityStorageRequest ) (* protos.CleanEntityStorageResponse , error ) {
667+ return nil , status .Error (codes .Unimplemented , "" )
668+ }
669+
670+ func (g * grpcExecutor ) CompleteEntityTask (ctx context.Context , req * protos.EntityBatchResult ) (* protos.CompleteTaskResponse , error ) {
671+ return nil , status .Error (codes .Unimplemented , "" )
672+ }
673+
674+ func (g * grpcExecutor ) GetEntity (ctx context.Context , req * protos.GetEntityRequest ) (* protos.GetEntityResponse , error ) {
675+ return nil , status .Error (codes .Unimplemented , "" )
676+ }
677+
678+ func (g * grpcExecutor ) QueryEntities (ctx context.Context , req * protos.QueryEntitiesRequest ) (* protos.QueryEntitiesResponse , error ) {
679+ return nil , status .Error (codes .Unimplemented , "" )
680+ }
681+
682+ func (g * grpcExecutor ) RewindInstance (ctx context.Context , req * protos.RewindInstanceRequest ) (* protos.RewindInstanceResponse , error ) {
683+ return nil , status .Error (codes .Unimplemented , "" )
684+ }
685+
686+ func (g * grpcExecutor ) SignalEntity (ctx context.Context , req * protos.SignalEntityRequest ) (* protos.SignalEntityResponse , error ) {
687+ return nil , status .Error (codes .Unimplemented , "" )
688+ }
689+
690+ func (g * grpcExecutor ) StreamInstanceHistory (req * protos.StreamInstanceHistoryRequest , stream protos.TaskHubSidecarService_StreamInstanceHistoryServer ) error {
691+ return status .Error (codes .Unimplemented , "" )
692+ }
693+
694+ func (grpcExecutor ) mustEmbedUnimplementedTaskHubSidecarServiceServer () {}
0 commit comments