2024-01-01 17:49:27 +08:00
package kis
2023-12-31 18:04:28 +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/config"
2023-12-31 18:04:28 +08:00
)
2024-04-16 15:28:59 +08:00
// Function is the basic computation unit of streaming computation. KisFunction is a basic logical unit of streaming computation, any number of KisFunctions can be combined into a KisFlow
2024-01-01 17:49:27 +08:00
type Function interface {
2024-04-15 17:50:02 +08:00
// Call executes the streaming computation logic
2024-01-01 17:49:27 +08:00
Call ( ctx context . Context , flow Flow ) error
2023-12-31 18:04:28 +08:00
2024-04-15 17:50:02 +08:00
// SetConfig configures the current Function instance
2023-12-31 18:04:28 +08:00
SetConfig ( s * config . KisFuncConfig ) error
2024-04-15 17:50:02 +08:00
// GetConfig retrieves the configuration of the current Function instance
2023-12-31 18:04:28 +08:00
GetConfig ( ) * config . KisFuncConfig
2024-04-15 17:50:02 +08:00
// SetFlow sets the Flow instance that the current Function instance depends on
2024-01-01 17:49:27 +08:00
SetFlow ( f Flow ) error
2024-04-15 17:50:02 +08:00
// GetFlow retrieves the Flow instance that the current Function instance depends on
2024-01-01 17:49:27 +08:00
GetFlow ( ) Flow
2023-12-31 18:04:28 +08:00
2024-04-15 17:50:02 +08:00
// AddConnector adds a Connector to the current Function instance
2024-01-09 17:30:58 +08:00
AddConnector ( conn Connector ) error
2024-04-15 17:50:02 +08:00
// GetConnector retrieves the Connector associated with the current Function instance
2024-01-09 17:30:58 +08:00
GetConnector ( ) Connector
2024-04-15 17:50:02 +08:00
// CreateId generates a random KisID for the current Function instance
2024-01-03 10:16:54 +08:00
CreateId ( )
2024-04-15 17:50:02 +08:00
// GetID retrieves the FID of the current Function
GetID ( ) string
// GetPrevId retrieves the FID of the previous Function node of the current Function
2023-12-31 18:04:28 +08:00
GetPrevId ( ) string
2024-04-15 17:50:02 +08:00
// GetNextId retrieves the FID of the next Function node of the current Function
2023-12-31 18:04:28 +08:00
GetNextId ( ) string
2024-04-15 17:50:02 +08:00
// Next returns the next layer of the computation flow Function. If the current layer is the last layer, it returns nil
2024-01-01 17:49:27 +08:00
Next ( ) Function
2024-04-15 17:50:02 +08:00
// Prev returns the previous layer of the computation flow Function. If the current layer is the last layer, it returns nil
2024-01-01 17:49:27 +08:00
Prev ( ) Function
2024-04-15 17:50:02 +08:00
// SetN sets the next Function instance
2024-01-01 17:49:27 +08:00
SetN ( f Function )
2024-04-15 17:50:02 +08:00
// SetP sets the previous Function instance
2024-01-01 17:49:27 +08:00
SetP ( f Function )
2024-04-15 17:50:02 +08:00
// GetMetaData retrieves the temporary data of the current Function
2024-01-26 17:27:29 +08:00
GetMetaData ( key string ) interface { }
2024-04-15 17:50:02 +08:00
// SetMetaData sets the temporary data of the current Function
2024-01-26 17:27:29 +08:00
SetMetaData ( key string , value interface { } )
2023-12-31 18:04:28 +08:00
}