plugin

package
v0.0.2-rc1 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

Overview

Package plugin provides SeaTunnel plugin marketplace management. plugin 包提供 SeaTunnel 插件市场管理功能。

  • Licensed to the Apache Software Foundation (ASF) under one or more
  • contributor license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright ownership.
  • The ASF licenses this file to You under the Apache License, Version 2.0
  • (the "License"); you may not use this file except in compliance with
  • the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Package plugin provides SeaTunnel plugin marketplace management. plugin 包提供 SeaTunnel 插件市场管理功能。

Index

Constants

View Source
const (
	// ConnectorRepoGroupPath is the Maven group path used for SeaTunnel connectors.
	// ConnectorRepoGroupPath 是 SeaTunnel 连接器所在的 Maven group 路径。
	ConnectorRepoGroupPath = "org/apache/seatunnel"
	// SeaTunnel documentation URL for connector docs / SeaTunnel 文档 URL,用于连接器文档
	SeaTunnelDocsBaseURL = "https://seatunnel.apache.org/zh-CN/docs"
	// HTTP request timeout for fetching plugin list / 获取插件列表的 HTTP 请求超时
	PluginFetchTimeout = 60 * time.Second
)

SeaTunnel Maven repository and documentation URLs SeaTunnel Maven 仓库和文档 URL

Variables

View Source
var (
	ErrDownloadFailed     = errors.New("download failed / 下载失败")
	ErrChecksumMismatch   = errors.New("checksum mismatch / 校验和不匹配")
	ErrFileNotFound       = errors.New("file not found on server / 服务器上未找到文件")
	ErrDownloadCancelled  = errors.New("download cancelled / 下载已取消")
	ErrDownloadInProgress = errors.New("download already in progress / 下载正在进行中")
)

Downloader errors / 下载器错误

View Source
var (
	ErrInvalidVersion      = errors.New("invalid version / 无效的版本号")
	ErrInvalidMirror       = errors.New("invalid mirror source / 无效的镜像源")
	ErrPluginNotAvailable  = errors.New("plugin not available / 插件不可用")
	ErrClusterNotFound     = errors.New("cluster not found / 集群未找到")
	ErrPluginAlreadyExists = errors.New("plugin already installed / 插件已安装")
	ErrVersionMismatch     = errors.New("plugin version does not match cluster version / 插件版本与集群版本不匹配")
	ErrClusterVersionEmpty = errors.New("cluster version is not set / 集群版本未设置")
)

Common service errors / 常见服务错误

View Source
var (
	ErrPluginNotFound = errors.New("plugin not found / 插件未找到")
)

Common errors / 常见错误

View Source
var MirrorURLs = map[MirrorSource]string{
	MirrorSourceApache:      "https://repo.maven.apache.org/maven2",
	MirrorSourceAliyun:      "https://maven.aliyun.com/repository/public",
	MirrorSourceHuaweiCloud: "https://repo.huaweicloud.com/repository/maven",
}

MirrorURLs maps mirror sources to their Maven repository base URLs. MirrorURLs 将镜像源映射到其 Maven 仓库基础 URL。

Functions

This section is empty.

Types

type AddDependencyRequest

type AddDependencyRequest struct {
	PluginName       string `json:"plugin_name"`                    // 插件名称(从 URL 获取)/ Plugin name (from URL)
	SeatunnelVersion string `json:"seatunnel_version,omitempty"`    // SeaTunnel 版本(用于推导默认 target_dir)/ SeaTunnel version
	GroupID          string `json:"group_id" binding:"required"`    // Maven groupId
	ArtifactID       string `json:"artifact_id" binding:"required"` // Maven artifactId
	Version          string `json:"version" binding:"required"`     // 版本号(必填)/ Version (required)
	TargetDir        string `json:"target_dir,omitempty"`           // 目标目录(可选)/ Target directory
}

AddDependencyRequest represents a request to add a dependency to a plugin. AddDependencyRequest 表示为插件添加依赖的请求。

type AddDependencyResponse

type AddDependencyResponse struct {
	ErrorMsg string                  `json:"error_msg"`
	Data     *PluginDependencyConfig `json:"data"`
}

AddDependencyResponse represents the response for adding a dependency. AddDependencyResponse 表示添加依赖的响应。

type AgentCommandSender

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

AgentCommandSender is an interface for sending commands to agents. AgentCommandSender 是向 Agent 发送命令的接口。

type AnalyzeOfficialDependenciesRequest

type AnalyzeOfficialDependenciesRequest struct {
	Version      string `json:"version"`
	ProfileKey   string `json:"profile_key"`
	ForceRefresh bool   `json:"force_refresh"`
}

AnalyzeOfficialDependenciesRequest represents analyze request payload. AnalyzeOfficialDependenciesRequest 表示在线分析请求。

type AvailablePluginsResponse

type AvailablePluginsResponse struct {
	Plugins             []Plugin         `json:"plugins"`                         // 插件列表 / Plugin list
	Total               int              `json:"total"`                           // 总数 / Total count
	Version             string           `json:"version"`                         // SeaTunnel 版本 / SeaTunnel version
	Mirror              string           `json:"mirror"`                          // 当前请求镜像源 / Requested mirror
	Source              PluginListSource `json:"source"`                          // 数据来源 / Data source
	CacheHit            bool             `json:"cache_hit"`                       // 是否命中缓存 / Whether cache was hit
	CatalogSourceMirror string           `json:"catalog_source_mirror,omitempty"` // 目录实际来源镜像 / Catalog source mirror
	CatalogRefreshedAt  *time.Time       `json:"catalog_refreshed_at,omitempty"`  // 最近刷新时间 / Catalog refreshed at
}

type AvailableVersionsResponse

type AvailableVersionsResponse struct {
	Versions           []string `json:"versions"`            // 版本列表 / Version list
	RecommendedVersion string   `json:"recommended_version"` // 推荐版本 / Recommended version
	Warning            string   `json:"warning,omitempty"`   // 警告信息 / Warning message
}

AvailableVersionsResponse represents the response for listing available versions. AvailableVersionsResponse 表示获取可用版本列表的响应。

type ClusterGetter

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

ClusterGetter is an interface for getting cluster information. ClusterGetter 是获取集群信息的接口。

type ClusterNodeGetter

type ClusterNodeGetter interface {
	GetClusterNodes(ctx context.Context, clusterID uint) ([]ClusterNodeInfo, error)
}

ClusterNodeGetter is an interface for getting cluster nodes. ClusterNodeGetter 是获取集群节点的接口。

type ClusterNodeInfo

type ClusterNodeInfo struct {
	NodeID     uint   // Node ID / 节点 ID
	HostID     uint   // Host ID / 主机 ID
	InstallDir string // SeaTunnel installation directory / SeaTunnel 安装目录
}

ClusterNodeInfo represents node information needed for plugin installation. ClusterNodeInfo 表示插件安装所需的节点信息。

type DeleteDependencyResponse

type DeleteDependencyResponse struct {
	ErrorMsg string `json:"error_msg"`
	Data     any    `json:"data"`
}

DeleteDependencyResponse represents the response for deleting a dependency. DeleteDependencyResponse 表示删除依赖的响应。

type DeleteLocalPluginResponse

type DeleteLocalPluginResponse struct {
	ErrorMsg string `json:"error_msg"`
	Data     any    `json:"data"`
}

DeleteLocalPluginResponse represents the response for deleting a local plugin. DeleteLocalPluginResponse 表示删除本地插件的响应。

type DependencyResolutionMode

type DependencyResolutionMode string

DependencyResolutionMode represents how effective dependencies are resolved. DependencyResolutionMode 表示生效依赖的解析模式。

const (
	DependencyResolutionModeExact    DependencyResolutionMode = "exact"
	DependencyResolutionModeFallback DependencyResolutionMode = "fallback"
	DependencyResolutionModeRuntime  DependencyResolutionMode = "runtime"
	DependencyResolutionModeNone     DependencyResolutionMode = "none"
)

type DisableDependencyRequest

type DisableDependencyRequest struct {
	PluginName       string `json:"plugin_name"`                 // 插件名称(从 URL 获取)/ Plugin name (from URL)
	SeatunnelVersion string `json:"seatunnel_version,omitempty"` // SeaTunnel 版本 / SeaTunnel version
	GroupID          string `json:"group_id" binding:"required"`
	ArtifactID       string `json:"artifact_id" binding:"required"`
	Version          string `json:"version" binding:"required"`
	TargetDir        string `json:"target_dir" binding:"required"`
}

DisableDependencyRequest represents a request to disable one official dependency item. DisableDependencyRequest 表示禁用一条官方依赖的请求。

type DisableDependencyResponse

type DisableDependencyResponse struct {
	ErrorMsg string                   `json:"error_msg"`
	Data     *PluginDependencyDisable `json:"data"`
}

DisableDependencyResponse represents the response for disabling one official dependency item. DisableDependencyResponse 表示禁用官方依赖的响应。

type DownloadAllPluginsProgress

type DownloadAllPluginsProgress struct {
	Total      int    `json:"total"`      // 总插件数 / Total plugins
	Downloaded int    `json:"downloaded"` // 已下载数 / Downloaded count
	Failed     int    `json:"failed"`     // 失败数 / Failed count
	Skipped    int    `json:"skipped"`    // 跳过数(已存在)/ Skipped count (already exists)
	Status     string `json:"status"`     // 状态 / Status
	Message    string `json:"message"`    // 消息 / Message
}

DownloadAllPluginsProgress represents the progress of downloading all plugins. DownloadAllPluginsProgress 表示下载所有插件的进度。

type DownloadAllPluginsRequest

type DownloadAllPluginsRequest struct {
	Version                string              `json:"version" binding:"required"`         // 版本号 / Version
	Mirror                 MirrorSource        `json:"mirror,omitempty"`                   // 镜像源 / Mirror source
	SelectedPluginProfiles map[string][]string `json:"selected_plugin_profiles,omitempty"` // 按插件传入的画像选择 / Profile selections keyed by plugin
}

