kis-flow/config/kis_flow_config.go

34 lines
1.2 KiB
Go
Raw Permalink Normal View History

2023-12-31 15:26:53 +08:00
package config
2023-12-31 10:50:01 +08:00
2024-03-26 14:54:50 +08:00
import "github.com/aceld/kis-flow/common"
2023-12-31 10:50:01 +08:00
2024-04-15 17:50:02 +08:00
// KisFlowFunctionParam represents the Id of a Function and carries fixed configuration parameters in a Flow configuration
2023-12-31 10:50:01 +08:00
type KisFlowFunctionParam struct {
2024-04-15 17:50:02 +08:00
FuncName string `yaml:"fname"` // Required
Params FParam `yaml:"params"` // Optional, custom fixed configuration parameters for the Function in the current Flow
2023-12-31 10:50:01 +08:00
}
2024-04-15 17:50:02 +08:00
// KisFlowConfig represents the object that spans the entire stream computing context environment
2023-12-31 10:50:01 +08:00
type KisFlowConfig struct {
KisType string `yaml:"kistype"`
Status int `yaml:"status"`
FlowName string `yaml:"flow_name"`
Flows []KisFlowFunctionParam `yaml:"flows"`
}
2024-04-15 17:50:02 +08:00
// NewFlowConfig creates a Flow strategy configuration object, used to describe a KisFlow information
2024-01-03 10:16:54 +08:00
func NewFlowConfig(flowName string, enable common.KisOnOff) *KisFlowConfig {
2023-12-31 10:50:01 +08:00
config := new(KisFlowConfig)
config.FlowName = flowName
config.Flows = make([]KisFlowFunctionParam, 0)
config.Status = int(enable)
return config
}
2024-04-15 17:50:02 +08:00
// AppendFunctionConfig adds a Function Config to the current Flow
2023-12-31 10:50:01 +08:00
func (fConfig *KisFlowConfig) AppendFunctionConfig(params KisFlowFunctionParam) {
fConfig.Flows = append(fConfig.Flows, params)
}