repository

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCompatibilityRepository

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

MemoryCompatibilityRepository is an in-memory implementation of port.CompatibilityRepository with three pre-loaded compatibility matrices.

func NewMemoryCompatibilityRepository

func NewMemoryCompatibilityRepository() *MemoryCompatibilityRepository

NewMemoryCompatibilityRepository constructs a MemoryCompatibilityRepository with three canonical compatibility matrices pre-loaded.

func (*MemoryCompatibilityRepository) Create

Create persists a new matrix. Returns ErrCompatibilityMatrixExists when the id collides with an existing row. F8-Phase5 admin CRUD endpoint backing.

func (*MemoryCompatibilityRepository) Delete

Delete is idempotent — missing row returns nil. Handlers that want strict 404 semantics should GetByID beforehand.

func (*MemoryCompatibilityRepository) GetAll

GetAll returns all compatibility matrices in id order, like the Postgres repository.

func (*MemoryCompatibilityRepository) GetByID

GetByID returns the compatibility matrix with the given ID.

func (*MemoryCompatibilityRepository) Update

Update replaces every mutable field on the matrix identified by m.ID.

func (*MemoryCompatibilityRepository) Validate

Validate finds the best matching matrix for the given tool map (tool category -> tool name). Returns the first matrix in id order whose tools all match — the same choice the Postgres repository makes. Returns an error if no match is found.

type MemoryHelmStepMetadataRepository

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

MemoryHelmStepMetadataRepository is an in-memory implementation of the Helm step metadata repository.

func NewMemoryHelmStepMetadataRepository

func NewMemoryHelmStepMetadataRepository() *MemoryHelmStepMetadataRepository

NewMemoryHelmStepMetadataRepository constructs an empty in-memory repository.

func (*MemoryHelmStepMetadataRepository) Create

func (*MemoryHelmStepMetadataRepository) Delete

func (*MemoryHelmStepMetadataRepository) GetByStep

func (*MemoryHelmStepMetadataRepository) List

func (*MemoryHelmStepMetadataRepository) Seed

func (*MemoryHelmStepMetadataRepository) Update

type MemoryHistoryRepository

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

MemoryHistoryRepository is an in-memory implementation of port.HistoryRepository.

func NewMemoryHistoryRepository

func NewMemoryHistoryRepository() *MemoryHistoryRepository

NewMemoryHistoryRepository constructs an empty MemoryHistoryRepository.

func (*MemoryHistoryRepository) GetDiff

func (r *MemoryHistoryRepository) GetDiff(_ context.Context, stackID, versionID string) ([]domain.ConfigDiff, error)

GetDiff computes the diff between the given version and the one immediately preceding it. If there is no previous version, all fields are reported as new (OldValue = "").

func (*MemoryHistoryRepository) GetVersion

func (r *MemoryHistoryRepository) GetVersion(_ context.Context, stackID, versionID string) (*domain.StackVersion, error)

GetVersion returns a specific version by its ID, scoped to a stack.

func (*MemoryHistoryRepository) ListVersions

func (r *MemoryHistoryRepository) ListVersions(_ context.Context, stackID string) ([]*domain.StackVersion, error)

ListVersions returns all versions for a stack, sorted by version number ascending.

func (*MemoryHistoryRepository) SaveVersion

func (r *MemoryHistoryRepository) SaveVersion(_ context.Context, version *domain.StackVersion) error

SaveVersion persists a new stack version snapshot.

type MemoryResourceDefaultRepository

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

func NewMemoryResourceDefaultRepository

func NewMemoryResourceDefaultRepository() *MemoryResourceDefaultRepository

func (*MemoryResourceDefaultRepository) List

func (*MemoryResourceDefaultRepository) Upsert

type MemoryStackRepository

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

MemoryStackRepository is an in-memory implementation of port.StackRepository. It is intended for development and testing; it is not safe to use across process restarts.

func NewMemoryStackRepository

func NewMemoryStackRepository() *MemoryStackRepository

