diff --git a/internal/manager/api_impl/api_impl.go b/internal/manager/api_impl/api_impl.go index 3d6f72d9..858d4219 100644 --- a/internal/manager/api_impl/api_impl.go +++ b/internal/manager/api_impl/api_impl.go @@ -81,7 +81,7 @@ var _ TaskStateMachine = (*task_state_machine.StateMachine)(nil) type ChangeBroadcaster interface { // BroadcastNewJob sends a 'new job' notification to all SocketIO clients. - BroadcastNewJob(jobUpdate api.JobUpdate) + BroadcastNewJob(jobUpdate api.SocketIOJobUpdate) // Note that there is no BroadcastNewTask. The 'new job' broadcast is sent // after the job's tasks have been created, and thus there is no need for a diff --git a/internal/manager/api_impl/jobs_test.go b/internal/manager/api_impl/jobs_test.go index 4d5e622d..3a1cc909 100644 --- a/internal/manager/api_impl/jobs_test.go +++ b/internal/manager/api_impl/jobs_test.go @@ -61,7 +61,7 @@ func TestSubmitJob(t *testing.T) { mf.persistence.EXPECT().FetchJob(gomock.Any(), queuedJob.JobID).Return(&dbJob, nil) // Expect the new job to be broadcast. - jobUpdate := api.JobUpdate{ + jobUpdate := api.SocketIOJobUpdate{ Id: dbJob.UUID, Name: &dbJob.Name, Priority: dbJob.Priority, diff --git a/internal/manager/api_impl/mocks/api_impl_mock.gen.go b/internal/manager/api_impl/mocks/api_impl_mock.gen.go index b241cf37..79b75a77 100644 --- a/internal/manager/api_impl/mocks/api_impl_mock.gen.go +++ b/internal/manager/api_impl/mocks/api_impl_mock.gen.go @@ -253,7 +253,7 @@ func (m *MockChangeBroadcaster) EXPECT() *MockChangeBroadcasterMockRecorder { } // BroadcastNewJob mocks base method. -func (m *MockChangeBroadcaster) BroadcastNewJob(arg0 api.JobUpdate) { +func (m *MockChangeBroadcaster) BroadcastNewJob(arg0 api.SocketIOJobUpdate) { m.ctrl.T.Helper() m.ctrl.Call(m, "BroadcastNewJob", arg0) } diff --git a/internal/manager/task_state_machine/task_state_machine.go b/internal/manager/task_state_machine/task_state_machine.go index ef5b7ef1..ce159486 100644 --- a/internal/manager/task_state_machine/task_state_machine.go +++ b/internal/manager/task_state_machine/task_state_machine.go @@ -51,7 +51,7 @@ var _ PersistenceService = (*persistence.DB)(nil) type ChangeBroadcaster interface { // BroadcastJobUpdate sends the job update to SocketIO clients. - BroadcastJobUpdate(jobUpdate api.JobUpdate) + BroadcastJobUpdate(jobUpdate api.SocketIOJobUpdate) // BroadcastTaskUpdate sends the task update to SocketIO clients. BroadcastTaskUpdate(jobUpdate api.SocketIOTaskUpdate) diff --git a/internal/manager/task_state_machine/task_state_machine_test.go b/internal/manager/task_state_machine/task_state_machine_test.go index 8cbf81e6..e3a5a594 100644 --- a/internal/manager/task_state_machine/task_state_machine_test.go +++ b/internal/manager/task_state_machine/task_state_machine_test.go @@ -396,7 +396,7 @@ func (m *StateMachineMocks) expectBroadcastJobChange( job *persistence.Job, fromStatus, toStatus api.JobStatus, ) *gomock.Call { - expectUpdate := api.JobUpdate{ + expectUpdate := api.SocketIOJobUpdate{ Id: job.UUID, Name: &job.Name, PreviousStatus: &fromStatus, @@ -411,7 +411,7 @@ func (m *StateMachineMocks) expectBroadcastJobChangeWithTaskRefresh( job *persistence.Job, fromStatus, toStatus api.JobStatus, ) *gomock.Call { - expectUpdate := api.JobUpdate{ + expectUpdate := api.SocketIOJobUpdate{ Id: job.UUID, Name: &job.Name, PreviousStatus: &fromStatus, diff --git a/internal/manager/webupdates/job_updates.go b/internal/manager/webupdates/job_updates.go index 7a060f2d..59f4271b 100644 --- a/internal/manager/webupdates/job_updates.go +++ b/internal/manager/webupdates/job_updates.go @@ -8,12 +8,12 @@ import ( "git.blender.org/flamenco/pkg/api" ) -// NewJobUpdate returns a partial JobUpdate struct for the given job. +// NewJobUpdate returns a partial SocketIOJobUpdate struct for the given job. // It only fills in the fields that represent the current state of the job. For // example, it omits `PreviousStatus`. The ommitted fields can be filled in by // the caller. -func NewJobUpdate(job *persistence.Job) api.JobUpdate { - jobUpdate := api.JobUpdate{ +func NewJobUpdate(job *persistence.Job) api.SocketIOJobUpdate { + jobUpdate := api.SocketIOJobUpdate{ Id: job.UUID, Name: &job.Name, Updated: job.UpdatedAt, @@ -43,7 +43,7 @@ func NewTaskUpdate(task *persistence.Task) api.SocketIOTaskUpdate { } // BroadcastJobUpdate sends the job update to clients. -func (b *BiDirComms) BroadcastJobUpdate(jobUpdate api.JobUpdate) { +func (b *BiDirComms) BroadcastJobUpdate(jobUpdate api.SocketIOJobUpdate) { log.Debug().Interface("jobUpdate", jobUpdate).Msg("socketIO: broadcasting job update") b.BroadcastTo(SocketIORoomJobs, SIOEventJobUpdate, jobUpdate) } @@ -51,7 +51,7 @@ func (b *BiDirComms) BroadcastJobUpdate(jobUpdate api.JobUpdate) { // BroadcastNewJob sends a "new job" notification to clients. // This function should be called when the job has been completely created, so // including its tasks. -func (b *BiDirComms) BroadcastNewJob(jobUpdate api.JobUpdate) { +func (b *BiDirComms) BroadcastNewJob(jobUpdate api.SocketIOJobUpdate) { if jobUpdate.PreviousStatus != nil { log.Warn().Interface("jobUpdate", jobUpdate).Msg("socketIO: new jobs should not have a previous state") jobUpdate.PreviousStatus = nil @@ -72,7 +72,7 @@ func (b *BiDirComms) BroadcastTaskUpdate(taskUpdate api.SocketIOTaskUpdate) { // this room will receive info scoped to this job, so for example updates to all // tasks of this job. // -// Note that `api.JobUpdate`s themselves are sent to all SocketIO clients, and +// Note that `api.SocketIOJobUpdate`s themselves are sent to all SocketIO clients, and // not to this room. func roomForJob(jobUUID string) SocketIORoomName { return SocketIORoomName("job-" + jobUUID) diff --git a/internal/manager/webupdates/sio_rooms.go b/internal/manager/webupdates/sio_rooms.go index 8a5a5ca4..62adfd05 100644 --- a/internal/manager/webupdates/sio_rooms.go +++ b/internal/manager/webupdates/sio_rooms.go @@ -23,7 +23,7 @@ const ( // Predefined SocketIO event types. SIOEventChatMessageRcv SocketIOEventType = "/chat" // clients send chat messages here SIOEventChatMessageSend SocketIOEventType = "/message" // chat messages are broadcasted here - SIOEventJobUpdate SocketIOEventType = "/jobs" // sends api.JobUpdate + SIOEventJobUpdate SocketIOEventType = "/jobs" // sends api.SocketIOJobUpdate SIOEventTaskUpdate SocketIOEventType = "/task" // sends api.SocketIOTaskUpdate SIOEventSubscription SocketIOEventType = "/subscription" // clients send api.SocketIOSubscription ) diff --git a/web/app/src/components/JobsTable.vue b/web/app/src/components/JobsTable.vue index 05a3d854..20511abc 100644 --- a/web/app/src/components/JobsTable.vue +++ b/web/app/src/components/JobsTable.vue @@ -42,7 +42,7 @@ export default { const vueComponent = this; const options = { - // See pkg/api/flamenco-manager.yaml, schemas Job and JobUpdate. + // See pkg/api/flamenco-manager.yaml, schemas Job and SocketIOJobUpdate. columns: [ // Useful for debugging when there are many similar jobs: // { title: "ID", field: "id", headerSort: false, formatter: (cell) => cell.getData().id.substr(0, 8), }, diff --git a/web/app/src/components/UpdateListener.vue b/web/app/src/components/UpdateListener.vue index 7514bc32..a9e3ad8e 100644 --- a/web/app/src/components/UpdateListener.vue +++ b/web/app/src/components/UpdateListener.vue @@ -106,7 +106,7 @@ export default { this.socket.on("/jobs", (jobUpdate) => { // Convert to API object, in order to have the same parsing of data as // when we'd do an API call. - const apiJobUpdate = API.JobUpdate.constructFromObject(jobUpdate) + const apiJobUpdate = API.SocketIOJobUpdate.constructFromObject(jobUpdate) this.$emit("jobUpdate", apiJobUpdate); });