Skip to content

Commit 8257250

Browse files
2rbaSerg Tyatin
andauthored
STSSRE-1430: Make getWorkflow public (#89)
Co-authored-by: Serg Tyatin <[email protected]>
1 parent b48c955 commit 8257250

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

iwf/client_impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type clientImpl struct {
1717

1818
func (c *clientImpl) StartWorkflow(ctx context.Context, workflow ObjectWorkflow, workflowId string, timeoutSecs int32, input interface{}, options *WorkflowOptions) (string, error) {
1919
wfType := GetFinalWorkflowType(workflow)
20-
wf := c.registry.getWorkflow(wfType)
20+
wf := c.registry.GetWorkflow(wfType)
2121
if wf == nil {
2222
return "", NewInvalidArgumentError("workflow is not registered")
2323
}

iwf/registry.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ type Registry interface {
1010
// GetAllRegisteredWorkflowTypes returns all the workflow types that have been registered
1111
GetAllRegisteredWorkflowTypes() []string
1212

13+
// GetWorkflow returns the workflow with the given type
14+
GetWorkflow(wfType string) ObjectWorkflow
15+
1316
// below are all for internal implementation
14-
getWorkflow(wfType string) ObjectWorkflow
1517
getWorkflowStartingState(wfType string) WorkflowState
1618
getWorkflowStateDef(wfType string, id string) StateDef
1719
getWorkflowRPC(wfType string, rpcMethod string) CommunicationMethodDef

iwf/registry_impl.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ func (r *registryImpl) GetAllRegisteredWorkflowTypes() []string {
4646
return res
4747
}
4848

49+
func (r *registryImpl) GetWorkflow(wfType string) ObjectWorkflow {
50+
return r.workflowStore[wfType]
51+
}
52+
4953
func (r *registryImpl) getWorkflowStartingState(wfType string) WorkflowState {
5054
return r.workflowStartingState[wfType]
5155
}
@@ -74,10 +78,6 @@ func (r *registryImpl) getWorkflowRPC(wfType string, rpcMethod string) Communica
7478
return r.workflowRPCStore[wfType][rpcMethod]
7579
}
7680

77-
func (r *registryImpl) getWorkflow(wfType string) ObjectWorkflow {
78-
return r.workflowStore[wfType]
79-
}
80-
8181
func (r *registryImpl) registerWorkflow(wf ObjectWorkflow) error {
8282
wfType := GetFinalWorkflowType(wf)
8383
_, ok := r.workflowStore[wfType]

0 commit comments

Comments
 (0)