NewMemoryStackRepository constructs an empty MemoryStackRepository.

func (*MemoryStackRepository) Create

func (r *MemoryStackRepository) Create(_ context.Context, stack *domain.Stack) error

Create stores a new stack. Returns an error if the ID already exists.

func (*MemoryStackRepository) Delete

Delete removes a stack by ID.

func (*MemoryStackRepository) FindByID

func (r *MemoryStackRepository) FindByID(ctx context.Context, id string) (*domain.Stack, error)

func (*MemoryStackRepository) GetByID

GetByID retrieves a stack by its ID.

func (*MemoryStackRepository) List

func (r *MemoryStackRepository) List(_ context.Context, orgID string, includeDeleted bool) ([]*domain.Stack, error)

List returns all stacks belonging to the given organization.

func (*MemoryStackRepository) ListByCluster added in v0.6.0

func (r *MemoryStackRepository) ListByCluster(_ context.Context, clusterID string) ([]*domain.Stack, error)

ListByCluster 는 한 클러스터의 지우지 않은 스택을 조직과 무관하게 돌려준다.

func (*MemoryStackRepository) ListCompleted added in v0.6.0

func (r *MemoryStackRepository) ListCompleted(_ context.Context) ([]*domain.Stack, error)

ListCompleted 는 설치가 끝난 스택을 조직과 무관하게 돌려준다.

func (*MemoryStackRepository) ListInFlight

func (r *MemoryStackRepository) ListInFlight(_ context.Context) ([]*domain.Stack, error)

ListInFlight 는 설치가 진행 중인 상태로 남아 있는 스택을 조직과 무관하게 돌려준다.

func (*MemoryStackRepository) SetYAMLOverride added in v0.6.0

func (r *MemoryStackRepository) SetYAMLOverride(_ context.Context, stackID, key, yamlText string) error

SetYAMLOverride 는 스택 설정의 yaml_overrides 에서 키 하나만 바꾼다. 행의 다른 값은 그대로다.

func (*MemoryStackRepository) TouchUpdatedAt

func (r *MemoryStackRepository) TouchUpdatedAt(_ context.Context, stackID string) error

Update replaces a stored stack with the given value. TouchUpdatedAt 은 갱신 시각만 찍는다. 설치가 살아 있음을 알리는 데 쓴다.

func (*MemoryStackRepository) Update

func (r *MemoryStackRepository) Update(_ context.Context, stack *domain.Stack) error

func (*MemoryStackRepository) UpdateTools

func (r *MemoryStackRepository) UpdateTools(ctx context.Context, stack *domain.Stack) error

type MemoryTemplateRepository

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

MemoryTemplateRepository is an in-memory implementation of port.TemplateRepository with canonical Golden Path templates.

func NewMemoryTemplateRepository

func NewMemoryTemplateRepository() *MemoryTemplateRepository

NewMemoryTemplateRepository constructs a MemoryTemplateRepository with canonical Golden Path templates pre-loaded.

func (*MemoryTemplateRepository) Create

func (r *MemoryTemplateRepository) Create(_ context.Context, template *domain.Template) error

func (*MemoryTemplateRepository) Delete

func (*MemoryTemplateRepository) GetByID

GetByID returns the template with the given ID.

func (*MemoryTemplateRepository) List

List returns all available templates.

func (*MemoryTemplateRepository) Update

func (r *MemoryTemplateRepository) Update(_ context.Context, template *domain.Template) error

type PostgresClusterReader

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

PostgresClusterReader implements port.ClusterReader by querying the clusters table the admin module owns. This is safe inside the modular monolith because both modules share one database; a future microservice split would replace this with a gRPC/HTTP client.

func NewPostgresClusterReader

func NewPostgresClusterReader(pool *pgxpool.Pool) *PostgresClusterReader

NewPostgresClusterReader constructs a PostgresClusterReader.

func (*PostgresClusterReader) GetClusterSummary