DownloadAllPluginsRequest represents a request to download all plugins. DownloadAllPluginsRequest 表示下载所有插件的请求。

type DownloadAllPluginsResponse

type DownloadAllPluginsResponse struct {
	ErrorMsg string                      `json:"error_msg"`
	Data     *DownloadAllPluginsProgress `json:"data"`
}

DownloadAllPluginsResponse represents the response for downloading all plugins. DownloadAllPluginsResponse 表示下载所有插件的响应。

type DownloadPluginRequest

type DownloadPluginRequest struct {
	Version     string       `json:"version" binding:"required"` // 版本号 / Version
	Mirror      MirrorSource `json:"mirror,omitempty"`           // 镜像源 / Mirror source
	ProfileKeys []string     `json:"profile_keys,omitempty"`     // 选中的依赖画像 / Selected dependency profiles
}

DownloadPluginRequest represents a request to download a plugin. DownloadPluginRequest 表示下载插件的请求。

type DownloadPluginResponse

type DownloadPluginResponse struct {
	ErrorMsg string            `json:"error_msg"`
	Data     *DownloadProgress `json:"data"`
}

DownloadPluginResponse represents the response for downloading a plugin. DownloadPluginResponse 表示下载插件的响应。

type DownloadProgress

type DownloadProgress struct {
	PluginName          string     `json:"plugin_name"`                     // 插件名称 / Plugin name
	Version             string     `json:"version"`                         // 版本号 / Version
	Status              string     `json:"status"`                          // 状态: pending/downloading/completed/failed / Status
	Progress            int        `json:"progress"`                        // 进度 (0-100) / Progress
	CurrentStep         string     `json:"current_step"`                    // 当前步骤 / Current step
	CurrentArtifact     string     `json:"current_artifact,omitempty"`      // 当前下载条目 / Current downloading artifact
	CurrentArtifactKind string     `json:"current_artifact_kind,omitempty"` // connector / dependency
	DownloadedBytes     int64      `json:"downloaded_bytes"`                // 已下载字节 / Downloaded bytes
	TotalBytes          int64      `json:"total_bytes"`                     // 总字节 / Total bytes
	Speed               int64      `json:"speed"`                           // 下载速度 (bytes/s) / Download speed
	Message             string     `json:"message,omitempty"`               // 消息 / Message
	Error               string     `json:"error,omitempty"`                 // 错误信息 / Error message
	StartTime           time.Time  `json:"start_time"`                      // 开始时间 / Start time
	EndTime             *time.Time `json:"end_time,omitempty"`              // 结束时间 / End time
	ConnectorCount      int        `json:"connector_count,omitempty"`       // 连接器总数 / Total connectors
	ConnectorCompleted  int        `json:"connector_completed,omitempty"`   // 已完成连接器 / Completed connectors
	DependencyCount     int        `json:"dependency_count,omitempty"`      // 依赖总数 / Total dependencies
	DependencyCompleted int        `json:"dependency_completed,omitempty"`  // 已完成依赖 / Completed dependencies
	SelectedProfileKeys []string   `json:"selected_profile_keys,omitempty"` // 选中的画像 / Selected profiles
}

DownloadProgress represents the progress of a download task. DownloadProgress 表示下载任务的进度。

type Downloader

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

Downloader handles plugin file downloads from Maven repositories. Downloader 处理从 Maven 仓库下载插件文件。

func NewDownloader

func NewDownloader(pluginsDir string) *Downloader

NewDownloader creates a new Downloader instance. NewDownloader 创建一个新的 Downloader 实例。

func (*Downloader) CancelDownload

func (d *Downloader) CancelDownload(name, version string) error

CancelDownload cancels an active download. CancelDownload 取消活动的下载。

func (*Downloader) ClearActiveDownload

func (d *Downloader) ClearActiveDownload(name, version string)

ClearActiveDownload removes an active download progress entry. ClearActiveDownload 删除活动下载进度。

func (*Downloader) DeleteLocalPlugin

func (d *Downloader) DeleteLocalPlugin(name, version string) error

DeleteLocalPlugin deletes a locally downloaded plugin. DeleteLocalPlugin 删除本地已下载的插件。 Note: Uses GetConnectorPathByName which maps plugin name to artifact ID. 注意:使用 GetConnectorPathByName 将插件名称映射到 artifact ID。

func (*Downloader) DownloadConnector

func (d *Downloader) DownloadConnector(ctx context.Context, plugin *Plugin, mirror MirrorSource, callback ProgressCallback) error

DownloadConnector downloads a connector jar from Maven repository. DownloadConnector 从 Maven 仓库下载连接器 jar。 Downloads to: plugins_dir/${version}/connectors/connector-${name}-${version}.jar

func (*Downloader) DownloadDependencies

func (d *Downloader) DownloadDependencies(ctx context.Context, plugin *Plugin, mirror MirrorSource, callback ProgressCallback) error

DownloadDependencies downloads all dependencies for a plugin. DownloadDependencies 下载插件的所有依赖。 Downloads to: plugins_dir/${version}/lib/

func (*Downloader) DownloadPlugin

func (d *Downloader) DownloadPlugin(ctx context.Context, plugin *Plugin, mirror MirrorSource, selectedProfileKeys []string, connectorReady, dependenciesReady bool, callback ProgressCallback) error

DownloadPlugin downloads a plugin and all its dependencies. DownloadPlugin 下载插件及其所有依赖。

func (*Downloader) GetConnectorPath

func (d *Downloader) GetConnectorPath(artifactID, version string) string

GetConnectorPath returns the path for a connector jar file. GetConnectorPath 返回连接器 jar 文件的路径。 Path format: plugins_dir/${version}/connectors/${artifactId}-${version}.jar The artifactID should be provided directly from plugin.ArtifactID (e.g., connector-cdc-mysql) artifactID 应该直接从 plugin.ArtifactID 提供(如 connector-cdc-mysql)

func (*Downloader) GetConnectorPathByName

func (d *Downloader) GetConnectorPathByName(name, version string) string

GetConnectorPathByName returns the path for a connector jar file by plugin name. GetConnectorPathByName 通过插件名称返回连接器 jar 文件的路径。 This is a convenience method that looks up the artifact ID from the plugin name. 这是一个便捷方法,从插件名称查找 artifact ID。 Deprecated: Use GetConnectorPath with artifact_id directly when possible. 已弃用:尽可能直接使用 GetConnectorPath 和 artifact_id。

func (*Downloader) GetDependencyPath

func (d *Downloader) GetDependencyPath(artifactID, version, pluginVersion, targetDir string) string

GetDependencyPath returns the path for a dependency file under the requested target dir. GetDependencyPath 返回指定 target_dir 下的依赖文件路径。

func (*Downloader) GetDownloadProgress

func (d *Downloader) GetDownloadProgress(name, version string) *DownloadProgress

GetDownloadProgress returns the current download progress for a plugin. GetDownloadProgress 返回插件的当前下载进度。

func (*Downloader) GetLibPath

func (d *Downloader) GetLibPath(artifactID, version, pluginVersion string) string

GetLibPath returns the legacy lib directory path for a dependency file. GetLibPath 返回依赖库文件在传统 lib 目录下的路径。

func (*Downloader) GetPluginsDir

func (d *Downloader) GetPluginsDir() string

GetPluginsDir returns the plugins directory path. GetPluginsDir 返回插件目录路径。

func (*Downloader) IsConnectorDownloaded

func (d *Downloader) IsConnectorDownloaded(name, version string) bool

IsConnectorDownloaded checks if a connector is already downloaded. IsConnectorDownloaded 检查连接器是否已下载。 Note: Uses GetConnectorPathByName which maps plugin name to artifact ID. 注意:使用 GetConnectorPathByName 将插件名称映射到 artifact ID。

func (*Downloader) IsConnectorDownloadedByArtifactID

func (d *Downloader) IsConnectorDownloadedByArtifactID(artifactID, version string) bool

IsConnectorDownloadedByArtifactID checks if a connector is already downloaded using artifact ID. IsConnectorDownloadedByArtifactID 使用 artifact ID 检查连接器是否已下载。

func (*Downloader) IsDependencyDownloaded

func (d *Downloader) IsDependencyDownloaded(artifactID, depVersion, pluginVersion, targetDir string) bool

IsDependencyDownloaded checks if a dependency is already downloaded. IsDependencyDownloaded 检查依赖是否已下载。

func (*Downloader) ListActiveDownloads

func (d *Downloader) ListActiveDownloads() []*DownloadProgress

ListActiveDownloads returns all active download tasks. ListActiveDownloads 返回所有活动的下载任务。

func (*Downloader) ListLocalPlugins

func (d *Downloader) ListLocalPlugins() ([]LocalPlugin, error)

ListLocalPlugins returns a list of locally downloaded plugins. ListLocalPlugins 返回本地已下载的插件列表。

func (*Downloader) ReadPluginFile

func (d *Downloader) ReadPluginFile(name, version string) ([]byte, error)

ReadPluginFile reads the plugin file content from local storage. ReadPluginFile 从本地存储读取插件文件内容。 Note: Uses GetConnectorPathByName which maps plugin name to artifact ID. 注意:使用 GetConnectorPathByName 将插件名称映射到 artifact ID。

func (*Downloader) ReadPluginFileByArtifactID

func (d *Downloader) ReadPluginFileByArtifactID(artifactID, version string) ([]byte, error)

ReadPluginFileByArtifactID reads the plugin file content using artifact ID. ReadPluginFileByArtifactID 使用 artifact ID 读取插件文件内容。

func (*Downloader) UpsertActiveDownload

func (d *Downloader) UpsertActiveDownload(progress *DownloadProgress)

UpsertActiveDownload stores or updates an active download progress entry. UpsertActiveDownload 存储或更新活动下载进度。

type EnableDisablePluginResponse

type EnableDisablePluginResponse struct {
	ErrorMsg string           `json:"error_msg"`
	Data     *InstalledPlugin `json:"data"`
}

