Documentation
¶
Index ¶
- type ExecutorManager
- type ExecutorSyncTrigger
- type GojaExecutor
- func (e *GojaExecutor) AddBuildInServices(eventsource eventsourceservice.Service, taskService execservice.ExecService, ...)
- func (e *GojaExecutor) ExecuteFunction(ctx context.Context, code string, functionName string, event *eventstore.Event) (map[string]interface{}, error)
- func (e *GojaExecutor) StartSync(ctx context.Context, syncInterval time.Duration)
- func (e *GojaExecutor) StopSync()
- func (e *GojaExecutor) TriggerSync()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutorManager ¶
type ExecutorManager interface {
StartSync(ctx context.Context, syncInterval time.Duration)
StopSync()
ExecutorSyncTrigger
eventdispatch.Executor
}
type ExecutorSyncTrigger ¶
type ExecutorSyncTrigger interface {
TriggerSync()
}
type GojaExecutor ¶
type GojaExecutor struct {
// contains filtered or unexported fields
}
GojaExecutor handles JavaScript function execution using goja VM with pre-compiled functions. It provides a secure sandboxed environment for executing user-provided JavaScript code with access to system services through controlled built-in functions.
func NewGojaExecutor ¶
func NewGojaExecutor( tracker libtracker.ActivityTracker, functionService functionservice.Service, ) *GojaExecutor
NewGojaExecutor creates a new Goja executor with VM pool and function cache.
Parameters:
- tracker: Activity tracker for monitoring execution
- functionService: Service for synchronizing function-scripts
Returns:
- Executor: A new GojaExecutor instance
func (*GojaExecutor) AddBuildInServices ¶
func (e *GojaExecutor) AddBuildInServices( eventsource eventsourceservice.Service, taskService execservice.ExecService, taskchainService taskchainservice.Service, taskchainExecService execservice.TasksEnvService, )
func (*GojaExecutor) ExecuteFunction ¶
func (e *GojaExecutor) ExecuteFunction( ctx context.Context, code string, functionName string, event *eventstore.Event, ) (map[string]interface{}, error)
ExecuteFunction executes a JavaScript function with the given event as input.
Parameters:
- ctx: Execution context
- code: JavaScript code to execute
- functionName: Name of the function to call (or use global result)
- event: Event that triggered the function execution
Returns:
- map[string]interface{}: Function result as a JSON-like map
- error: Any error encountered during execution
func (*GojaExecutor) StartSync ¶
func (e *GojaExecutor) StartSync(ctx context.Context, syncInterval time.Duration)
StartSync begins background synchronization of the function cache Parameters:
- ctx: Context for managing the sync lifecycle
- syncInterval: How often to perform automatic syncs
func (*GojaExecutor) StopSync ¶
func (e *GojaExecutor) StopSync()
StopSync stops the background synchronization
func (*GojaExecutor) TriggerSync ¶
func (e *GojaExecutor) TriggerSync()
TriggerSync manually triggers a synchronization
Click to show internal directories.
Click to hide internal directories.