func (r *PostgresClusterReader) GetClusterSummary(ctx context.Context, clusterID string) (*port.ClusterSummary, error)

GetClusterSummary returns the subset of cluster fields the Pre-Deploy Gate needs. Returns nil, nil when the cluster row is missing.

type PostgresCompatibilityRepository

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

func NewPostgresCompatibilityRepository

func NewPostgresCompatibilityRepository(pool *pgxpool.Pool) *PostgresCompatibilityRepository

func (*PostgresCompatibilityRepository) Create

Create inserts a new matrix. Returns port.ErrCompatibilityMatrixExists when the id is already present (ON CONFLICT DO NOTHING + rows-affected check).

func (*PostgresCompatibilityRepository) Delete

Delete removes a matrix. Idempotent — missing id is not an error.

func (*PostgresCompatibilityRepository) GetAll

func (*PostgresCompatibilityRepository) GetByID

func (*PostgresCompatibilityRepository) Update

Update replaces every mutable column. Returns port.ErrCompatibilityMatrixNotFound when no row matched.

func (*PostgresCompatibilityRepository) Validate

type PostgresDeployLogStore

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

PostgresDeployLogStore 는 설치 로그를 stack_deploy_logs 에 남긴다.

로그가 프로세스 메모리에만 있으면 파드가 재시작되는 순간 사라진다. 설치는 20~30분짜리라 그 사이 재시작이 겹칠 확률이 낮지 않고, 그러면 무엇이 왜 멈췄는지 사후에 알 방법이 없다.

func NewPostgresDeployLogStore

func NewPostgresDeployLogStore(pool *pgxpool.Pool) *PostgresDeployLogStore

func (*PostgresDeployLogStore) Append

func (r *PostgresDeployLogStore) Append(ctx context.Context, deploymentID string, entry port.LogEntry) error

Append 는 항목 하나를 남긴다.

func (*PostgresDeployLogStore) Delete

func (r *PostgresDeployLogStore) Delete(ctx context.Context, deploymentID string) error

Delete 는 이 배포의 로그를 지운다.

func (*PostgresDeployLogStore) List

func (r *PostgresDeployLogStore) List(ctx context.Context, deploymentID string, limit int) ([]port.LogEntry, error)

List 는 최근 limit 줄을 기록 순서로 돌려준다.

상한을 넘으면 오래된 쪽을 버린다 — 화면이 필요로 하는 것은 최근이고, 진행률은 마지막 항목에서 복원되기 때문이다. 그래서 안쪽 질의는 seq 역순으로 자르고 바깥에서 다시 오름차순으로 세운다.

type PostgresHelmStepMetadataRepository

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

PostgresHelmStepMetadataRepository stores DB-backed Helm chart metadata for stack steps.

func NewPostgresHelmStepMetadataRepository

func NewPostgresHelmStepMetadataRepository(pool *pgxpool.Pool) *PostgresHelmStepMetadataRepository

func (*PostgresHelmStepMetadataRepository) Create

func (*PostgresHelmStepMetadataRepository) Delete

func (*PostgresHelmStepMetadataRepository) GetByStep

func (*PostgresHelmStepMetadataRepository) List

func (*PostgresHelmStepMetadataRepository) Update

type PostgresHistoryRepository

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

func NewPostgresHistoryRepository

func NewPostgresHistoryRepository(pool *pgxpool.Pool) *PostgresHistoryRepository

func (*PostgresHistoryRepository) GetDiff

func (r *PostgresHistoryRepository) GetDiff(ctx context.Context, stackID, versionID string) ([]domain.ConfigDiff, error)

func (*PostgresHistoryRepository) GetVersion

func (r *PostgresHistoryRepository) GetVersion(ctx context.Context, stackID, versionID string) (*domain.StackVersion, error)

func (*PostgresHistoryRepository) ListVersions

func (r *PostgresHistoryRepository) ListVersions(ctx context.Context, stackID string) ([]*domain.StackVersion, error)

func (*PostgresHistoryRepository) SaveVersion

