@@ -43,12 +43,12 @@ func (rb *redisBackend) CreateWorkflowInstance(ctx context.Context, instance *wo
43
43
}
44
44
45
45
_ , err = createWorkflowInstanceCmd .Run (ctx , rb .rdb , []string {
46
- instanceKey (instance ),
47
- activeInstanceExecutionKey (instance .InstanceID ),
48
- pendingEventsKey (instance ),
49
- payloadKey (instance ),
50
- instancesActive (),
51
- instancesByCreation (),
46
+ rb . keys . instanceKey (instance ),
47
+ rb . keys . activeInstanceExecutionKey (instance .InstanceID ),
48
+ rb . keys . pendingEventsKey (instance ),
49
+ rb . keys . payloadKey (instance ),
50
+ rb . keys . instancesActive (),
51
+ rb . keys . instancesByCreation (),
52
52
keyInfo .SetKey ,
53
53
keyInfo .StreamKey ,
54
54
},
@@ -81,7 +81,7 @@ func (rb *redisBackend) GetWorkflowInstanceHistory(ctx context.Context, instance
81
81
start = "(" + historyID (* lastSequenceID )
82
82
}
83
83
84
- msgs , err := rb .rdb .XRange (ctx , historyKey (instance ), start , "+" ).Result ()
84
+ msgs , err := rb .rdb .XRange (ctx , rb . keys . historyKey (instance ), start , "+" ).Result ()
85
85
if err != nil {
86
86
return nil , err
87
87
}
@@ -98,7 +98,7 @@ func (rb *redisBackend) GetWorkflowInstanceHistory(ctx context.Context, instance
98
98
events = append (events , event )
99
99
}
100
100
101
- res , err := rb .rdb .HMGet (ctx , payloadKey (instance ), payloadKeys ... ).Result ()
101
+ res , err := rb .rdb .HMGet (ctx , rb . keys . payloadKey (instance ), payloadKeys ... ).Result ()
102
102
if err != nil {
103
103
return nil , fmt .Errorf ("reading payloads: %w" , err )
104
104
}
@@ -114,7 +114,7 @@ func (rb *redisBackend) GetWorkflowInstanceHistory(ctx context.Context, instance
114
114
}
115
115
116
116
func (rb * redisBackend ) GetWorkflowInstanceState (ctx context.Context , instance * core.WorkflowInstance ) (core.WorkflowInstanceState , error ) {
117
- instanceState , err := readInstance (ctx , rb .rdb , instanceKey (instance ))
117
+ instanceState , err := readInstance (ctx , rb .rdb , rb . keys . instanceKey (instance ))
118
118
if err != nil {
119
119
return core .WorkflowInstanceStateActive , err
120
120
}
@@ -124,7 +124,7 @@ func (rb *redisBackend) GetWorkflowInstanceState(ctx context.Context, instance *
124
124
125
125
func (rb * redisBackend ) CancelWorkflowInstance (ctx context.Context , instance * core.WorkflowInstance , event * history.Event ) error {
126
126
// Read the instance to check if it exists
127
- _ , err := readInstance (ctx , rb .rdb , instanceKey (instance ))
127
+ _ , err := readInstance (ctx , rb .rdb , rb . keys . instanceKey (instance ))
128
128
if err != nil {
129
129
return err
130
130
}
@@ -141,7 +141,7 @@ func (rb *redisBackend) CancelWorkflowInstance(ctx context.Context, instance *co
141
141
}
142
142
143
143
func (rb * redisBackend ) RemoveWorkflowInstance (ctx context.Context , instance * core.WorkflowInstance ) error {
144
- i , err := readInstance (ctx , rb .rdb , instanceKey (instance ))
144
+ i , err := readInstance (ctx , rb .rdb , rb . keys . instanceKey (instance ))
145
145
if err != nil {
146
146
return err
147
147
}
@@ -151,7 +151,7 @@ func (rb *redisBackend) RemoveWorkflowInstance(ctx context.Context, instance *co
151
151
return backend .ErrInstanceNotFinished
152
152
}
153
153
154
- return deleteInstance (ctx , rb . rdb , instance )
154
+ return rb . deleteInstance (ctx , instance )
155
155
}
156
156
157
157
type instanceState struct {
@@ -199,8 +199,8 @@ func readInstancePipelineCmd(cmd *redis.StringCmd) (*instanceState, error) {
199
199
return & state , nil
200
200
}
201
201
202
- func readActiveInstanceExecution (ctx context.Context , rdb redis. UniversalClient , instanceID string ) (* core.WorkflowInstance , error ) {
203
- val , err := rdb .Get (ctx , activeInstanceExecutionKey (instanceID )).Result ()
202
+ func ( rb * redisBackend ) readActiveInstanceExecution (ctx context.Context , instanceID string ) (* core.WorkflowInstance , error ) {
203
+ val , err := rb . rdb .Get (ctx , rb . keys . activeInstanceExecutionKey (instanceID )).Result ()
204
204
if err != nil {
205
205
if err == redis .Nil {
206
206
return nil , nil
0 commit comments