sync

package
v1.1.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GlobalVariableTypeString represents a plain text variable.
	// GlobalVariableTypeString 表示普通文本变量。
	GlobalVariableTypeString = "string"

	// GlobalVariableTypeSecret represents a password/secret variable that is never displayed after creation.
	// GlobalVariableTypeSecret 表示密码/机密变量,创建或更新后不回显明文。
	GlobalVariableTypeSecret = "secret"
)
View Source
const (
	CuratedSectionEnv       = "env"
	CuratedSectionSource    = "source"
	CuratedSectionTransform = "transform"
	CuratedSectionSink      = "sink"
	CuratedSectionCombo     = "combo"

	CuratedOriginBuiltin  = "builtin"
	CuratedOriginUser     = "user"
	CuratedOriginOverride = "override"

	CuratedModeBatch     = "BATCH"
	CuratedModeStreaming = "STREAMING"
	CuratedModeAny       = "ANY"
)

Curated template section / origin constants. 精选模板分区与来源常量。

View Source
const (
	SchedulerKindDolphin      = "dolphin"
	SchedulerAPIStyleAuto     = "auto"
	SchedulerAPIStyleProcess  = "process"
	SchedulerAPIStyleWorkflow = "workflow"
)

Variables

View Source
var (
	ErrTaskNotFound                    = errors.New("sync: task not found")
	ErrTaskVersionNotFound             = errors.New("sync: task version not found")
	ErrJobInstanceNotFound             = errors.New("sync: job instance not found")
	ErrTaskNameRequired                = errors.New("sync: task name is required")
	ErrInvalidTaskMode                 = errors.New("sync: invalid task mode")
	ErrInvalidTaskStatus               = errors.New("sync: invalid task status")
	ErrInvalidRunType                  = errors.New("sync: invalid run type")
	ErrTaskArchived                    = errors.New("sync: archived task cannot be modified")
	ErrTaskNotPublished                = errors.New("sync: task has not been published")
	ErrTaskDefinitionEmpty             = errors.New("sync: task definition content is required")
	ErrInvalidPreviewMode              = errors.New("sync: invalid preview mode")
	ErrPreviewHTTPSinkEmpty            = errors.New("sync: preview http sink configuration is required")
	ErrJobAlreadyFinished              = errors.New("sync: job instance already finished")
	ErrJobPermissionDenied             = errors.New("sync: job instance permission denied")
	ErrJobStatusChanged                = errors.New("sync: job instance status changed concurrently")
	ErrInvalidNodeType                 = errors.New("sync: invalid node type")
	ErrParentTaskNotFolder             = errors.New("sync: parent node must be a folder")
	ErrFolderContentUnsupported        = errors.New("sync: folder node does not support job content")
	ErrTaskNotFile                     = errors.New("sync: operation only supports file nodes")
	ErrInvalidContentFormat            = errors.New("sync: invalid content format")
	ErrRecoverSourceRequired           = errors.New("sync: recover source job instance is required")
	ErrTaskNameInvalid                 = errors.New("sync: task name contains unsupported characters")
	ErrTaskParentCycle                 = errors.New("sync: parent node cannot be current node or its descendant")
	ErrRootFileNotAllowed              = errors.New("sync: files must be created inside a folder")
	ErrTaskNameDuplicate               = errors.New("sync: task name already exists in the current folder")
	ErrLocalExecutionUnavailable       = errors.New("sync: local execution is unavailable")
	ErrLocalClusterRequired            = errors.New("sync: local execution requires a cluster context")
	ErrLocalSavepointUnsupported       = errors.New("sync: local execution does not support savepoint")
	ErrExecutionTargetUnavailable      = errors.New("sync: execution target is unavailable")
	ErrExecutionTargetClusterMismatch  = errors.New("sync: execution target does not belong to task cluster")
	ErrJobLogsUnavailable              = errors.New("sync: job logs are unavailable")
	ErrPreviewPayloadInvalid           = errors.New("sync: preview collect payload is invalid")
	ErrGlobalVariableNotFound          = errors.New("sync: global variable not found")
	ErrGlobalVariableKeyRequired       = errors.New("sync: global variable key is required")
	ErrGlobalVariableKeyInvalid        = errors.New("sync: global variable key contains unsupported characters")
	ErrGlobalVariableKeyDuplicate      = errors.New("sync: global variable key already exists")
	ErrReservedBuiltinVariableKey      = errors.New("sync: variable key is reserved for built-in time variables")
	ErrPreviewSessionNotFound          = errors.New("sync: preview session not found")
	ErrInvalidTaskSchedule             = errors.New("sync: invalid task schedule")
	ErrMaskedSecretCannotBeRestored    = errors.New("sync: masked secret cannot be restored from the saved task")
	ErrTaskReadOnly                    = errors.New("sync: task is read-only for current user")
	ErrTaskPermissionDenied            = errors.New("sync: task permission denied")
	ErrInvalidTaskCollaborator         = errors.New("sync: collaborator user id must be greater than zero")
	ErrGlobalVariablePermissionDenied  = errors.New("sync: global variable permission denied")
	ErrCuratedTemplateNotFound         = errors.New("sync: curated template not found")
	ErrCuratedTemplateNameRequired     = errors.New("sync: curated template name is required")
	ErrCuratedTemplateContentRequired  = errors.New("sync: curated template content is required")
	ErrCuratedTemplateSectionInvalid   = errors.New("sync: curated template section is invalid")
	ErrCuratedTemplateBuiltinReadonly  = errors.New("sync: built-in curated template is read-only")
	ErrCuratedTemplatePermissionDenied = errors.New("sync: curated template permission denied")
	ErrCuratedBuiltinIDRequired        = errors.New("sync: curated builtin_id is required")
	ErrUnreplacedVariable              = errors.New("sync: variable value still contains an unreplaced ${...} placeholder")
	ErrInvalidScheduleTime             = errors.New("sync: schedule_time must be RFC3339 or yyyyMMddHHmmss")
	ErrAttachGenerationMismatch        = errors.New("sync: attach_generation does not match the current job")
	ErrJobCancellingTimeout            = errors.New("sync: timed out waiting for the previous job on this external_ref to finish cancelling")
	ErrScheduleLockedByDolphin         = errors.New("sync: built-in schedule cannot be enabled while the task is bound to DolphinScheduler")
	ErrSchedulerConnectionNotFound     = errors.New("sync: scheduler connection not found")
	ErrSchedulerConnectionInvalid      = errors.New("sync: scheduler connection is invalid")
	ErrSchedulerBindingNotFound        = errors.New("sync: scheduler binding not found")
	ErrSchedulerBindingExists          = errors.New("sync: task already has a scheduler binding")
	ErrDolphinCycle                    = errors.New("sync: adding the selected upstream/downstream edges would create a cycle")
	ErrDolphinVersionConflict          = errors.New("sync: DolphinScheduler workflow version changed")
	ErrDolphinNodeMissing              = errors.New("sync: bound DolphinScheduler task node is missing; use first-time push")
	ErrDolphinPushInvalid              = errors.New("sync: invalid DolphinScheduler push request")
	ErrDolphinPushNoNewVersion         = errors.New("sync: dolphin push requires a new published version")
	ErrDolphinUnsupportedVersion       = errors.New("sync: only DolphinScheduler 3.x is supported")
)

Functions

func FormatJobMetricsLogBlock added in v1.2.0

func FormatJobMetricsLogBlock(metrics map[string]interface{}, at time.Time, final bool) string

FormatJobMetricsLogBlock 将 SeaTunnel / STX 已存 metrics 格式化为可读日志块(双语标签)。 FormatJobMetricsLogBlock formats stored SeaTunnel/STX metrics into a readable log block (bilingual labels).

Types

type AgentCommandSender

type AgentCommandSender interface {
	SendCommand(ctx context.Context, agentID string, commandType string, params map[string]string) (success bool, output string, err error)
}

type BasicResponse

type BasicResponse struct {
	ErrorMsg string      `json:"error_msg"`
	Data     interface{} `json:"data"`
}

type CancelByRefRequest added in v1.2.0

type CancelByRefRequest struct {
	ExternalRef      string `json:"external_ref"`
	AttachGeneration int    `json:"attach_generation"`
}

CancelByRefRequest 按外部引用停止作业。 CancelByRefRequest stops a job by its external scheduler reference.

type CancelJobRequest

type CancelJobRequest struct {
	StopWithSavepoint bool `json:"stop_with_savepoint"`
}

CancelJobRequest represents stop-job behavior.

type CheckpointSnapshot

type CheckpointSnapshot struct {
	JobInstanceID uint                      `json:"job_instance_id"`
	PlatformJobID string                    `json:"platform_job_id"`
	EngineJobID   string                    `json:"engine_job_id"`
	Status        string                    `json:"status"`
	EmptyReason   string                    `json:"empty_reason,omitempty"`
	Message       string                    `json:"message,omitempty"`
	Overview      *EngineCheckpointOverview `json:"overview,omitempty"`
	History       []*EngineCheckpointRecord `json:"history,omitempty"`
}

CheckpointSnapshot represents checkpoint overview and history for one job. CheckpointSnapshot 表示单个作业的 checkpoint 概览与历史。

type CheckpointSnapshotResponse

type CheckpointSnapshotResponse struct {
	ErrorMsg string              `json:"error_msg"`
	Data     *CheckpointSnapshot `json:"data"`
}

type ClusterLogProvider

type ClusterLogProvider interface {
	GetNodeLogs(ctx context.Context, clusterID uint, nodeID uint, req *clusterapp.GetNodeLogsRequest) (string, error)
	GetJobLogMode(ctx context.Context, clusterID uint) (string, error)
}

type ClusterRuntimeResolver

type ClusterRuntimeResolver interface {
	ResolveEngineEndpoint(ctx context.Context, clusterID uint, taskDefinition JSONMap) (*EngineEndpoint, error)
}

ClusterRuntimeResolver resolves SeaTunnel engine API endpoints from cluster metadata.

type ClusterVersionProvider

type ClusterVersionProvider interface {
	GetClusterVersion(ctx context.Context, clusterID uint) (string, error)
}

ClusterVersionProvider provides SeaTunnel cluster version lookup.

type ConfigToolClient

ConfigToolClient talks to stx-java-proxy config APIs.

type ConfigToolContentRequest

type ConfigToolContentRequest struct {
	Content       string   `json:"content,omitempty"`
	ContentFormat string   `json:"contentFormat,omitempty"`
	FilePath      string   `json:"filePath,omitempty"`
	Variables     []string `json:"variables,omitempty"`
}

ConfigToolContentRequest represents shared content/filePath input.

type ConfigToolDAGResponse

type ConfigToolDAGResponse struct {
	OK             bool            `json:"ok"`
	Message        string          `json:"message,omitempty"`
	SimpleGraph    bool            `json:"simpleGraph"`
	SourceCount    int             `json:"sourceCount"`
	TransformCount int             `json:"transformCount"`
	SinkCount      int             `json:"sinkCount"`
	Warnings       []string        `json:"warnings"`
	Graph          ConfigToolGraph `json:"graph"`
}

ConfigToolDAGResponse mirrors java-proxy dag response.

type ConfigToolError

type ConfigToolError struct {
	StatusCode int
	Path       string
	Message    string
	RawBody    string
	ErrorType  string
}

ConfigToolError captures structured proxy request failures.

func (*ConfigToolError) Error

func (e *ConfigToolError) Error() string

type ConfigToolGraph

type ConfigToolGraph struct {
	Nodes []map[string]interface{} `json:"nodes"`
	Edges []map[string]interface{} `json:"edges"`
}

ConfigToolGraph mirrors java-proxy DAG payload.

type ConfigToolPluginEnumValuesRequest

type ConfigToolPluginEnumValuesRequest struct {
	PluginType        string   `json:"pluginType"`
	FactoryIdentifier string   `json:"factoryIdentifier"`
	OptionKey         string   `json:"optionKey"`
	PluginJars        []string `json:"pluginJars,omitempty"`
	IncludeSupplement bool     `json:"includeSupplement"`
}

ConfigToolPluginEnumValuesRequest represents plugin enum values input.

type ConfigToolPluginEnumValuesResponse

type ConfigToolPluginEnumValuesResponse struct {
	OK                bool     `json:"ok"`
	PluginType        string   `json:"pluginType"`
	FactoryIdentifier string   `json:"factoryIdentifier"`
	OptionKey         string   `json:"optionKey"`
	EnumValues        []string `json:"enumValues"`
	Warnings          []string `json:"warnings"`
}

ConfigToolPluginEnumValuesResponse mirrors java-proxy enum values response.

type ConfigToolPluginFactoryInfo

type ConfigToolPluginFactoryInfo struct {
	FactoryIdentifier string `json:"factoryIdentifier"`
	ClassName         string `json:"className,omitempty"`
	Origin            string `json:"origin,omitempty"`
}

ConfigToolPluginFactoryInfo mirrors java-proxy plugin list entry.

type ConfigToolPluginListRequest

type ConfigToolPluginListRequest struct {
	PluginType string   `json:"pluginType"`
	PluginJars []string `json:"pluginJars,omitempty"`
}

ConfigToolPluginListRequest represents plugin discovery input.

type ConfigToolPluginListResponse

type ConfigToolPluginListResponse struct {
	OK         bool                          `json:"ok"`
	PluginType string                        `json:"pluginType"`
	Plugins    []ConfigToolPluginFactoryInfo `json:"plugins"`
	Warnings   []string                      `json:"warnings"`
}

ConfigToolPluginListResponse mirrors java-proxy plugin list response.

type ConfigToolPluginOptionDescriptor

type ConfigToolPluginOptionDescriptor struct {
	Key                 string      `json:"key"`
	Type                string      `json:"type,omitempty"`
	ElementType         string      `json:"elementType,omitempty"`
	DefaultValue        interface{} `json:"defaultValue,omitempty"`
	Description         string      `json:"description,omitempty"`
	FallbackKeys        []string    `json:"fallbackKeys,omitempty"`
	EnumValues          []string    `json:"enumValues,omitempty"`
	EnumDisplayValues   []string    `json:"enumDisplayValues,omitempty"`
	RequiredMode        string      `json:"requiredMode,omitempty"`
	ConditionExpression string      `json:"conditionExpression,omitempty"`
	ConstraintGroup     string      `json:"constraintGroup,omitempty"`
	Origins             []string    `json:"origins,omitempty"`
	DeclaredClasses     []string    `json:"declaredClasses,omitempty"`
	Advanced            bool        `json:"advanced"`
}

ConfigToolPluginOptionDescriptor mirrors java-proxy plugin option descriptor.

type ConfigToolPluginOptionsRequest

type ConfigToolPluginOptionsRequest struct {
	PluginType        string   `json:"pluginType"`
	FactoryIdentifier string   `json:"factoryIdentifier"`
	PluginJars        []string `json:"pluginJars,omitempty"`
	IncludeSupplement bool     `json:"includeSupplement"`
}

ConfigToolPluginOptionsRequest represents plugin schema inspection input.

type ConfigToolPluginOptionsResponse

type ConfigToolPluginOptionsResponse struct {
	OK                bool                               `json:"ok"`
	PluginType        string                             `json:"pluginType"`
	FactoryIdentifier string                             `json:"factoryIdentifier"`
	Options           []ConfigToolPluginOptionDescriptor `json:"options"`
	ValueConstraints  []map[string]interface{}           `json:"valueConstraints,omitempty"`
	ConditionRules    []map[string]interface{}           `json:"conditionRules,omitempty"`
	Warnings          []string                           `json:"warnings"`
}

ConfigToolPluginOptionsResponse mirrors java-proxy plugin options response.

type ConfigToolPluginTemplateRequest

type ConfigToolPluginTemplateRequest struct {
	PluginType        string   `json:"pluginType"`
	FactoryIdentifier string   `json:"factoryIdentifier"`
	PluginJars        []string `json:"pluginJars,omitempty"`
	IncludeSupplement bool     `json:"includeSupplement"`
	IncludeComments   bool     `json:"includeComments"`
	IncludeAdvanced   bool     `json:"includeAdvanced"`
}

ConfigToolPluginTemplateRequest represents plugin template rendering input.

type ConfigToolPluginTemplateResponse

type ConfigToolPluginTemplateResponse struct {
	OK                bool     `json:"ok"`
	PluginType        string   `json:"pluginType"`
	FactoryIdentifier string   `json:"factoryIdentifier"`
	ContentFormat     string   `json:"contentFormat"`
	Template          string   `json:"template"`
	Warnings          []string `json:"warnings"`
}

ConfigToolPluginTemplateResponse mirrors java-proxy template response.

type ConfigToolPreviewRequest

type ConfigToolPreviewRequest struct {
	ConfigToolContentRequest
	SourceNodeID          string                 `json:"sourceNodeId,omitempty"`
	SourceIndex           *int                   `json:"sourceIndex,omitempty"`
	TransformNodeID       string                 `json:"transformNodeId,omitempty"`
	TransformIndex        *int                   `json:"transformIndex,omitempty"`
	PlatformJobID         string                 `json:"platformJobId,omitempty"`
	EngineJobID           string                 `json:"engineJobId,omitempty"`
	PreviewRowLimit       *int                   `json:"previewRowLimit,omitempty"`
	OutputFormat          string                 `json:"outputFormat,omitempty"`
	MetadataOutputDataset string                 `json:"metadataOutputDataset,omitempty"`
	MetadataFields        map[string]interface{} `json:"metadataFields,omitempty"`
	EnvOverrides          map[string]interface{} `json:"envOverrides,omitempty"`
	HttpSink              map[string]interface{} `json:"httpSink,omitempty"`
}

ConfigToolPreviewRequest represents preview derive request.

type ConfigToolPreviewResponse

type ConfigToolPreviewResponse struct {
	OK             bool                   `json:"ok"`
	Message        string                 `json:"message,omitempty"`
	Mode           string                 `json:"mode,omitempty"`
	SelectedNodeID string                 `json:"selectedNodeId,omitempty"`
	SelectedIndex  int                    `json:"selectedIndex,omitempty"`
	Warnings       []string               `json:"warnings"`
	Content        string                 `json:"content,omitempty"`
	ContentFormat  string                 `json:"contentFormat,omitempty"`
	Config         map[string]interface{} `json:"config,omitempty"`
	Graph          ConfigToolGraph        `json:"graph"`
	SimpleGraph    bool                   `json:"simpleGraph"`
}

ConfigToolPreviewResponse mirrors java-proxy preview response.

type ConfigToolResolver

type ConfigToolResolver interface {
	ResolveConfigToolEndpoint(ctx context.Context, clusterID uint, taskDefinition JSONMap) (string, error)
}

ConfigToolResolver resolves java-proxy endpoint for a sync task.

type ConfigToolSinkSaveModePreviewAction

type ConfigToolSinkSaveModePreviewAction struct {
	Phase      string `json:"phase,omitempty"`
	ActionType string `json:"actionType,omitempty"`
	ResultType string `json:"resultType,omitempty"`
	Content    string `json:"content,omitempty"`
	Native     bool   `json:"native"`
}

ConfigToolSinkSaveModePreviewAction mirrors one java-proxy save mode preview action.

type ConfigToolSinkSaveModePreviewRequest

type ConfigToolSinkSaveModePreviewRequest struct {
	ConfigToolContentRequest
	SinkIndex          *int     `json:"sinkIndex,omitempty"`
	SinkNodeID         string   `json:"sinkNodeId,omitempty"`
	PluginJars         []string `json:"pluginJars,omitempty"`
	IncludeInfoPreview bool     `json:"includeInfoPreview"`
}

ConfigToolSinkSaveModePreviewRequest represents sink save mode preview input.

type ConfigToolSinkSaveModePreviewResponse

type ConfigToolSinkSaveModePreviewResponse struct {
	OK             bool                                  `json:"ok"`
	Connector      string                                `json:"connector,omitempty"`
	SinkIndex      int                                   `json:"sinkIndex,omitempty"`
	Supported      bool                                  `json:"supported"`
	Completeness   string                                `json:"completeness,omitempty"`
	SchemaSaveMode string                                `json:"schemaSaveMode,omitempty"`
	DataSaveMode   string                                `json:"dataSaveMode,omitempty"`
	TablePath      string                                `json:"tablePath,omitempty"`
	Actions        []ConfigToolSinkSaveModePreviewAction `json:"actions,omitempty"`
	Tables         []ConfigToolSinkSaveModePreviewTable  `json:"tables,omitempty"`
	Warnings       []string                              `json:"warnings,omitempty"`
}

