2024-01-04 16:36:36 +08:00
|
|
|
package kis
|
|
|
|
|
2024-01-09 17:30:58 +08:00
|
|
|
import (
|
|
|
|
"context"
|
2024-04-16 14:58:00 +08:00
|
|
|
|
2024-03-26 14:54:50 +08:00
|
|
|
"github.com/aceld/kis-flow/common"
|
2024-01-09 17:30:58 +08:00
|
|
|
)
|
2024-01-04 16:36:36 +08:00
|
|
|
|
2024-01-09 17:30:58 +08:00
|
|
|
/*
|
|
|
|
Function Call
|
|
|
|
*/
|
2024-01-04 16:36:36 +08:00
|
|
|
// funcRouter
|
|
|
|
// key: Function Name
|
2024-04-15 17:50:02 +08:00
|
|
|
// value: FaaSDesc callback description for custom business
|
2024-03-19 19:16:03 +08:00
|
|
|
type funcRouter map[string]*FaaSDesc
|
2024-01-04 16:36:36 +08:00
|
|
|
|
|
|
|
// flowRouter
|
|
|
|
// key: Flow Name
|
|
|
|
// value: Flow
|
|
|
|
type flowRouter map[string]Flow
|
2024-01-09 17:30:58 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
Connector Init
|
|
|
|
*/
|
2024-04-15 17:50:02 +08:00
|
|
|
// ConnInit Connector third-party storage initialization
|
2024-01-09 17:30:58 +08:00
|
|
|
type ConnInit func(conn Connector) error
|
|
|
|
|
|
|
|
// connInitRouter
|
2024-04-15 17:50:02 +08:00
|
|
|
// key: Connector Name
|
|
|
|
// value: ConnInit
|
2024-01-09 17:30:58 +08:00
|
|
|
type connInitRouter map[string]ConnInit
|
|
|
|
|
|
|
|
/*
|
|
|
|
Connector Call
|
|
|
|
*/
|
2024-04-15 17:50:02 +08:00
|
|
|
// CaaS Connector storage read/write business implementation
|
2024-04-03 12:36:34 +08:00
|
|
|
type CaaS func(context.Context, Connector, Function, Flow, interface{}) (interface{}, error)
|
2024-01-09 17:30:58 +08:00
|
|
|
|
2024-04-15 17:50:02 +08:00
|
|
|
// connFuncRouter Maps CaaS callback storage business to FunctionName
|
2024-01-09 17:30:58 +08:00
|
|
|
// key: Function Name
|
2024-04-15 17:50:02 +08:00
|
|
|
// value: Connector storage read/write business implementation
|
2024-01-09 17:30:58 +08:00
|
|
|
type connFuncRouter map[string]CaaS
|
|
|
|
|
2024-04-15 17:50:02 +08:00
|
|
|
// connSL Splits connFuncRouter into two subtrees based on KisMode
|
2024-01-09 17:30:58 +08:00
|
|
|
// key: Function KisMode S/L
|
2024-04-15 17:50:02 +08:00
|
|
|
// value: connFuncRouter
|
2024-01-09 17:30:58 +08:00
|
|
|
type connSL map[common.KisMode]connFuncRouter
|
|
|
|
|
|
|
|
// connTree
|
|
|
|
// key: Connector Name
|
2024-04-15 17:50:02 +08:00
|
|
|
// value: connSL second-level tree
|
2024-01-09 17:30:58 +08:00
|
|
|
type connTree map[string]connSL
|