Documentation
¶
Overview ¶
Package service holds the application vertical's business rules: templates and the batch deployments that bind them to a cluster.
Index ¶
- type BatchDeploymentService
- func (s *BatchDeploymentService) Create(ctx context.Context, req *dto.BatchDeploymentRequest) (*dto.BatchDeploymentResponse, error)
- func (s *BatchDeploymentService) Delete(ctx context.Context, id string) error
- func (s *BatchDeploymentService) Get(ctx context.Context, id string) (*dto.BatchDeploymentResponse, error)
- func (s *BatchDeploymentService) List(ctx context.Context, templateID string) ([]dto.BatchDeploymentResponse, error)
- func (s *BatchDeploymentService) Update(ctx context.Context, id string, req *dto.BatchDeploymentRequest) (*dto.BatchDeploymentResponse, error)
- type TemplateService
- func (s *TemplateService) Create(ctx context.Context, req *dto.TemplateRequest) (*dto.TemplateResponse, error)
- func (s *TemplateService) Delete(ctx context.Context, id string) error
- func (s *TemplateService) Get(ctx context.Context, id string) (*dto.TemplateResponse, error)
- func (s *TemplateService) List(ctx context.Context) ([]dto.TemplateResponse, error)
- func (s *TemplateService) Update(ctx context.Context, id string, req *dto.TemplateRequest) (*dto.TemplateResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDeploymentService ¶
type BatchDeploymentService struct {
// contains filtered or unexported fields
}
BatchDeploymentService manages deployments: a template made runnable somewhere.
func NewBatchDeploymentService ¶
func NewBatchDeploymentService( db *gorm.DB, deployments *repository.BatchDeploymentRepository, templates *repository.TemplateRepository, clusters *computerepo.SlurmClusterRepository, ) *BatchDeploymentService
NewBatchDeploymentService returns a deployment service.
func (*BatchDeploymentService) Create ¶
func (s *BatchDeploymentService) Create(ctx context.Context, req *dto.BatchDeploymentRequest) (*dto.BatchDeploymentResponse, error)
Create registers a deployment and the resource request it owns.
func (*BatchDeploymentService) Delete ¶
func (s *BatchDeploymentService) Delete(ctx context.Context, id string) error
Delete removes a deployment and its owned config.
func (*BatchDeploymentService) Get ¶
func (s *BatchDeploymentService) Get(ctx context.Context, id string) (*dto.BatchDeploymentResponse, error)
Get returns one deployment.
func (*BatchDeploymentService) List ¶
func (s *BatchDeploymentService) List(ctx context.Context, templateID string) ([]dto.BatchDeploymentResponse, error)
List returns every deployment, or only those of templateID when it is non-empty.
func (*BatchDeploymentService) Update ¶
func (s *BatchDeploymentService) Update(ctx context.Context, id string, req *dto.BatchDeploymentRequest) (*dto.BatchDeploymentResponse, error)
Update changes a deployment, mutating its owned config in place so the config row survives the edit rather than being replaced.
type TemplateService ¶
type TemplateService struct {
// contains filtered or unexported fields
}
TemplateService manages application templates and their owned declarations.
Reads are open; writes are administrative. A template describes an application's contract independently of where it runs, so its declarations are replaced wholesale on update rather than patched.
func NewTemplateService ¶
func NewTemplateService(db *gorm.DB, templates *repository.TemplateRepository, deployments *repository.BatchDeploymentRepository) *TemplateService
NewTemplateService returns a template service.
func (*TemplateService) Create ¶
func (s *TemplateService) Create(ctx context.Context, req *dto.TemplateRequest) (*dto.TemplateResponse, error)
Create registers a template together with its declarations.
func (*TemplateService) Delete ¶
func (s *TemplateService) Delete(ctx context.Context, id string) error
Delete removes a template, refusing while it still has deployments.
Deployments outlive individual template edits and are managed through their own endpoints, so removing the template out from under them is rejected rather than cascaded.
func (*TemplateService) Get ¶
func (s *TemplateService) Get(ctx context.Context, id string) (*dto.TemplateResponse, error)
Get returns one template.
func (*TemplateService) List ¶
func (s *TemplateService) List(ctx context.Context) ([]dto.TemplateResponse, error)
List returns every template.
func (*TemplateService) Update ¶
func (s *TemplateService) Update(ctx context.Context, id string, req *dto.TemplateRequest) (*dto.TemplateResponse, error)
Update replaces a template's fields and its declaration set.