- edge node의 runtime 재연결 시 config refresh機制 구현 - node adapter에 config set 및 diff 기능 추가 - proto runtime에 config refresh 관련 스키마 추가 - edge transport server에 config refresh 핸들러 추가 - 관련 테스트 코드 및 archive 작업 기록 추가
66 lines
2.6 KiB
Go
66 lines
2.6 KiB
Go
package configrefresh
|
|
|
|
// Status is the overall classification of a refresh operation.
|
|
type Status string
|
|
|
|
const (
|
|
// StatusApplied means all detected changes are mutable and were (or would be) applied live.
|
|
StatusApplied Status = "applied"
|
|
// StatusRestartRequired means at least one change requires a process restart.
|
|
StatusRestartRequired Status = "restart_required"
|
|
// StatusRejected means the candidate config failed to load or validate.
|
|
StatusRejected Status = "rejected"
|
|
)
|
|
|
|
// NodeResult captures the config refresh outcome for one connected node.
|
|
type NodeResult struct {
|
|
NodeID string `json:"node_id"`
|
|
Alias string `json:"alias,omitempty"`
|
|
Status string `json:"status"`
|
|
Error string `json:"error,omitempty"`
|
|
RestartRequiredPaths []string `json:"restart_required_paths,omitempty"`
|
|
}
|
|
|
|
// RejectedResult builds a rejected Result with stable, non-nil change and
|
|
// ops-report slices so the API/CLI JSON response is consistent across rejected
|
|
// paths (invalid request, load/validate failure, apply failure).
|
|
func RejectedResult(req Request, summary string) Result {
|
|
return Result{
|
|
Status: StatusRejected,
|
|
Mode: req.Mode,
|
|
RequestID: req.RequestID,
|
|
Summary: summary,
|
|
Changes: []Change{},
|
|
ChangedNodes: []string{},
|
|
ChangedProviders: []string{},
|
|
ChangedModels: []string{},
|
|
RestartRequiredPaths: []string{},
|
|
NodeResults: []NodeResult{},
|
|
}
|
|
}
|
|
|
|
// Change describes one detected config diff and its classification.
|
|
type Change struct {
|
|
Path string `json:"path"`
|
|
Class Status `json:"class"`
|
|
Previous string `json:"previous,omitempty"`
|
|
Next string `json:"next,omitempty"`
|
|
}
|
|
|
|
// Result is the response from a refresh evaluate or apply operation.
|
|
type Result struct {
|
|
Status Status `json:"status"`
|
|
Mode Mode `json:"mode"`
|
|
RequestID string `json:"request_id,omitempty"`
|
|
Changes []Change `json:"changes"`
|
|
Summary string `json:"summary"`
|
|
// Derived ops-report fields let an operator confirm which node, provider,
|
|
// and model items changed and which paths force a restart, without parsing
|
|
// individual Change paths. They are stable, sorted, and always non-nil so
|
|
// the API/CLI JSON response is consistent across runs.
|
|
ChangedNodes []string `json:"changed_nodes"`
|
|
ChangedProviders []string `json:"changed_providers"`
|
|
ChangedModels []string `json:"changed_models"`
|
|
RestartRequiredPaths []string `json:"restart_required_paths"`
|
|
NodeResults []NodeResult `json:"node_results,omitempty"`
|
|
}
|