{"modulePath":"github.com/https-cert/deploy","version":"v0.7.4","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package updater\n\n## Functions\n\n```go\nfunc PerformUpdate(ctx context.Context, info *UpdateInfo) error\n```\nPerformUpdate 执行更新\n\n```go\nfunc Rollback() error\n```\nRollback 回滚到上一次更新保留的备份版本。\n\n## Types\n\n```go\ntype Assets struct {\n\tName               string `json:\"name\"`\n\tBrowserDownloadURL string `json:\"browser_download_url\"`\n\tSize               int64  `json:\"size\"`\n}\n```\nGitHubRelease GitHub Release API 响应结构\n\n```go\ntype GitHubRelease struct {\n\tTagName string    `json:\"tag_name\"`\n\tName    string    `json:\"name\"`\n\tBody    string    `json:\"body\"`\n\tAssets  []*Assets `json:\"assets\"`\n}\n```\nGitHubRelease GitHub Release API 响应结构\n\n```go\ntype Service struct {\n\t// Runtime 是更新镜像和代理配置的只读快照。\n\tRuntime *config.Runtime\n\t// HTTPClient 是检查 Release 时使用的客户端。\n\tHTTPClient *http.Client\n\t// ReleaseURL 是 Release API 地址，空值使用 GitHub 默认地址。\n\tReleaseURL string\n\t// CurrentVersion 覆盖默认编译版本，便于离线测试。\n\tCurrentVersion string\n}\n```\nService 持有一次更新操作所需的显式配置和 HTTP 依赖。\n\n```go\nfunc NewService(runtime *config.Runtime, httpClient *http.Client) *Service\n```\nNewService 创建显式依赖的更新服务。\n\n```go\nfunc (s *Service) CheckUpdate(ctx context.Context) (*UpdateInfo, error)\n```\nCheckUpdate 使用 Service 的 HTTP 客户端检查最新 Release。\n\n```go\nfunc (s *Service) PerformUpdate(ctx context.Context, info *UpdateInfo) error\n```\nPerformUpdate 执行更新流程并复用现有原子替换实现。\n\n```go\nfunc (s *Service) Rollback() error\n```\nRollback 回滚上一次更新保留的备份二进制。\n\n```go\ntype UpdateInfo struct {\n\tCurrentVersion string\n\tLatestVersion  string\n\tHasUpdate      bool\n\tDownloadURL    string\n\tChecksumURL    string\n\tReleaseNotes   string\n\tBinaryName     string\n}\n```\nUpdateInfo 更新信息\n\n```go\nfunc CheckUpdate(ctx context.Context) (*UpdateInfo, error)\n```\nCheckUpdate 检查是否有新版本\n\n","path":"github.com/https-cert/deploy/internal/updater","name":"updater","synopsis":"","isRedistributable":true}