ConfigToolSinkSaveModePreviewResponse mirrors java-proxy save mode preview response.

type ConfigToolSinkSaveModePreviewTable

type ConfigToolSinkSaveModePreviewTable struct {
	TablePath      string                                `json:"tablePath,omitempty"`
	Supported      bool                                  `json:"supported"`
	Completeness   string                                `json:"completeness,omitempty"`
	SchemaSaveMode string                                `json:"schemaSaveMode,omitempty"`
	DataSaveMode   string                                `json:"dataSaveMode,omitempty"`
	Actions        []ConfigToolSinkSaveModePreviewAction `json:"actions,omitempty"`
	Warnings       []string                              `json:"warnings,omitempty"`
}

ConfigToolSinkSaveModePreviewTable mirrors per-table preview details.

type ConfigToolValidateRequest

type ConfigToolValidateRequest struct {
	ConfigToolContentRequest
	TestConnection bool `json:"testConnection"`
}

ConfigToolValidateRequest represents config validation / connection test input.

type ConfigToolValidateResponse

type ConfigToolValidateResponse struct {
	OK       bool                        `json:"ok"`
	Valid    bool                        `json:"valid"`
	Summary  string                      `json:"summary"`
	Errors   []string                    `json:"errors"`
	Warnings []string                    `json:"warnings"`
	Checks   []ConfigToolValidationCheck `json:"checks"`
}

ConfigToolValidateResponse mirrors java-proxy config validation response.

type ConfigToolValidationCheck

type ConfigToolValidationCheck struct {
	NodeID        string `json:"nodeId"`
	Kind          string `json:"kind"`
	ConnectorType string `json:"connectorType"`
	Target        string `json:"target"`
	Status        string `json:"status"`
	Message       string `json:"message"`
}

ConfigToolValidationCheck represents one connector validation result.

type ConfigToolWebUIDAGEdge

type ConfigToolWebUIDAGEdge struct {
	InputVertexID  int `json:"inputVertexId"`
	TargetVertexID int `json:"targetVertexId"`
}

ConfigToolWebUIDAGEdge mirrors webui edge payload from java-proxy.

type ConfigToolWebUIDAGResponse

type ConfigToolWebUIDAGResponse struct {
	JobID          string                 `json:"jobId"`
	JobName        string                 `json:"jobName"`
	JobStatus      string                 `json:"jobStatus"`
	ErrorMsg       string                 `json:"errorMsg"`
	CreateTime     string                 `json:"createTime"`
	FinishTime     string                 `json:"finishTime"`
	JobDag         ConfigToolWebUIJobDAG  `json:"jobDag"`
	Metrics        map[string]interface{} `json:"metrics"`
	PluginJarsUrls []string               `json:"pluginJarsUrls"`
	SimpleGraph    bool                   `json:"simpleGraph"`
	Warnings       []string               `json:"warnings"`
}

ConfigToolWebUIDAGResponse mirrors java-proxy webui dag preview response.

type ConfigToolWebUIDAGVertexInfo

type ConfigToolWebUIDAGVertexInfo struct {
	VertexID         int                                           `json:"vertexId"`
	Type             string                                        `json:"type"`
	ConnectorType    string                                        `json:"connectorType"`
	TablePaths       []string                                      `json:"tablePaths"`
	TableColumns     map[string][]string                           `json:"tableColumns"`
	TableSchemas     map[string]map[string]interface{}             `json:"tableSchemas"`
	SaveModePreviews map[string]ConfigToolSinkSaveModePreviewTable `json:"saveModePreviews,omitempty"`
	SaveModeWarnings []string                                      `json:"saveModeWarnings,omitempty"`
}

ConfigToolWebUIDAGVertexInfo mirrors webui vertex payload from java-proxy.

type ConfigToolWebUIJobDAG

type ConfigToolWebUIJobDAG struct {
	JobID         string                                  `json:"jobId"`
	PipelineEdges map[string][]ConfigToolWebUIDAGEdge     `json:"pipelineEdges"`
	VertexInfoMap map[string]ConfigToolWebUIDAGVertexInfo `json:"vertexInfoMap"`
	EnvOptions    map[string]interface{}                  `json:"envOptions"`
}

ConfigToolWebUIJobDAG mirrors webui compatible jobDag payload.

type ContentFormat

type ContentFormat string

ContentFormat represents the editor content format. ContentFormat 表示编辑器内容格式。

const (
	ContentFormatHOCON ContentFormat = "hocon"
	ContentFormatJSON  ContentFormat = "json"
)

type CreateCuratedTemplateRequest added in v1.0.0

type CreateCuratedTemplateRequest struct {
	Name        string   `json:"name" binding:"required"`
	Description string   `json:"description"`
	Section     string   `json:"section"`
	Mode        string   `json:"mode"`
	Pattern     string   `json:"pattern"`
	Connectors  []string `json:"connectors"`
	Content     string   `json:"content" binding:"required"`
	BuiltinID   string   `json:"builtin_id"`
}

CreateCuratedTemplateRequest creates one user curated template. CreateCuratedTemplateRequest 创建一条用户精选模板。

type CreateGlobalVariableRequest

type CreateGlobalVariableRequest struct {
	Key         string `json:"key" binding:"required"`
	Value       string `json:"value"`
	ValueType   string `json:"value_type"`
	Description string `json:"description"`
}

CreateGlobalVariableRequest represents one global variable payload. CreateGlobalVariableRequest 表示创建全局变量请求体。

type CreateTaskRequest

type CreateTaskRequest struct {
	ParentID      *uint   `json:"parent_id"`
	NodeType      string  `json:"node_type"`
	Name          string  `json:"name" binding:"required"`
	Description   string  `json:"description"`
	ClusterID     uint    `json:"cluster_id"`
	EngineVersion string  `json:"engine_version"`
	Mode          string  `json:"mode"`
	ContentFormat string  `json:"content_format"`
	Content       string  `json:"content"`
	JobName       string  `json:"job_name"`
	SortOrder     int     `json:"sort_order"`
	Definition    JSONMap `json:"definition"`
}

CreateTaskRequest represents the payload for creating a sync workspace node.

type CuratedComboParseData added in v1.0.0

type CuratedComboParseData struct {
	Env       string   `json:"env"`
	Source    string   `json:"source"`
	Transform string   `json:"transform"`
	Sink      string   `json:"sink"`
	Present   []string `json:"present"`
	Combined  string   `json:"combined"`
}

CuratedComboParseData is the four-section parse result. CuratedComboParseData 是四节解析结果。

type CuratedComboParseResponse added in v1.0.0

type CuratedComboParseResponse struct {
	ErrorMsg string                 `json:"error_msg"`
	Data     *CuratedComboParseData `json:"data"`
}

CuratedComboParseResponse is the HTTP parse envelope.

type CuratedTemplate added in v1.0.0

type CuratedTemplate struct {
	ID          uint            `json:"id" gorm:"primaryKey;autoIncrement"`
	BuiltinID   string          `json:"builtin_id" gorm:"size:120;index"`
	OwnerUserID uint            `json:"owner_user_id" gorm:"index;not null"`
	Name        string          `json:"name" gorm:"size:200;not null"`
	Description string          `json:"description" gorm:"type:text"`
	Section     string          `json:"section" gorm:"size:32;not null;index"`
	Mode        string          `json:"mode" gorm:"size:32;not null;default:'ANY'"`
	Pattern     string          `json:"pattern" gorm:"size:32;not null;default:'other'"`
	Connectors  JSONStringSlice `json:"connectors" gorm:"type:json"`
	// Content 精选模板脚本正文;MySQL 用 MEDIUMTEXT,PG/SQLite 用 TEXT。
	// Content is curated template script body; MySQL uses MEDIUMTEXT, PG/SQLite use TEXT.
	Content   db.ScriptText `json:"content" gorm:"not null"`
	Enabled   bool          `json:"enabled" gorm:"not null;default:true"`
	CreatedAt time.Time     `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time     `json:"updated_at" gorm:"autoUpdateTime"`
}

CuratedTemplate stores one user-owned or forked curated template row. CuratedTemplate 存储用户自建或从内置 fork 的精选模板行。

func (CuratedTemplate) TableName added in v1.0.0

func (CuratedTemplate) TableName() string

TableName returns the curated template table name. TableName 返回精选模板表名。

type CuratedTemplateListData added in v1.0.0

type CuratedTemplateListData struct {
	Items []*CuratedTemplateView `json:"items"`
	Total int                    `json:"total"`
}

CuratedTemplateListData wraps list payload. CuratedTemplateListData 包装列表载荷。

type CuratedTemplateListResponse added in v1.0.0

type CuratedTemplateListResponse struct {
	ErrorMsg string                   `json:"error_msg"`
	Data     *CuratedTemplateListData `json:"data"`
}

CuratedTemplateListResponse is the HTTP list envelope.

type CuratedTemplateResponse added in v1.0.0

type CuratedTemplateResponse struct {
	ErrorMsg string               `json:"error_msg"`
	Data     *CuratedTemplateView `json:"data"`
}

CuratedTemplateResponse is the HTTP item envelope.

type CuratedTemplateView added in v1.0.0

type CuratedTemplateView struct {
	ID          uint     `json:"id,omitempty"`
	BuiltinID   string   `json:"builtin_id,omitempty"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Section     string   `json:"section"`
	Mode        string   `json:"mode"`
	Pattern     string   `json:"pattern"`
	Connectors  []string `json:"connectors"`
	Content     string   `json:"content"`
	Enabled     bool     `json:"enabled"`
	Origin      string   `json:"origin"` // builtin|user|override
	HasOverride bool     `json:"has_override"`
	OwnerUserID uint     `json:"owner_user_id,omitempty"`
}

CuratedTemplateView is the API list/detail view for curated templates. CuratedTemplateView 是精选模板的列表/详情视图。

type DAGResponse

type DAGResponse struct {
	ErrorMsg string     `json:"error_msg"`
	Data     *DAGResult `json:"data"`
}

type DAGResult

type DAGResult struct {
	Nodes       []JSONMap `json:"nodes"`
	Edges       []JSONMap `json:"edges"`
	WebUIJob    JSONMap   `json:"webui_job,omitempty"`
	SimpleGraph bool      `json:"simple_graph,omitempty"`
	Warnings    []string  `json:"warnings,omitempty"`
}

DAGResult represents DAG response payload.

type DefaultClusterRuntimeResolver

type DefaultClusterRuntimeResolver struct {
	// contains filtered or unexported fields
}

DefaultClusterRuntimeResolver resolves engine endpoint via cluster and host records.

func NewDefaultClusterRuntimeResolver

func NewDefaultClusterRuntimeResolver(clusterRepo *clusterapp.Repository, hostRepo *hostapp.Repository) *DefaultClusterRuntimeResolver

NewDefaultClusterRuntimeResolver creates a runtime resolver.

func (*DefaultClusterRuntimeResolver) ResolveEngineEndpoint

func (r *DefaultClusterRuntimeResolver) ResolveEngineEndpoint(ctx context.Context, clusterID uint, taskDefinition JSONMap) (*EngineEndpoint, error)

ResolveEngineEndpoint resolves one endpoint from cluster metadata.

type DefaultConfigToolClient

type DefaultConfigToolClient struct {
	// contains filtered or unexported fields
}

DefaultConfigToolClient is the default java-proxy HTTP client.

func NewDefaultConfigToolClient

func NewDefaultConfigToolClient() *DefaultConfigToolClient

NewDefaultConfigToolClient creates a config tool client.

func (*DefaultConfigToolClient) DeriveSourcePreview

DeriveSourcePreview calls /api/v1/config/preview/source.

func (*DefaultConfigToolClient) DeriveTransformPreview

func (c *DefaultConfigToolClient) DeriveTransformPreview(ctx context.Context, endpoint string, req *ConfigToolPreviewRequest) (*ConfigToolPreviewResponse, error)

DeriveTransformPreview calls /api/v1/config/preview/transform.

func (*DefaultConfigToolClient) GetPluginOptions

GetPluginOptions calls /api/v1/plugin/options.

func (*DefaultConfigToolClient) InspectDAG

InspectDAG calls /api/v1/config/dag.

func (*DefaultConfigToolClient) InspectWebUIDAG

InspectWebUIDAG calls /api/v1/config/webui-dag.

func (*DefaultConfigToolClient) ListPluginEnumValues

ListPluginEnumValues calls /api/v1/plugin/enum-values.

func (*DefaultConfigToolClient) ListPlugins

ListPlugins calls /api/v1/plugin/list.

func (*DefaultConfigToolClient) PreviewSinkSaveMode

PreviewSinkSaveMode calls /api/v1/config/preview/sink-savemode.

func (*DefaultConfigToolClient) RenderPluginTemplate

RenderPluginTemplate calls /api/v1/plugin/template.

func (*DefaultConfigToolClient) ValidateConfig

ValidateConfig calls /api/v1/config/validate.

type DefaultConfigToolResolver

type DefaultConfigToolResolver struct {
	// contains filtered or unexported fields
}

DefaultConfigToolResolver resolves java-proxy endpoint using cluster managed status or task override.

func NewDefaultConfigToolResolver

func NewDefaultConfigToolResolver(clusterService *clusterapp.Service) *DefaultConfigToolResolver

NewDefaultConfigToolResolver creates a config tool resolver.

func (*DefaultConfigToolResolver) ResolveConfigToolEndpoint

func (r *DefaultConfigToolResolver) ResolveConfigToolEndpoint(ctx context.Context, clusterID uint, taskDefinition JSONMap) (string, error)

ResolveConfigToolEndpoint resolves java-proxy endpoint.

type DefaultExecutionTargetResolver

type DefaultExecutionTargetResolver struct {
	// contains filtered or unexported fields
}

func NewDefaultExecutionTargetResolver

func NewDefaultExecutionTargetResolver(clusterRepo *clusterapp.Repository, hostRepo *hostapp.Repository) *DefaultExecutionTargetResolver

func (*DefaultExecutionTargetResolver) ResolveExecutionTarget

func (r *DefaultExecutionTargetResolver) ResolveExecutionTarget(ctx context.Context, clusterID uint, definition JSONMap) (*ExecutionTarget, error)

func (*DefaultExecutionTargetResolver) ResolveExecutionTargets

func (r *DefaultExecutionTargetResolver) ResolveExecutionTargets(ctx context.Context, clusterID uint, definition JSONMap) ([]*ExecutionTarget, error)

type DolphinClient added in v1.2.0

type DolphinClient struct {
	// contains filtered or unexported fields
}

DolphinClient 按版本切换 process-definition / workflow-definition 路径访问 Dolphin API。 DolphinClient talks to DolphinScheduler and switches process/workflow paths by version.

func (*DolphinClient) CreateDefinition added in v1.2.0

func (c *DolphinClient) CreateDefinition(ctx context.Context, projectCode int64, graph *dolphinGraph) (*dolphinGraph, error)

func (*DolphinClient) CreateSchedule added in v1.2.0

func (c *DolphinClient) CreateSchedule(ctx context.Context, projectCode, workflowCode int64, crontab, timezone string) error

func (*DolphinClient) GenTaskCodes added in v1.2.0

func (c *DolphinClient) GenTaskCodes(ctx context.Context, projectCode int64, n int) ([]int64, error)

func (*DolphinClient) GetDefinition added in v1.2.0

func (c *DolphinClient) GetDefinition(ctx context.Context, projectCode, workflowCode int64) (*dolphinGraph, error)

func (*DolphinClient) ListProjects added in v1.2.0

func (c *DolphinClient) ListProjects(ctx context.Context) ([]DolphinProject, error)

func (*DolphinClient) ListWorkflows added in v1.2.0

func (c *DolphinClient) ListWorkflows(ctx context.Context, projectCode int64) ([]DolphinWorkflowSummary, error)

func (*DolphinClient) OnlineSchedules added in v1.2.0

func (c *DolphinClient) OnlineSchedules(ctx context.Context, projectCode, workflowCode int64) error

func (*DolphinClient) Release added in v1.2.0

func (c *DolphinClient) Release(ctx context.Context, projectCode, workflowCode int64, state string) error

func (*DolphinClient) ResolveEnvironmentCode added in v1.2.0

func (c *DolphinClient) ResolveEnvironmentCode(ctx context.Context, name string) (int64, error)

ResolveEnvironmentCode 按环境名查找 Dolphin environment code;找不到时返回 -1。 ResolveEnvironmentCode looks up a Dolphin environment code by name; missing names return -1.

func (*DolphinClient) UpdateDefinition added in v1.2.0

func (c *DolphinClient) UpdateDefinition(ctx context.Context, projectCode int64, graph *dolphinGraph) error

type DolphinProject added in v1.2.0

type DolphinProject struct {
	Code int64  `json:"code"`
	Name string `json:"name"`
}

DolphinProject 是连接上可选的 Dolphin 项目。 DolphinProject is a Dolphin project available on a connection.

type DolphinProjectListResponse added in v1.2.0

type DolphinProjectListResponse struct {
	ErrorMsg string           `json:"error_msg"`
	Data     []DolphinProject `json:"data"`
}

type DolphinPushRequest added in v1.2.0

type DolphinPushRequest struct {
	Mode               string  `json:"mode"`
	ConnectionID       uint    `json:"connection_id"`
	ProjectCode        int64   `json:"project_code"`
	WorkflowName       string  `json:"workflow_name"`
	WorkflowCode       int64   `json:"workflow_code"`
	Upstreams          []int64 `json:"upstreams"`
	Downstreams        []int64 `json:"downstreams"`
	UseBuiltinSchedule bool    `json:"use_builtin_schedule"`
	// Timeout 已忽略:生成脚本不再写入 --timeout,保留字段只为兼容旧请求体。
	// Timeout is ignored: generated scripts omit --timeout; kept only for old request bodies.
	Timeout         string            `json:"timeout"`
	Variables       map[string]string `json:"variables"`
	WorkerGroup     string            `json:"worker_group"`
	Environment     string            `json:"environment"`
	DryRun          bool              `json:"dry_run"`
	ExpectedVersion int               `json:"expected_version"`
}

DolphinPushRequest 描述一次推送到 Dolphin 的请求。 DolphinPushRequest describes one push into DolphinScheduler.

type DolphinPushResponse added in v1.2.0

type DolphinPushResponse struct {
	ErrorMsg string             `json:"error_msg"`
	Data     *DolphinPushResult `json:"data"`
}

type DolphinPushResult added in v1.2.0

type DolphinPushResult struct {
	DryRun       bool                  `json:"dry_run"`
	Mode         string                `json:"mode"`
	Script       *DolphinScriptResult  `json:"script,omitempty"`
	Binding      *TaskSchedulerBinding `json:"binding,omitempty"`
	WorkflowCode int64                 `json:"workflow_code,omitempty"`
	TaskCode     int64                 `json:"task_code,omitempty"`
	Version      int                   `json:"version,omitempty"`
	ReleaseState string                `json:"release_state,omitempty"`
	WouldOffline bool                  `json:"would_offline,omitempty"`
	Cycle        bool                  `json:"cycle"`
	Message      string                `json:"message,omitempty"`
	Warning      string                `json:"warning,omitempty"`
}

DolphinPushResult 返回推送预览或实际写入结果。 DolphinPushResult returns a dry-run preview or the written binding.

type DolphinScriptResponse added in v1.2.0

type DolphinScriptResponse struct {
	ErrorMsg string               `json:"error_msg"`
	Data     *DolphinScriptResult `json:"data"`
}

type DolphinScriptResult added in v1.2.0

type DolphinScriptResult struct {
	Script      string            `json:"script"`
	EnvNotes    string            `json:"env_notes"`
	Timeout     string            `json:"timeout,omitempty"`
	WorkerGroup string            `json:"worker_group"`
	Environment string            `json:"environment"`
	Variables   map[string]string `json:"variables,omitempty"`
}

DolphinScriptResult 是给 Dolphin SHELL 节点使用的脚本和环境说明。 DolphinScriptResult is the SHELL script and environment notes for a Dolphin node.

func BuildDolphinShellScript added in v1.2.0

func BuildDolphinShellScript(task *Task, variables map[string]string, workerGroup, environment string) *DolphinScriptResult

BuildDolphinShellScript 生成 SHELL 节点脚本;没有覆盖变量时不追加 --var,也不写入 --timeout。 BuildDolphinShellScript builds the SHELL node script, omits --var without overrides, and never writes --timeout.