func (r *PostgresHistoryRepository) SaveVersion(ctx context.Context, version *domain.StackVersion) error

type PostgresKubeconfigProvider

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

func NewPostgresKubeconfigProvider

func NewPostgresKubeconfigProvider(pool *pgxpool.Pool, encryptionKey []byte) *PostgresKubeconfigProvider

func (*PostgresKubeconfigProvider) GetKubeconfig

func (p *PostgresKubeconfigProvider) GetKubeconfig(ctx context.Context, clusterID string) ([]byte, error)

type PostgresResourceDefaultRepository

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

func NewPostgresResourceDefaultRepository

func NewPostgresResourceDefaultRepository(pool *pgxpool.Pool) *PostgresResourceDefaultRepository

func (*PostgresResourceDefaultRepository) List

func (*PostgresResourceDefaultRepository) Upsert

type PostgresStackImageScanRepository added in v0.6.0

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

PostgresStackImageScanRepository 는 설치 이미지 스캔 결과를 보관한다.

func NewPostgresStackImageScanRepository added in v0.6.0

func NewPostgresStackImageScanRepository(pool *pgxpool.Pool) *PostgresStackImageScanRepository

NewPostgresStackImageScanRepository 는 저장소를 만든다.

func (*PostgresStackImageScanRepository) ClaimCVENotices added in v0.6.0

func (r *PostgresStackImageScanRepository) ClaimCVENotices(ctx context.Context, stackID string, ids []string, at time.Time) ([]string, error)

ClaimCVENotices 는 ids 중 아직 남지 않은 것을 남기고 이번에 남긴 것만 돌려준다. 같은 행을 두 레플리카가 동시에 넣으면 기본 키가 하나만 받는다.

func (*PostgresStackImageScanRepository) ListByStack added in v0.6.0

ListByStack 은 스택의 결과를 돌려준다.

func (*PostgresStackImageScanRepository) ListVulnerabilities added in v0.6.0

func (r *PostgresStackImageScanRepository) ListVulnerabilities(ctx context.Context, stackID, digest string) (domain.StackImageVulnerabilities, error)

ListVulnerabilities 는 이미지 하나의 저장된 취약점 목록이다.

func (*PostgresStackImageScanRepository) NotifiedCVEIDs added in v0.6.0

func (r *PostgresStackImageScanRepository) NotifiedCVEIDs(ctx context.Context, stackID string) (map[string]bool, error)

NotifiedCVEIDs 는 스택에 이미 알린 CVE 다.

func (*PostgresStackImageScanRepository) ReleaseCVENotices added in v0.6.0

func (r *PostgresStackImageScanRepository) ReleaseCVENotices(ctx context.Context, stackID string, ids []string) error

ReleaseCVENotices 는 보내지 못한 선점을 되돌린다.

func (*PostgresStackImageScanRepository) ReplaceForStack added in v0.6.0

func (r *PostgresStackImageScanRepository) ReplaceForStack(ctx context.Context, stackID string, scans []domain.StackImageScan) error

ReplaceForStack 은 스택의 결과를 이번 스캔으로 통째로 바꾼다.

func (*PostgresStackImageScanRepository) VulnerabilityIDsByRelease added in v0.6.0

func (r *PostgresStackImageScanRepository) VulnerabilityIDsByRelease(ctx context.Context, stackID, release string) (map[string]bool, bool, error)

VulnerabilityIDsByRelease 는 스택의 한 릴리스가 설치한 이미지에서 지금 발견된 취약점 ID 와, 그 릴리스의 이미지 중 취약점 목록을 저장한 것이 있는지다. 업그레이드 대상이 아닌 공용 구성요소는 같은 이름의 릴리스라도 뺀다.

type PostgresStackRepository

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

func NewPostgresStackRepository

func NewPostgresStackRepository(pool *pgxpool.Pool) *PostgresStackRepository

func (*PostgresStackRepository) Create

func (r *PostgresStackRepository) Create(ctx context.Context, stack *domain.Stack) error

