Documentation
¶
Index ¶
- type BackupDeps
- type BackupFactory
- type BackupSetDeps
- type BackupSetResult
- type BackupSetUseCase
- type BackupUseCase
- type DBTargets
- type RestoreDeps
- type RestoreFactory
- type RestoreSetDeps
- type RestoreSetResult
- type RestoreSetUseCase
- type RestoreUseCase
- type RetentionUseCase
- type RotationPauser
- type RunBackupRequest
- type RunBackupSetRequest
- type RunRestoreRequest
- type RunRestoreSetRequest
- type VerifyResult
- type VerifyUseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupDeps ¶
type BackupDeps struct {
Repo port.BackupRepository
Dumper port.DBDumper
KV port.KVExporter
Scaler port.WorkloadScaler
Archiver port.VolumeArchiver
Resources port.ResourceDumper
// Shared 는 클러스터 공용 자원(Gateway CRD·GatewayClass·내부 CA)을 뜬다. Resources 와 같이
// 스택 클러스터 어댑터다.
Sealer port.Sealer
Store port.ArtifactStore
Notifier port.Notifier
Pauser RotationPauser
Targets DBTargets
// Releases 는 없어도 백업은 성립한다 — 버전을 모른 채 복구하게 될 뿐이다.
// 그래서 nil 이면 건너뛰되, 조회에 실패하면 그 사실을 남긴다.
Releases port.HelmReleaseLister
PlatformVersion string
Logger *slog.Logger
}
type BackupFactory ¶
type BackupFactory func(ctx context.Context, stackID string) (*BackupUseCase, error)
BackupFactory 는 스택(빈 값이면 플랫폼) 전용 백업 유스케이스를 만든다 — wiring.Module.Backup 과 같다.
type BackupSetDeps ¶
type BackupSetDeps struct {
Repo port.BackupRepository
Stacks port.StackLister
Factory BackupFactory
Logger *slog.Logger
}
BackupSetDeps 는 세트 백업의 의존이다.
type BackupSetResult ¶
type BackupSetResult struct {
SetID string
Status domain.Status
Runs []*domain.BackupRun
Failed []string
}
BackupSetResult 는 세트의 실행들과 파생 상태다. Failed 는 실행조차 못 만든 멤버(유스케이스 조립 실패 등)의 사유다 — 실행이 만들어진 뒤의 실패는 그 실행의 Status·Error 에 있다.
type BackupSetUseCase ¶
type BackupSetUseCase struct {
// contains filtered or unexported fields
}
BackupSetUseCase 는 플랫폼 전체 — 플랫폼 + 조직의 모든 설치 완료 스택 — 를 한 세트로 뜬다 (domain.PlanBackupSet). 멤버 하나가 실패해도 나머지는 계속 뜬다.
func NewBackupSetUseCase ¶
func NewBackupSetUseCase(d BackupSetDeps) *BackupSetUseCase
func (*BackupSetUseCase) Run ¶
func (uc *BackupSetUseCase) Run(ctx context.Context, req RunBackupSetRequest) (*BackupSetResult, error)
Run 은 계획을 세우고 멤버를 순서대로 뜬다. 스택 목록을 못 읽으면 시작하지 않는다 — 무엇을 뜰지 모르는 채 플랫폼만 뜨고 "전체" 라고 하면 복구할 때에야 빠진 것이 드러난다.
type BackupUseCase ¶
type BackupUseCase struct {
// contains filtered or unexported fields
}
func NewBackupUseCase ¶
func NewBackupUseCase(d BackupDeps) *BackupUseCase
func (*BackupUseCase) Run ¶
func (uc *BackupUseCase) Run(ctx context.Context, req RunBackupRequest) (*domain.BackupRun, error)
type RestoreDeps ¶
type RestoreDeps struct {
Repo port.BackupRepository
Dumper port.DBDumper
KV port.KVExporter
Scaler port.WorkloadScaler
Archiver port.VolumeArchiver
Resources port.ResourceDumper
Shared port.SharedResourceDumper
// 설치기). 없으면 컨트롤러가 이미 있다고 보고 건너뛴다 — 없으면 ApplyShared 가 무엇을 깔아야 하는지
// 말하고 멈춘다.
SharedComponents port.SharedComponentsEnsurer
// Namespaces 는 복구할 네임스페이스를 만든다. 없으면 이미 있다고 보고 건너뛴다.
Namespaces port.NamespaceEnsurer
// Connections 는 플랫폼 DB 를 되돌린 직후 연결 풀을 비운다 — 옛 테이블을 가리키는 준비된 문장이
// 다음 질의를 0A000 으로 죽인다. 없으면 건너뛴다(테스트·풀 없는 구성).
Connections port.ConnectionResetter
// KVImportWait / KVImportRetry 는 스택 금고 KV import 를 기다리는 상한과 재시도 간격이다. 금고는
// 워크로드 재개 뒤 뜨는 데 시간이 걸린다. 0 이면 기본값(2분 / 10초).
KVImportWait time.Duration
KVImportRetry time.Duration
// GatewayAliases 는 복구 뒤 러너·Argo CD hostAliases 를 게이트웨이의 지금 주소로 맞춘다.
// 없으면 건너뛴다.
GatewayAliases port.GatewayAliasRepinner
// StackKubeconfig 는 복구가 붙은 스택 클러스터의 kubeconfig 다. 복구를 시작할 때(DB 를 되돌리기
// 전) 읽은 것이라, full 복구가 DB 의 클러스터 정보를 백업 시점으로 돌려도 실제 대상을 가리킨다.
StackKubeconfig []byte
Sealer port.Sealer
Store port.ArtifactStore
TokenSources port.TokenSourceLister
Targets DBTargets
// Prereq 는 실행 시점의 전제 조건을 읽어온다. 함수로 둔 이유는 키의
// 존재 여부가 프로세스 수명 동안 바뀔 수 있기 때문이다.
Prereq func(context.Context) domain.Prerequisites
// Releases 는 대상 네임스페이스에 이미 설치된 차트를 읽는다. 없으면
// 버전 대조를 건너뛴다 — 대조 없이도 복구는 성립한다.
Releases port.HelmReleaseLister
Logger *slog.Logger
}
type RestoreFactory ¶
type RestoreFactory func(ctx context.Context, stackID string) (*RestoreUseCase, error)
RestoreFactory 는 스택(빈 값이면 플랫폼) 전용 복구 유스케이스를 만든다 — wiring.Module.Restore 와 같다.
type RestoreSetDeps ¶
type RestoreSetDeps struct {
Repo port.BackupRepository
Factory RestoreFactory
Logger *slog.Logger
}
type RestoreSetResult ¶
type RestoreSetResult struct {
SetID string
Restores []*domain.RestoreRun
Failed []string
Skipped []string
}
RestoreSetResult 는 멤버별 복구 기록과, 되돌리지 못한 멤버의 사유, 산출물이 없어 건너뛴 백업 ID 다.
type RestoreSetUseCase ¶
type RestoreSetUseCase struct {
// contains filtered or unexported fields
}
RestoreSetUseCase 는 백업 세트를 플랫폼 → 스택 순서로 되돌린다(domain.PlanSetRestore).
플랫폼 복구가 실패하면 멈춘다 — 스택 복구는 플랫폼 DB 의 스택 기록(클러스터)으로 그 클러스터에 붙으므로 플랫폼이 없으면 어디로 가야 할지도 모른다. 스택 하나의 실패는 다른 스택을 막지 않는다.
func NewRestoreSetUseCase ¶
func NewRestoreSetUseCase(d RestoreSetDeps) *RestoreSetUseCase
func (*RestoreSetUseCase) Run ¶
func (uc *RestoreSetUseCase) Run(ctx context.Context, req RunRestoreSetRequest) (*RestoreSetResult, error)
type RestoreUseCase ¶
type RestoreUseCase struct {
// contains filtered or unexported fields
}
func NewRestoreUseCase ¶
func NewRestoreUseCase(d RestoreDeps) *RestoreUseCase
func (*RestoreUseCase) Run ¶
func (uc *RestoreUseCase) Run(ctx context.Context, req RunRestoreRequest) (*domain.RestoreRun, error)
type RetentionUseCase ¶
type RetentionUseCase struct {
// contains filtered or unexported fields
}
RetentionUseCase 는 보존 정책을 적용한다.
산출물만 지우고 이력 행은 남긴다 — "언제 백업이 끊겼나" 의 근거가 사라지면 안 된다 (설계 §4.5).
func NewRetentionUseCase ¶
func NewRetentionUseCase(repo port.BackupRepository, store port.ArtifactStore, policy domain.RetentionPolicy, logger *slog.Logger) *RetentionUseCase
type RotationPauser ¶
type RotationPauser interface {
Pause(ctx context.Context) error
Resume(ctx context.Context) error
}
RotationPauser 는 백업 동안 토큰 회전을 멈춘다.
회전 스케줄러가 5분마다 DB 와 금고를 함께 고쳐쓰기 때문에, 멈추지 않으면 두 백업 산출물 사이에 skew 가 생긴다 (§2.1).
type RunBackupRequest ¶
type RunBackupRequest struct {
OrgID string
StackID string
Namespace string
Mode domain.Mode
Trigger domain.Trigger
// Scope 는 사용자가 고른 백업 대상이다. 비어 있으면 모드에서 파생한다 —
// 스케줄 백업과 옛 호출부는 모드만 넘기기 때문이다.
//
// 골랐다면 그것이 모드보다 우선한다. 모드는 "보통 이만큼" 이라는 preset 이고,
// 실제로 무엇을 뜰지는 Scope 가 정한다 (RequiresQuiesce 도 Scope 를 본다).
Scope []domain.Component
// SetID 가 있으면 이 실행은 백업 세트의 멤버다(domain.PlanBackupSet).
SetID string
}
type RunBackupSetRequest ¶
type RunRestoreRequest ¶
type RunRestoreRequest struct {
BackupRunID string
OrgID string
Namespace string
Mode domain.RestoreMode
}
type RunRestoreSetRequest ¶
type VerifyResult ¶
type VerifyResult struct {
BackupRunID string `json:"backup_run_id"`
OK bool `json:"ok"`
CheckedCount int `json:"checked_count"`
SchemaCheck domain.SchemaCheckResult `json:"schema_check"`
MissingObjects []string `json:"missing_objects,omitempty"`
ChecksumFails []string `json:"checksum_fails,omitempty"`
}
type VerifyUseCase ¶
type VerifyUseCase struct {
// contains filtered or unexported fields
}
VerifyUseCase 는 복원 없이 "이 백업이 열리기는 하는가" 를 확인한다.
복구 리허설을 상시로 돌릴 수는 없으므로, 팀이 겪은 "백업은 되는데 복원이 안 됐다" 에 대한 최소한의 상시 방어선이다 (설계 §7.2).
func NewVerifyUseCase ¶
func NewVerifyUseCase(repo port.BackupRepository, store port.ArtifactStore, dumper port.DBDumper, target port.DBTarget, logger *slog.Logger) *VerifyUseCase
func (*VerifyUseCase) Verify ¶
func (uc *VerifyUseCase) Verify(ctx context.Context, backupRunID string) (VerifyResult, error)