Skip to content

Commit 9603960

Browse files
authored
fix(117): split callback state to separate file (#119)
Signed-off-by: lsytj0413 <511121939@qq.com> Signed-off-by: lsytj0413 <511121939@qq.com>
1 parent bafff78 commit 9603960

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

model/callback_state.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2022 The Serverless Workflow Specification Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package model
16+
17+
// CallbackState executes a function and waits for callback event that indicates
18+
// completion of the task.
19+
type CallbackState struct {
20+
BaseState
21+
// Defines the action to be executed
22+
Action Action `json:"action" validate:"required"`
23+
// References a unique callback event name in the defined workflow events
24+
EventRef string `json:"eventRef" validate:"required"`
25+
// Time period to wait for incoming events (ISO 8601 format)
26+
Timeouts *CallbackStateTimeout `json:"timeouts" validate:"omitempty"`
27+
// Event data filter
28+
EventDataFilter EventDataFilter `json:"eventDataFilter,omitempty"`
29+
}
30+
31+
// CallbackStateTimeout defines timeout settings for callback state
32+
type CallbackStateTimeout struct {
33+
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
34+
ActionExecTimeout string `json:"actionExecTimeout,omitempty" validate:"omitempty,iso8601duration"`
35+
EventTimeout string `json:"eventTimeout,omitempty" validate:"omitempty,iso8601duration"`
36+
}

model/states.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,6 @@ type InjectStateTimeout struct {
150150
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
151151
}
152152

153-
// CallbackState ...
154-
type CallbackState struct {
155-
BaseState
156-
// Defines the action to be executed
157-
Action Action `json:"action" validate:"required"`
158-
// References a unique callback event name in the defined workflow events
159-
EventRef string `json:"eventRef" validate:"required"`
160-
// Time period to wait for incoming events (ISO 8601 format)
161-
Timeouts CallbackStateTimeout `json:"timeouts" validate:"required"`
162-
// Event data filter
163-
EventDataFilter EventDataFilter `json:"eventDataFilter,omitempty"`
164-
}
165-
166-
// CallbackStateTimeout ...
167-
type CallbackStateTimeout struct {
168-
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
169-
ActionExecTimeout string `json:"actionExecTimeout,omitempty"`
170-
EventTimeout string `json:"eventTimeout,omitempty"`
171-
}
172-
173153
// BaseSwitchState ...
174154
type BaseSwitchState struct {
175155
BaseState

0 commit comments

Comments
 (0)