EnableDisablePluginResponse represents the response for enabling/disabling a plugin. EnableDisablePluginResponse 表示启用/禁用插件的响应。

type GetDownloadStatusResponse

type GetDownloadStatusResponse struct {
	ErrorMsg string            `json:"error_msg"`
	Data     *DownloadProgress `json:"data"`
}

GetDownloadStatusResponse represents the response for getting download status. GetDownloadStatusResponse 表示获取下载状态的响应。

type GetInstallProgressResponse

type GetInstallProgressResponse struct {
	ErrorMsg string               `json:"error_msg"`
	Data     *PluginInstallStatus `json:"data"`
}

GetInstallProgressResponse represents the response for getting plugin installation progress. GetInstallProgressResponse 表示获取插件安装进度的响应。

type GetOfficialDependenciesResponse

type GetOfficialDependenciesResponse struct {
	ErrorMsg string                        `json:"error_msg"`
	Data     *OfficialDependenciesResponse `json:"data"`
}

GetOfficialDependenciesResponse represents the response for official dependency lookup. GetOfficialDependenciesResponse 表示获取官方依赖的响应。

type GetPluginInfoResponse

type GetPluginInfoResponse struct {
	ErrorMsg string  `json:"error_msg"`
	Data     *Plugin `json:"data"`
}

GetPluginInfoResponse represents the response for getting plugin info. GetPluginInfoResponse 表示获取插件信息的响应。

type Handler

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

Handler provides HTTP handlers for plugin management. Handler 提供插件管理的 HTTP 处理器。

func NewHandler

func NewHandler(service *Service, auditRepo *audit.Repository) *Handler

NewHandler creates a new Handler instance. NewHandler 创建一个新的 Handler 实例。 auditRepo may be nil; audit logging is skipped when nil.

func (*Handler) AddDependency

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

AddDependency handles POST /api/v1/plugins/:name/dependencies - adds a dependency to a plugin. AddDependency 处理 POST /api/v1/plugins/:name/dependencies - 为插件添加依赖。 @Tags plugins @Accept json @Produce json @Param name path string true "插件名称" @Param request body AddDependencyRequest true "添加依赖请求" @Success 200 {object} AddDependencyResponse @Router /api/v1/plugins/{name}/dependencies [post]

func (*Handler) AnalyzeOfficialDependencies

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

AnalyzeOfficialDependencies handles POST /api/v1/plugins/:name/official-dependencies/analyze. AnalyzeOfficialDependencies 处理 POST /api/v1/plugins/:name/official-dependencies/analyze。

func (*Handler) DeleteDependency

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

DeleteDependency handles DELETE /api/v1/plugins/:name/dependencies/:depId - deletes a dependency. DeleteDependency 处理 DELETE /api/v1/plugins/:name/dependencies/:depId - 删除依赖。 @Tags plugins @Produce json @Param name path string true "插件名称" @Param depId path int true "依赖ID" @Success 200 {object} DeleteDependencyResponse @Router /api/v1/plugins/{name}/dependencies/{depId} [delete]

func (*Handler) DeleteLocalPlugin

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

DeleteLocalPlugin handles DELETE /api/v1/plugins/:name/local - deletes a locally downloaded plugin. DeleteLocalPlugin 处理 DELETE /api/v1/plugins/:name/local - 删除本地已下载的插件。 @Tags plugins @Produce json @Param name path string true "插件名称" @Param version query string true "版本号" @Success 200 {object} DeleteLocalPluginResponse @Router /api/v1/plugins/{name}/local [delete]

func (*Handler) DisableDependency

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

DisableDependency handles POST /api/v1/plugins/:name/dependencies/disables. DisableDependency 处理 POST /api/v1/plugins/:name/dependencies/disables。

func (*Handler) DisablePlugin

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

DisablePlugin handles PUT /api/v1/clusters/:id/plugins/:name/disable - disables a plugin. DisablePlugin 处理 PUT /api/v1/clusters/:id/plugins/:name/disable - 禁用插件。 @Tags plugins @Produce json @Param id path int true "集群ID" @Param name path string true "插件名称" @Success 200 {object} EnableDisablePluginResponse @Router /api/v1/clusters/{id}/plugins/{name}/disable [put]

func (*Handler) DownloadAllPlugins

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

DownloadAllPlugins handles POST /api/v1/plugins/download-all - downloads all plugins. DownloadAllPlugins 处理 POST /api/v1/plugins/download-all - 一键下载所有插件。 @Tags plugins @Accept json @Produce json @Param request body DownloadAllPluginsRequest true "下载请求" @Success 200 {object} DownloadAllPluginsResponse @Router /api/v1/plugins/download-all [post]

func (*Handler) DownloadPlugin

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

DownloadPlugin handles POST /api/v1/plugins/:name/download - downloads a plugin to Control Plane. DownloadPlugin 处理 POST /api/v1/plugins/:name/download - 下载插件到 Control Plane。 @Tags plugins @Accept json @Produce json @Param name path string true "插件名称" @Param request body DownloadPluginRequest true "下载请求" @Success 200 {object} DownloadPluginResponse @Router /api/v1/plugins/{name}/download [post]

func (*Handler) EnableDependency

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

EnableDependency handles DELETE /api/v1/plugins/:name/dependencies/disables/:disableId. EnableDependency 处理 DELETE /api/v1/plugins/:name/dependencies/disables/:disableId。

func (*Handler) EnablePlugin

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

EnablePlugin handles PUT /api/v1/clusters/:id/plugins/:name/enable - enables a plugin. EnablePlugin 处理 PUT /api/v1/clusters/:id/plugins/:name/enable - 启用插件。 @Tags plugins @Produce json @Param id path int true "集群ID" @Param name path string true "插件名称" @Success 200 {object} EnableDisablePluginResponse @Router /api/v1/clusters/{id}/plugins/{name}/enable [put]

func (*Handler) GetDownloadStatus

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

GetDownloadStatus handles GET /api/v1/plugins/:name/download/status - gets download status. GetDownloadStatus 处理 GET /api/v1/plugins/:name/download/status - 获取下载状态。 @Tags plugins @Produce json @Param name path string true "插件名称" @Param version query string true "版本号" @Success 200 {object} GetDownloadStatusResponse @Router /api/v1/plugins/{name}/download/status [get]

func (*Handler) GetInstallProgress

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

GetInstallProgress handles GET /api/v1/clusters/:id/plugins/:name/progress - gets plugin installation progress. GetInstallProgress 处理 GET /api/v1/clusters/:id/plugins/:name/progress - 获取插件安装进度。 @Tags plugins @Produce json @Param id path int true "集群ID" @Param name path string true "插件名称" @Success 200 {object} GetInstallProgressResponse @Router /api/v1/clusters/{id}/plugins/{name}/progress [get]

func (*Handler) GetOfficialDependencies

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

GetOfficialDependencies handles GET /api/v1/plugins/:name/official-dependencies. GetOfficialDependencies 处理 GET /api/v1/plugins/:name/official-dependencies。

func (*Handler) GetPluginInfo

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

GetPluginInfo handles GET /api/v1/plugins/:name - gets plugin info. GetPluginInfo 处理 GET /api/v1/plugins/:name - 获取插件详情。 @Tags plugins @Produce json @Param name path string true "插件名称" @Param version query string false "SeaTunnel 版本" @Success 200 {object} GetPluginInfoResponse @Router /api/v1/plugins/{name} [get]

func (*Handler) InstallPlugin

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

InstallPlugin handles POST /api/v1/clusters/:id/plugins - installs a plugin on a cluster. InstallPlugin 处理 POST /api/v1/clusters/:id/plugins - 在集群上安装插件。 @Tags plugins @Accept json @Produce json @Param id path int true "集群ID" @Param request body InstallPluginRequest true "安装请求" @Success 200 {object} InstallPluginResponse @Router /api/v1/clusters/{id}/plugins [post]

func (*Handler) ListActiveDownloads

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

ListActiveDownloads handles GET /api/v1/plugins/downloads - lists active download tasks. ListActiveDownloads 处理 GET /api/v1/plugins/downloads - 获取活动下载任务列表。 @Tags plugins @Produce json @Success 200 {object} ListActiveDownloadsResponse @Router /api/v1/plugins/downloads [get]

func (*Handler) ListAvailablePlugins

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

ListAvailablePlugins handles GET /api/v1/plugins - lists available plugins. ListAvailablePlugins 处理 GET /api/v1/plugins - 获取可用插件列表。 @Tags plugins @Produce json @Param version query string false "SeaTunnel 版本" @Param mirror query string false "镜像源 (apache/aliyun/huaweicloud)" @Success 200 {object} ListPluginsResponse @Router /api/v1/plugins [get]

func (*Handler) ListDependencies

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

ListDependencies handles GET /api/v1/plugins/:name/dependencies - lists dependencies for a plugin. ListDependencies 处理 GET /api/v1/plugins/:name/dependencies - 获取插件的依赖列表。 @Tags plugins @Produce json @Param name path string true "插件名称" @Success 200 {object} ListDependenciesResponse @Router /api/v1/plugins/{name}/dependencies [get]

func (*Handler) ListInstalledPlugins

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

ListInstalledPlugins handles GET /api/v1/clusters/:id/plugins - lists installed plugins on a cluster. ListInstalledPlugins 处理 GET /api/v1/clusters/:id/plugins - 获取集群已安装插件列表。 @Tags plugins @Produce json @Param id path int true "集群ID" @Success 200 {object} ListInstalledPluginsResponse @Router /api/v1/clusters/{id}/plugins [get]

func (*Handler) ListLocalPlugins

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

ListLocalPlugins handles GET /api/v1/plugins/local - lists locally downloaded plugins. ListLocalPlugins 处理 GET /api/v1/plugins/local - 获取已下载的本地插件列表。 @Tags plugins @Produce json @Success 200 {object} ListLocalPluginsResponse @Router /api/v1/plugins/local [get]

func (*Handler) RefreshAvailablePlugins

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

