Skip to content

Commit 910cfe5

Browse files
authored
Merge branch 'qiniu:develop' into develop
2 parents 70430e8 + e631114 commit 910cfe5

File tree

12 files changed

+2735
-48
lines changed

12 files changed

+2735
-48
lines changed

docs/deploy/README.md

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
┌─────────────────┐ 方法调用 ┌─────────────────┐ 网络通信 ┌─────────────────┐
2727
│ 调度系统 │ ──────────────▶ │ 发布系统 │ ──────────────▶ │ 实例节点 │
2828
│ │ │ │ │ │
29-
│ • 发布指令 │ │ • 执行发布操作 │ │ • 服务实例 │
30-
│ • 批次规划 │ │ • 状态跟踪 │ │ • 版本更新 │
29+
│ • 发布指令 │ │ • 发布操作 │ │ • 服务实例 │
30+
│ • 批次规划 │ │ • 实例管理 │ │ • 版本更新 │
3131
│ • 健康检查 │ │ • 回滚操作 │ │ • 状态上报 │
3232
│ │ │ │ │ │
3333
└─────────────────┘ └─────────────────┘ └─────────────────┘
@@ -80,25 +80,30 @@
8080

8181
### 4.1 DeployService接口
8282

83+
#### 4.1.1 接口定义
84+
8385
发布服务接口,负责发布和回滚操作的执行。
8486

8587
```go
8688
type DeployService interface {
87-
ExecuteDeployment(params *DeployParams) (*OperationResult, error)
89+
DeployNewService(params *DeployNewServiceParams) (*OperationResult, error)
90+
DeployNewVersion(params *DeployNewVersionParams) (*OperationResult, error)
8891
ExecuteRollback(params *RollbackParams) (*OperationResult, error)
8992
}
9093
```
9194

92-
#### 4.1.1 ExecuteDeployment方法
95+
#### 4.1.2 方法说明
9396

94-
触发指定服务版本的发布操作
97+
**DeployNewService方法**: 部署新服务并创建指定数量的实例
9598

96-
#### 4.1.2 ExecuteRollback方法
99+
**DeployNewVersion方法**: 触发指定服务版本的发布操作
97100

98-
对指定实例执行回滚操作,支持单实例或批量实例回滚
101+
**ExecuteRollback方法**: 对指定实例执行回滚操作,支持单实例或批量实例回滚
99102

100103
### 4.2 InstanceManager接口
101104

105+
#### 4.2.1 接口定义
106+
102107
实例管理接口,负责实例信息查询和状态管理,发布模块和服务管理模块都需要使用。
103108

104109
```go
@@ -108,20 +113,70 @@ type InstanceManager interface {
108113
}
109114
```
110115

111-
#### 4.2.1 方法说明
116+
#### 4.2.2 方法说明
112117

113-
**GetServiceInstances**: 获取指定服务的实例详细信息,可选择按版本过滤
118+
**GetServiceInstances方法**: 获取指定服务的实例详细信息,可选择按版本过滤
114119

115-
**GetInstanceVersionHistory**: 获取指定实例的版本历史记录
120+
**GetInstanceVersionHistory方法**: 获取指定实例的版本历史记录
116121

117122
## 5. 内部工具函数
118123

119-
**ValidatePackageURL**: 验证包URL的有效性和安全性
124+
### 5.1 **ValidatePackageURL**: 验证包URL的有效性
125+
```go
126+
func ValidatePackageURL(packageURL string) error
127+
```
120128

121-
**GetServiceInstanceIDs**: 根据服务名和版本获取实例ID列表,用于内部批量操作
129+
### 5.2 **GetServiceInstanceInfos**: 根据服务名和版本获取实例信息列表
130+
```go
131+
func GetServiceInstanceInfos(serviceName string, version ...string) ([]*InstanceInfo, error)
132+
```
122133

123-
**GetInstanceHost**: 根据实例ID获取实例的IP地址
134+
### 5.3 **GetInstanceIP**: 根据实例ID获取实例的IP地址
135+
```go
136+
func GetInstanceIP(instanceID string) (string, error)
137+
```
124138

125-
**GetInstancePort**: 根据实例ID获取实例的端口号
139+
### 5.4 **GetInstancePort**: 根据实例ID获取实例的端口号
140+
```go
141+
func GetInstancePort(instanceID string) (int, error)
142+
```
143+
144+
### 5.5 **CheckInstanceHealth**: 检查实例的健康状态
145+
```go
146+
func CheckInstanceHealth(instanceIP string, instancePort int) (bool, error)
147+
```
126148

127-
**CheckInstanceHealth**: 检查单个实例是否有响应,用于发布前验证目标实例的可用性
149+
### 5.6 **GetAvailableHosts**: 获取所有可用的主机列表
150+
```go
151+
func GetAvailableHosts() ([]string, error)
152+
```
153+
154+
### 5.7 **GetHostIp**: 根据主机名获取主机IP地址
155+
```go
156+
func GetHostIp(hostName string) (string, error)
157+
```
158+
159+
### 5.8 **CheckHostHealth**: 检查主机的健康状态
160+
```go
161+
func CheckHostHealth(hostIpAddress string) (bool, error)
162+
```
163+
164+
### 5.9 **SelectHostForNewInstance**: 为新实例选择合适的主机
165+
```go
166+
func SelectHostForNewInstance(availableHosts []string, service string, version string) (string, error)
167+
```
168+
169+
### 5.10 **GenerateInstanceID**: 根据服务名生成实例ID
170+
```go
171+
func GenerateInstanceID(serviceName string) (string, error)
172+
```
173+
174+
### 5.11 **GenerateInstanceIP**: 生成实例IP地址
175+
```go
176+
func GenerateInstanceIP() (string, error)
177+
```
178+
179+
### 5.12 **GenerateInstance**: 创建实例
180+
```go
181+
func GenerateInstance(instanceID string, instanceIP string) error
182+
```

0 commit comments

Comments
 (0)