func (*PostgresStackRepository) Delete

func (r *PostgresStackRepository) Delete(ctx context.Context, id string) error

func (*PostgresStackRepository) FindByID

func (r *PostgresStackRepository) FindByID(ctx context.Context, id string) (*domain.Stack, error)

func (*PostgresStackRepository) GetByID

func (*PostgresStackRepository) List

func (r *PostgresStackRepository) List(ctx context.Context, orgID string, includeDeleted bool) ([]*domain.Stack, error)

func (*PostgresStackRepository) ListByCluster added in v0.6.0

func (r *PostgresStackRepository) ListByCluster(ctx context.Context, clusterID string) ([]*domain.Stack, error)

ListByCluster 는 한 클러스터의 지우지 않은 스택을 조직과 무관하게 돌려준다.

cluster_id 는 UUID 라 형식이 틀린 값이 오면 쿼리가 실패한다. 그때는 오류가 아니라 "없음" 이어야 하므로 먼저 걸러 낸다. text 로 바꿔 비교하면 같은 결과지만 idx_stacks_cluster_id 를 쓰지 못한다.

func (*PostgresStackRepository) ListCompleted added in v0.6.0

func (r *PostgresStackRepository) ListCompleted(ctx context.Context) ([]*domain.Stack, error)

ListCompleted 는 설치가 끝난 스택을 조직과 무관하게 돌려준다.

설치 이미지 주기 재스캔이 쓴다. 오래 스캔하지 않은 순서가 아니라 갱신 순서로 도는 것은, 재스캔이 스택 레코드를 건드리지 않아 둘이 같은 순서를 뜻하지 않기 때문이다 — 한 번에 전부 돈다.

func (*PostgresStackRepository) ListInFlight

func (r *PostgresStackRepository) ListInFlight(ctx context.Context) ([]*domain.Stack, error)

ListInFlight 는 설치가 진행 중인 상태로 남아 있는 스택을 조직과 무관하게 돌려준다.

조직으로 거르지 않는다. 끊긴 설치를 찾는 일은 조직 경계와 무관하고, 거르면 조직 수만큼 조회를 반복해야 한다.

func (*PostgresStackRepository) SetYAMLOverride added in v0.6.0

func (r *PostgresStackRepository) SetYAMLOverride(ctx context.Context, stackID, key, yamlText string) error

SetYAMLOverride 는 스택 설정의 yaml_overrides 에서 키 하나만 바꾼다.

Update 는 행 전체(이름·상태·단계·config)를 덮어쓴다. 오래 걸리는 작업 뒤에 그 결과를 저장하면 그 사이 들어온 상태 전이나 다른 키의 편집을 되돌린다 — 그리고 StackConfig 에 없는 config.tools 도 지운다. 여기서는 그 키만 바꾼다.

func (*PostgresStackRepository) TouchUpdatedAt

func (r *PostgresStackRepository) TouchUpdatedAt(ctx context.Context, stackID string) error

TouchUpdatedAt 은 갱신 시각만 찍는다.

끊긴 설치를 찾는 리퍼는 갱신 시각만 본다. 그런데 그 시각은 단계가 시작·완료될 때만 움직여서, 한 단계가 임계값보다 오래 걸리면 멀쩡히 도는 설치가 끊긴 것으로 표시된다 — 2026-08-21 운영에서 그렇게 됐다. 설치가 도는 동안 이것을 주기적으로 찍으면 "시각이 멈췄다" 가 "돌리던 것이 사라졌다" 를 뜻하게 된다.

func (*PostgresStackRepository) Update

func (r *PostgresStackRepository) Update(ctx context.Context, stack *domain.Stack) error

func (*PostgresStackRepository) UpdateTools

func (r *PostgresStackRepository) UpdateTools(ctx context.Context, stack *domain.Stack) error

type PostgresTemplateRepository

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

func NewPostgresTemplateRepository

func NewPostgresTemplateRepository(pool *pgxpool.Pool) *PostgresTemplateRepository

func (*PostgresTemplateRepository) Create

func (r *PostgresTemplateRepository) Create(ctx context.Context, template *domain.Template) error

func (*PostgresTemplateRepository) Delete

func (*PostgresTemplateRepository) GetByID

func (*PostgresTemplateRepository) List

func (*PostgresTemplateRepository) Update

func (r *PostgresTemplateRepository) Update(ctx context.Context, template *domain.Template) error

type PostgresTokenSourceRegistry

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

func NewPostgresTokenSourceRegistry

func NewPostgresTokenSourceRegistry(pool *pgxpool.Pool, secret *secrets.Router) *PostgresTokenSourceRegistry

func (*PostgresTokenSourceRegistry) Upsert

type PostgresUpgradeRepository added in v0.6.0

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

func NewPostgresUpgradeRepository added in v0.6.0

func NewPostgresUpgradeRepository(pool *pgxpool.Pool) *PostgresUpgradeRepository

func (*PostgresUpgradeRepository) ActiveRun added in v0.6.0

func (r *PostgresUpgradeRepository) ActiveRun(ctx context.Context, stackID string) (*domain.UpgradeRun, error)

func (*PostgresUpgradeRepository) CloseStaleRun added in v0.6.0

func (r *PostgresUpgradeRepository) CloseStaleRun(ctx context.Context, run *domain.UpgradeRun, staleBefore time.Time) (bool, error)

func (*PostgresUpgradeRepository) CreateBundle added in v0.6.0

CreateBundle 은 기본 키와 경로 유니크 제약(tool · source · target)으로 중복을 막는다.

func (*PostgresUpgradeRepository) CreateRun added in v0.6.0

CreateRun 은 진행 중 실행의 부분 유니크 인덱스와 Idempotency-Key 유니크 제약으로 동시 요청을 가린다. 어느 제약에 걸렸는지를 도메인 오류로 바꿔 돌려준다.

func (*PostgresUpgradeRepository) FindRunByIdempotencyKey added in v0.6.0

func (r *PostgresUpgradeRepository) FindRunByIdempotencyKey(ctx context.Context, stackID, key string) (*domain.UpgradeRun, error)

func (*PostgresUpgradeRepository) GetBundle added in v0.6.0

func (*PostgresUpgradeRepository) GetRun added in v0.6.0

func (r *PostgresUpgradeRepository) GetRun(ctx context.Context, stackID, runID string) (*domain.UpgradeRun, error)

func (*PostgresUpgradeRepository) GetVerifiedBundle added in v0.6.0

func (r *PostgresUpgradeRepository) GetVerifiedBundle(ctx context.Context, id string) (*domain.UpgradeBundle, error)

func (*PostgresUpgradeRepository) Heartbeat added in v0.6.0

func (r *PostgresUpgradeRepository) Heartbeat(ctx context.Context, runID string, at time.Time) error

func (*PostgresUpgradeRepository) LatestRun added in v0.6.0

func (r *PostgresUpgradeRepository) LatestRun(ctx context.Context, stackID, tool string) (*domain.UpgradeRun, error)

func (*PostgresUpgradeRepository) ListBundles added in v0.6.0

func (*PostgresUpgradeRepository) ListRuns added in v0.6.0

func (r *PostgresUpgradeRepository) ListRuns(ctx context.Context, stackID string, limit int) ([]domain.UpgradeRun, error)

func (*PostgresUpgradeRepository) ListVerifiedBundles added in v0.6.0

func (r *PostgresUpgradeRepository) ListVerifiedBundles(ctx context.Context, tool, source string) ([]domain.UpgradeBundle, error)

func (*PostgresUpgradeRepository) UpdateBundleStatus added in v0.6.0

func (r *PostgresUpgradeRepository) UpdateBundleStatus(ctx context.Context, id, status string) error

func (*PostgresUpgradeRepository) UpdateRun added in v0.6.0

Jump to

Keyboard shortcuts

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