executor

package
v0.0.0-...-c693505 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutorStatusPrepared  = "PREPARED"
	ExecutorStatusRunning   = "RUNNING"
	ExecutorStatusDestroyed = "DESTROYED"
)

ExecutorStatus 定义executor状态常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// Config 适配器配置
	Config(ctx context.Context, config map[string]any) error
}

Adapter 适配器接口

type Bridge

type Bridge interface {
	// Conn 连接到环境中
	Conn(ctx context.Context, adapter Adapter) (Executor, error)
}

Bridge 桥接器接口

type CommandWrapper

type CommandWrapper struct {
	StepName string // 步骤名称
	Command  string // 要执行的命令
}

CommandWrapper 包装命令,携带步骤元信息用于精确映射

type Executor

type Executor interface {
	// Prepare 准备环境
	Prepare(ctx context.Context) error
	// Destruction 销毁环境
	Destruction(ctx context.Context) error
	// Transfer 从 commandChan 接收命令执行,并将结果发送到 resultChan
	// inputChan 用于接收交互式输入数据,可为 nil(不需要输入时)
	Transfer(ctx context.Context, resultChan chan<- any, commandChan <-chan any, inputChan <-chan []byte)
}

Executor 执行器接口

type ExecutorInfoProvider

type ExecutorInfoProvider interface {
	// GetRuntimeInfo 获取executor特定的运行时信息
	GetRuntimeInfo() map[string]any
	// GetInstanceId 获取executor实例ID (容器ID/Pod名称等)
	GetInstanceId() string
	// GetType 获取executor类型
	GetType() string
}

ExecutorInfoProvider 用于获取 executor 运行时信息

type ExecutorProvider

type ExecutorProvider interface {
	// GetExecutor 根据执行器名称返回对应的Executor实例
	GetExecutor(ctx context.Context, name string) (Executor, error)
}

ExecutorProvider Executor提供者接口,用于根据类型创建Executor

type InputReadyEvent

type InputReadyEvent struct {
	StepName string // 步骤名称
}

InputReadyEvent 输入就绪事件 通知流水线 InputChan 已准备好,可以开始发送输入

type InputRequest

type InputRequest struct {
	Prompt  string `json:"prompt"`  // 显示给用户的提示信息
	Type    string `json:"type"`    // 输入类型: text/password/confirm
	Timeout int    `json:"timeout"` // 等待超时(秒),0表示使用默认值
}

InputRequest 输入请求信息 程序通过输出 {"flowx":"wait-input",...} 来请求用户输入

type InputRequestEvent

type InputRequestEvent struct {
	StepName string        // 步骤名称
	Request  *InputRequest // 输入请求详情
}

InputRequestEvent 输入请求事件 执行器检测到程序等待输入时发送此事件

type StepResult

type StepResult struct {
	StepName   string
	Command    string
	Output     string
	Error      error
	StartTime  time.Time
	FinishTime time.Time
}

StepResult 步骤执行结果

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL