feat: runtime manager
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// Package handlers ships the GM/Admin-facing internal REST surface of
|
||||
// Runtime Manager. The package is consumed by
|
||||
// `galaxy/rtmanager/internal/api/internalhttp`; each handler delegates
|
||||
// to one of the lifecycle services in `internal/service/`
|
||||
// (`startruntime`, `stopruntime`, `restartruntime`, `patchruntime`,
|
||||
// `cleanupcontainer`) or reads directly from `ports.RuntimeRecordStore`
|
||||
// (list / get).
|
||||
//
|
||||
// The interfaces declared in this file mirror the single `Handle`
|
||||
// method exposed by every concrete lifecycle service. Production wiring
|
||||
// passes the concrete service pointers; tests pass `mockgen`-generated
|
||||
// mocks. The narrow shape keeps the handler layer free of service
|
||||
// internals (lease tokens, telemetry, durable side effects) and matches
|
||||
// the repo-wide `mockgen` convention for wide / recorder ports.
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"galaxy/rtmanager/internal/service/cleanupcontainer"
|
||||
"galaxy/rtmanager/internal/service/patchruntime"
|
||||
"galaxy/rtmanager/internal/service/restartruntime"
|
||||
"galaxy/rtmanager/internal/service/startruntime"
|
||||
"galaxy/rtmanager/internal/service/stopruntime"
|
||||
)
|
||||
|
||||
//go:generate go run go.uber.org/mock/mockgen -destination=mocks/mock_services.go -package=mocks galaxy/rtmanager/internal/api/internalhttp/handlers StartService,StopService,RestartService,PatchService,CleanupService
|
||||
|
||||
// StartService is the narrow port the start handler depends on. It
|
||||
// matches the public Handle method of `startruntime.Service`; the
|
||||
// concrete service satisfies the interface implicitly.
|
||||
type StartService interface {
|
||||
Handle(ctx context.Context, in startruntime.Input) (startruntime.Result, error)
|
||||
}
|
||||
|
||||
// StopService is the narrow port the stop handler depends on.
|
||||
type StopService interface {
|
||||
Handle(ctx context.Context, in stopruntime.Input) (stopruntime.Result, error)
|
||||
}
|
||||
|
||||
// RestartService is the narrow port the restart handler depends on.
|
||||
type RestartService interface {
|
||||
Handle(ctx context.Context, in restartruntime.Input) (restartruntime.Result, error)
|
||||
}
|
||||
|
||||
// PatchService is the narrow port the patch handler depends on.
|
||||
type PatchService interface {
|
||||
Handle(ctx context.Context, in patchruntime.Input) (patchruntime.Result, error)
|
||||
}
|
||||
|
||||
// CleanupService is the narrow port the cleanup handler depends on.
|
||||
type CleanupService interface {
|
||||
Handle(ctx context.Context, in cleanupcontainer.Input) (cleanupcontainer.Result, error)
|
||||
}
|
||||
Reference in New Issue
Block a user