sync

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 30 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"
)

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")
)

Functions

This section is empty.

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 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)
}

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"`
	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 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 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 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)
	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 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"`
}

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 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 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) CollectPreview

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

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

func (*Handler) CreateGlobalVariable

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

CreateGlobalVariable handles POST /api/v1/sync/global-variables.

func (*Handler) CreateTask

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

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

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) 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) GetTaskTree

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

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

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) 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) 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) RecoverJob

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

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

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) 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) UpdateGlobalVariable

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

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

func (*Handler) UpdateTask

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

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

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"`
	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"`
}

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"`
	EmptyReason string `json:"empty_reason,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"
	JobStatusSuccess         JobStatus = "success"
	JobStatusFailed          JobStatus = "failed"
	JobStatusCanceled        JobStatus = "canceled"
)

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 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) Transaction

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

Transaction executes fn inside one database transaction.

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) 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) 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 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) 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) 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) CancelJobForActor

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

CancelJobForActor 在归属检查后请求取消作业。 CancelJobForActor requests cancellation after enforcing ownership.

func (*Service) CollectPreview

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

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) CreateTask

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

CreateTask creates one workspace node.

func (*Service) DeleteGlobalVariable

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

DeleteGlobalVariable deletes one workspace-wide 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) DeleteTaskVersion

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

DeleteTaskVersion removes one immutable snapshot.

func (*Service) GetJob

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

GetJob returns one job instance and refreshes live runtime state when possible.

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 ownership.

func (*Service) GetJobForActor

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

GetJobForActor 按当前用户归属读取一个作业。 GetJobForActor loads one job under the current user's ownership 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 ownership.

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 ownership.

func (*Service) GetTask

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

GetTask returns one workspace node.

func (*Service) GetTaskTree

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

GetTaskTree returns nested workspace nodes for the left tree.

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.

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 may view all jobs.

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) 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) ListTasks

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

ListTasks returns paginated workspace nodes.

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) 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) 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) 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) 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) 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) 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) 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) TestTaskConnections

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

TestTaskConnections validates connector connectivity for the task definition.

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) UpdateTask

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

UpdateTask updates one workspace node.

func (*Service) ValidateTask

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

ValidateTask validates current file content.

type SinkSaveModePreviewResponse

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

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"`
	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),兼容多数据库。
	// Content stores task definition content (HOCON or JSON), compatible with multiple databases.
	Content                 string     `json:"content" gorm:"type:text"`
	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:"-"`
	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) TableName

func (Task) TableName() string

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

type TaskActionRequest

type TaskActionRequest struct {
	Draft *TaskDraftPayload `json:"draft,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 TaskResponse

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

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"`
	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),兼容多数据库。
	// ContentSnapshot stores version snapshot content (HOCON or JSON), compatible with multiple databases.
	ContentSnapshot    string    `json:"content_snapshot" gorm:"type:text"`
	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 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 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