kis-flow/function/kis_function_l.go

34 lines
663 B
Go
Raw Normal View History

2023-12-31 18:04:28 +08:00
package function
import (
"context"
2024-04-16 15:11:23 +08:00
2024-03-26 14:54:50 +08:00
"github.com/aceld/kis-flow/kis"
"github.com/aceld/kis-flow/log"
2023-12-31 18:04:28 +08:00
)
type KisFunctionL struct {
BaseFunction
}
2024-01-26 17:27:29 +08:00
func NewKisFunctionL() kis.Function {
f := new(KisFunctionL)
2024-04-15 17:50:02 +08:00
// Initialize metaData
2024-01-26 17:27:29 +08:00
f.metaData = make(map[string]interface{})
return f
}
2024-01-01 17:49:27 +08:00
func (f *KisFunctionL) Call(ctx context.Context, flow kis.Flow) error {
2024-04-15 11:17:47 +08:00
log.Logger().DebugF("KisFunctionL, flow = %+v\n", flow)
2023-12-31 18:04:28 +08:00
2024-04-15 17:50:02 +08:00
// Route to the specific computing Function through KisPool
2024-01-04 16:36:36 +08:00
if err := kis.Pool().CallFunction(ctx, f.Config.FName, flow); err != nil {
2024-04-15 11:17:47 +08:00
log.Logger().ErrorFX(ctx, "Function Called Error err = %s\n", err)
2024-01-04 16:36:36 +08:00
return err
}
2023-12-31 18:04:28 +08:00
return nil
}