2024-01-01 17:49:27 +08:00
|
|
|
|
package kis
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2024-03-26 14:54:50 +08:00
|
|
|
|
"github.com/aceld/kis-flow/common"
|
|
|
|
|
"github.com/aceld/kis-flow/config"
|
2024-01-26 17:27:29 +08:00
|
|
|
|
"time"
|
2024-01-01 17:49:27 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Flow interface {
|
|
|
|
|
// Run 调度Flow,依次调度Flow中的Function并且执行
|
|
|
|
|
Run(ctx context.Context) error
|
|
|
|
|
// Link 将Flow中的Function按照配置文件中的配置进行连接
|
|
|
|
|
Link(fConf *config.KisFuncConfig, fParams config.FParam) error
|
2024-01-03 17:22:35 +08:00
|
|
|
|
// CommitRow 提交Flow数据到即将执行的Function层
|
|
|
|
|
CommitRow(row interface{}) error
|
2024-03-26 16:47:34 +08:00
|
|
|
|
// CommitRowBatch 提交Flow数据到即将执行的Function层(批量提交)
|
|
|
|
|
// row: Must be a slice
|
|
|
|
|
CommitRowBatch(row interface{}) error
|
2024-01-03 17:22:35 +08:00
|
|
|
|
// Input 得到flow当前执行Function的输入源数据
|
|
|
|
|
Input() common.KisRowArr
|
2024-01-04 16:36:36 +08:00
|
|
|
|
// GetName 得到Flow的名称
|
|
|
|
|
GetName() string
|
|
|
|
|
// GetThisFunction 得到当前正在执行的Function
|
|
|
|
|
GetThisFunction() Function
|
|
|
|
|
// GetThisFuncConf 得到当前正在执行的Function的配置
|
|
|
|
|
GetThisFuncConf() *config.KisFuncConfig
|
2024-01-09 17:30:58 +08:00
|
|
|
|
// GetConnector 得到当前正在执行的Function的Connector
|
|
|
|
|
GetConnector() (Connector, error)
|
|
|
|
|
// GetConnConf 得到当前正在执行的Function的Connector的配置
|
|
|
|
|
GetConnConf() (*config.KisConnConfig, error)
|
2024-01-12 17:27:43 +08:00
|
|
|
|
// GetConfig 得到当前Flow的配置
|
|
|
|
|
GetConfig() *config.KisFlowConfig
|
|
|
|
|
// GetFuncConfigByName 得到当前Flow的配置
|
|
|
|
|
GetFuncConfigByName(funcName string) *config.KisFuncConfig
|
2024-01-23 16:21:02 +08:00
|
|
|
|
// Next 当前Flow执行到的Function进入下一层Function所携带的Action动作
|
|
|
|
|
Next(acts ...ActionFunc) error
|
2024-01-26 17:27:29 +08:00
|
|
|
|
// GetCacheData 得到当前Flow的缓存数据
|
|
|
|
|
GetCacheData(key string) interface{}
|
|
|
|
|
// SetCacheData 设置当前Flow的缓存数据
|
|
|
|
|
SetCacheData(key string, value interface{}, Exp time.Duration)
|
|
|
|
|
// GetMetaData 得到当前Flow的临时数据
|
|
|
|
|
GetMetaData(key string) interface{}
|
|
|
|
|
// SetMetaData 设置当前Flow的临时数据
|
|
|
|
|
SetMetaData(key string, value interface{})
|
|
|
|
|
// GetFuncParam 得到Flow的当前正在执行的Function的配置默认参数,取出一对key-value
|
|
|
|
|
GetFuncParam(key string) string
|
|
|
|
|
// GetFuncParamAll 得到Flow的当前正在执行的Function的配置默认参数,取出全部Key-Value
|
|
|
|
|
GetFuncParamAll() config.FParam
|
2024-02-04 16:27:28 +08:00
|
|
|
|
// GetFuncParamsAllFuncs 得到Flow中所有Function的FuncParams,取出全部Key-Value
|
|
|
|
|
GetFuncParamsAllFuncs() map[string]config.FParam
|
|
|
|
|
// Fork 得到Flow的一个副本(深拷贝)
|
|
|
|
|
Fork(ctx context.Context) Flow
|
2024-01-01 17:49:27 +08:00
|
|
|
|
}
|