Documentation
¶
Overview ¶
Package app assembles the object graph every entry point shares.
Construction is explicit rather than reflective: every repository and service is built here, so the dependency graph the Java service expressed through component scanning is readable in one place. What this package adds over doing it inside the HTTP handler is a second caller — the workflow worker needs the same services the controllers do, and neither should be reaching for a package-level singleton to find them. The graph is built once per database and handed to whoever needs it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repositories ¶
type Repositories struct {
AuditEvents *auditrepo.EventRepository
Users *iamrepo.UserRepository
Groups *iamrepo.GroupRepository
GroupMembers *iamrepo.GroupMemberRepository
ServiceAccounts *iamrepo.ServiceAccountRepository
SSHCredentials *credentialsrepo.SSHCredentialRepository
SlurmClusters *computerepo.SlurmClusterRepository
ClusterPartitions *computerepo.ClusterPartitionRepository
SlurmClusterConfigs *computerepo.SlurmClusterConfigRepository
Templates *applicationrepo.TemplateRepository
BatchDeployments *applicationrepo.BatchDeploymentRepository
SCPDataStorages *datarepo.SCPDataStorageRepository
DataProducts *datarepo.DataProductRepository
VirtualDataDirectories *datarepo.VirtualDataDirectoryRepository
VirtualDataFiles *datarepo.VirtualDataFileRepository
Processes *processrepo.ProcessRepository
Statuses *processrepo.StatusRepository
TaskStatuses *processrepo.TaskStatusRepository
ProcessWorkflows *processrepo.WorkflowRepository
BatchJobStatuses *processrepo.BatchJobStatusRepository
DataStagingTasks *processrepo.DataStagingTaskRepository
JobSubmissionTasks *processrepo.JobSubmissionTaskRepository
JobMonitoringTasks *processrepo.JobMonitoringTaskRepository
InteractiveCommandTasks *processrepo.InteractiveCommandTaskRepository
Links *processrepo.LinkRepository
}
func NewRepositories ¶
func NewRepositories(db *gorm.DB) *Repositories
type Services ¶
type Services struct {
// Config and DB are carried so a caller that needs to open a transaction of its
// own — or read what it was configured with — does not have to be handed them
// separately alongside this struct.
Config config.Config
DB *gorm.DB
// Permissions resolves roles to the permissions they grant. The HTTP middleware
// resolves each caller through it, and whatever changes role_permissions calls
// Invalidate on it so the change takes effect at once.
Permissions *iamrepo.PermissionResolver
// Audit log.
Audit *auditsvc.EventService
// IAM.
User *iamsvc.UserService
Group *iamsvc.GroupService
GroupMember *iamsvc.GroupMemberService
// ServiceAccount administers non-human users and their expiring tokens.
ServiceAccount *iamsvc.ServiceAccountService
// Permission lists the permissions that exist.
Permission *iamsvc.PermissionService
// Credentials.
SSHCredential *credentialssvc.SSHCredentialService
InteractiveAuth *credentialssvc.InteractiveAuthService
// Compute.
SlurmCluster *computesvc.SlurmClusterService
ClusterPartition *computesvc.ClusterPartitionService
SlurmClusterConfig *computesvc.SlurmClusterConfigService
SlurmClusterConfigSharing *sharingsvc.Service
ClusterDiscovery *computesvc.ClusterDiscoveryService
// Application catalogue.
Template *applicationsvc.TemplateService
BatchDeployment *applicationsvc.BatchDeploymentService
// Data.
SCPDataStorage *datasvc.SCPDataStorageService
SCPDataStorageSharing *sharingsvc.Service
DataProduct *datasvc.DataProductService
DataProductSharing *sharingsvc.Service
DataTransfer *datasvc.DataTransferService
VirtualDataDirectory *datasvc.VirtualDataDirectoryService
VirtualDataFile *datasvc.VirtualDataFileService
VirtualDataDirectorySharing *sharingsvc.Service
// Processes. There is no batch process service: a batch process is a section of
// the process that owns it, written and read through ProcessService.
Process *processsvc.ProcessService
ProcessStatus *processsvc.StatusService
TaskStatus *processsvc.TaskStatusService
ProcessWorkflow *processsvc.WorkflowService
DataStagingTask *processsvc.DataStagingTaskService
JobSubmissionTask *processsvc.JobSubmissionTaskService
JobMonitoringTask *processsvc.JobMonitoringTaskService
InteractiveCommandTask *processsvc.InteractiveCommandTaskService
// Launch is a higher-level service that orchestrates the other services to submit
// a process and its tasks, and to monitor the job until it completes.
Launch *processsvc.LaunchService
Link *processsvc.LinkService
ExecutionEngine *orchestration.ExecutionEngine
}
Services is every service the application exposes, built over one database.
The fields are exported and named after what they manage rather than after their types, so a caller reads Svcs.Process, not a type assertion out of a container.
func NewServices ¶
func NewServices(cfg config.Config, db *gorm.DB, repos *Repositories, workflowBackend backend.Backend) *Services
New builds every service over db.
The repositories stay local: they are an implementation detail of the services above them, and nothing outside this function has ever wanted one directly.