RefreshAvailablePlugins handles POST /api/v1/plugins/refresh - refreshes connector catalog from Maven. RefreshAvailablePlugins 处理 POST /api/v1/plugins/refresh - 从 Maven 刷新连接器目录。 @Tags plugins @Accept json @Produce json @Param request body RefreshAvailablePluginsRequest false "刷新参数" @Success 200 {object} ListPluginsResponse @Router /api/v1/plugins/refresh [post]

func (*Handler) UninstallPlugin

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

UninstallPlugin handles DELETE /api/v1/clusters/:id/plugins/:name - uninstalls a plugin from a cluster. UninstallPlugin 处理 DELETE /api/v1/clusters/:id/plugins/:name - 从集群卸载插件。 @Tags plugins @Produce json @Param id path int true "集群ID" @Param name path string true "插件名称" @Success 200 {object} UninstallPluginResponse @Router /api/v1/clusters/{id}/plugins/{name} [delete]

func (*Handler) UploadDependency

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

UploadDependency handles POST /api/v1/plugins/:name/dependencies/upload - uploads a custom jar dependency. UploadDependency 处理 POST /api/v1/plugins/:name/dependencies/upload - 上传自定义 Jar 依赖。

type HostInfoGetter

type HostInfoGetter interface {
	GetHostAgentID(ctx context.Context, hostID uint) (string, error)
}

HostInfoGetter is an interface for getting host information. HostInfoGetter 是获取主机信息的接口。

type InstallPluginRequest

type InstallPluginRequest struct {
	PluginName  string       `json:"plugin_name" binding:"required"` // 插件名称 / Plugin name
	Version     string       `json:"version" binding:"required"`     // 版本号 / Version
	Mirror      MirrorSource `json:"mirror,omitempty"`               // 镜像源 / Mirror source
	ProfileKeys []string     `json:"profile_keys,omitempty"`         // 选中的依赖画像 / Selected dependency profiles
}

InstallPluginRequest represents a request to install a plugin. InstallPluginRequest 表示安装插件的请求。

type InstallPluginResponse

type InstallPluginResponse struct {
	ErrorMsg string           `json:"error_msg"`
	Data     *InstalledPlugin `json:"data"`
}

InstallPluginResponse represents the response for installing a plugin. InstallPluginResponse 表示安装插件的响应。

type InstalledPlugin

type InstalledPlugin struct {
	ID                  uint               `gorm:"primaryKey" json:"id"`
	ClusterID           uint               `gorm:"index;not null" json:"cluster_id"`                 // 集群 ID / Cluster ID
	PluginName          string             `gorm:"size:100;not null;index" json:"plugin_name"`       // 插件名称 / Plugin name
	ArtifactID          string             `gorm:"size:100" json:"artifact_id"`                      // Maven artifact ID (e.g., connector-cdc-mysql)
	Category            PluginCategory     `gorm:"size:20;not null" json:"category"`                 // 分类 / Category
	Version             string             `gorm:"size:20;not null" json:"version"`                  // 版本号 / Version
	Status              PluginStatus       `gorm:"size:20;not null;default:installed" json:"status"` // 状态 / Status
	InstallPath         string             `gorm:"size:255" json:"install_path"`                     // 安装路径 / Install path
	InstalledAt         time.Time          `gorm:"not null" json:"installed_at"`                     // 安装时间 / Installed at
	UpdatedAt           time.Time          `json:"updated_at"`                                       // 更新时间 / Updated at
	InstalledBy         uint               `json:"installed_by,omitempty"`                           // 安装者 ID / Installed by
	SelectedProfileKeys []string           `gorm:"-" json:"selected_profile_keys,omitempty"`         // 选中的画像 / Selected profiles
	AttachedConnectors  []string           `gorm:"-" json:"attached_connectors,omitempty"`           // 自动附带的连接器 / Attached connectors
	Dependencies        []PluginDependency `gorm:"-" json:"dependencies,omitempty"`                  // 自动附带的依赖 / Attached dependencies
}

InstalledPlugin represents a plugin installed on a cluster (GORM model). InstalledPlugin 表示安装在集群上的插件(GORM 模型)。 Note: Plugins are managed at cluster level, not host level. 注意:插件在集群级别管理,而非主机级别。

func (InstalledPlugin) TableName

func (InstalledPlugin) TableName() string

TableName returns the table name for InstalledPlugin. TableName 返回 InstalledPlugin 的表名。

type ListActiveDownloadsResponse

type ListActiveDownloadsResponse struct {
	ErrorMsg string              `json:"error_msg"`
	Data     []*DownloadProgress `json:"data"`
}

ListActiveDownloadsResponse represents the response for listing active downloads. ListActiveDownloadsResponse 表示获取活动下载列表的响应。

type ListDependenciesResponse

type ListDependenciesResponse struct {
	ErrorMsg string                   `json:"error_msg"`
	Data     []PluginDependencyConfig `json:"data"`
}

ListDependenciesResponse represents the response for listing plugin dependencies. ListDependenciesResponse 表示获取插件依赖列表的响应。

type ListInstalledPluginsResponse

type ListInstalledPluginsResponse struct {
	ErrorMsg string            `json:"error_msg"`
	Data     []InstalledPlugin `json:"data"`
}

ListInstalledPluginsResponse represents the response for listing installed plugins. ListInstalledPluginsResponse 表示获取已安装插件列表的响应。

type ListLocalPluginsResponse

type ListLocalPluginsResponse struct {
	ErrorMsg string        `json:"error_msg"`
	Data     []LocalPlugin `json:"data"`
}

ListLocalPluginsResponse represents the response for listing local plugins. ListLocalPluginsResponse 表示获取本地插件列表的响应。

type ListPluginsResponse

type ListPluginsResponse struct {
	ErrorMsg string                    `json:"error_msg"`
	Data     *AvailablePluginsResponse `json:"data"`
}

ListPluginsResponse represents the response for listing plugins. ListPluginsResponse 表示获取插件列表的响应。

type LocalPlugin

type LocalPlugin struct {
	Name                string             `json:"name"`                            // 插件名称 / Plugin name
	ArtifactID          string             `json:"artifact_id"`                     // Maven artifact ID / Maven artifact ID
	Version             string             `json:"version"`                         // 版本号 / Version
	Category            PluginCategory     `json:"category"`                        // 插件分类 / Plugin category
	ConnectorPath       string             `json:"connector_path"`                  // 连接器路径 / Connector path
	Size                int64              `json:"size"`                            // 文件大小 / File size
	DownloadedAt        time.Time          `json:"downloaded_at"`                   // 下载时间 / Downloaded at
	SelectedProfileKeys []string           `json:"selected_profile_keys,omitempty"` // 选中的画像 / Selected profiles
	AttachedConnectors  []string           `json:"attached_connectors,omitempty"`   // 自动附带的连接器 / Attached connectors
	Dependencies        []PluginDependency `json:"dependencies,omitempty"`          // 自动附带的依赖 / Auto attached dependencies
}

LocalPlugin represents a locally downloaded plugin. LocalPlugin 表示本地已下载的插件。

type MirrorSource

type MirrorSource string

MirrorSource represents the Maven repository mirror source. MirrorSource 表示 Maven 仓库镜像源。

const (
	MirrorSourceApache      MirrorSource = "apache"      // Apache 官方仓库
	MirrorSourceAliyun      MirrorSource = "aliyun"      // 阿里云镜像
	MirrorSourceHuaweiCloud MirrorSource = "huaweicloud" // 华为云镜像
)

type OfficialDependenciesResponse

type OfficialDependenciesResponse struct {
	PluginName               string                    `json:"plugin_name"`
	SeatunnelVersion         string                    `json:"seatunnel_version"`
	DependencyStatus         PluginDependencyStatus    `json:"dependency_status"`
	DependencyCount          int                       `json:"dependency_count"`
	BaselineVersionUsed      string                    `json:"baseline_version_used,omitempty"`
	DependencyResolutionMode DependencyResolutionMode  `json:"dependency_resolution_mode"`
	Profiles                 []PluginDependencyProfile `json:"profiles"`
	EffectiveDependencies    []PluginDependency        `json:"effective_dependencies"`
	DisabledDependencies     []PluginDependencyDisable `json:"disabled_dependencies,omitempty"`
}

OfficialDependenciesResponse contains resolved official dependency information for one plugin. OfficialDependenciesResponse 表示单个插件解析后的官方依赖信息。

type Plugin

type Plugin struct {
	Name                      string                   `json:"name"`                                  // 插件名称 / Plugin name
	DisplayName               string                   `json:"display_name"`                          // 显示名称 / Display name
	Category                  PluginCategory           `json:"category"`                              // 分类 / Category
	Version                   string                   `json:"version"`                               // 版本号(与 SeaTunnel 主版本一致)/ Version
	Description               string                   `json:"description"`                           // 描述 / Description
	GroupID                   string                   `json:"group_id"`                              // Maven groupId
	ArtifactID                string                   `json:"artifact_id"`                           // Maven artifactId
	Dependencies              []PluginDependency       `json:"dependencies,omitempty"`                // 依赖库列表 / Dependencies
	Icon                      string                   `json:"icon,omitempty"`                        // 图标 URL / Icon URL
	DocURL                    string                   `json:"doc_url,omitempty"`                     // 文档链接 / Documentation URL
	DependencyStatus          PluginDependencyStatus   `json:"dependency_status,omitempty"`           // 依赖状态 / Dependency status
	DependencyCount           int                      `json:"dependency_count,omitempty"`            // 生效依赖数量 / Effective dependency count
	DependencyBaselineVersion string                   `json:"dependency_baseline_version,omitempty"` // 依赖基线版本 / Dependency baseline version
	DependencyResolutionMode  DependencyResolutionMode `json:"dependency_resolution_mode,omitempty"`  // 依赖解析模式 / Dependency resolution mode
}

Plugin represents a SeaTunnel plugin. Plugin 表示一个 SeaTunnel 插件。

type PluginCatalogEntry

type PluginCatalogEntry struct {
	ID               uint                `gorm:"primaryKey" json:"id"`
	SeatunnelVersion string              `gorm:"size:50;not null;index:idx_plugin_catalog_version_name,unique" json:"seatunnel_version"`
	PluginName       string              `gorm:"size:120;not null;index:idx_plugin_catalog_version_name,unique" json:"plugin_name"`
	DisplayName      string              `gorm:"size:200;not null" json:"display_name"`
	ArtifactID       string              `gorm:"size:200;not null" json:"artifact_id"`
	GroupID          string              `gorm:"size:200;not null" json:"group_id"`
	Category         PluginCategory      `gorm:"size:50;not null" json:"category"`
	Description      string              `gorm:"type:text" json:"description"`
	DocURL           string              `gorm:"size:500" json:"doc_url"`
	Source           PluginCatalogSource `gorm:"size:20;not null;default:remote" json:"source"`
	SourceMirror     string              `gorm:"size:30" json:"source_mirror"`
	RefreshedAt      *time.Time          `json:"refreshed_at"`
	CreatedAt        time.Time           `json:"created_at"`
	UpdatedAt        time.Time           `json:"updated_at"`
}

PluginCatalogEntry stores discovered connector metadata in DB. PluginCatalogEntry 持久化存储发现到的连接器元数据。

func (PluginCatalogEntry) TableName

func (PluginCatalogEntry) TableName() string

type PluginCatalogSource

type PluginCatalogSource string

PluginCatalogSource represents the source of catalog entries. PluginCatalogSource 表示插件目录项来源。

const (
	PluginCatalogSourceSeed   PluginCatalogSource = "seed"
	PluginCatalogSourceRemote PluginCatalogSource = "remote"
)

type PluginCategory

type PluginCategory string

PluginCategory represents the category of a plugin. PluginCategory 表示插件的分类。

const (
	PluginCategorySource    PluginCategory = "source"    // Source / Data source (legacy, for compatibility / 遗留,用于兼容)
	PluginCategorySink      PluginCategory = "sink"      // Sink / Data sink (legacy, for compatibility / 遗留,用于兼容)
	PluginCategoryConnector PluginCategory = "connector" // Connector / 连接器 (primary category, can be used as source or sink / 主要分类,可作为 source 或 sink)
	PluginCategoryTransform PluginCategory = "transform" // Transform / 数据转换 (deprecated, not fetched from Maven / 已弃用,不从 Maven 获取)
)

type PluginDependency

type PluginDependency struct {
	GroupID          string                 `json:"group_id"`                     // Maven groupId
	ArtifactID       string                 `json:"artifact_id"`                  // Maven artifactId
	Version          string                 `json:"version"`                      // 版本号 / Version
	TargetDir        string                 `json:"target_dir"`                   // 目标目录 (connectors/、lib/ 或 plugins/<mapping>) / Target directory
	SourceType       PluginDependencySource `json:"source_type,omitempty"`        // 依赖来源 / Dependency source
	OriginalFileName string                 `json:"original_file_name,omitempty"` // 原始上传文件名 / Original uploaded file name
	StoredPath       string                 `json:"-"`                            // 控制面存储路径(仅服务端内部使用)/ Stored path (server-side only)
}

PluginDependency represents a dependency of a plugin. PluginDependency 表示插件的依赖项。

type PluginDependencyConfig

type PluginDependencyConfig struct {
	ID               uint                   `gorm:"primaryKey" json:"id"`
	PluginName       string                 `gorm:"size:80;not null;index:idx_plugin_dep,unique" json:"plugin_name"`                  // 插件名称 / Plugin name
	SeatunnelVersion string                 `gorm:"size:50;not null;default:'';index:idx_plugin_dep,unique" json:"seatunnel_version"` // SeaTunnel 版本 / SeaTunnel version
	GroupID          string                 `gorm:"size:128;not null;index:idx_plugin_dep,unique" json:"group_id"`                    // Maven groupId / 分组标识
	ArtifactID       string                 `gorm:"size:128;not null;index:idx_plugin_dep,unique" json:"artifact_id"`                 // Maven artifactId
	Version          string                 `gorm:"size:64;not null;index:idx_plugin_dep,unique" json:"version"`                      // 版本号 / Version
	TargetDir        string                 `gorm:"size:64;not null;default:lib;index:idx_plugin_dep,unique" json:"target_dir"`       // 目标目录 / Target directory
	SourceType       PluginDependencySource `gorm:"size:20;not null;default:maven;index:idx_plugin_dep,unique" json:"source_type"`    // 来源类型 / Source type
	OriginalFileName string                 `gorm:"size:255" json:"original_file_name,omitempty"`                                     // 原始文件名 / Original uploaded file name
	StoredPath       string                 `gorm:"size:1024" json:"-"`                                                               // 控制面存储路径 / Stored path
	FileSize         int64                  `gorm:"not null;default:0" json:"file_size,omitempty"`                                    // 文件大小 / File size
	Checksum         string                 `gorm:"size:128" json:"checksum,omitempty"`                                               // 文件摘要 / File checksum
	CreatedAt        time.Time              `json:"created_at"`
	UpdatedAt        time.Time              `json:"updated_at"`
}

PluginDependencyConfig represents a user-configured dependency for a plugin (GORM model). PluginDependencyConfig 表示用户为插件配置的依赖项(GORM 模型)。

func (PluginDependencyConfig) TableName

func (PluginDependencyConfig) TableName() string

TableName returns the table name for PluginDependencyConfig. TableName 返回 PluginDependencyConfig 的表名。

type PluginDependencyDisable

type PluginDependencyDisable struct {
	ID               uint      `gorm:"primaryKey" json:"id"`
	PluginName       string    `gorm:"size:80;not null;index:idx_plugin_dep_disable,unique" json:"plugin_name"`
	SeatunnelVersion string    `gorm:"size:50;not null;default:'';index:idx_plugin_dep_disable,unique" json:"seatunnel_version"`
	GroupID          string    `gorm:"size:128;not null;index:idx_plugin_dep_disable,unique" json:"group_id"`
	ArtifactID       string    `gorm:"size:128;not null;index:idx_plugin_dep_disable,unique" json:"artifact_id"`
	Version          string    `gorm:"size:64;not null;index:idx_plugin_dep_disable,unique" json:"version"`
	TargetDir        string    `gorm:"size:64;not null;index:idx_plugin_dep_disable,unique" json:"target_dir"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

PluginDependencyDisable represents one disabled official dependency entry for a plugin/version. PluginDependencyDisable 表示插件某个版本下被用户禁用的一条官方依赖。

func (PluginDependencyDisable) TableName

func (PluginDependencyDisable) TableName() string

TableName returns the table name for PluginDependencyDisable. TableName 返回 PluginDependencyDisable 的表名。

type PluginDependencyProfile

type PluginDependencyProfile struct {
	ID                       uint                          `gorm:"primaryKey" json:"id"`
	SeatunnelVersion         string                        `gorm:"size:50;not null;index:idx_plugin_dep_profile_unique,unique" json:"seatunnel_version"`
	PluginName               string                        `gorm:"size:120;not null;index:idx_plugin_dep_profile_unique,unique;index" json:"plugin_name"`
	ArtifactID               string                        `gorm:"size:200;not null" json:"artifact_id"`
	ProfileKey               string                        `gorm:"size:120;not null;default:default;index:idx_plugin_dep_profile_unique,unique" json:"profile_key"`
	ProfileName              string                        `gorm:"size:200" json:"profile_name"`
	EngineScope              string                        `gorm:"size:50;not null;default:zeta;index:idx_plugin_dep_profile_unique,unique" json:"engine_scope"`
	SourceKind               PluginDependencyProfileSource `gorm:"size:30;not null;index:idx_plugin_dep_profile_unique,unique" json:"source_kind"`
	BaselineVersionUsed      string                        `gorm:"size:50" json:"baseline_version_used"`
	ResolutionMode           DependencyResolutionMode      `gorm:"size:20;not null;default:exact" json:"resolution_mode"`
	TargetDir                string                        `gorm:"size:120;not null;default:lib" json:"target_dir"`
	AppliesTo                string                        `gorm:"size:255;not null;default:*" json:"applies_to"`
	IncludeVersions          string                        `gorm:"size:500" json:"include_versions"`
	ExcludedVersions         string                        `gorm:"size:500" json:"excluded_versions"`
	DocSlug                  string                        `gorm:"size:255" json:"doc_slug"`
	DocSourceURL             string                        `gorm:"size:500" json:"doc_source_url"`
	Confidence               string                        `gorm:"size:20;not null;default:medium" json:"confidence"`
	IsDefault                bool                          `gorm:"not null" json:"is_default"`
	NoAdditionalDependencies bool                          `gorm:"not null;default:false" json:"no_additional_dependencies"`
	ContentHash              string                        `gorm:"size:128" json:"content_hash"`
	CreatedAt                time.Time                     `json:"created_at"`
	UpdatedAt                time.Time                     `json:"updated_at"`
	Items                    []PluginDependencyProfileItem `gorm:"foreignKey:ProfileID;constraint:OnDelete:CASCADE" json:"items,omitempty"`
}

PluginDependencyProfile stores one official dependency profile for a plugin/version. PluginDependencyProfile 存储插件某个版本的一份官方依赖画像。

func (PluginDependencyProfile) TableName

func (PluginDependencyProfile) TableName() string

type PluginDependencyProfileItem

type PluginDependencyProfileItem struct {
	ID         uint      `gorm:"primaryKey" json:"id"`
	ProfileID  uint      `gorm:"not null;index:idx_plugin_dep_profile_item_unique,unique" json:"profile_id"`
	GroupID    string    `gorm:"size:128;not null;index:idx_plugin_dep_profile_item_unique,unique" json:"group_id"`
	ArtifactID string    `gorm:"size:128;not null;index:idx_plugin_dep_profile_item_unique,unique" json:"artifact_id"`
	Version    string    `gorm:"size:64;not null;index:idx_plugin_dep_profile_item_unique,unique" json:"version"`
	TargetDir  string    `gorm:"size:64;not null;index:idx_plugin_dep_profile_item_unique,unique" json:"target_dir"`
	Required   bool      `gorm:"not null;default:true" json:"required"`
	SourceURL  string    `gorm:"size:500" json:"source_url"`
	Note       string    `gorm:"type:text" json:"note"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	Disabled   bool      `gorm:"-" json:"disabled"`
	DisableID  *uint     `gorm:"-" json:"disable_id,omitempty"`
}

PluginDependencyProfileItem stores one dependency item under a profile. PluginDependencyProfileItem 存储画像中的单条依赖项。

func (PluginDependencyProfileItem) TableName

func (PluginDependencyProfileItem) TableName() string

type PluginDependencyProfileSource

type PluginDependencyProfileSource string

PluginDependencyProfileSource represents the source kind of official dependency profile. PluginDependencyProfileSource 表示官方依赖画像来源类型。

const (
	PluginDependencyProfileSourceOfficialSeed    PluginDependencyProfileSource = "official_seed"
	PluginDependencyProfileSourceRuntimeAnalyzed PluginDependencyProfileSource = "runtime_analyzed"
)

type PluginDependencyResponse

type PluginDependencyResponse struct {
	PluginName   string                   `json:"plugin_name"`  // 插件名称 / Plugin name
	Dependencies []PluginDependencyConfig `json:"dependencies"` // 依赖列表 / Dependencies
}

PluginDependencyResponse represents the response for plugin dependencies. PluginDependencyResponse 表示插件依赖的响应。

type PluginDependencySource

type PluginDependencySource string

PluginDependencySource represents the source type of an effective dependency. PluginDependencySource 表示依赖来源类型。

const (
	PluginDependencySourceMaven    PluginDependencySource = "maven"
	PluginDependencySourceUpload   PluginDependencySource = "upload"
	PluginDependencySourceOfficial PluginDependencySource = "official"
)

type PluginDependencyStatus

type PluginDependencyStatus string

PluginDependencyStatus represents lightweight dependency readiness shown in plugin marketplace. PluginDependencyStatus 表示插件市场展示的轻量依赖状态。

const (
	PluginDependencyStatusReadyExact      PluginDependencyStatus = "ready_exact"
	PluginDependencyStatusReadyFallback   PluginDependencyStatus = "ready_fallback"
	PluginDependencyStatusRuntimeAnalyzed PluginDependencyStatus = "runtime_analyzed"
	PluginDependencyStatusNotRequired     PluginDependencyStatus = "not_required"
	PluginDependencyStatusUnknown         PluginDependencyStatus = "unknown"
)

type PluginDownloadRequest

type PluginDownloadRequest struct {
	PluginName  string       `json:"plugin_name" binding:"required"` // 插件名称 / Plugin name
	Version     string       `json:"version" binding:"required"`     // 版本号 / Version
	Mirror      MirrorSource `json:"mirror,omitempty"`               // 镜像源 / Mirror source
	ProfileKeys []string     `json:"profile_keys,omitempty"`         // 选中的依赖画像 / Selected dependency profiles
}

PluginDownloadRequest represents a request to download/install a plugin. PluginDownloadRequest 表示下载/安装插件的请求。

type PluginDownloadStatus

type PluginDownloadStatus string

PluginDownloadStatus represents the status of a plugin download task. PluginDownloadStatus 表示插件下载任务的状态。

const (
	PluginDownloadPending     PluginDownloadStatus = "pending"     // 等待中 / Pending
	PluginDownloadDownloading PluginDownloadStatus = "downloading" // 下载中 / Downloading
	PluginDownloadCompleted   PluginDownloadStatus = "completed"   // 已完成 / Completed
	PluginDownloadFailed      PluginDownloadStatus = "failed"      // 失败 / Failed
	PluginDownloadCancelled   PluginDownloadStatus = "cancelled"   // 已取消 / Cancelled
)

type PluginDownloadTask

type PluginDownloadTask struct {
	ID              string               `json:"id"`                         // 任务 ID / Task ID
	ClusterID       uint                 `json:"cluster_id"`                 // 集群 ID / Cluster ID
	PluginName      string               `json:"plugin_name"`                // 插件名称 / Plugin name
	Version         string               `json:"version"`                    // 版本号 / Version
	Mirror          MirrorSource         `json:"mirror"`                     // 镜像源 / Mirror source
	Status          PluginDownloadStatus `json:"status"`                     // 状态 / Status
	Progress        int                  `json:"progress"`                   // 进度 (0-100) / Progress
	CurrentStep     string               `json:"current_step,omitempty"`     // 当前步骤 / Current step
	DownloadedBytes int64                `json:"downloaded_bytes,omitempty"` // 已下载字节 / Downloaded bytes
	TotalBytes      int64                `json:"total_bytes,omitempty"`      // 总字节 / Total bytes
	Speed           int64                `json:"speed,omitempty"`            // 下载速度 (bytes/s) / Download speed
	Message         string               `json:"message,omitempty"`          // 消息 / Message
	Error           string               `json:"error,omitempty"`            // 错误信息 / Error message
	StartTime       time.Time            `json:"start_time"`                 // 开始时间 / Start time
	EndTime         *time.Time           `json:"end_time,omitempty"`         // 结束时间 / End time
}

PluginDownloadTask represents a plugin download task. PluginDownloadTask 表示插件下载任务。

type PluginFilter

type PluginFilter struct {
	ClusterID uint           `json:"cluster_id,omitempty"` // 集群 ID / Cluster ID
	Category  PluginCategory `json:"category,omitempty"`   // 分类 / Category
	Status    PluginStatus   `json:"status,omitempty"`     // 状态 / Status
	Keyword   string         `json:"keyword,omitempty"`    // 搜索关键词 / Search keyword
	Page      int            `json:"page,omitempty"`       // 页码 / Page number
	PageSize  int            `json:"page_size,omitempty"`  // 每页数量 / Page size
}

PluginFilter represents filter options for querying plugins. PluginFilter 表示查询插件的过滤选项。

type PluginInstallStatus

type PluginInstallStatus struct {
	PluginName string `json:"plugin_name"`       // 插件名称 / Plugin name
	Status     string `json:"status"`            // 状态 / Status
	Progress   int    `json:"progress"`          // 进度 (0-100) / Progress
	Message    string `json:"message,omitempty"` // 消息 / Message
	Error      string `json:"error,omitempty"`   // 错误信息 / Error message
}

PluginInstallStatus represents the installation status of a plugin. PluginInstallStatus 表示插件的安装状态。

type PluginListSource

type PluginListSource string

AvailablePluginsResponse represents the response for listing available plugins. AvailablePluginsResponse 表示获取可用插件列表的响应。

const (
	PluginListSourceDatabase PluginListSource = "database"
	PluginListSourceRemote   PluginListSource = "remote"
	PluginListSourceSeed     PluginListSource = "seed"
)

type PluginStatus

type PluginStatus string

PluginStatus represents the status of a plugin. PluginStatus 表示插件的状态。

const (
	PluginStatusAvailable PluginStatus = "available" // 可用 / Available
	PluginStatusInstalled PluginStatus = "installed" // 已安装 / Installed
	PluginStatusEnabled   PluginStatus = "enabled"   // 已启用 / Enabled
	PluginStatusDisabled  PluginStatus = "disabled"  // 已禁用 / Disabled
)

type ProgressCallback

type ProgressCallback func(progress *DownloadProgress)

ProgressCallback is a callback function for reporting download progress. ProgressCallback 是用于报告下载进度的回调函数。

type RefreshAvailablePluginsRequest

type RefreshAvailablePluginsRequest struct {
	Version string       `json:"version"`
	Mirror  MirrorSource `json:"mirror"`
}

RefreshAvailablePluginsRequest represents the request for refreshing connector catalog. RefreshAvailablePluginsRequest 表示刷新连接器目录的请求。

type Repository

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

Repository provides data access for installed plugins. Repository 提供已安装插件的数据访问。

func NewRepository

func NewRepository(db *gorm.DB) *Repository

NewRepository creates a new Repository instance. NewRepository 创建一个新的 Repository 实例。

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, plugin *InstalledPlugin) error

Create creates a new installed plugin record. Create 创建一个新的已安装插件记录。

func (*Repository) Delete

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

Delete deletes an installed plugin record. Delete 删除已安装插件记录。

func (*Repository) DeleteByClusterAndName

func (r *Repository) DeleteByClusterAndName(ctx context.Context, clusterID uint, pluginName string) error

DeleteByClusterAndName deletes an installed plugin by cluster ID and plugin name. DeleteByClusterAndName 通过集群 ID 和插件名称删除已安装插件。

func (*Repository) DeleteDependency

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

DeleteDependency deletes a dependency configuration by ID. DeleteDependency 通过 ID 删除依赖配置。

func (*Repository) DeleteDependencyDisable

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

DeleteDependencyDisable deletes a disable record by ID. DeleteDependencyDisable 通过 ID 删除禁用记录。

func (*Repository) DeleteStaleDependencyProfiles

func (r *Repository) DeleteStaleDependencyProfiles(ctx context.Context, seatunnelVersion string, sourceKind PluginDependencyProfileSource, keepKeys map[string]struct{}) error

DeleteStaleDependencyProfiles removes official profiles that are no longer present in the latest seed for one version. DeleteStaleDependencyProfiles 删除某个版本中最新 seed 已不存在的官方依赖画像。

func (*Repository) ExistsByClusterAndName

func (r *Repository) ExistsByClusterAndName(ctx context.Context, clusterID uint, pluginName string) (bool, error)

ExistsByClusterAndName checks if a plugin is installed on a cluster. ExistsByClusterAndName 检查插件是否已安装在集群上。

func (*Repository) FindDependencyByNaturalKey

func (r *Repository) FindDependencyByNaturalKey(ctx context.Context, pluginName, seatunnelVersion, groupID, artifactID, version, targetDir string, sourceType PluginDependencySource) (*PluginDependencyConfig, error)

FindDependencyByNaturalKey finds one dependency config by its natural key. FindDependencyByNaturalKey 按自然键查找依赖配置。

func (*Repository) FindDependencyDisableByNaturalKey

func (r *Repository) FindDependencyDisableByNaturalKey(ctx context.Context, pluginName, seatunnelVersion, groupID, artifactID, version, targetDir string) (*PluginDependencyDisable, error)

FindDependencyDisableByNaturalKey finds one disable record by natural key. FindDependencyDisableByNaturalKey 按自然键查找禁用记录。

func (*Repository) GetByClusterAndName

func (r *Repository) GetByClusterAndName(ctx context.Context, clusterID uint, pluginName string) (*InstalledPlugin, error)

GetByClusterAndName retrieves an installed plugin by cluster ID and plugin name. GetByClusterAndName 通过集群 ID 和插件名称获取已安装插件。

func (*Repository) GetByID

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

GetByID retrieves an installed plugin by ID. GetByID 通过 ID 获取已安装插件。

func (*Repository) GetDependencyByID

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

GetDependencyByID retrieves a dependency by ID. GetDependencyByID 通过 ID 获取依赖。

func (*Repository) GetDependencyDisableByID

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

GetDependencyDisableByID retrieves one disable record by ID. GetDependencyDisableByID 通过 ID 获取禁用记录。

func (*Repository) List

func (r *Repository) List(ctx context.Context, filter *PluginFilter) ([]InstalledPlugin, int64, error)

List retrieves installed plugins with optional filters. List 获取已安装插件列表,支持可选过滤条件。

func (*Repository) ListByCluster

func (r *Repository) ListByCluster(ctx context.Context, clusterID uint) ([]InstalledPlugin, error)

ListByCluster retrieves all installed plugins for a specific cluster. ListByCluster 获取指定集群的所有已安装插件。

func (*Repository) ListCatalogEntriesByVersion

func (r *Repository) ListCatalogEntriesByVersion(ctx context.Context, version string) ([]PluginCatalogEntry, error)

ListCatalogEntriesByVersion returns persisted plugin catalog entries for a SeaTunnel version. ListCatalogEntriesByVersion 返回指定 SeaTunnel 版本的插件目录项。

func (*Repository) ListDependencies

func (r *Repository) ListDependencies(ctx context.Context, pluginName, seatunnelVersion string) ([]PluginDependencyConfig, error)

ListDependencies retrieves all user-added dependencies for a plugin/version. ListDependencies 获取插件指定版本的所有用户新增依赖。

func (*Repository) ListDependencyDisables

func (r *Repository) ListDependencyDisables(ctx context.Context, pluginName, seatunnelVersion string) ([]PluginDependencyDisable, error)

ListDependencyDisables lists disabled official dependencies for a plugin/version. ListDependencyDisables 获取插件指定版本的官方依赖禁用记录。

func (*Repository) ListDependencyProfilesByPlugin

func (r *Repository) ListDependencyProfilesByPlugin(ctx context.Context, pluginName string) ([]PluginDependencyProfile, error)

ListDependencyProfilesByPlugin returns all dependency profiles for a plugin. ListDependencyProfilesByPlugin 返回插件的所有依赖画像。

func (*Repository) ReplaceCatalogEntriesByVersion

func (r *Repository) ReplaceCatalogEntriesByVersion(ctx context.Context, version string, entries []PluginCatalogEntry) error

ReplaceCatalogEntriesByVersion replaces all catalog entries for one version. ReplaceCatalogEntriesByVersion 替换指定版本的全部插件目录项。

func (*Repository) Transaction

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

Transaction runs fn within a DB transaction. Transaction 在数据库事务中执行 fn。

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, plugin *InstalledPlugin) error

Update updates an installed plugin record. Update 更新已安装插件记录。

func (*Repository) UpdateStatus

func (r *Repository) UpdateStatus(ctx context.Context, id uint, status PluginStatus) error

UpdateStatus updates the status of an installed plugin. UpdateStatus 更新已安装插件的状态。

func (*Repository) UpsertCatalogEntries

func (r *Repository) UpsertCatalogEntries(ctx context.Context, entries []PluginCatalogEntry) error

UpsertCatalogEntries upserts plugin catalog entries by version + plugin name. UpsertCatalogEntries 按版本 + 插件名 upsert 插件目录项。

func (*Repository) UpsertDependency

func (r *Repository) UpsertDependency(ctx context.Context, dep *PluginDependencyConfig) error

UpsertDependency creates or updates one dependency configuration. UpsertDependency 创建或更新一条依赖配置。

func (*Repository) UpsertDependencyDisable

func (r *Repository) UpsertDependencyDisable(ctx context.Context, item *PluginDependencyDisable) error

UpsertDependencyDisable creates or updates one disabled official dependency record. UpsertDependencyDisable 创建或更新一条官方依赖禁用记录。

func (*Repository) UpsertDependencyProfile

func (r *Repository) UpsertDependencyProfile(ctx context.Context, profile *PluginDependencyProfile) error

UpsertDependencyProfile upserts one profile and replaces its items. UpsertDependencyProfile upsert 一份依赖画像并替换其子项。

type Service

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

Service provides plugin management functionality. Service 提供插件管理功能。

func NewService

func NewService(repo *Repository) *Service

NewService creates a new Service instance. NewService 创建一个新的 Service 实例。

func NewServiceWithDownloader

func NewServiceWithDownloader(repo *Repository, pluginsDir string) *Service

NewServiceWithDownloader creates a new Service instance with a custom downloader. NewServiceWithDownloader 创建一个带有自定义下载器的新 Service 实例。

func (*Service) AddDependency

func (s *Service) AddDependency(ctx context.Context, req *AddDependencyRequest) (*PluginDependencyConfig, error)

AddDependency adds one Maven-based user dependency. AddDependency 添加一条基于 Maven 坐标的用户依赖。

func (*Service) AnalyzeOfficialDependencies

func (s *Service) AnalyzeOfficialDependencies(ctx context.Context, pluginName, version, profileKey string, forceRefresh bool) (*OfficialDependenciesResponse, error)

AnalyzeOfficialDependencies fetches official docs and stores analyzed dependency profiles. AnalyzeOfficialDependencies 抓取官方文档并保存分析后的依赖画像。

func (*Service) DeleteDependency

func (s *Service) DeleteDependency(ctx context.Context, depID uint) error

DeleteDependency deletes one user-added dependency and removes uploaded file when needed. DeleteDependency 删除一条用户新增依赖,并在需要时清理上传文件。

func (*Service) DeleteLocalPlugin

func (s *Service) DeleteLocalPlugin(name, version string) error

DeleteLocalPlugin deletes a locally downloaded plugin. DeleteLocalPlugin 删除本地已下载的插件。

func (*Service) DisableDependency

func (s *Service) DisableDependency(ctx context.Context, req *DisableDependencyRequest) (*PluginDependencyDisable, error)

DisableDependency disables one official dependency item for a plugin/version. DisableDependency 禁用插件某个版本下的一条官方依赖。

func (*Service) DisablePlugin

func (s *Service) DisablePlugin(ctx context.Context, clusterID uint, pluginName string) (*InstalledPlugin, error)

DisablePlugin disables an installed plugin. DisablePlugin 禁用已安装的插件。

func (*Service) DownloadAllPlugins

func (s *Service) DownloadAllPlugins(ctx context.Context, version string, mirror MirrorSource, selectedProfilesByPlugin map[string][]string) (*DownloadAllPluginsProgress, error)

DownloadAllPlugins downloads all available plugins for a version. DownloadAllPlugins 下载指定版本的所有可用插件。

func (*Service) DownloadPlugin

func (s *Service) DownloadPlugin(ctx context.Context, name, version string, mirror MirrorSource, profileKeys []string) (*DownloadProgress, error)

DownloadPlugin downloads a plugin to the Control Plane local storage. DownloadPlugin 下载插件到 Control Plane 本地存储。

func (*Service) DownloadPluginSync

func (s *Service) DownloadPluginSync(ctx context.Context, pluginName, version, mirror string, profileKeys []string) error

DownloadPluginSync downloads a plugin synchronously (blocking). DownloadPluginSync 同步下载插件(阻塞)。 This implements the installer.PluginTransferer interface. 这实现了 installer.PluginTransferer 接口。

func (*Service) EnableDependency

func (s *Service) EnableDependency(ctx context.Context, disableID uint) error

EnableDependency removes one disabled official dependency record. EnableDependency 重新启用一条被禁用的官方依赖。

func (*Service) EnablePlugin

func (s *Service) EnablePlugin(ctx context.Context, clusterID uint, pluginName string) (*InstalledPlugin, error)

EnablePlugin enables an installed plugin. EnablePlugin 启用已安装的插件。

func (*Service) GetDownloadStatus

func (s *Service) GetDownloadStatus(name, version string, profileKeys []string) *DownloadProgress

GetDownloadStatus returns the current download status for a plugin. GetDownloadStatus 返回插件的当前下载状态。

func (*Service) GetEffectiveDependencies

func (s *Service) GetEffectiveDependencies(ctx context.Context, pluginName, version string, profileKeys []string) ([]PluginDependency, error)

GetEffectiveDependencies merges official stored dependencies and user-configured dependencies. GetEffectiveDependencies 合并官方依赖与用户补充依赖。

func (*Service) GetInstallProgress

func (s *Service) GetInstallProgress(clusterID uint, pluginName string) *PluginInstallStatus

GetInstallProgress returns the installation progress for a plugin on a cluster. GetInstallProgress 返回集群上插件的安装进度。

func (*Service) GetInstalledPlugin

func (s *Service) GetInstalledPlugin(ctx context.Context, clusterID uint, pluginName string) (*InstalledPlugin, error)

GetInstalledPlugin returns an installed plugin by cluster and name. GetInstalledPlugin 通过集群和名称获取已安装插件。

func (*Service) GetOfficialDependencies