type DolphinTaskStatus added in v1.2.0

type DolphinTaskStatus struct {
	Binding       *TaskSchedulerBinding `json:"binding"`
	Connection    *SchedulerConnection  `json:"connection,omitempty"`
	Script        *DolphinScriptResult  `json:"script,omitempty"`
	RecentJobs    []*JobInstance        `json:"recent_jobs"`
	BuiltinLocked bool                  `json:"builtin_locked"`
	// PublishedVersion 是任务当前已发布版本;PushedVersion 是上次推到 Dolphin 的版本。
	// PublishedVersion is the task's current published version; PushedVersion is the last version pushed to Dolphin.
	PublishedVersion int `json:"published_version"`
	PushedVersion    int `json:"pushed_version"`
}

DolphinTaskStatus 是任务侧边栏需要的绑定、脚本和最近作业摘要。 DolphinTaskStatus is the sidebar summary of binding, script, and recent Dolphin-triggered jobs.

type DolphinTaskStatusResponse added in v1.2.0

type DolphinTaskStatusResponse struct {
	ErrorMsg string             `json:"error_msg"`
	Data     *DolphinTaskStatus `json:"data"`
}

type DolphinWorkflowDetail added in v1.2.0

type DolphinWorkflowDetail struct {
	Code         int64                     `json:"code"`
	Name         string                    `json:"name"`
	Version      int                       `json:"version"`
	ReleaseState string                    `json:"release_state"`
	Tasks        []DolphinWorkflowTask     `json:"tasks"`
	Relations    []DolphinWorkflowRelation `json:"relations"`
}

DolphinWorkflowDetail 供复用工作流时展示节点列表、连线和当前版本。 DolphinWorkflowDetail is the workflow snapshot used when reusing a graph.

type DolphinWorkflowDetailResponse added in v1.2.0

type DolphinWorkflowDetailResponse struct {
	ErrorMsg string                 `json:"error_msg"`
	Data     *DolphinWorkflowDetail `json:"data"`
}

type DolphinWorkflowListResponse added in v1.2.0

type DolphinWorkflowListResponse struct {
	ErrorMsg string                   `json:"error_msg"`
	Data     []DolphinWorkflowSummary `json:"data"`
}

type DolphinWorkflowRelation added in v1.2.0

type DolphinWorkflowRelation struct {
	PreTaskCode  int64 `json:"pre_task_code"`
	PostTaskCode int64 `json:"post_task_code"`
}

DolphinWorkflowRelation 是工作流里的一条有向边,供前端成环预检。 DolphinWorkflowRelation is one directed edge used by the frontend cycle preview.

type DolphinWorkflowSummary added in v1.2.0

type DolphinWorkflowSummary struct {
	Code         int64  `json:"code"`
	Name         string `json:"name"`
	ReleaseState string `json:"release_state"`
	Version      int    `json:"version"`
}

DolphinWorkflowSummary 是复用工作流时的候选列表项。 DolphinWorkflowSummary is one reusable workflow candidate.

type DolphinWorkflowTask added in v1.2.0

type DolphinWorkflowTask struct {
	Code      int64  `json:"code"`
	Name      string `json:"name"`
	TaskType  string `json:"task_type"`
	RawScript string `json:"raw_script,omitempty"`
}

DolphinWorkflowTask 是上下游勾选项,可选带回当前 SHELL 脚本供 Diff。 DolphinWorkflowTask is one upstream/downstream checkbox candidate and may include the current SHELL script for diffs.

type EngineCheckpoint

type EngineCheckpoint struct {
	CheckpointID       int64  `json:"checkpointId"`
	CheckpointType     string `json:"checkpointType"`
	Status             string `json:"status"`
	TriggerTimestamp   int64  `json:"triggerTimestamp"`
	CompletedTimestamp int64  `json:"completedTimestamp,omitempty"`
	DurationMillis     int64  `json:"durationMillis,omitempty"`
	StateSize          int64  `json:"stateSize,omitempty"`
	FailureReason      string `json:"failureReason,omitempty"`
}

EngineCheckpoint describes one checkpoint metadata record.

type EngineCheckpointInProgress

type EngineCheckpointInProgress struct {
	CheckpointID     int64  `json:"checkpointId"`
	CheckpointType   string `json:"checkpointType"`
	TriggerTimestamp int64  `json:"triggerTimestamp"`
	Acknowledged     int64  `json:"acknowledged"`
	Total            int64  `json:"total"`
}

EngineCheckpointInProgress describes one running checkpoint progress row.

type EngineCheckpointOverview

type EngineCheckpointOverview struct {
	JobID     string                      `json:"jobId"`
	UpdatedAt int64                       `json:"updatedAt"`
	Pipelines []*EngineCheckpointPipeline `json:"pipelines"`
}

EngineCheckpointOverview describes one checkpoint overview payload from the engine.

type EngineCheckpointPipeline

type EngineCheckpointPipeline struct {
	PipelineID      int                           `json:"pipelineId"`
	Counts          map[string]int64              `json:"counts"`
	LatestCompleted *EngineCheckpoint             `json:"latestCompleted,omitempty"`
	LatestFailed    *EngineCheckpoint             `json:"latestFailed,omitempty"`
	LatestSavepoint *EngineCheckpoint             `json:"latestSavepoint,omitempty"`
	InProgress      []*EngineCheckpointInProgress `json:"inProgress,omitempty"`
	History         []*EngineCheckpointRecord     `json:"history,omitempty"`
}

EngineCheckpointPipeline describes one pipeline checkpoint summary.

type EngineCheckpointRecord

type EngineCheckpointRecord struct {
	PipelineID int               `json:"pipelineId"`
	Checkpoint *EngineCheckpoint `json:"checkpoint"`
}

EngineCheckpointRecord describes one checkpoint history row.

type EngineClient

type EngineClient interface {
	Submit(ctx context.Context, req *EngineSubmitRequest) (*EngineSubmitResponse, error)
	GetJobInfo(ctx context.Context, endpoint *EngineEndpoint, jobID string) (*EngineJobInfo, error)
	ListRunningJobs(ctx context.Context, endpoint *EngineEndpoint) ([]*EngineJobListItem, error)
	ListFinishedJobs(ctx context.Context, endpoint *EngineEndpoint, state string) ([]*EngineJobListItem, error)
	GetJobCheckpointOverview(ctx context.Context, endpoint *EngineEndpoint, jobID string) (*EngineCheckpointOverview, error)
	GetJobCheckpointHistory(ctx context.Context, endpoint *EngineEndpoint, jobID string, pipelineID *int, limit int, status string) ([]*EngineCheckpointRecord, error)
	StopJob(ctx context.Context, endpoint *EngineEndpoint, jobID string, stopWithSavepoint bool) error
	GetJobLogs(ctx context.Context, endpoint *EngineEndpoint, jobID string) (string, error)
}

EngineClient submits and manages jobs on SeaTunnel Engine REST API V2.

type EngineEndpoint

type EngineEndpoint struct {
	BaseURL     string
	ContextPath string
	LegacyURL   string
	APIMode     string
}

EngineEndpoint describes one SeaTunnel REST endpoint.

type EngineJobInfo

type EngineJobInfo struct {
	JobID        string                 `json:"jobId"`
	JobName      string                 `json:"jobName"`
	JobStatus    string                 `json:"jobStatus"`
	CreateTime   string                 `json:"createTime"`
	FinishedTime string                 `json:"finishTime"`
	ErrorMsg     interface{}            `json:"errorMsg"`
	JobDag       map[string]interface{} `json:"jobDag"`
	Metrics      map[string]interface{} `json:"metrics"`
}

EngineJobInfo describes job-info response subset used by sync studio.

type EngineJobListItem added in v1.2.0

type EngineJobListItem struct {
	JobID        string      `json:"jobId"`
	JobName      string      `json:"jobName"`
	JobStatus    string      `json:"jobStatus"`
	CreateTime   string      `json:"createTime"`
	FinishedTime string      `json:"finishTime"`
	ErrorMsg     interface{} `json:"errorMsg"`
}

EngineJobListItem 是 running/finished 列表接口返回的单条作业摘要。 EngineJobListItem is one job row from running/finished list APIs.

type EngineSubmitRequest

type EngineSubmitRequest struct {
	Endpoint           *EngineEndpoint
	Format             string
	JobID              string
	JobName            string
	StartWithSavepoint bool
	Body               []byte
}

EngineSubmitRequest describes one submit request.

type EngineSubmitResponse

type EngineSubmitResponse struct {
	JobID           string `json:"jobId"`
	JobName         string `json:"jobName"`
	APIMode         string `json:"apiMode,omitempty"`
	EndpointBaseURL string `json:"endpointBaseUrl,omitempty"`
	EngineURL       string `json:"engineUrl,omitempty"`
	EngineMethod    string `json:"engineMethod,omitempty"`
}

EngineSubmitResponse describes submit response payload.

type ExecutionRequest

type ExecutionRequest struct {
	RequestID      string
	IdempotencyKey string
	RequestHash    string
	ClientType     string
}

ExecutionRequest 保存一次同步写操作的非敏感请求元数据。 ExecutionRequest stores non-sensitive request metadata for one sync write operation.

type ExecutionTarget

type ExecutionTarget struct {
	ClusterID     uint
	NodeID        uint
	HostID        uint
	AgentID       string
	InstallDir    string
	Role          string
	HostIP        string
	APIPort       int
	HazelcastPort int
}

type ExecutionTargetResolver

type ExecutionTargetResolver interface {
	ResolveExecutionTarget(ctx context.Context, clusterID uint, definition JSONMap) (*ExecutionTarget, error)
	ResolveExecutionTargets(ctx context.Context, clusterID uint, definition JSONMap) ([]*ExecutionTarget, error)
}

type ForkCuratedTemplateRequest added in v1.0.0

type ForkCuratedTemplateRequest struct {
	BuiltinID   string `json:"builtin_id" binding:"required"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

ForkCuratedTemplateRequest forks a built-in curated template. ForkCuratedTemplateRequest 从内置精选 fork 用户副本。

type GetSyncPluginOptionsRequest

type GetSyncPluginOptionsRequest struct {
	ClusterID         uint   `json:"cluster_id" binding:"required"`
	PluginType        string `json:"plugin_type" binding:"required"`
	FactoryIdentifier string `json:"factory_identifier" binding:"required"`
	IncludeSupplement *bool  `json:"include_supplement,omitempty"`
}

type GlobalVariable

type GlobalVariable struct {
	ID          uint      `json:"id" gorm:"primaryKey;autoIncrement"`
	Key         string    `json:"key" gorm:"size:120;not null;uniqueIndex"`
	Value       string    `json:"value" gorm:"type:text"`
	ValueType   string    `json:"value_type" gorm:"size:32;not null;default:'string'"`
	Description string    `json:"description" gorm:"type:text"`
	CreatedBy   uint      `json:"created_by"`
	CreatedAt   time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

GlobalVariable represents one workspace-wide runtime variable. GlobalVariable 表示一个工作台级别的全局运行时变量。

func (*GlobalVariable) MaskSecret

func (v *GlobalVariable) MaskSecret() *GlobalVariable

MaskSecret returns a safe copy with value masked to "******" if it is a secret variable. MaskSecret 若为敏感机密变量,返回变量值脱敏为 "******" 的安全副本。

func (GlobalVariable) TableName

func (GlobalVariable) TableName() string

TableName returns the sync global variable table name. TableName 返回同步全局变量表名。

type GlobalVariableListData

type GlobalVariableListData struct {
	Total int64             `json:"total"`
	Items []*GlobalVariable `json:"items"`
}

GlobalVariableListData represents paginated global variables.

type GlobalVariableListResponse

type GlobalVariableListResponse struct {
	ErrorMsg string                  `json:"error_msg"`
	Data     *GlobalVariableListData `json:"data"`
}

type GlobalVariableResponse

type GlobalVariableResponse struct {
	ErrorMsg string          `json:"error_msg"`
	Data     *GlobalVariable `json:"data"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler 提供数据同步工作台 HTTP 处理器。 Handler provides HTTP handlers for sync studio APIs.

func NewHandler

func NewHandler(service *Service) *Handler

NewHandler creates a new sync handler.

func (*Handler) CancelJob

func (h *Handler) CancelJob(c *gin.Context)

CancelJob handles POST /api/v1/sync/jobs/:id/cancel.

func (*Handler) CancelJobByRef added in v1.2.0

func (h *Handler) CancelJobByRef(c *gin.Context)

CancelJobByRef 处理 POST /api/v1/sync/jobs/cancel-by-ref。 CancelJobByRef handles POST /api/v1/sync/jobs/cancel-by-ref. @Summary 按外部调度引用停止作业 @Tags Sync @Accept json @Produce json @Param request body CancelByRefRequest true "外部引用与接管序号" @Success 200 {object} JobResponse @Failure 400 {object} JobResponse @Failure 409 {object} JobResponse @Router /api/v1/sync/jobs/cancel-by-ref [post]

func (*Handler) CollectPreview

func (h *Handler) CollectPreview(c *gin.Context)

CollectPreview handles POST /api/v1/sync/preview/collect.

func (*Handler) CreateCuratedTemplate added in v1.0.0

func (h *Handler) CreateCuratedTemplate(c *gin.Context)

CreateCuratedTemplate handles POST /api/v1/sync/curated-templates. CreateCuratedTemplate 处理创建精选模板。

func (*Handler) CreateGlobalVariable

func (h *Handler) CreateGlobalVariable(c *gin.Context)

CreateGlobalVariable 处理 POST /api/v1/sync/global-variables。 CreateGlobalVariable handles POST /api/v1/sync/global-variables.

func (*Handler) CreateSchedulerConnection added in v1.2.0

func (h *Handler) CreateSchedulerConnection(c *gin.Context)

CreateSchedulerConnection 处理 POST /api/v1/sync/scheduler-connections。 CreateSchedulerConnection handles POST /api/v1/sync/scheduler-connections. @Summary 创建调度器连接 @Tags Sync @Accept json @Produce json @Param request body SchedulerConnectionRequest true "连接信息" @Success 200 {object} SchedulerConnectionResponse @Failure 400 {object} SchedulerConnectionResponse @Router /api/v1/sync/scheduler-connections [post]

func (*Handler) CreateTask

func (h *Handler) CreateTask(c *gin.Context)

CreateTask handles POST /api/v1/sync/tasks.

func (*Handler) DeleteCuratedTemplate added in v1.0.0

func (h *Handler) DeleteCuratedTemplate(c *gin.Context)

DeleteCuratedTemplate handles DELETE /api/v1/sync/curated-templates/:id. DeleteCuratedTemplate 处理删除精选模板。

func (*Handler) DeleteGlobalVariable

func (h *Handler) DeleteGlobalVariable(c *gin.Context)

DeleteGlobalVariable handles DELETE /api/v1/sync/global-variables/:id.

func (*Handler) DeleteTask

func (h *Handler) DeleteTask(c *gin.Context)

DeleteTask handles DELETE /api/v1/sync/tasks/:id.

func (*Handler) DeleteTaskVersion

func (h *Handler) DeleteTaskVersion(c *gin.Context)

DeleteTaskVersion handles DELETE /api/v1/sync/tasks/:id/versions/:versionId.

func (*Handler) ForkCuratedTemplate added in v1.0.0

func (h *Handler) ForkCuratedTemplate(c *gin.Context)

ForkCuratedTemplate handles POST /api/v1/sync/curated-templates/fork. ForkCuratedTemplate 处理 fork 内置精选。

func (*Handler) GetDolphinScript added in v1.2.0

func (h *Handler) GetDolphinScript(c *gin.Context)

GetDolphinScript 处理 GET /api/v1/sync/tasks/:id/dolphin/script。 GetDolphinScript handles GET /api/v1/sync/tasks/:id/dolphin/script. @Summary 生成 Dolphin SHELL 节点脚本 @Tags Sync @Produce json @Param id path int true "任务 ID" @Param worker_group query string false "Dolphin worker group" @Param environment query string false "Dolphin worker environment" @Success 200 {object} DolphinScriptResponse @Failure 400 {object} DolphinScriptResponse @Router /api/v1/sync/tasks/{id}/dolphin/script [get]

func (*Handler) GetDolphinTaskStatus added in v1.2.0

func (h *Handler) GetDolphinTaskStatus(c *gin.Context)

GetDolphinTaskStatus 处理 GET /api/v1/sync/tasks/:id/dolphin。 GetDolphinTaskStatus handles GET /api/v1/sync/tasks/:id/dolphin. @Summary 获取任务的 Dolphin 绑定状态 @Tags Sync @Produce json @Param id path int true "任务 ID" @Success 200 {object} DolphinTaskStatusResponse @Failure 400 {object} DolphinTaskStatusResponse @Failure 404 {object} DolphinTaskStatusResponse @Router /api/v1/sync/tasks/{id}/dolphin [get]

func (*Handler) GetDolphinWorkflow added in v1.2.0

func (h *Handler) GetDolphinWorkflow(c *gin.Context)

GetDolphinWorkflow 处理 GET /api/v1/sync/scheduler-connections/:id/projects/:projectCode/workflows/:workflowCode。 GetDolphinWorkflow handles GET /api/v1/sync/scheduler-connections/:id/projects/:projectCode/workflows/:workflowCode. @Summary 读取 Dolphin 工作流定义 @Tags Sync @Produce json @Param id path int true "连接 ID" @Param projectCode path int true "项目 code" @Param workflowCode path int true "工作流 code" @Success 200 {object} DolphinWorkflowDetailResponse @Failure 400 {object} DolphinWorkflowDetailResponse @Router /api/v1/sync/scheduler-connections/{id}/projects/{projectCode}/workflows/{workflowCode} [get]

func (*Handler) GetJob

func (h *Handler) GetJob(c *gin.Context)

GetJob handles GET /api/v1/sync/jobs/:id.

func (*Handler) GetJobCheckpointSnapshot

func (h *Handler) GetJobCheckpointSnapshot(c *gin.Context)

GetJobCheckpointSnapshot handles GET /api/v1/sync/jobs/:id/checkpoint.

func (*Handler) GetJobLogs

func (h *Handler) GetJobLogs(c *gin.Context)

GetJobLogs handles GET /api/v1/sync/jobs/:id/logs.

func (*Handler) GetPluginOptions

func (h *Handler) GetPluginOptions(c *gin.Context)

GetPluginOptions handles POST /api/v1/sync/plugins/options.

func (*Handler) GetPreviewSnapshot

func (h *Handler) GetPreviewSnapshot(c *gin.Context)

GetPreviewSnapshot handles GET /api/v1/sync/jobs/:id/preview.

func (*Handler) GetTask

func (h *Handler) GetTask(c *gin.Context)

GetTask handles GET /api/v1/sync/tasks/:id.

func (*Handler) GetTaskDAG

func (h *Handler) GetTaskDAG(c *gin.Context)

GetTaskDAG handles POST /api/v1/sync/tasks/:id/dag.

func (*Handler) GetTaskPermissions added in v1.0.0

func (h *Handler) GetTaskPermissions(c *gin.Context)

GetTaskPermissions 处理 GET /api/v1/sync/tasks/:id/permissions。 GetTaskPermissions handles GET /api/v1/sync/tasks/:id/permissions. @Summary 获取同步任务共享权限 @Tags Sync @Produce json @Param id path int true "任务 ID" @Success 200 {object} TaskPermissionsResponse @Failure 400 {object} TaskPermissionsResponse @Failure 403 {object} TaskPermissionsResponse @Failure 404 {object} TaskPermissionsResponse @Router /api/v1/sync/tasks/{id}/permissions [get]

func (*Handler) GetTaskTree

func (h *Handler) GetTaskTree(c *gin.Context)

GetTaskTree handles GET /api/v1/sync/tree.

func (*Handler) ListCuratedTemplates added in v1.0.0

func (h *Handler) ListCuratedTemplates(c *gin.Context)

ListCuratedTemplates handles POST /api/v1/sync/curated-templates/list. ListCuratedTemplates 处理精选模板列表。

func (*Handler) ListDolphinProjects added in v1.2.0

func (h *Handler) ListDolphinProjects(c *gin.Context)

ListDolphinProjects 处理 GET /api/v1/sync/scheduler-connections/:id/projects。 ListDolphinProjects handles GET /api/v1/sync/scheduler-connections/:id/projects. @Summary 列出 Dolphin 项目 @Tags Sync @Produce json @Param id path int true "连接 ID" @Success 200 {object} DolphinProjectListResponse @Failure 400 {object} DolphinProjectListResponse @Router /api/v1/sync/scheduler-connections/{id}/projects [get]

func (*Handler) ListDolphinWorkflows added in v1.2.0

func (h *Handler) ListDolphinWorkflows(c *gin.Context)

ListDolphinWorkflows 处理 GET /api/v1/sync/scheduler-connections/:id/projects/:projectCode/workflows。 ListDolphinWorkflows handles GET /api/v1/sync/scheduler-connections/:id/projects/:projectCode/workflows. @Summary 列出 Dolphin 工作流 @Tags Sync @Produce json @Param id path int true "连接 ID" @Param projectCode path int true "项目 code" @Success 200 {object} DolphinWorkflowListResponse @Failure 400 {object} DolphinWorkflowListResponse @Router /api/v1/sync/scheduler-connections/{id}/projects/{projectCode}/workflows [get]

func (*Handler) ListGlobalVariables

func (h *Handler) ListGlobalVariables(c *gin.Context)

ListGlobalVariables handles GET /api/v1/sync/global-variables.

func (*Handler) ListJobs

func (h *Handler) ListJobs(c *gin.Context)

ListJobs handles GET /api/v1/sync/jobs.

func (*Handler) ListPluginEnumCatalog

func (h *Handler) ListPluginEnumCatalog(c *gin.Context)

ListPluginEnumCatalog handles POST /api/v1/sync/plugins/enum-catalog.

func (*Handler) ListPluginEnumValues

func (h *Handler) ListPluginEnumValues(c *gin.Context)

ListPluginEnumValues handles POST /api/v1/sync/plugins/enum-values.

func (*Handler) ListPluginFactories

func (h *Handler) ListPluginFactories(c *gin.Context)

ListPluginFactories handles POST /api/v1/sync/plugins/list.

func (*Handler) ListSchedulerConnections added in v1.2.0

func (h *Handler) ListSchedulerConnections(c *gin.Context)

ListSchedulerConnections 处理 GET /api/v1/sync/scheduler-connections。 ListSchedulerConnections handles GET /api/v1/sync/scheduler-connections. @Summary 列出调度器连接 @Tags Sync @Produce json @Success 200 {object} SchedulerConnectionListResponse @Router /api/v1/sync/scheduler-connections [get]

func (*Handler) ListTaskVersions

func (h *Handler) ListTaskVersions(c *gin.Context)

ListTaskVersions handles GET /api/v1/sync/tasks/:id/versions.

func (*Handler) ListTasks

func (h *Handler) ListTasks(c *gin.Context)

ListTasks handles GET /api/v1/sync/tasks.

func (*Handler) ParseCuratedCombo added in v1.0.0

func (h *Handler) ParseCuratedCombo(c *gin.Context)

ParseCuratedCombo handles POST /api/v1/sync/curated-templates/parse-combo. ParseCuratedCombo 处理一键组合四节解析。

func (*Handler) PreviewSinkSaveMode

func (h *Handler) PreviewSinkSaveMode(c *gin.Context)

PreviewSinkSaveMode handles POST /api/v1/sync/tasks/:id/preview/sink-savemode.

func (*Handler) PreviewTask

func (h *Handler) PreviewTask(c *gin.Context)

PreviewTask handles POST /api/v1/sync/tasks/:id/preview.

func (*Handler) PublishTask

func (h *Handler) PublishTask(c *gin.Context)

PublishTask handles POST /api/v1/sync/tasks/:id/publish.

func (*Handler) PushDolphin added in v1.2.0

func (h *Handler) PushDolphin(c *gin.Context)

PushDolphin 处理 POST /api/v1/sync/tasks/:id/dolphin/push。 PushDolphin handles POST /api/v1/sync/tasks/:id/dolphin/push. @Summary 把同步任务推送到 DolphinScheduler @Tags Sync @Accept json @Produce json @Param id path int true "任务 ID" @Param request body DolphinPushRequest true "推送请求" @Success 200 {object} DolphinPushResponse @Failure 400 {object} DolphinPushResponse @Failure 409 {object} DolphinPushResponse @Router /api/v1/sync/tasks/{id}/dolphin/push [post]

func (*Handler) RecoverJob

func (h *Handler) RecoverJob(c *gin.Context)

RecoverJob handles POST /api/v1/sync/jobs/:id/recover.

func (*Handler) RenderCuratedTemplate added in v1.0.0

func (h *Handler) RenderCuratedTemplate(c *gin.Context)

RenderCuratedTemplate handles POST /api/v1/sync/curated-templates/render. RenderCuratedTemplate 按集群版本渲染可插入正文(含低版本 plugin IO 改写)。

func (*Handler) RenderPluginTemplate

func (h *Handler) RenderPluginTemplate(c *gin.Context)

RenderPluginTemplate handles POST /api/v1/sync/plugins/template.

func (*Handler) RollbackTaskVersion

func (h *Handler) RollbackTaskVersion(c *gin.Context)

RollbackTaskVersion handles POST /api/v1/sync/tasks/:id/versions/:versionId/rollback.

func (*Handler) SetAuditRepository added in v1.0.0

func (h *Handler) SetAuditRepository(repo *audit.Repository)

SetAuditRepository 配置工作台写操作使用的审计仓库。 SetAuditRepository configures the audit repository for sync writes.

func (*Handler) SubmitTask

func (h *Handler) SubmitTask(c *gin.Context)

SubmitTask handles POST /api/v1/sync/tasks/:id/submit.

func (*Handler) TestTaskConnections

func (h *Handler) TestTaskConnections(c *gin.Context)

TestTaskConnections handles POST /api/v1/sync/tasks/:id/test-connections.

func (*Handler) UnbindDolphin added in v1.2.0

func (h *Handler) UnbindDolphin(c *gin.Context)

UnbindDolphin 处理 POST /api/v1/sync/tasks/:id/dolphin/unbind。 UnbindDolphin handles POST /api/v1/sync/tasks/:id/dolphin/unbind. @Summary 解除任务与 Dolphin 的绑定 @Tags Sync @Produce json @Param id path int true "任务 ID" @Success 200 {object} BasicResponse @Failure 400 {object} BasicResponse @Router /api/v1/sync/tasks/{id}/dolphin/unbind [post]

func (*Handler) UpdateCuratedTemplate added in v1.0.0

func (h *Handler) UpdateCuratedTemplate(c *gin.Context)

UpdateCuratedTemplate handles PUT /api/v1/sync/curated-templates/:id. UpdateCuratedTemplate 处理更新精选模板。

func (*Handler) UpdateGlobalVariable

func (h *Handler) UpdateGlobalVariable(c *gin.Context)

UpdateGlobalVariable handles PUT /api/v1/sync/global-variables/:id.

func (*Handler) UpdateSchedulerConnection added in v1.2.0

func (h *Handler) UpdateSchedulerConnection(c *gin.Context)

UpdateSchedulerConnection 处理 PUT /api/v1/sync/scheduler-connections/:id。 UpdateSchedulerConnection handles PUT /api/v1/sync/scheduler-connections/:id. @Summary 更新调度器连接 @Tags Sync @Accept json @Produce json @Param id path int true "连接 ID" @Param request body SchedulerConnectionRequest true "连接信息,空 token 表示保留原值" @Success 200 {object} SchedulerConnectionResponse @Failure 400 {object} SchedulerConnectionResponse @Failure 404 {object} SchedulerConnectionResponse @Router /api/v1/sync/scheduler-connections/{id} [put]

func (*Handler) UpdateTask

func (h *Handler) UpdateTask(c *gin.Context)

UpdateTask handles PUT /api/v1/sync/tasks/:id.

func (*Handler) UpdateTaskPermissions added in v1.0.0

func (h *Handler) UpdateTaskPermissions(c *gin.Context)

UpdateTaskPermissions 处理 PUT /api/v1/sync/tasks/:id/permissions。 UpdateTaskPermissions handles PUT /api/v1/sync/tasks/:id/permissions. @Summary 更新同步任务共享权限 @Tags Sync @Accept json @Produce json @Param id path int true "任务 ID" @Param request body UpdateTaskPermissionsRequest true "共享权限请求" @Success 200 {object} TaskPermissionsResponse @Failure 400 {object} TaskPermissionsResponse @Failure 403 {object} TaskPermissionsResponse @Failure 404 {object} TaskPermissionsResponse @Router /api/v1/sync/tasks/{id}/permissions [put]

func (*Handler) ValidateTask

func (h *Handler) ValidateTask(c *gin.Context)

ValidateTask handles POST /api/v1/sync/tasks/:id/validate.

type JSONMap

type JSONMap map[string]interface{}

JSONMap represents JSON object payload stored in database. JSONMap 表示存储在数据库中的 JSON 对象载荷。

func (*JSONMap) Scan

func (m *JSONMap) Scan(value interface{}) error

Scan implements the sql.Scanner interface. Scan 实现 sql.Scanner 接口。

func (JSONMap) Value

func (m JSONMap) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Value 实现 driver.Valuer 接口。

type JSONStringSlice

type JSONStringSlice []string

JSONStringSlice represents one JSON-encoded string array. JSONStringSlice 表示一个 JSON 编码的字符串数组。

func (*JSONStringSlice) Scan

func (s *JSONStringSlice) Scan(value interface{}) error

Scan implements the sql.Scanner interface. Scan 实现 sql.Scanner 接口。

func (JSONStringSlice) Value

func (s JSONStringSlice) Value() (driver.Value, error)

Value implements the driver.Valuer interface. Value 实现 driver.Valuer 接口。

type JobFilter

type JobFilter struct {
	TaskID        uint
	RunType       RunType
	PlatformJobID string
	EngineJobID   string
	OwnerUserID   uint
	IncludeAll    bool
	Page          int
	Size          int
}

JobFilter represents job instance list query filters.

type JobIDGenerator

type JobIDGenerator struct {
	// contains filtered or unexported fields
}

JobIDGenerator generates platform-owned numeric job ids. JobIDGenerator 生成平台自管的纯数字作业 ID。

func NewJobIDGenerator

func NewJobIDGenerator() *JobIDGenerator

NewJobIDGenerator creates a numeric job id generator. NewJobIDGenerator 创建纯数字作业 ID 生成器。

func (*JobIDGenerator) NextJobID

func (g *JobIDGenerator) NextJobID() string

NextJobID returns a pure numeric job id string. NextJobID 返回纯数字字符串作业 ID。

type JobInstance

type JobInstance struct {
	ID                      uint      `json:"id" gorm:"primaryKey;autoIncrement"`
	ExecutionID             string    `json:"execution_id" gorm:"size:36;index"`
	TaskID                  uint      `json:"task_id" gorm:"index;not null"`
	TaskVersion             int       `json:"task_version" gorm:"not null"`
	RunType                 RunType   `json:"run_type" gorm:"size:20;not null;index"`
	PlatformJobID           string    `json:"platform_job_id" gorm:"size:32;index"`
	EngineJobID             string    `json:"engine_job_id" gorm:"size:255;index"`
	RecoveredFromInstanceID *uint     `json:"recovered_from_instance_id,omitempty" gorm:"index"`
	Status                  JobStatus `json:"status" gorm:"size:20;default:pending;index"`
	// LastSyncedAt 记录最近一次成功向 SeaTunnel 对齐状态的时间(UTC)。
	// LastSyncedAt is when STX last successfully synced runtime state from SeaTunnel (UTC).
	LastSyncedAt *time.Time `json:"last_synced_at,omitempty"`
	// SyncState 表示观察面新鲜度:ok / degraded / stale / unknown。
	// SyncState indicates observation freshness: ok / degraded / stale / unknown.
	SyncState JobSyncState `json:"sync_state" gorm:"size:20;default:unknown;index"`
	// SyncFailCount 连续问引擎失败次数,成功对齐后归零。
	// SyncFailCount counts consecutive engine sync failures; reset after a successful sync.
	SyncFailCount int `json:"sync_fail_count" gorm:"not null;default:0"`
	// SyncLagMs 由 API 根据 last_synced_at 派生,不落库。
	// SyncLagMs is derived from last_synced_at at read time and is not persisted.
	SyncLagMs int64 `json:"sync_lag_ms,omitempty" gorm:"-"`
	// Mode 从提交快照回填,供 CLI --wait 区分批任务和实时任务,不落库。
	// Mode is copied from the submit snapshot so CLI --wait can tell batch from streaming; it is not persisted.
	Mode          string     `json:"mode,omitempty" gorm:"-"`
	SubmitSpec    JSONMap    `json:"submit_spec" gorm:"type:json"`
	ResultPreview JSONMap    `json:"result_preview" gorm:"type:json"`
	ErrorMessage  string     `json:"error_message" gorm:"type:text"`
	StartedAt     *time.Time `json:"started_at"`
	FinishedAt    *time.Time `json:"finished_at"`
	CreatedBy     uint       `json:"created_by"`
	CreatedAt     time.Time  `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt     time.Time  `json:"updated_at" gorm:"autoUpdateTime"`
	// ExternalRef 记录外部调度器这次运行的引用,例如 ds:{工作流实例}:{节点 code}。
	// ExternalRef stores the external scheduler run identity such as ds:{workflowInstance}:{taskCode}.
	ExternalRef string `json:"external_ref,omitempty" gorm:"size:255;index"`
	// AttachGeneration 在同一 external_ref 被 CLI 接管时递增,用来忽略过期停止请求。
	// AttachGeneration increments when another CLI attaches to the same external_ref so stale cancel requests are ignored.
	AttachGeneration int `json:"attach_generation" gorm:"not null;default:0"`
}

JobInstance stores one preview/run/recover execution instance. JobInstance 存储一次预览/运行/恢复执行实例。

func (JobInstance) TableName

func (JobInstance) TableName() string

TableName returns the sync job instance table name. TableName 返回同步作业实例表名。

type JobListData

type JobListData struct {
	Total int64          `json:"total"`
	Items []*JobInstance `json:"items"`
}

JobListData represents job list response data.

type JobListResponse

type JobListResponse struct {
	ErrorMsg string       `json:"error_msg"`
	Data     *JobListData `json:"data"`
}

type JobLogsResponse

type JobLogsResponse struct {
	ErrorMsg string         `json:"error_msg"`
	Data     *JobLogsResult `json:"data"`
}

type JobLogsResult

type JobLogsResult struct {
	Mode   string `json:"mode"`
	Source string `json:"source"`
	Logs   string `json:"logs"`
	// MetricsLog 为基于 result_preview.metrics 的最新可读快照,不计入 offset。
	// MetricsLog is the latest human-readable metrics snapshot from result_preview; not covered by offset.
	MetricsLog        string `json:"metrics_log,omitempty"`
	EmptyReason       string `json:"empty_reason,omitempty"`
	ClusterJobLogMode string `json:"cluster_job_log_mode,omitempty"`
	ClusterID         uint   `json:"cluster_id,omitempty"`
	NextOffset        string `json:"next_offset,omitempty"`
	FileSize          int64  `json:"file_size,omitempty"`
	UpdatedAt         string `json:"updated_at"`
}

type JobResponse

type JobResponse struct {
	ErrorMsg string       `json:"error_msg"`
	Data     *JobInstance `json:"data"`
}

type JobStatus

type JobStatus string

JobStatus represents sync job instance status. JobStatus 表示同步作业实例状态。

const (
	JobStatusPending         JobStatus = "pending"
	JobStatusRunning         JobStatus = "running"
	JobStatusCancelRequested JobStatus = "cancel_requested"
	JobStatusCancelling      JobStatus = "cancelling"
	// JobStatusDoingSavepoint mirrors SeaTunnel DOING_SAVEPOINT (stop-with-savepoint in progress).
	// JobStatusDoingSavepoint 对应引擎 DOING_SAVEPOINT(带 Savepoint 停止进行中)。
	JobStatusDoingSavepoint JobStatus = "doing_savepoint"
	// JobStatusFailing mirrors SeaTunnel FAILING (transitioning to FAILED).
	// JobStatusFailing 对应引擎 FAILING(正在失败、尚未 FAILED)。
	JobStatusFailing  JobStatus = "failing"
	JobStatusSuccess  JobStatus = "success"
	JobStatusFailed   JobStatus = "failed"
	JobStatusCanceled JobStatus = "canceled"
	// JobStatusSavepointDone mirrors SeaTunnel SAVEPOINT_DONE (terminal after savepoint stop).
	// JobStatusSavepointDone 对应引擎 SAVEPOINT_DONE(Savepoint 停止完成的终态)。
	JobStatusSavepointDone JobStatus = "savepoint_done"
)

type JobSyncState added in v1.2.0

type JobSyncState string

JobSyncState 描述 STX 与 SeaTunnel 引擎状态对齐的新鲜度,不等同于作业生命周期 status。 JobSyncState describes how fresh STX's cached engine view is; it is not the job lifecycle status.

const (
	JobSyncStateOK       JobSyncState = "ok"
	JobSyncStateDegraded JobSyncState = "degraded"
	JobSyncStateStale    JobSyncState = "stale"
	JobSyncStateUnknown  JobSyncState = "unknown"
)

type ListCuratedTemplatesRequest added in v1.0.0

type ListCuratedTemplatesRequest struct {
	Section string `json:"section"`
	Mode    string `json:"mode"`
	Q       string `json:"q"`
	Origin  string `json:"origin"` // builtin|user|all
}

ListCuratedTemplatesRequest filters curated templates. ListCuratedTemplatesRequest 筛选精选模板列表。

type ListSyncPluginEnumCatalogRequest

type ListSyncPluginEnumCatalogRequest struct {
	ClusterID         uint  `json:"cluster_id" binding:"required"`
	IncludeSupplement *bool `json:"include_supplement,omitempty"`
}

type ListSyncPluginEnumValuesRequest

type ListSyncPluginEnumValuesRequest struct {
	ClusterID         uint   `json:"cluster_id" binding:"required"`
	PluginType        string `json:"plugin_type" binding:"required"`
	FactoryIdentifier string `json:"factory_identifier" binding:"required"`
	OptionKey         string `json:"option_key" binding:"required"`
	IncludeSupplement *bool  `json:"include_supplement,omitempty"`
}

type ListSyncPluginFactoriesRequest

type ListSyncPluginFactoriesRequest struct {
	ClusterID  uint   `json:"cluster_id" binding:"required"`
	PluginType string `json:"plugin_type" binding:"required"`
}

type LocalRunResponse

type LocalRunResponse struct {
	PID        int    `json:"pid"`
	ConfigFile string `json:"config_file"`
	LogFile    string `json:"log_file,omitempty"`
	StatusFile string `json:"status_file,omitempty"`
}

type LocalStatusResponse

type LocalStatusResponse struct {
	Running    bool   `json:"running"`
	Status     string `json:"status"`
	ExitCode   int    `json:"exit_code"`
	Message    string `json:"message"`
	FinishedAt string `json:"finished_at,omitempty"`
}

type ParseCuratedComboRequest added in v1.0.0

type ParseCuratedComboRequest struct {
	Content string `json:"content" binding:"required"`
}

ParseCuratedComboRequest parses job content into four sections for combo save. ParseCuratedComboRequest 将作业正文解析为四节,供一键组合另存。

type PluginEnumCatalogResponse

type PluginEnumCatalogResponse struct {
	ErrorMsg string                       `json:"error_msg"`
	Data     *SyncPluginEnumCatalogResult `json:"data"`
}

type PluginEnumValuesResponse

type PluginEnumValuesResponse struct {
	ErrorMsg string                      `json:"error_msg"`
	Data     *SyncPluginEnumValuesResult `json:"data"`
}

type PluginFactoryListResponse

type PluginFactoryListResponse struct {
	ErrorMsg string                       `json:"error_msg"`
	Data     *SyncPluginFactoryListResult `json:"data"`
}

type PluginOptionSchemaResponse

type PluginOptionSchemaResponse struct {
	ErrorMsg string                        `json:"error_msg"`
	Data     *SyncPluginOptionSchemaResult `json:"data"`
}

type PluginTemplateResponse

type PluginTemplateResponse struct {
	ErrorMsg string                    `json:"error_msg"`
	Data     *SyncPluginTemplateResult `json:"data"`
}

type PreviewCollectRequest

type PreviewCollectRequest struct {
	PlatformJobID string                   `json:"platform_job_id"`
	EngineJobID   string                   `json:"engine_job_id"`
	Dataset       string                   `json:"dataset"`
	Catalog       map[string]interface{}   `json:"catalog"`
	Columns       []interface{}            `json:"columns"`
	Rows          []map[string]interface{} `json:"rows"`
	RowLimit      int                      `json:"row_limit"`
	Page          int                      `json:"page"`
	PageSize      int                      `json:"page_size"`
	Total         int                      `json:"total"`
	Replace       bool                     `json:"replace"`
}

type PreviewRow

type PreviewRow struct {
	ID        uint      `json:"id" gorm:"primaryKey;autoIncrement"`
	SessionID uint      `json:"session_id" gorm:"index;not null"`
	TableID   uint      `json:"table_id" gorm:"index;not null"`
	RowIndex  int       `json:"row_index" gorm:"index;not null"`
	RowData   JSONMap   `json:"row_data" gorm:"type:json"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
}

PreviewRow stores one preview data row. PreviewRow 存储一条预览数据行。

func (PreviewRow) TableName

func (PreviewRow) TableName() string

TableName returns the preview row table name. TableName 返回预览数据行表名。

type PreviewSession

type PreviewSession struct {
	ID             uint       `json:"id" gorm:"primaryKey;autoIncrement"`
	JobInstanceID  uint       `json:"job_instance_id" gorm:"uniqueIndex;not null"`
	TaskID         uint       `json:"task_id" gorm:"index;not null"`
	PlatformJobID  string     `json:"platform_job_id" gorm:"size:32;index"`
	EngineJobID    string     `json:"engine_job_id" gorm:"size:255;index"`
	RowLimit       int        `json:"row_limit" gorm:"not null;default:100"`
	TimeoutMinutes int        `json:"timeout_minutes" gorm:"not null;default:10"`
	Status         string     `json:"status" gorm:"size:32;not null;default:collecting;index"`
	TotalRows      int        `json:"total_rows" gorm:"not null;default:0"`
	TableCount     int        `json:"table_count" gorm:"not null;default:0"`
	Truncated      bool       `json:"truncated" gorm:"not null;default:false"`
	LastError      string     `json:"last_error" gorm:"type:text"`
	StartedAt      *time.Time `json:"started_at"`
	FinishedAt     *time.Time `json:"finished_at"`
	CreatedAt      time.Time  `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt      time.Time  `json:"updated_at" gorm:"autoUpdateTime"`
}

PreviewSession stores one incremental preview session snapshot. PreviewSession 存储一次增量预览会话快照。

func (PreviewSession) TableName

func (PreviewSession) TableName() string

TableName returns the preview session table name. TableName 返回预览会话表名。

type PreviewSnapshot

type PreviewSnapshot struct {
	SessionID      uint                `json:"session_id"`
	JobInstanceID  uint                `json:"job_instance_id"`
	PlatformJobID  string              `json:"platform_job_id"`
	EngineJobID    string              `json:"engine_job_id"`
	Status         string              `json:"status"`
	EmptyReason    string              `json:"empty_reason,omitempty"`
	RowLimit       int                 `json:"row_limit"`
	TimeoutMinutes int                 `json:"timeout_minutes"`
	TotalRows      int                 `json:"total_rows"`
	TableCount     int                 `json:"table_count"`
	Truncated      bool                `json:"truncated"`
	InjectedScript string              `json:"injected_script,omitempty"`
	ContentFormat  string              `json:"content_format,omitempty"`
	Tables         []*PreviewTableData `json:"tables"`
	SelectedTable  *PreviewTableData   `json:"selected_table,omitempty"`
	Warnings       []string            `json:"warnings,omitempty"`
}

PreviewSnapshot represents one incremental preview snapshot payload. PreviewSnapshot 表示一次增量预览快照返回。

type PreviewSnapshotResponse

type PreviewSnapshotResponse struct {
	ErrorMsg string           `json:"error_msg"`
	Data     *PreviewSnapshot `json:"data"`
}

type PreviewSyncSinkSaveModeRequest

type PreviewSyncSinkSaveModeRequest struct {
	ClusterID          uint              `json:"cluster_id" binding:"required"`
	SinkIndex          *int              `json:"sink_index,omitempty"`
	SinkNodeID         string            `json:"sink_node_id,omitempty"`
	IncludeInfoPreview *bool             `json:"include_info_preview,omitempty"`
	Draft              *TaskDraftPayload `json:"draft,omitempty"`
}

type PreviewTable

type PreviewTable struct {
	ID          uint            `json:"id" gorm:"primaryKey;autoIncrement"`
	SessionID   uint            `json:"session_id" gorm:"index;not null"`
	TablePath   string          `json:"table_path" gorm:"size:512;index;not null"`
	DisplayName string          `json:"display_name" gorm:"size:512"`
	Columns     JSONStringSlice `json:"columns" gorm:"type:json"`
	RowCount    int             `json:"row_count" gorm:"not null;default:0"`
	CreatedAt   time.Time       `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time       `json:"updated_at" gorm:"autoUpdateTime"`
}

PreviewTable stores one preview table group under a session. PreviewTable 存储预览会话中的一张表分组。

func (PreviewTable) TableName

func (PreviewTable) TableName() string

TableName returns the preview table table name. TableName 返回预览表分组表名。

type PreviewTableData

type PreviewTableData struct {
	ID        uint                     `json:"id"`
	TablePath string                   `json:"table_path"`
	Columns   []string                 `json:"columns"`
	RowCount  int                      `json:"row_count"`
	Rows      []map[string]interface{} `json:"rows,omitempty"`
}

PreviewTableData represents one table group inside a preview snapshot. PreviewTableData 表示预览快照中的单张表数据。

type PreviewTaskRequest

type PreviewTaskRequest struct {
	RowLimit        int               `json:"row_limit"`
	TimeoutMinutes  int               `json:"timeout_minutes"`
	SourceNodeID    string            `json:"source_node_id,omitempty"`
	SourceIndex     *int              `json:"source_index,omitempty"`
	TransformNodeID string            `json:"transform_node_id,omitempty"`
	TransformIndex  *int              `json:"transform_index,omitempty"`
	Mode            string            `json:"mode,omitempty"`
	Draft           *TaskDraftPayload `json:"draft,omitempty"`
}

PreviewTaskRequest represents optional preview execution parameters.

type PublishTaskRequest

type PublishTaskRequest struct {
	Comment string `json:"comment"`
}

PublishTaskRequest represents the payload for publishing a sync task.

type RecoverJobRequest

type RecoverJobRequest struct {
	Draft *TaskDraftPayload `json:"draft,omitempty"`
}

RecoverJobRequest represents a recover request with an optional unsaved task draft.

type RecoverTaskRequest

type RecoverTaskRequest struct {
	Comment string `json:"comment,omitempty"`
}

RecoverTaskRequest represents the payload for recovering from one previous job.

type RenderSyncPluginTemplateRequest

type RenderSyncPluginTemplateRequest struct {
	ClusterID         uint   `json:"cluster_id" binding:"required"`
	PluginType        string `json:"plugin_type" binding:"required"`
	FactoryIdentifier string `json:"factory_identifier" binding:"required"`
	IncludeSupplement *bool  `json:"include_supplement,omitempty"`
	IncludeComments   *bool  `json:"include_comments,omitempty"`
	IncludeAdvanced   *bool  `json:"include_advanced,omitempty"`
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository provides persistence operations for sync tasks and instances.

func NewRepository

func NewRepository(db *gorm.DB) *Repository

NewRepository creates a new sync repository.

func (*Repository) CreateCuratedTemplate added in v1.0.0

func (r *Repository) CreateCuratedTemplate(ctx context.Context, item *CuratedTemplate) error

CreateCuratedTemplate creates one curated template row. CreateCuratedTemplate 创建一条精选模板。

func (*Repository) CreateGlobalVariable

func (r *Repository) CreateGlobalVariable(ctx context.Context, item *GlobalVariable) error

CreateGlobalVariable creates one global variable.

func (*Repository) CreateJobInstance

func (r *Repository) CreateJobInstance(ctx context.Context, instance *JobInstance) error

CreateJobInstance creates a new job instance record.

func (*Repository) CreatePreviewRows

func (r *Repository) CreatePreviewRows(ctx context.Context, rows []*PreviewRow) error

CreatePreviewRows appends preview rows in batch. CreatePreviewRows 批量追加预览数据行。

func (*Repository) CreatePreviewSession

func (r *Repository) CreatePreviewSession(ctx context.Context, session *PreviewSession) error

CreatePreviewSession creates one preview session. CreatePreviewSession 创建一条预览会话记录。

func (*Repository) CreatePreviewTable

func (r *Repository) CreatePreviewTable(ctx context.Context, table *PreviewTable) error

CreatePreviewTable creates one preview table. CreatePreviewTable 创建一条预览表记录。

func (*Repository) CreateSchedulerConnection added in v1.2.0

func (r *Repository) CreateSchedulerConnection(ctx context.Context, item *SchedulerConnection) error

CreateSchedulerConnection 保存一条调度器连接。 CreateSchedulerConnection stores one scheduler connection.

func (*Repository) CreateTask

func (r *Repository) CreateTask(ctx context.Context, task *Task) error

CreateTask creates a sync task.

func (*Repository) CreateTaskVersion

func (r *Repository) CreateTaskVersion(ctx context.Context, version *TaskVersion) error

CreateTaskVersion stores one immutable task snapshot.

func (*Repository) DeleteCuratedTemplate added in v1.0.0

func (r *Repository) DeleteCuratedTemplate(ctx context.Context, id uint) error

DeleteCuratedTemplate deletes one curated template by id. DeleteCuratedTemplate 按 id 删除精选模板。

func (*Repository) DeleteGlobalVariable

func (r *Repository) DeleteGlobalVariable(ctx context.Context, id uint) error

DeleteGlobalVariable deletes one global variable.

func (*Repository) DeleteJobInstancesByTaskIDs

func (r *Repository) DeleteJobInstancesByTaskIDs(ctx context.Context, taskIDs []uint) error

DeleteJobInstancesByTaskIDs deletes run history for the provided task ids.

func (*Repository) DeletePreviewRowsBySessionIDs

func (r *Repository) DeletePreviewRowsBySessionIDs(ctx context.Context, sessionIDs []uint) error

DeletePreviewRowsBySessionIDs deletes preview rows for sessions. DeletePreviewRowsBySessionIDs 删除指定会话的预览数据行。

func (*Repository) DeletePreviewRowsByTableID

func (r *Repository) DeletePreviewRowsByTableID(ctx context.Context, tableID uint) error

DeletePreviewRowsByTableID deletes preview rows by table. DeletePreviewRowsByTableID 按表删除预览数据行。

func (*Repository) DeletePreviewRowsByTaskIDs

func (r *Repository) DeletePreviewRowsByTaskIDs(ctx context.Context, taskIDs []uint) error

DeletePreviewRowsByTaskIDs deletes preview rows for the provided task ids. DeletePreviewRowsByTaskIDs 删除指定任务的预览数据行。

func (*Repository) DeletePreviewSessionsByIDs

func (r *Repository) DeletePreviewSessionsByIDs(ctx context.Context, sessionIDs []uint) error

DeletePreviewSessionsByIDs deletes preview sessions by ids. DeletePreviewSessionsByIDs 删除指定预览会话。

func (*Repository) DeletePreviewSessionsByTaskIDs

func (r *Repository) DeletePreviewSessionsByTaskIDs(ctx context.Context, taskIDs []uint) error

DeletePreviewSessionsByTaskIDs deletes preview sessions for the provided task ids. DeletePreviewSessionsByTaskIDs 删除指定任务的预览会话。

func (*Repository) DeletePreviewTablesBySessionIDs

func (r *Repository) DeletePreviewTablesBySessionIDs(ctx context.Context, sessionIDs []uint) error

DeletePreviewTablesBySessionIDs deletes preview tables for sessions. DeletePreviewTablesBySessionIDs 删除指定会话的预览表。

func (*Repository) DeletePreviewTablesByTaskIDs

func (r *Repository) DeletePreviewTablesByTaskIDs(ctx context.Context, taskIDs []uint) error

DeletePreviewTablesByTaskIDs deletes preview tables for the provided task ids. DeletePreviewTablesByTaskIDs 删除指定任务的预览表分组。

func (*Repository) DeleteSchedulerBindingByTaskID added in v1.2.0

func (r *Repository) DeleteSchedulerBindingByTaskID(ctx context.Context, taskID uint) error

DeleteSchedulerBindingByTaskID 删除任务绑定,不影响 Dolphin 侧节点。 DeleteSchedulerBindingByTaskID removes the STX binding without touching the Dolphin node.

func (*Repository) DeleteSchedulerConnection added in v1.2.0

func (r *Repository) DeleteSchedulerConnection(ctx context.Context, id uint) error

DeleteSchedulerConnection 删除调度器连接。 DeleteSchedulerConnection deletes a scheduler connection.

func (*Repository) DeleteTaskVersion

func (r *Repository) DeleteTaskVersion(ctx context.Context, taskID uint, versionID uint) error

DeleteTaskVersion removes one immutable task snapshot.

func (*Repository) DeleteTaskVersionsByTaskIDs

func (r *Repository) DeleteTaskVersionsByTaskIDs(ctx context.Context, taskIDs []uint) error

DeleteTaskVersionsByTaskIDs deletes snapshots for the provided task ids.

func (*Repository) DeleteTasksByIDs

func (r *Repository) DeleteTasksByIDs(ctx context.Context, taskIDs []uint) error

DeleteTasksByIDs deletes the provided workspace nodes.

func (*Repository) ExistsSiblingTaskName

func (r *Repository) ExistsSiblingTaskName(ctx context.Context, parentID *uint, name string, excludeID *uint) (bool, error)

ExistsSiblingTaskName reports whether the same folder already contains a node with the provided name. ExistsSiblingTaskName 返回同级目录下是否已存在同名节点。

func (*Repository) GetActiveJobByExternalRef added in v1.2.0

func (r *Repository) GetActiveJobByExternalRef(ctx context.Context, ref string) (*JobInstance, error)

GetActiveJobByExternalRef 返回同一外部引用上仍在运行或停止中的作业。 GetActiveJobByExternalRef returns the in-flight job that currently owns the external reference.

func (*Repository) GetCuratedTemplateByID added in v1.0.0

func (r *Repository) GetCuratedTemplateByID(ctx context.Context, id uint) (*CuratedTemplate, error)

GetCuratedTemplateByID returns one curated template by id. GetCuratedTemplateByID 按 id 返回精选模板。

func (*Repository) GetCuratedTemplateByOwnerAndBuiltin added in v1.0.0

func (r *Repository) GetCuratedTemplateByOwnerAndBuiltin(ctx context.Context, ownerUserID uint, builtinID string) (*CuratedTemplate, error)

GetCuratedTemplateByOwnerAndBuiltin returns override row for one builtin id. GetCuratedTemplateByOwnerAndBuiltin 返回用户对某内置 id 的副本行。

func (*Repository) GetGlobalVariableByID

func (r *Repository) GetGlobalVariableByID(ctx context.Context, id uint) (*GlobalVariable, error)

GetGlobalVariableByID returns one global variable by id.

func (*Repository) GetGlobalVariableByKey

func (r *Repository) GetGlobalVariableByKey(ctx context.Context, key string) (*GlobalVariable, error)

GetGlobalVariableByKey returns one global variable by key.

func (*Repository) GetJobInstanceByID

func (r *Repository) GetJobInstanceByID(ctx context.Context, id uint) (*JobInstance, error)

GetJobInstanceByID returns one job instance by id.

func (*Repository) GetJobInstanceByIDForOwner

func (r *Repository) GetJobInstanceByIDForOwner(ctx context.Context, id, ownerUserID uint, includeAll bool) (*JobInstance, error)

GetJobInstanceByIDForOwner 按用户归属读取作业实例,管理员可跳过归属限制。 GetJobInstanceByIDForOwner loads a job instance under owner scope, while administrators may bypass the owner filter.

func (*Repository) GetLatestScheduledJobInstancesByTaskIDs

func (r *Repository) GetLatestScheduledJobInstancesByTaskIDs(ctx context.Context, taskIDs []uint) (map[uint]*JobInstance, error)

GetLatestScheduledJobInstancesByTaskIDs returns the latest scheduled job instance keyed by task id.

func (*Repository) GetPreviewJobInstanceByPlatformOrEngineJobID

func (r *Repository) GetPreviewJobInstanceByPlatformOrEngineJobID(ctx context.Context, platformJobID string, engineJobID string) (*JobInstance, error)

GetPreviewJobInstanceByPlatformOrEngineJobID retrieves one preview job by platform or engine job id.

func (*Repository) GetPreviewSessionByJobInstanceID

func (r *Repository) GetPreviewSessionByJobInstanceID(ctx context.Context, jobInstanceID uint) (*PreviewSession, error)

GetPreviewSessionByJobInstanceID returns the preview session for one job instance. GetPreviewSessionByJobInstanceID 返回指定作业实例的预览会话。

func (*Repository) GetPreviewTableByPath

func (r *Repository) GetPreviewTableByPath(ctx context.Context, sessionID uint, tablePath string) (*PreviewTable, error)

GetPreviewTableByPath returns one preview table by session and table path. GetPreviewTableByPath 按会话和表路径返回一条预览表记录。

func (*Repository) GetSchedulerBindingByTaskID added in v1.2.0

func (r *Repository) GetSchedulerBindingByTaskID(ctx context.Context, taskID uint) (*TaskSchedulerBinding, error)

GetSchedulerBindingByTaskID 读取任务的 Dolphin 绑定。 GetSchedulerBindingByTaskID loads the Dolphin binding for a task.

func (*Repository) GetSchedulerConnectionByID added in v1.2.0

func (r *Repository) GetSchedulerConnectionByID(ctx context.Context, id uint) (*SchedulerConnection, error)

GetSchedulerConnectionByID 按编号读取调度器连接。 GetSchedulerConnectionByID loads a scheduler connection by id.

func (*Repository) GetTaskByID

func (r *Repository) GetTaskByID(ctx context.Context, id uint) (*Task, error)

GetTaskByID returns one task by id.

func (*Repository) GetTaskVersionByID

func (r *Repository) GetTaskVersionByID(ctx context.Context, taskID uint, versionID uint) (*TaskVersion, error)

GetTaskVersionByID returns one immutable task snapshot.

func (*Repository) GetTaskVersionByVersion

func (r *Repository) GetTaskVersionByVersion(ctx context.Context, taskID uint, version int) (*TaskVersion, error)

GetTaskVersionByVersion returns one immutable task snapshot by version number.

func (*Repository) HasScheduledJobInstanceInWindow

func (r *Repository) HasScheduledJobInstanceInWindow(ctx context.Context, taskID uint, startedAt time.Time, finishedAt time.Time) (bool, error)

HasScheduledJobInstanceInWindow reports whether a scheduled job already exists in the target trigger window.

func (*Repository) ListAllTasks

func (r *Repository) ListAllTasks(ctx context.Context) ([]*Task, error)

ListAllTasks returns all nodes for tree building.

func (*Repository) ListCuratedTemplatesByOwner added in v1.0.0

func (r *Repository) ListCuratedTemplatesByOwner(ctx context.Context, ownerUserID uint) ([]*CuratedTemplate, error)

ListCuratedTemplatesByOwner returns curated templates owned by one user. ListCuratedTemplatesByOwner 返回某用户拥有的精选模板。

func (*Repository) ListExpiredPreviewSessions

func (r *Repository) ListExpiredPreviewSessions(ctx context.Context, cutoff time.Time) ([]*PreviewSession, error)

ListExpiredPreviewSessions returns finished preview sessions older than cutoff. ListExpiredPreviewSessions 返回超过截止时间的已完成预览会话。

func (*Repository) ListGlobalVariables

func (r *Repository) ListGlobalVariables(ctx context.Context) ([]*GlobalVariable, error)

ListGlobalVariables returns all global variables ordered by key.

func (*Repository) ListGlobalVariablesPaginated

func (r *Repository) ListGlobalVariablesPaginated(ctx context.Context, page, size int) ([]*GlobalVariable, int64, error)

ListGlobalVariablesPaginated returns global variables ordered by key with pagination.

func (*Repository) ListJobInstances

func (r *Repository) ListJobInstances(ctx context.Context, filter *JobFilter) ([]*JobInstance, int64, error)

ListJobInstances lists job instances with filter and pagination.

func (*Repository) ListNonTerminalJobInstances added in v1.2.0

func (r *Repository) ListNonTerminalJobInstances(ctx context.Context, limit int) ([]*JobInstance, error)

ListNonTerminalJobInstances 返回仍需与引擎对齐的作业实例。 ListNonTerminalJobInstances returns job instances that still need engine reconciliation.

func (*Repository) ListPreviewRowsByTableID

func (r *Repository) ListPreviewRowsByTableID(ctx context.Context, tableID uint, offset, limit int) ([]*PreviewRow, error)

ListPreviewRowsByTableID lists preview rows for one table with pagination. ListPreviewRowsByTableID 按表分页返回预览数据行。

func (*Repository) ListPreviewTablesBySessionID

func (r *Repository) ListPreviewTablesBySessionID(ctx context.Context, sessionID uint) ([]*PreviewTable, error)

ListPreviewTablesBySessionID lists preview tables for one session. ListPreviewTablesBySessionID 返回一个会话下的预览表列表。

func (*Repository) ListRecentJobsByExternalRefPrefix added in v1.2.0

func (r *Repository) ListRecentJobsByExternalRefPrefix(ctx context.Context, taskID uint, prefix string, limit int) ([]*JobInstance, error)

ListRecentJobsByExternalRefPrefix 列出任务上带外部引用的最近作业。 ListRecentJobsByExternalRefPrefix lists recent jobs for a task that carry an external reference.

func (*Repository) ListRecentTerminalJobInstances added in v1.2.0

func (r *Repository) ListRecentTerminalJobInstances(ctx context.Context, limit int, since time.Time) ([]*JobInstance, error)

ListRecentTerminalJobInstances 返回近期已终态且仍带引擎作业 ID 的实例(用于补拉终态指标)。 ListRecentTerminalJobInstances returns recently finished job instances that still have an engine job id (for final metrics backfill).

func (*Repository) ListSchedulerConnections added in v1.2.0

func (r *Repository) ListSchedulerConnections(ctx context.Context) ([]*SchedulerConnection, error)

ListSchedulerConnections 列出全部调度器连接。 ListSchedulerConnections lists every scheduler connection.

func (*Repository) ListTaskVersionsByTaskID

func (r *Repository) ListTaskVersionsByTaskID(ctx context.Context, taskID uint) ([]*TaskVersion, error)

ListTaskVersionsByTaskID lists immutable snapshots for one task.

func (*Repository) ListTaskVersionsByTaskIDPaginated

func (r *Repository) ListTaskVersionsByTaskIDPaginated(ctx context.Context, taskID uint, page, size int) ([]*TaskVersion, int64, error)

ListTaskVersionsByTaskIDPaginated lists immutable snapshots for one task with pagination.

func (*Repository) ListTasks

func (r *Repository) ListTasks(ctx context.Context, filter *TaskFilter) ([]*Task, int64, error)

ListTasks lists tasks with filter and pagination.

func (*Repository) ListTimedOutPreviewSessions

func (r *Repository) ListTimedOutPreviewSessions(ctx context.Context, now time.Time) ([]*PreviewSession, error)

ListTimedOutPreviewSessions returns collecting preview sessions that exceeded timeout. ListTimedOutPreviewSessions 返回超过超时时间仍在收集中预览会话。

func (*Repository) SaveSchedulerBinding added in v1.2.0

func (r *Repository) SaveSchedulerBinding(ctx context.Context, item *TaskSchedulerBinding) error

SaveSchedulerBinding 创建或更新任务绑定。 SaveSchedulerBinding creates or updates a task binding.

func (*Repository) Transaction

func (r *Repository) Transaction(ctx context.Context, fn func(tx *Repository) error) error

Transaction executes fn inside one database transaction.

func (*Repository) UpdateCuratedTemplate added in v1.0.0

func (r *Repository) UpdateCuratedTemplate(ctx context.Context, item *CuratedTemplate) error

UpdateCuratedTemplate updates one curated template row. UpdateCuratedTemplate 更新一条精选模板。

func (*Repository) UpdateGlobalVariable

func (r *Repository) UpdateGlobalVariable(ctx context.Context, item *GlobalVariable) error

UpdateGlobalVariable updates one global variable.

func (*Repository) UpdateJobInstance

func (r *Repository) UpdateJobInstance(ctx context.Context, instance *JobInstance) error

UpdateJobInstance updates one job instance.

func (*Repository) UpdateJobStatus

func (r *Repository) UpdateJobStatus(ctx context.Context, id uint, expected []JobStatus, updates map[string]any) error

UpdateJobStatus 使用旧状态条件更新作业,防止完成回调覆盖取消状态。 UpdateJobStatus updates a job under an expected-status condition so completion callbacks cannot overwrite cancellation state.

func (*Repository) UpdateJobSyncMetadata added in v1.2.0

func (r *Repository) UpdateJobSyncMetadata(ctx context.Context, id uint, updates map[string]any) error

UpdateJobSyncMetadata 更新作业观察字段,不参与 status 条件竞争。 UpdateJobSyncMetadata updates observation metadata without status CAS.

func (*Repository) UpdatePreviewSession

func (r *Repository) UpdatePreviewSession(ctx context.Context, session *PreviewSession) error

UpdatePreviewSession updates one preview session. UpdatePreviewSession 更新一条预览会话。

func (*Repository) UpdatePreviewTable

func (r *Repository) UpdatePreviewTable(ctx context.Context, table *PreviewTable) error

UpdatePreviewTable updates one preview table. UpdatePreviewTable 更新一条预览表记录。

func (*Repository) UpdateSchedulerConnection added in v1.2.0

func (r *Repository) UpdateSchedulerConnection(ctx context.Context, item *SchedulerConnection) error

UpdateSchedulerConnection 保存调度器连接的更新。 UpdateSchedulerConnection persists scheduler connection updates.

func (*Repository) UpdateTask

func (r *Repository) UpdateTask(ctx context.Context, task *Task) error

UpdateTask updates a sync task.

type RunType

type RunType string

RunType represents sync job instance run type. RunType 表示同步作业实例运行类型。

const (
	RunTypePreview  RunType = "preview"
	RunTypeRun      RunType = "run"
	RunTypeRecover  RunType = "recover"
	RunTypeSchedule RunType = "schedule"
)

type SchedulerConnection added in v1.2.0

type SchedulerConnection struct {
	ID                 uint   `json:"id" gorm:"primaryKey;autoIncrement"`
	Name               string `json:"name" gorm:"size:120;not null"`
	Kind               string `json:"kind" gorm:"size:32;not null;index;default:dolphin"`
	BaseURL            string `json:"base_url" gorm:"size:512;not null"`
	Token              string `json:"-" gorm:"type:text"`
	TokenSet           bool   `json:"token_set" gorm:"-"`
	DefaultProjectCode int64  `json:"default_project_code"`
	APIStyle           string `json:"api_style" gorm:"size:32;not null;default:auto"`
	// DolphinVersion 可选,例如 3.2.2 / 3.3.1;空则运行时探测 3.1/3.2 与 3.3+ 路径。
	// DolphinVersion is optional, e.g. 3.2.2 / 3.3.1; empty means probe 3.1/3.2 vs 3.3+ paths at runtime.
	DolphinVersion string    `json:"dolphin_version,omitempty" gorm:"size:32"`
	CreatedBy      uint      `json:"created_by"`
	CreatedAt      time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt      time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

SchedulerConnection 保存访问外部调度器的 API 地址和令牌。 SchedulerConnection stores the API endpoint and token for an external scheduler.

func (*SchedulerConnection) MaskToken added in v1.2.0

func (c *SchedulerConnection) MaskToken()

MaskToken 把令牌从 API 响应当中去掉,只保留是否已配置。 MaskToken removes the raw token from API responses and only reports whether it is set.

func (SchedulerConnection) TableName added in v1.2.0

func (SchedulerConnection) TableName() string

TableName 指定调度器连接表名。 TableName specifies the scheduler connection table.

type SchedulerConnectionListData added in v1.2.0

type SchedulerConnectionListData struct {
	Items []*SchedulerConnection `json:"items"`
}

SchedulerConnectionListData 是调度器连接列表。 SchedulerConnectionListData is the scheduler connection list payload.

type SchedulerConnectionListResponse added in v1.2.0

type SchedulerConnectionListResponse struct {
	ErrorMsg string                       `json:"error_msg"`
	Data     *SchedulerConnectionListData `json:"data"`
}

type SchedulerConnectionRequest added in v1.2.0

type SchedulerConnectionRequest struct {
	Name               string `json:"name"`
	Kind               string `json:"kind"`
	BaseURL            string `json:"base_url"`
	Token              string `json:"token"`
	DefaultProjectCode int64  `json:"default_project_code"`
	APIStyle           string `json:"api_style"`
	DolphinVersion     string `json:"dolphin_version"`
}

SchedulerConnectionRequest 创建或更新调度器连接。 SchedulerConnectionRequest creates or updates a scheduler connection.

type SchedulerConnectionResponse added in v1.2.0

type SchedulerConnectionResponse struct {
	ErrorMsg string               `json:"error_msg"`
	Data     *SchedulerConnection `json:"data"`
}

type SeaTunnelEngineClient

type SeaTunnelEngineClient struct {
	// contains filtered or unexported fields
}

SeaTunnelEngineClient is the default REST V2 engine client.

func NewSeaTunnelEngineClient

func NewSeaTunnelEngineClient() *SeaTunnelEngineClient

NewSeaTunnelEngineClient creates a SeaTunnel engine client.

func (*SeaTunnelEngineClient) GetJobCheckpointHistory

func (c *SeaTunnelEngineClient) GetJobCheckpointHistory(ctx context.Context, endpoint *EngineEndpoint, jobID string, pipelineID *int, limit int, status string) ([]*EngineCheckpointRecord, error)

GetJobCheckpointHistory fetches job checkpoint history from REST V2.

func (*SeaTunnelEngineClient) GetJobCheckpointOverview

func (c *SeaTunnelEngineClient) GetJobCheckpointOverview(ctx context.Context, endpoint *EngineEndpoint, jobID string) (*EngineCheckpointOverview, error)

GetJobCheckpointOverview fetches one job checkpoint overview from REST V2.

func (*SeaTunnelEngineClient) GetJobInfo

func (c *SeaTunnelEngineClient) GetJobInfo(ctx context.Context, endpoint *EngineEndpoint, jobID string) (*EngineJobInfo, error)

GetJobInfo fetches one job info.

func (*SeaTunnelEngineClient) GetJobLogs

func (c *SeaTunnelEngineClient) GetJobLogs(ctx context.Context, endpoint *EngineEndpoint, jobID string) (string, error)

GetJobLogs fetches one job log payload through SeaTunnel REST APIs.

func (*SeaTunnelEngineClient) ListFinishedJobs added in v1.2.0

func (c *SeaTunnelEngineClient) ListFinishedJobs(ctx context.Context, endpoint *EngineEndpoint, state string) ([]*EngineJobListItem, error)

ListFinishedJobs 拉取已完成作业列表,state 为空时尝试不带状态的路径。 ListFinishedJobs fetches finished jobs; when state is empty a path without state is tried first.

func (*SeaTunnelEngineClient) ListRunningJobs added in v1.2.0

func (c *SeaTunnelEngineClient) ListRunningJobs(ctx context.Context, endpoint *EngineEndpoint) ([]*EngineJobListItem, error)

ListRunningJobs 拉取当前运行中的作业列表。 ListRunningJobs fetches all currently running jobs from the engine.

func (*SeaTunnelEngineClient) StopJob

func (c *SeaTunnelEngineClient) StopJob(ctx context.Context, endpoint *EngineEndpoint, jobID string, stopWithSavepoint bool) error

StopJob cancels one running job.

func (*SeaTunnelEngineClient) Submit

Submit submits one SeaTunnel job.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides sync studio control-plane behavior.

func NewService

func NewService(repo *Repository) *Service

NewService creates a new sync service.

func (*Service) BuildTaskDAG

func (s *Service) BuildTaskDAG(ctx context.Context, id uint, draft *TaskDraftPayload) (*DAGResult, error)

BuildTaskDAG returns DAG projection for the task definition.

func (*Service) BuildTaskDAGForActor added in v1.0.0

func (s *Service) BuildTaskDAGForActor(ctx context.Context, actor executionapp.Actor, id uint, draft *TaskDraftPayload) (*DAGResult, error)

BuildTaskDAGForActor builds DAG after checking view permission.

func (*Service) CancelJob

func (s *Service) CancelJob(ctx context.Context, id uint, stopWithSavepoint bool) (*JobInstance, error)

CancelJob 请求真实停止作业,并在确认停止前保留取消中间状态。 CancelJob requests a real stop and keeps intermediate cancellation states until the stop is confirmed.

func (*Service) CancelJobByRef added in v1.2.0

func (s *Service) CancelJobByRef(ctx context.Context, actor executionapp.Actor, ref string, generation int) (*JobInstance, error)

CancelJobByRef 按外部引用停止作业;generation 为 0 时使用当前代次。 CancelJobByRef stops the job for an external ref; generation 0 means "use the current generation".

func (*Service) CancelJobForActor

func (s *Service) CancelJobForActor(ctx context.Context, actor executionapp.Actor, id uint, stopWithSavepoint bool) (*JobInstance, error)

CancelJobForActor 在权限检查后请求取消作业。仅管理员、发起人或任务所有者可取消。 CancelJobForActor requests cancellation after enforcing ownership. Only administrators, the job submitter, or task owner may cancel.

func (*Service) CollectPreview

func (s *Service) CollectPreview(ctx context.Context, req *PreviewCollectRequest) error

func (*Service) CreateCuratedTemplate added in v1.0.0

func (s *Service) CreateCuratedTemplate(ctx context.Context, req *CreateCuratedTemplateRequest, userID uint) (*CuratedTemplateView, error)

CreateCuratedTemplate creates one user template (save-as / custom). CreateCuratedTemplate 创建用户精选(另存/自定义)。

func (*Service) CreateGlobalVariable

func (s *Service) CreateGlobalVariable(ctx context.Context, req *CreateGlobalVariableRequest, createdBy uint) (*GlobalVariable, error)

CreateGlobalVariable creates one workspace-wide variable and returns a masked safe copy. CreateGlobalVariable 创建一个工作台全局变量并返回脱敏后的安全副本。

func (*Service) CreateSchedulerConnection added in v1.2.0

func (s *Service) CreateSchedulerConnection(ctx context.Context, req *SchedulerConnectionRequest, createdBy uint) (*SchedulerConnection, error)

CreateSchedulerConnection 保存一条新的调度器连接。 CreateSchedulerConnection stores a new scheduler connection.

func (*Service) CreateTask

func (s *Service) CreateTask(ctx context.Context, req *CreateTaskRequest, createdBy uint) (*Task, error)

CreateTask creates one workspace node.

func (*Service) DeleteCuratedTemplate added in v1.0.0

func (s *Service) DeleteCuratedTemplate(ctx context.Context, id uint, userID uint) error

DeleteCuratedTemplate deletes one owned curated template. DeleteCuratedTemplate 删除用户拥有的精选模板。

func (*Service) DeleteGlobalVariable

func (s *Service) DeleteGlobalVariable(ctx context.Context, id uint) error

DeleteGlobalVariable deletes one workspace-wide variable.

func (*Service) DeleteGlobalVariableForActor added in v1.0.0

func (s *Service) DeleteGlobalVariableForActor(ctx context.Context, actor executionapp.Actor, id uint) error

DeleteGlobalVariableForActor deletes one workspace-wide variable after enforcing actor permissions. Ordinary users can only delete variables they created; administrators can delete any variable.

func (*Service) DeleteTask

func (s *Service) DeleteTask(ctx context.Context, id uint) error

DeleteTask removes one workspace node and all nested descendants.

func (*Service) DeleteTaskForActor added in v1.0.0

func (s *Service) DeleteTaskForActor(ctx context.Context, actor executionapp.Actor, id uint) error

DeleteTaskForActor removes one workspace node after verifying owner/admin rights.

func (*Service) DeleteTaskVersion

func (s *Service) DeleteTaskVersion(ctx context.Context, id uint, versionID uint) error

DeleteTaskVersion removes one immutable snapshot.

func (*Service) DeleteTaskVersionForActor added in v1.0.0

func (s *Service) DeleteTaskVersionForActor(ctx context.Context, actor executionapp.Actor, id uint, versionID uint) error

DeleteTaskVersionForActor removes one immutable snapshot after checking edit permission.

func (*Service) ForkCuratedTemplate added in v1.0.0

func (s *Service) ForkCuratedTemplate(ctx context.Context, req *ForkCuratedTemplateRequest, userID uint) (*CuratedTemplateView, error)

ForkCuratedTemplate copies a built-in seed into the user's override row. ForkCuratedTemplate 将内置种子复制为用户的 override 行。

func (*Service) GetCuratedTemplateContentForInsert added in v1.0.0

func (s *Service) GetCuratedTemplateContentForInsert(ctx context.Context, builtinID string, userID uint, dbID uint, clusterID uint) (string, error)

GetCuratedTemplateContentForInsert returns content, rewriting plugin IO keys for legacy clusters. GetCuratedTemplateContentForInsert 返回待插入正文,并按低版本集群改写 plugin IO 键。

func (*Service) GetDolphinScript added in v1.2.0

func (s *Service) GetDolphinScript(ctx context.Context, actor executionapp.Actor, taskID uint, variables map[string]string, workerGroup, environment string) (*DolphinScriptResult, error)

GetDolphinScript 生成当前任务的 SHELL 节点脚本。 GetDolphinScript builds the SHELL node script for the current task.

func (*Service) GetDolphinTaskStatus added in v1.2.0

func (s *Service) GetDolphinTaskStatus(ctx context.Context, actor executionapp.Actor, taskID uint) (*DolphinTaskStatus, error)

GetDolphinTaskStatus 返回侧边栏需要的绑定、脚本和最近作业摘要。 GetDolphinTaskStatus returns the sidebar summary of binding, script, and recent jobs.

func (*Service) GetDolphinWorkflow added in v1.2.0

func (s *Service) GetDolphinWorkflow(ctx context.Context, connectionID uint, projectCode, workflowCode int64) (*DolphinWorkflowDetail, error)

GetDolphinWorkflow 读取工作流定义,供复用时勾选上下游。 GetDolphinWorkflow loads a workflow definition so callers can pick upstream/downstream nodes.

func (*Service) GetJob

func (s *Service) GetJob(ctx context.Context, id uint) (*JobInstance, error)

GetJob returns one job instance from the database without hitting the engine. GetJob 只读数据库返回单个作业,不再同步刷新 SeaTunnel。

func (*Service) GetJobCheckpointSnapshot

func (s *Service) GetJobCheckpointSnapshot(
	ctx context.Context,
	jobID uint,
	pipelineID *int,
	limit int,
	status string,
) (*CheckpointSnapshot, error)

GetJobCheckpointSnapshot returns checkpoint overview/history for one job. GetJobCheckpointSnapshot 返回单个作业的 checkpoint 概览与历史。

func (*Service) GetJobCheckpointSnapshotForActor

func (s *Service) GetJobCheckpointSnapshotForActor(ctx context.Context, actor executionapp.Actor, id uint, pipelineID *int, limit int, status string) (*CheckpointSnapshot, error)

GetJobCheckpointSnapshotForActor 在权限检查后读取 Checkpoint 信息。 GetJobCheckpointSnapshotForActor reads checkpoint data after enforcing permission.

func (*Service) GetJobForActor

func (s *Service) GetJobForActor(ctx context.Context, actor executionapp.Actor, id uint, fresh bool) (*JobInstance, error)

GetJobForActor 按当前用户归属或任务可见性读取一个作业。 GetJobForActor loads one job under the current user's ownership or task view scope.

func (*Service) GetJobLogs

func (s *Service) GetJobLogs(ctx context.Context, id uint, offset string, limitBytes int, keyword string, level string) (*JobLogsResult, error)

func (*Service) GetJobLogsForActor

func (s *Service) GetJobLogsForActor(ctx context.Context, actor executionapp.Actor, id uint, offset string, limitBytes int, keyword, level string) (*JobLogsResult, error)

GetJobLogsForActor 在权限检查后读取作业日志。 GetJobLogsForActor reads job logs after enforcing permission.

func (*Service) GetPluginOptions

func (*Service) GetPreviewSnapshot

func (s *Service) GetPreviewSnapshot(ctx context.Context, jobID uint, tablePath string) (*PreviewSnapshot, error)

GetPreviewSnapshot returns one incremental preview snapshot for a job instance. GetPreviewSnapshot 返回一个作业实例的增量预览快照。

func (*Service) GetPreviewSnapshotForActor

func (s *Service) GetPreviewSnapshotForActor(ctx context.Context, actor executionapp.Actor, id uint, tablePath string) (*PreviewSnapshot, error)

GetPreviewSnapshotForActor 在权限检查后读取预览结果。 GetPreviewSnapshotForActor reads a preview snapshot after enforcing permission.

func (*Service) GetTask

func (s *Service) GetTask(ctx context.Context, id uint) (*Task, error)

GetTask returns one workspace node.

func (*Service) GetTaskForActor added in v1.0.0

func (s *Service) GetTaskForActor(ctx context.Context, actor executionapp.Actor, id uint) (*Task, error)

GetTaskForActor returns one workspace node decorated with actor permissions.

func (*Service) GetTaskPermissionsForActor added in v1.0.0

func (s *Service) GetTaskPermissionsForActor(ctx context.Context, actor executionapp.Actor, id uint) (*TaskPermissions, error)

GetTaskPermissionsForActor 只返回共享权限,不返回任务正文。 GetTaskPermissionsForActor returns sharing permissions without exposing task content.

func (*Service) GetTaskTree

func (s *Service) GetTaskTree(ctx context.Context) ([]*TaskTreeNode, error)

GetTaskTree returns nested workspace nodes for the left tree.

func (*Service) GetTaskTreeForActor added in v1.0.0

func (s *Service) GetTaskTreeForActor(ctx context.Context, actor executionapp.Actor) ([]*TaskTreeNode, error)

GetTaskTreeForActor returns nested workspace nodes filtered and decorated with actor permissions.

func (*Service) ListCuratedTemplates added in v1.0.0

func (s *Service) ListCuratedTemplates(ctx context.Context, req *ListCuratedTemplatesRequest, userID uint) (*CuratedTemplateListData, error)

ListCuratedTemplates merges built-in seeds with the current user's DB rows. ListCuratedTemplates 合并内置种子与当前用户的数据库行。

func (*Service) ListDolphinProjects added in v1.2.0

func (s *Service) ListDolphinProjects(ctx context.Context, connectionID uint) ([]DolphinProject, error)

ListDolphinProjects 列出连接上的 Dolphin 项目。 ListDolphinProjects lists Dolphin projects available on a connection.

func (*Service) ListDolphinWorkflows added in v1.2.0

func (s *Service) ListDolphinWorkflows(ctx context.Context, connectionID uint, projectCode int64) ([]DolphinWorkflowSummary, error)

ListDolphinWorkflows 列出项目下的工作流定义。 ListDolphinWorkflows lists workflow definitions in a project.

func (*Service) ListGlobalVariables

func (s *Service) ListGlobalVariables(ctx context.Context) ([]*GlobalVariable, error)

ListGlobalVariables returns all workspace-wide variables.

func (*Service) ListGlobalVariablesPaginated

func (s *Service) ListGlobalVariablesPaginated(ctx context.Context, page, size int) ([]*GlobalVariable, int64, error)

ListGlobalVariablesPaginated returns paginated workspace-wide variables with sensitive values masked. ListGlobalVariablesPaginated 返回分页全局变量,敏感凭据值将被脱敏为 ******。

func (*Service) ListJobs

func (s *Service) ListJobs(ctx context.Context, filter *JobFilter) ([]*JobInstance, int64, error)

ListJobs returns paginated job instances from the database without hitting the engine. ListJobs 只读数据库返回分页作业,不再同步刷新 SeaTunnel。

func (*Service) ListJobsForActor

func (s *Service) ListJobsForActor(ctx context.Context, actor executionapp.Actor, filter *JobFilter) ([]*JobInstance, int64, error)

ListJobsForActor 按当前用户归属列出作业,管理员或具备任务查看权限的用户可查看任务历史。 ListJobsForActor lists jobs owned by the current user, while administrators or users with task view access may view task job history.

func (*Service) ListPluginEnumCatalog

func (s *Service) ListPluginEnumCatalog(
	ctx context.Context,
	req *ListSyncPluginEnumCatalogRequest,
) (*SyncPluginEnumCatalogResult, error)

func (*Service) ListPluginEnumValues

func (s *Service) ListPluginEnumValues(
	ctx context.Context,
	req *ListSyncPluginEnumValuesRequest,
) (*SyncPluginEnumValuesResult, error)

func (*Service) ListPluginFactories

func (*Service) ListSchedulerConnections added in v1.2.0

func (s *Service) ListSchedulerConnections(ctx context.Context) ([]*SchedulerConnection, error)

ListSchedulerConnections 返回脱敏后的调度器连接列表。 ListSchedulerConnections returns scheduler connections with tokens masked.

func (*Service) ListTaskVersions

func (s *Service) ListTaskVersions(ctx context.Context, id uint) ([]*TaskVersion, error)

ListTaskVersions returns all immutable snapshots for one file task.

func (*Service) ListTaskVersionsPaginated

func (s *Service) ListTaskVersionsPaginated(ctx context.Context, id uint, page, size int) ([]*TaskVersion, int64, error)

ListTaskVersionsPaginated returns paginated immutable snapshots for one file task.

func (*Service) ListTaskVersionsPaginatedForActor added in v1.0.0

func (s *Service) ListTaskVersionsPaginatedForActor(ctx context.Context, actor executionapp.Actor, id uint, page, size int) ([]*TaskVersion, int64, error)

ListTaskVersionsPaginatedForActor returns paginated snapshots after verifying view permission.

func (*Service) ListTasks

func (s *Service) ListTasks(ctx context.Context, filter *TaskFilter) ([]*Task, int64, error)

ListTasks returns paginated workspace nodes.

func (*Service) ParseCuratedCombo added in v1.0.0

func (s *Service) ParseCuratedCombo(_ context.Context, req *ParseCuratedComboRequest) (*CuratedComboParseData, error)

ParseCuratedCombo extracts env/source/transform/sink from full job content. ParseCuratedCombo 从完整作业正文提取 env/source/transform/sink 四节。

func (*Service) PreviewSinkSaveMode

func (s *Service) PreviewSinkSaveMode(
	ctx context.Context,
	taskID uint,
	req *PreviewSyncSinkSaveModeRequest,
) (*SyncSinkSaveModePreviewResult, error)

func (*Service) PreviewTask

func (s *Service) PreviewTask(ctx context.Context, id uint, createdBy uint, opts *PreviewTaskRequest) (*JobInstance, error)

PreviewTask derives preview config then submits a debug run if possible.

func (*Service) PreviewTaskForActor added in v1.0.0

func (s *Service) PreviewTaskForActor(ctx context.Context, actor executionapp.Actor, id uint, opts *PreviewTaskRequest, request ExecutionRequest) (*JobInstance, error)

PreviewTaskForActor 检查运行权限后启动预览任务。

func (*Service) PreviewTaskWithExecution

func (s *Service) PreviewTaskWithExecution(ctx context.Context, id, createdBy uint, opts *PreviewTaskRequest, request ExecutionRequest) (*JobInstance, error)

PreviewTaskWithExecution 创建公共执行记录后启动预览任务。 PreviewTaskWithExecution starts a preview task after creating its shared execution record.

func (*Service) PublishTask

func (s *Service) PublishTask(ctx context.Context, id uint, comment string, createdBy uint) (*Task, *TaskVersion, error)

PublishTask snapshots current file definition and marks task as published.

func (*Service) PublishTaskForActor added in v1.0.0

func (s *Service) PublishTaskForActor(ctx context.Context, actor executionapp.Actor, id uint, comment string, createdBy uint) (*Task, *TaskVersion, error)

PublishTaskForActor snapshots current file definition after checking edit permission.

func (*Service) PushDolphin added in v1.2.0

func (s *Service) PushDolphin(ctx context.Context, actor executionapp.Actor, taskID uint, req *DolphinPushRequest) (*DolphinPushResult, error)

PushDolphin 把任务推送到 Dolphin:新建工作流、复用已有工作流,或只更新已绑定节点。 PushDolphin pushes a task into Dolphin as a new workflow, a reused workflow, or a node-only update.

func (*Service) RecoverJob

func (s *Service) RecoverJob(ctx context.Context, sourceJobID uint, createdBy uint, draft *TaskDraftPayload) (*JobInstance, error)

RecoverJob recreates a run using the original platform job id as savepoint recovery source.

func (*Service) RecoverJobWithExecution

func (s *Service) RecoverJobWithExecution(ctx context.Context, sourceJobID, createdBy uint, draft *TaskDraftPayload, request ExecutionRequest) (*JobInstance, error)

RecoverJobWithExecution 创建公共执行记录后恢复作业。 RecoverJobWithExecution recovers a job after creating its shared execution record.

func (*Service) RefreshJobByID added in v1.2.0

func (s *Service) RefreshJobByID(ctx context.Context, id uint) (*JobInstance, error)

RefreshJobByID 主动从引擎刷新一条作业(?fresh=1 或对账器补详情时使用)。 RefreshJobByID actively refreshes one job from the engine (?fresh=1 or reconciler detail fetch).

func (*Service) RenderPluginTemplate

func (s *Service) RenderPluginTemplate(
	ctx context.Context,
	req *RenderSyncPluginTemplateRequest,
) (*SyncPluginTemplateResult, error)

func (*Service) RequestCancel

RequestCancel 实现公共执行协议的同步任务真实取消入口。 RequestCancel implements the real cancellation entry for sync jobs under the shared execution contract.

func (*Service) RollbackTaskVersion

func (s *Service) RollbackTaskVersion(ctx context.Context, id uint, versionID uint) (*Task, error)

RollbackTaskVersion restores one immutable snapshot back to the editable task.

func (*Service) RollbackTaskVersionForActor added in v1.0.0

func (s *Service) RollbackTaskVersionForActor(ctx context.Context, actor executionapp.Actor, id uint, versionID uint) (*Task, error)

RollbackTaskVersionForActor restores snapshot after checking edit permission.

func (*Service) SetAgentCommandSender

func (s *Service) SetAgentCommandSender(sender AgentCommandSender)

func (*Service) SetClusterLogProvider

func (s *Service) SetClusterLogProvider(provider ClusterLogProvider)

func (*Service) SetClusterVersionProvider

func (s *Service) SetClusterVersionProvider(provider ClusterVersionProvider)

func (*Service) SetConfigToolClient

func (s *Service) SetConfigToolClient(client ConfigToolClient)

SetConfigToolClient sets the java-proxy config tool client.

func (*Service) SetConfigToolResolver

func (s *Service) SetConfigToolResolver(resolver ConfigToolResolver)

SetConfigToolResolver sets the java-proxy endpoint resolver.

func (*Service) SetDolphinHTTPClient added in v1.2.0

func (s *Service) SetDolphinHTTPClient(client *http.Client)

SetDolphinHTTPClient 覆盖访问 Dolphin API 的 HTTP 客户端,测试可注入 httptest。 SetDolphinHTTPClient overrides the HTTP client used for Dolphin API calls so tests can inject httptest.

func (*Service) SetEngineClient

func (s *Service) SetEngineClient(client EngineClient)

SetEngineClient sets the SeaTunnel engine client used by submit/get/cancel flows.

func (*Service) SetExecutionService

func (s *Service) SetExecutionService(service *executionapp.Service)

SetExecutionService 设置公共执行协议服务。 SetExecutionService configures the shared execution-contract service.

func (*Service) SetExecutionTargetResolver

func (s *Service) SetExecutionTargetResolver(resolver ExecutionTargetResolver)

func (*Service) SetJobIDGenerator

func (s *Service) SetJobIDGenerator(generator *JobIDGenerator)

SetJobIDGenerator sets the platform job id generator.

func (*Service) SetRuntimeResolver

func (s *Service) SetRuntimeResolver(resolver ClusterRuntimeResolver)

SetRuntimeResolver sets the runtime endpoint resolver for cluster-backed submissions.

func (*Service) StartJobReconciler added in v1.2.0

func (s *Service) StartJobReconciler(ctx context.Context)

StartJobReconciler 启动按集群对账 SeaTunnel 作业状态的后台任务。 StartJobReconciler starts the per-cluster SeaTunnel job status reconciler.

func (*Service) StartPreviewRuntime

func (s *Service) StartPreviewRuntime(ctx context.Context)

StartPreviewRuntime starts background maintenance for preview sessions. StartPreviewRuntime 启动预览会话后台维护任务。

func (*Service) StartTaskScheduleRuntime

func (s *Service) StartTaskScheduleRuntime(ctx context.Context)

func (*Service) SubmitTask

func (s *Service) SubmitTask(ctx context.Context, id uint, createdBy uint, draft *TaskDraftPayload) (*JobInstance, error)

SubmitTask creates one formal run instance with platform-managed job id.

func (*Service) SubmitTaskForActor added in v1.0.0

func (s *Service) SubmitTaskForActor(ctx context.Context, actor executionapp.Actor, id uint, draft *TaskDraftPayload, request ExecutionRequest) (*JobInstance, error)

SubmitTaskForActor 检查运行权限后提交运行任务。

func (*Service) SubmitTaskForActorWithOptions added in v1.2.0

func (s *Service) SubmitTaskForActorWithOptions(ctx context.Context, actor executionapp.Actor, id uint, opts *SubmitOptions, request ExecutionRequest) (*JobInstance, error)

SubmitTaskForActorWithOptions 在权限和调度令牌校验后提交或接管作业。 SubmitTaskForActorWithOptions submits or attaches after permission and scheduler-token checks.

func (*Service) SubmitTaskWithExecution

func (s *Service) SubmitTaskWithExecution(ctx context.Context, id, createdBy uint, draft *TaskDraftPayload, request ExecutionRequest) (*JobInstance, error)

SubmitTaskWithExecution 创建公共执行记录后提交运行任务。 SubmitTaskWithExecution submits a run task after creating its shared execution record.

func (*Service) SubmitTaskWithExecutionOptions added in v1.2.0

func (s *Service) SubmitTaskWithExecutionOptions(ctx context.Context, id, createdBy uint, opts *SubmitOptions, request ExecutionRequest) (*JobInstance, error)

SubmitTaskWithExecutionOptions 先尝试按 external_ref 接管,未命中再创建公共执行记录并提交。 SubmitTaskWithExecutionOptions attaches by external_ref when possible, otherwise creates a shared execution and submits.

func (*Service) SubmitTaskWithOptions added in v1.2.0

func (s *Service) SubmitTaskWithOptions(ctx context.Context, id uint, createdBy uint, opts *SubmitOptions) (*JobInstance, error)

SubmitTaskWithOptions 按本次覆盖项提交作业;同一 external_ref 运行中则接管。 SubmitTaskWithOptions submits a job with per-run overrides and attaches when the same external_ref is still running.

func (*Service) TestTaskConnections

func (s *Service) TestTaskConnections(ctx context.Context, id uint, draft *TaskDraftPayload) (*ValidateResult, error)

TestTaskConnections validates connector connectivity for the task definition.

func (*Service) TestTaskConnectionsForActor added in v1.0.0

func (s *Service) TestTaskConnectionsForActor(ctx context.Context, actor executionapp.Actor, id uint, draft *TaskDraftPayload) (*ValidateResult, error)

TestTaskConnectionsForActor tests connections after checking run permission.

func (*Service) UnbindDolphin added in v1.2.0

func (s *Service) UnbindDolphin(ctx context.Context, actor executionapp.Actor, taskID uint) error

UnbindDolphin 只删除 STX 侧绑定,不改 Dolphin 节点,也不吊销管理员签发的登录令牌。 UnbindDolphin removes the STX binding without changing Dolphin nodes or revoking admin-issued login tokens.

func (*Service) UpdateCuratedTemplate added in v1.0.0

func (s *Service) UpdateCuratedTemplate(ctx context.Context, id uint, req *UpdateCuratedTemplateRequest, userID uint) (*CuratedTemplateView, error)

UpdateCuratedTemplate updates one owned curated template. UpdateCuratedTemplate 更新用户拥有的精选模板。

func (*Service) UpdateGlobalVariable

func (s *Service) UpdateGlobalVariable(ctx context.Context, id uint, req *UpdateGlobalVariableRequest) (*GlobalVariable, error)

UpdateGlobalVariable updates one workspace-wide variable and returns a masked safe copy. UpdateGlobalVariable 更新工作台全局变量并返回脱敏后的安全副本。

func (*Service) UpdateGlobalVariableForActor added in v1.0.0

func (s *Service) UpdateGlobalVariableForActor(ctx context.Context, actor executionapp.Actor, id uint, req *UpdateGlobalVariableRequest) (*GlobalVariable, error)

UpdateGlobalVariableForActor updates one workspace-wide variable after enforcing actor permissions. Ordinary users can only edit variables they created; administrators can edit any variable.

func (*Service) UpdateSchedulerConnection added in v1.2.0

func (s *Service) UpdateSchedulerConnection(ctx context.Context, id uint, req *SchedulerConnectionRequest) (*SchedulerConnection, error)

UpdateSchedulerConnection 更新调度器连接;空 token 表示保留原值。 UpdateSchedulerConnection updates a scheduler connection and keeps the previous token when the new one is empty.

func (*Service) UpdateTask

func (s *Service) UpdateTask(ctx context.Context, id uint, req *UpdateTaskRequest) (*Task, error)

UpdateTask updates one workspace node.

func (*Service) UpdateTaskForActor added in v1.0.0

func (s *Service) UpdateTaskForActor(ctx context.Context, actor executionapp.Actor, id uint, req *UpdateTaskRequest) (*Task, error)

UpdateTaskForActor updates one workspace node after enforcing actor permissions.

func (*Service) UpdateTaskPermissionsForActor added in v1.0.0

func (s *Service) UpdateTaskPermissionsForActor(ctx context.Context, actor executionapp.Actor, id uint, req *UpdateTaskPermissionsRequest) (*TaskPermissions, *TaskPermissions, error)

UpdateTaskPermissionsForActor 只修改共享字段,并返回修改前后的值供审计记录使用。 UpdateTaskPermissionsForActor changes only sharing fields and returns before/after values for audit.

func (*Service) ValidateTask

func (s *Service) ValidateTask(ctx context.Context, id uint, draft *TaskDraftPayload) (*ValidateResult, error)

ValidateTask validates current file content.

func (*Service) ValidateTaskForActor added in v1.0.0

func (s *Service) ValidateTaskForActor(ctx context.Context, actor executionapp.Actor, id uint, draft *TaskDraftPayload) (*ValidateResult, error)

ValidateTaskForActor validates task after checking view permission.

type SinkSaveModePreviewResponse

type SinkSaveModePreviewResponse struct {
	ErrorMsg string                         `json:"error_msg"`
	Data     *SyncSinkSaveModePreviewResult `json:"data"`
}

type SubmitOptions added in v1.2.0

type SubmitOptions struct {
	Draft        *TaskDraftPayload
	Variables    map[string]string
	ExternalRef  string
	ScheduleTime time.Time
	CloseJob     *bool
}

SubmitOptions 描述一次正式提交的可选覆盖项,空值保持原有提交行为。 SubmitOptions holds optional per-submit overrides; empty values keep legacy submit behavior.

type SyncPluginEnumCatalogPlugin

type SyncPluginEnumCatalogPlugin struct {
	PluginType        string                       `json:"plugin_type"`
	FactoryIdentifier string                       `json:"factory_identifier"`
	Options           []SyncPluginOptionDescriptor `json:"options"`
}

type SyncPluginEnumCatalogResult

type SyncPluginEnumCatalogResult struct {
	EnvOptions []SyncPluginOptionDescriptor  `json:"env_options"`
	Plugins    []SyncPluginEnumCatalogPlugin `json:"plugins"`
	Warnings   []string                      `json:"warnings,omitempty"`
}

type SyncPluginEnumValuesResult

type SyncPluginEnumValuesResult struct {
	PluginType        string   `json:"plugin_type"`
	FactoryIdentifier string   `json:"factory_identifier"`
	OptionKey         string   `json:"option_key"`
	EnumValues        []string `json:"enum_values"`
	Warnings          []string `json:"warnings,omitempty"`
}

type SyncPluginFactoryInfo

type SyncPluginFactoryInfo struct {
	FactoryIdentifier string `json:"factory_identifier"`
	ClassName         string `json:"class_name,omitempty"`
	Origin            string `json:"origin,omitempty"`
}

type SyncPluginFactoryListResult

type SyncPluginFactoryListResult struct {
	PluginType string                  `json:"plugin_type"`
	Plugins    []SyncPluginFactoryInfo `json:"plugins"`
	Warnings   []string                `json:"warnings,omitempty"`
}

type SyncPluginOptionDescriptor

type SyncPluginOptionDescriptor struct {
	Key                 string      `json:"key"`
	Type                string      `json:"type,omitempty"`
	ElementType         string      `json:"element_type,omitempty"`
	DefaultValue        interface{} `json:"default_value,omitempty"`
	Description         string      `json:"description,omitempty"`
	FallbackKeys        []string    `json:"fallback_keys,omitempty"`
	EnumValues          []string    `json:"enum_values,omitempty"`
	EnumDisplayValues   []string    `json:"enum_display_values,omitempty"`
	RequiredMode        string      `json:"required_mode,omitempty"`
	ConditionExpression string      `json:"condition_expression,omitempty"`
	ConstraintGroup     string      `json:"constraint_group,omitempty"`
	Origins             []string    `json:"origins,omitempty"`
	DeclaredClasses     []string    `json:"declared_classes,omitempty"`
	Advanced            bool        `json:"advanced"`
}

type SyncPluginOptionSchemaResult

type SyncPluginOptionSchemaResult struct {
	PluginType        string                       `json:"plugin_type"`
	FactoryIdentifier string                       `json:"factory_identifier"`
	Options           []SyncPluginOptionDescriptor `json:"options"`
	ValueConstraints  []map[string]interface{}     `json:"value_constraints,omitempty"`
	ConditionRules    []map[string]interface{}     `json:"condition_rules,omitempty"`
	Warnings          []string                     `json:"warnings,omitempty"`
}

type SyncPluginTemplateResult

type SyncPluginTemplateResult struct {
	PluginType        string   `json:"plugin_type"`
	FactoryIdentifier string   `json:"factory_identifier"`
	ContentFormat     string   `json:"content_format"`
	Template          string   `json:"template"`
	Warnings          []string `json:"warnings,omitempty"`
}

type SyncPluginType

type SyncPluginType string
const (
	SyncPluginTypeSource    SyncPluginType = "source"
	SyncPluginTypeTransform SyncPluginType = "transform"
	SyncPluginTypeSink      SyncPluginType = "sink"
	SyncPluginTypeCatalog   SyncPluginType = "catalog"
)

type SyncSinkSaveModePreviewAction

type SyncSinkSaveModePreviewAction struct {
	Phase      string `json:"phase,omitempty"`
	ActionType string `json:"action_type,omitempty"`
	ResultType string `json:"result_type,omitempty"`
	Content    string `json:"content,omitempty"`
	Native     bool   `json:"native"`
}

type SyncSinkSaveModePreviewResult

type SyncSinkSaveModePreviewResult struct {
	Connector      string                          `json:"connector,omitempty"`
	SinkIndex      int                             `json:"sink_index,omitempty"`
	Supported      bool                            `json:"supported"`
	Completeness   string                          `json:"completeness,omitempty"`
	SchemaSaveMode string                          `json:"schema_save_mode,omitempty"`
	DataSaveMode   string                          `json:"data_save_mode,omitempty"`
	TablePath      string                          `json:"table_path,omitempty"`
	Actions        []SyncSinkSaveModePreviewAction `json:"actions,omitempty"`
	Tables         []SyncSinkSaveModePreviewTable  `json:"tables,omitempty"`
	Warnings       []string                        `json:"warnings,omitempty"`
}

type SyncSinkSaveModePreviewTable

type SyncSinkSaveModePreviewTable struct {
	TablePath      string                          `json:"table_path,omitempty"`
	Supported      bool                            `json:"supported"`
	Completeness   string                          `json:"completeness,omitempty"`
	SchemaSaveMode string                          `json:"schema_save_mode,omitempty"`
	DataSaveMode   string                          `json:"data_save_mode,omitempty"`
	Actions        []SyncSinkSaveModePreviewAction `json:"actions,omitempty"`
	Warnings       []string                        `json:"warnings,omitempty"`
}

type Task

type Task struct {
	ID            uint          `json:"id" gorm:"primaryKey;autoIncrement"`
	ParentID      *uint         `json:"parent_id,omitempty" gorm:"index"`
	NodeType      TaskNodeType  `json:"node_type" gorm:"size:20;not null;default:file;index"`
	Name          string        `json:"name" gorm:"size:120;not null;index"`
	Description   string        `json:"description" gorm:"type:text"`
	ClusterID     uint          `json:"cluster_id" gorm:"index"`
	EngineVersion string        `json:"engine_version" gorm:"size:50"`
	Mode          TaskMode      `json:"mode" gorm:"size:20;default:streaming"`
	Status        TaskStatus    `json:"status" gorm:"size:20;default:draft;index"`
	ContentFormat ContentFormat `json:"content_format" gorm:"size:20;not null;default:hocon"`
	// Content 存储任务定义内容(HOCON 或 JSON);MySQL 用 MEDIUMTEXT,PG/SQLite 用 TEXT。
	// Content stores task definition (HOCON/JSON); MySQL uses MEDIUMTEXT, PG/SQLite use TEXT.
	Content                 db.ScriptText `json:"content"`
	JobName                 string        `json:"job_name" gorm:"size:255"`
	Definition              JSONMap       `json:"definition" gorm:"type:json"`
	SortOrder               int           `json:"sort_order" gorm:"default:0;index"`
	CurrentVersion          int           `json:"current_version" gorm:"default:0"`
	ScheduleEnabled         bool          `json:"schedule_enabled" gorm:"-"`
	ScheduleCronExpr        string        `json:"schedule_cron_expr,omitempty" gorm:"-"`
	ScheduleTimezone        string        `json:"schedule_timezone,omitempty" gorm:"-"`
	ScheduleLastTriggeredAt *time.Time    `json:"schedule_last_triggered_at,omitempty" gorm:"-"`
	ScheduleNextTriggeredAt *time.Time    `json:"schedule_next_triggered_at,omitempty" gorm:"-"`
	CanEdit                 bool          `json:"can_edit" gorm:"-"`
	CanRun                  bool          `json:"can_run" gorm:"-"`
	IsOwner                 bool          `json:"is_owner" gorm:"-"`
	IsCollaborator          bool          `json:"is_collaborator" gorm:"-"`
	IsPublicTask            bool          `json:"is_public" gorm:"-"`
	CreatedBy               uint          `json:"created_by"`
	CreatedAt               time.Time     `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt               time.Time     `json:"updated_at" gorm:"autoUpdateTime"`
}

Task represents one sync studio workspace node. Task 表示一个数据同步工作台节点。

func (*Task) CanUserEdit added in v1.0.0

func (t *Task) CanUserEdit(userID uint, isAdmin bool) bool

CanUserEdit reports whether the given user can edit, save, or delete this task.

func (*Task) CanUserRun added in v1.0.0

func (t *Task) CanUserRun(userID uint, isAdmin bool) bool

CanUserRun reports whether the given user can run/submit/preview this task.

func (*Task) CanUserView added in v1.0.0

func (t *Task) CanUserView(userID uint, isAdmin bool) bool

CanUserView reports whether the given user can view this task.

func (*Task) CollaboratorIDs added in v1.0.0

func (t *Task) CollaboratorIDs() []uint

CollaboratorIDs returns the list of user IDs specified as co-developers.

func (*Task) DecoratePermissions added in v1.0.0

func (t *Task) DecoratePermissions(userID uint, isAdmin bool)

DecoratePermissions populates permission flags based on the caller's identity.

func (*Task) HasCollaborator added in v1.0.0

func (t *Task) HasCollaborator(userID uint) bool

HasCollaborator checks if the given user ID is in collaborators list.

func (*Task) IsPublic added in v1.0.0

func (t *Task) IsPublic() bool

IsPublic reports whether this task is publicly visible in the workspace.

func (Task) TableName

func (Task) TableName() string

TableName returns the sync task table name. TableName 返回同步任务表名。

type TaskActionRequest

type TaskActionRequest struct {
	Draft        *TaskDraftPayload `json:"draft,omitempty"`
	Variables    map[string]string `json:"variables,omitempty"`
	ExternalRef  string            `json:"external_ref,omitempty"`
	ScheduleTime string            `json:"schedule_time,omitempty"`
	CloseJob     *bool             `json:"close_job,omitempty"`
}

TaskActionRequest represents an action request with an optional unsaved draft.

type TaskDraftPayload

type TaskDraftPayload struct {
	Name          string  `json:"name"`
	Description   string  `json:"description"`
	ClusterID     uint    `json:"cluster_id"`
	EngineVersion string  `json:"engine_version"`
	Mode          string  `json:"mode"`
	ContentFormat string  `json:"content_format"`
	Content       string  `json:"content"`
	JobName       string  `json:"job_name"`
	Definition    JSONMap `json:"definition"`
}

TaskDraftPayload represents one unsaved in-memory task draft used by actions.

type TaskFilter

type TaskFilter struct {
	Name   string
	Status TaskStatus
	Page   int
	Size   int
}

TaskFilter represents task list query filters.

type TaskListData

type TaskListData struct {
	Total int64   `json:"total"`
	Items []*Task `json:"items"`
}

TaskListData represents task list response data.

type TaskListResponse

type TaskListResponse struct {
	ErrorMsg string        `json:"error_msg"`
	Data     *TaskListData `json:"data"`
}

type TaskMode

type TaskMode string

TaskMode represents sync task runtime mode. TaskMode 表示同步任务运行模式。

const (
	TaskModeStreaming TaskMode = "streaming"
	TaskModeBatch     TaskMode = "batch"
)

type TaskNodeType

type TaskNodeType string

TaskNodeType represents sync workspace node type. TaskNodeType 表示同步工作台节点类型。

const (
	TaskNodeTypeFolder TaskNodeType = "folder"
	TaskNodeTypeFile   TaskNodeType = "file"
)

type TaskPermissions added in v1.0.0

type TaskPermissions struct {
	TaskID          uint   `json:"task_id"`
	IsPublic        bool   `json:"is_public"`
	CollaboratorIDs []uint `json:"collaborator_ids"`
	CanEdit         bool   `json:"can_edit"`
	CanManage       bool   `json:"can_manage"`
	IsOwner         bool   `json:"is_owner"`
	IsCollaborator  bool   `json:"is_collaborator"`
}

TaskPermissions 只包含独立权限接口对外提供的共享字段。 TaskPermissions contains only the sharing fields exposed by the dedicated permissions API.

type TaskPermissionsResponse added in v1.0.0

type TaskPermissionsResponse struct {
	ErrorMsg string           `json:"error_msg"`
	Data     *TaskPermissions `json:"data"`
}

type TaskResponse

type TaskResponse struct {
	ErrorMsg string `json:"error_msg"`
	Data     *Task  `json:"data"`
}

type TaskSchedulerBinding added in v1.2.0

type TaskSchedulerBinding struct {
	ID           uint       `json:"id" gorm:"primaryKey;autoIncrement"`
	TaskID       uint       `json:"task_id" gorm:"uniqueIndex;not null"`
	Kind         string     `json:"kind" gorm:"size:32;not null;index;default:dolphin"`
	ConnectionID uint       `json:"connection_id" gorm:"index;not null"`
	ProjectCode  int64      `json:"project_code" gorm:"not null"`
	WorkflowCode int64      `json:"workflow_code" gorm:"not null"`
	TaskCode     int64      `json:"task_code" gorm:"not null"`
	WorkflowName string     `json:"workflow_name" gorm:"size:255"`
	ConsoleURL   string     `json:"console_url" gorm:"size:1024"`
	PushedAt     *time.Time `json:"pushed_at"`
	PushedBy     uint       `json:"pushed_by"`
	// TaskVersion 记录这次推送对应的 STX 已发布版本;同一版本不能再更新推送。
	// TaskVersion is the STX published version this push deployed; the same version cannot be pushed again.
	TaskVersion int       `json:"task_version"`
	CreatedAt   time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

TaskSchedulerBinding 记录任务与 Dolphin 项目/工作流/节点的绑定,不保存上下游。 TaskSchedulerBinding records the task-to-Dolphin project/workflow/node mapping without upstream/downstream.

func (TaskSchedulerBinding) TableName added in v1.2.0

func (TaskSchedulerBinding) TableName() string

TableName 指定任务调度绑定表名。 TableName specifies the task scheduler binding table.

type TaskStatus

type TaskStatus string

TaskStatus represents sync task lifecycle status. TaskStatus 表示同步任务生命周期状态。

const (
	TaskStatusDraft     TaskStatus = "draft"
	TaskStatusPublished TaskStatus = "published"
	TaskStatusArchived  TaskStatus = "archived"
)

type TaskTreeData

type TaskTreeData struct {
	Items []*TaskTreeNode `json:"items"`
}

TaskTreeData represents tree response payload.

type TaskTreeNode

type TaskTreeNode struct {
	ID                      uint            `json:"id"`
	ParentID                *uint           `json:"parent_id,omitempty"`
	NodeType                TaskNodeType    `json:"node_type"`
	Name                    string          `json:"name"`
	Description             string          `json:"description"`
	ClusterID               uint            `json:"cluster_id"`
	EngineVersion           string          `json:"engine_version"`
	Mode                    TaskMode        `json:"mode"`
	Status                  TaskStatus      `json:"status"`
	ContentFormat           ContentFormat   `json:"content_format"`
	Content                 string          `json:"content"`
	JobName                 string          `json:"job_name"`
	Definition              JSONMap         `json:"definition"`
	SortOrder               int             `json:"sort_order"`
	CurrentVersion          int             `json:"current_version"`
	ScheduleEnabled         bool            `json:"schedule_enabled,omitempty"`
	ScheduleCronExpr        string          `json:"schedule_cron_expr,omitempty"`
	ScheduleTimezone        string          `json:"schedule_timezone,omitempty"`
	ScheduleLastTriggeredAt *time.Time      `json:"schedule_last_triggered_at,omitempty"`
	ScheduleNextTriggeredAt *time.Time      `json:"schedule_next_triggered_at,omitempty"`
	CreatedBy               uint            `json:"created_by"`
	CanEdit                 bool            `json:"can_edit"`
	CanRun                  bool            `json:"can_run"`
	IsOwner                 bool            `json:"is_owner"`
	IsCollaborator          bool            `json:"is_collaborator"`
	IsPublicTask            bool            `json:"is_public"`
	Children                []*TaskTreeNode `json:"children,omitempty"`
}

TaskTreeNode represents one node in the sync workspace tree.

type TaskTreeResponse

type TaskTreeResponse struct {
	ErrorMsg string        `json:"error_msg"`
	Data     *TaskTreeData `json:"data"`
}

type TaskVersion

type TaskVersion struct {
	ID                    uint          `json:"id" gorm:"primaryKey;autoIncrement"`
	TaskID                uint          `json:"task_id" gorm:"index;not null"`
	Version               int           `json:"version" gorm:"not null"`
	NameSnapshot          string        `json:"name_snapshot" gorm:"size:120"`
	DescriptionSnapshot   string        `json:"description_snapshot" gorm:"type:text"`
	ClusterIDSnapshot     uint          `json:"cluster_id_snapshot"`
	EngineVersionSnapshot string        `json:"engine_version_snapshot" gorm:"size:50"`
	ModeSnapshot          TaskMode      `json:"mode_snapshot" gorm:"size:20"`
	ContentFormatSnapshot ContentFormat `json:"content_format_snapshot" gorm:"size:20"`
	// ContentSnapshot 存储版本快照内容(HOCON 或 JSON);MySQL 用 MEDIUMTEXT,PG/SQLite 用 TEXT。
	// ContentSnapshot stores version snapshot (HOCON/JSON); MySQL uses MEDIUMTEXT, PG/SQLite use TEXT.
	ContentSnapshot    db.ScriptText `json:"content_snapshot"`
	JobNameSnapshot    string        `json:"job_name_snapshot" gorm:"size:255"`
	DefinitionSnapshot JSONMap       `json:"definition_snapshot" gorm:"type:json"`
	Comment            string        `json:"comment" gorm:"size:255"`
	CreatedBy          uint          `json:"created_by"`
	CreatedAt          time.Time     `json:"created_at" gorm:"autoCreateTime"`
}

TaskVersion stores one immutable snapshot of a sync file task. TaskVersion 存储同步文件任务的一次不可变快照。

func (TaskVersion) TableName

func (TaskVersion) TableName() string

TableName returns the sync task version table name. TableName 返回同步任务版本表名。

type TaskVersionListData

type TaskVersionListData struct {
	Total int64          `json:"total"`
	Items []*TaskVersion `json:"items"`
}

TaskVersionListData represents paginated task versions.

type TaskVersionListResponse

type TaskVersionListResponse struct {
	ErrorMsg string               `json:"error_msg"`
	Data     *TaskVersionListData `json:"data"`
}

type TaskVersionResponse

type TaskVersionResponse struct {
	ErrorMsg string       `json:"error_msg"`
	Data     *TaskVersion `json:"data"`
}

type UpdateCuratedTemplateRequest added in v1.0.0

type UpdateCuratedTemplateRequest struct {
	Name        *string  `json:"name"`
	Description *string  `json:"description"`
	Section     *string  `json:"section"`
	Mode        *string  `json:"mode"`
	Pattern     *string  `json:"pattern"`
	Connectors  []string `json:"connectors"`
	Content     *string  `json:"content"`
	Enabled     *bool    `json:"enabled"`
}

UpdateCuratedTemplateRequest updates one user curated template. UpdateCuratedTemplateRequest 更新一条用户精选模板。

type UpdateGlobalVariableRequest

type UpdateGlobalVariableRequest struct {
	Key         string `json:"key" binding:"required"`
	Value       string `json:"value"`
	ValueType   string `json:"value_type"`
	Description string `json:"description"`
}

UpdateGlobalVariableRequest represents one global variable update payload. UpdateGlobalVariableRequest 表示更新全局变量请求体。

type UpdateTaskPermissionsRequest added in v1.0.0

type UpdateTaskPermissionsRequest struct {
	IsPublic        *bool  `json:"is_public"`
	CollaboratorIDs []uint `json:"collaborator_ids"`
}

UpdateTaskPermissionsRequest 表示一次只修改共享权限字段的请求。 UpdateTaskPermissionsRequest represents a partial sharing-permission update.

type UpdateTaskRequest

type UpdateTaskRequest struct {
	ParentID      *uint   `json:"parent_id"`
	NodeType      string  `json:"node_type"`
	Name          string  `json:"name" binding:"required"`
	Description   string  `json:"description"`
	ClusterID     uint    `json:"cluster_id"`
	EngineVersion string  `json:"engine_version"`
	Mode          string  `json:"mode"`
	ContentFormat string  `json:"content_format"`
	Content       string  `json:"content"`
	JobName       string  `json:"job_name"`
	SortOrder     int     `json:"sort_order"`
	Definition    JSONMap `json:"definition"`
}

UpdateTaskRequest represents the payload for updating a sync workspace node.

type ValidateCheck

type ValidateCheck struct {
	NodeID        string `json:"node_id"`
	Kind          string `json:"kind"`
	ConnectorType string `json:"connector_type"`
	Target        string `json:"target,omitempty"`
	Status        string `json:"status"`
	Message       string `json:"message"`
}

ValidateCheck represents one connector config/connection validation entry.

type ValidateResponse

type ValidateResponse struct {
	ErrorMsg string          `json:"error_msg"`
	Data     *ValidateResult `json:"data"`
}

type ValidateResult

type ValidateResult struct {
	Valid         bool              `json:"valid"`
	Errors        []string          `json:"errors"`
	Warnings      []string          `json:"warnings"`
	Summary       string            `json:"summary"`
	Resolved      map[string]string `json:"resolved,omitempty"`
	DetectedVars  []string          `json:"detected_vars,omitempty"`
	DetectedFiles []string          `json:"detected_files,omitempty"`
	Checks        []ValidateCheck   `json:"checks,omitempty"`
}

ValidateResult represents validation result payload.

Jump to

Keyboard shortcuts

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