func (s *Service) GetOfficialDependencies(ctx context.Context, pluginName, version, profileKey string) (*OfficialDependenciesResponse, error)

GetOfficialDependencies returns stored official dependency profiles for one plugin. GetOfficialDependencies 返回指定插件的已存储官方依赖画像。

func (*Service) GetPluginArtifactID

func (s *Service) GetPluginArtifactID(pluginName string) string

GetPluginArtifactID returns the Maven artifact ID for a plugin name. GetPluginArtifactID 返回插件名称对应的 Maven artifact ID。 This implements the installer.PluginTransferer interface. 这实现了 installer.PluginTransferer 接口。

func (*Service) GetPluginDependencies

func (s *Service) GetPluginDependencies(ctx context.Context, pluginName string) ([]PluginDependency, error)

GetPluginDependencies returns effective dependencies for a plugin using the default SeaTunnel version. GetPluginDependencies 返回插件的生效依赖(使用默认 SeaTunnel 版本)。

func (*Service) GetPluginDependenciesForVersion

func (s *Service) GetPluginDependenciesForVersion(ctx context.Context, pluginName, version string) ([]PluginDependency, error)

GetPluginDependenciesForVersion returns effective dependencies for a plugin using the given version. GetPluginDependenciesForVersion 返回指定版本下插件的生效依赖。

func (*Service) GetPluginDependenciesForVersionAndProfiles

func (s *Service) GetPluginDependenciesForVersionAndProfiles(ctx context.Context, pluginName, version string, profileKeys []string) ([]PluginDependency, error)

GetPluginDependenciesForVersionAndProfiles returns effective dependencies for a plugin using the given version and selected profiles. GetPluginDependenciesForVersionAndProfiles 返回指定版本与画像下插件的生效依赖。

func (*Service) GetPluginInfo

func (s *Service) GetPluginInfo(ctx context.Context, name string, version string) (*Plugin, error)

GetPluginInfo returns detailed information about a specific plugin. GetPluginInfo 返回特定插件的详细信息。

func (*Service) GetPluginPreparationFingerprint

func (s *Service) GetPluginPreparationFingerprint(ctx context.Context, pluginName, version string, profileKeys []string) (string, error)

GetPluginPreparationFingerprint returns a stable fingerprint for the plugin's effective dependency set. GetPluginPreparationFingerprint 返回插件当前生效依赖集合的稳定指纹。 This implements the installer.PluginTransferer interface. 这实现了 installer.PluginTransferer 接口。

func (*Service) InstallPlugin

func (s *Service) InstallPlugin(ctx context.Context, clusterID uint, req *InstallPluginRequest) (*InstalledPlugin, error)

InstallPlugin installs a plugin on a cluster via Agent. InstallPlugin 通过 Agent 在集群上安装插件。 Requirements: Validates that plugin version matches cluster version. 需求:校验插件版本与集群版本是否匹配。

func (*Service) InstallPluginToCluster

func (s *Service) InstallPluginToCluster(ctx context.Context, clusterID uint, req *InstallPluginRequest) (*InstalledPlugin, error)

InstallPluginToCluster installs a plugin to all nodes in a cluster. InstallPluginToCluster 将插件安装到集群中的所有节点。 This method: 1. Checks if plugin is downloaded locally (downloads if not) 2. Gets all cluster nodes 3. Transfers plugin files to each node's Agent 4. Sends install command to each Agent 5. Updates database record

func (*Service) IsPluginDownloaded

func (s *Service) IsPluginDownloaded(name, version string) bool

IsPluginDownloaded checks if a plugin is downloaded locally. IsPluginDownloaded 检查插件是否已在本地下载。

func (*Service) ListActiveDownloads

func (s *Service) ListActiveDownloads() []*DownloadProgress

ListActiveDownloads returns all active download tasks. ListActiveDownloads 返回所有活动的下载任务。

func (*Service) ListAvailablePlugins

func (s *Service) ListAvailablePlugins(ctx context.Context, version string, mirror MirrorSource) (*AvailablePluginsResponse, error)

ListAvailablePlugins returns available plugins from DB snapshot or Maven repository. ListAvailablePlugins 从数据库快照或 Maven 仓库获取可用插件列表。

func (*Service) ListDependencies

func (s *Service) ListDependencies(ctx context.Context, pluginName, seatunnelVersion string) ([]PluginDependencyConfig, error)

ListDependencies returns all user-added dependencies for a plugin/version. ListDependencies 返回插件指定版本下的所有用户新增依赖。

func (*Service) ListInstalledPlugins

func (s *Service) ListInstalledPlugins(ctx context.Context, clusterID uint) ([]InstalledPlugin, error)

ListInstalledPlugins returns installed plugins for a cluster. ListInstalledPlugins 返回集群上已安装的插件列表。

func (*Service) ListLocalPlugins

func (s *Service) ListLocalPlugins() ([]LocalPlugin, error)

ListLocalPlugins returns a list of locally downloaded plugins. ListLocalPlugins 返回本地已下载的插件列表。

func (*Service) RecordInstalledPlugin

func (s *Service) RecordInstalledPlugin(ctx context.Context, clusterID uint, pluginName, version string) error

RecordInstalledPlugin records a plugin as installed for a cluster. RecordInstalledPlugin 记录插件已安装到集群。 Sets category (e.g. connector) and artifact_id so one-click install shows correct classification. 设置分类(如 connector)和 artifact_id,以便一键安装后显示正确分类。 This implements the installer.PluginTransferer interface. 这实现了 installer.PluginTransferer 接口。

func (*Service) RefreshPlugins

func (s *Service) RefreshPlugins(ctx context.Context, version string, mirror MirrorSource) ([]Plugin, error)

RefreshPlugins forces a refresh of the plugin list from Maven repository. RefreshPlugins 强制从 Maven 仓库刷新插件列表。

func (*Service) SetAgentCommandSender

func (s *Service) SetAgentCommandSender(sender AgentCommandSender)

SetAgentCommandSender sets the agent command sender for plugin installation. SetAgentCommandSender 设置用于插件安装的 Agent 命令发送器。

func (*Service) SetClusterGetter

func (s *Service) SetClusterGetter(getter ClusterGetter)

SetClusterGetter sets the cluster getter for version validation. SetClusterGetter 设置集群获取器用于版本校验。

func (*Service) SetClusterNodeGetter

func (s *Service) SetClusterNodeGetter(getter ClusterNodeGetter)

SetClusterNodeGetter sets the cluster node getter for plugin installation. SetClusterNodeGetter 设置用于插件安装的集群节点获取器。

func (*Service) SetHostInfoGetter

func (s *Service) SetHostInfoGetter(getter HostInfoGetter)

SetHostInfoGetter sets the host info getter for plugin installation. SetHostInfoGetter 设置用于插件安装的主机信息获取器。

func (*Service) SetPluginFetcher

func (s *Service) SetPluginFetcher(fetcher func(ctx context.Context, version string, mirror MirrorSource) ([]Plugin, MirrorSource, error))

SetPluginFetcher sets the plugin list fetcher, mainly used in tests. SetPluginFetcher 设置插件列表获取函数,主要用于测试。

func (*Service) TransferPluginToAgent

func (s *Service) TransferPluginToAgent(ctx context.Context, agentID, pluginName, version, installDir string, profileKeys []string) error

TransferPluginToAgent transfers a plugin to an agent during SeaTunnel installation. TransferPluginToAgent 在 SeaTunnel 安装过程中将插件传输到 Agent。 This implements the installer.PluginTransferer interface. 这实现了 installer.PluginTransferer 接口。

func (*Service) UninstallPlugin

func (s *Service) UninstallPlugin(ctx context.Context, clusterID uint, pluginName string) error

UninstallPlugin uninstalls a plugin from a cluster. UninstallPlugin 从集群上卸载插件。 Sends uninstall_plugin command to each cluster node's agent to remove plugin files from install dir, then deletes the DB record. 向集群各节点 Agent 发送 uninstall_plugin 命令以从安装目录删除插件文件,再删除数据库记录。

func (*Service) UninstallPluginFromCluster

func (s *Service) UninstallPluginFromCluster(ctx context.Context, clusterID uint, pluginName string) error

UninstallPluginFromCluster uninstalls a plugin from all nodes in a cluster. UninstallPluginFromCluster 从集群中的所有节点卸载插件。

func (*Service) UploadDependency

UploadDependency uploads one custom jar and registers it as a user-added dependency. UploadDependency 上传一个自定义 jar,并登记为用户新增依赖。

type UninstallPluginResponse

type UninstallPluginResponse struct {
	ErrorMsg string `json:"error_msg"`
	Data     any    `json:"data"`
}

UninstallPluginResponse represents the response for uninstalling a plugin. UninstallPluginResponse 表示卸载插件的响应。

type UpdateDependencyRequest

type UpdateDependencyRequest struct {
	GroupID    string `json:"group_id"`    // Maven groupId
	ArtifactID string `json:"artifact_id"` // Maven artifactId
	Version    string `json:"version"`     // 版本号 / Version
}

UpdateDependencyRequest represents a request to update a dependency. UpdateDependencyRequest 表示更新依赖的请求。

type UploadDependencyRequest

type UploadDependencyRequest struct {
	PluginName       string `json:"plugin_name"`                 // 插件名称(从 URL 获取)/ Plugin name (from URL)
	SeatunnelVersion string `json:"seatunnel_version,omitempty"` // SeaTunnel 版本 / SeaTunnel version
	GroupID          string `json:"group_id,omitempty"`          // 分组(可选)/ Group ID (optional)
	ArtifactID       string `json:"artifact_id"`                 // 依赖名 / Artifact ID
	Version          string `json:"version"`                     // 依赖版本 / Version
	TargetDir        string `json:"target_dir,omitempty"`        // 目标目录 / Target directory
}

UploadDependencyRequest represents a request to upload a custom dependency jar. UploadDependencyRequest 表示上传自定义依赖 Jar 的请求。

Jump to

Keyboard shortcuts

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