Merge Go frontend (apiserver + xcecli) into meson build
This commit is contained in:
parent
43dc12a36c
commit
c9dc8c4676
205 changed files with 30793 additions and 328 deletions
38
src/frontend/apiserver/backend/handler.go
Normal file
38
src/frontend/apiserver/backend/handler.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package backend
|
||||
|
||||
import (
|
||||
"apiserver/models"
|
||||
"apiserver/store"
|
||||
)
|
||||
|
||||
// DefaultHandler implements NotificationHandler by writing to stores.
|
||||
type DefaultHandler struct{}
|
||||
|
||||
func (h *DefaultHandler) OnJobCreated(job *models.JobInfo) {
|
||||
store.Jobs.Put(uint64(job.Unique_JobID), *job)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnJobUpdated(job *models.JobInfo) {
|
||||
store.Jobs.Put(uint64(job.Unique_JobID), *job)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnJobDeleted(jobid uint64) {
|
||||
store.Jobs.Delete(jobid)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnQueueUpdated(queue *models.QueueInfo) {
|
||||
store.Queues.Put(queue.QueueName, *queue)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnHostUpdated(host *models.HostInfo) {
|
||||
store.Hosts.Put(host.HostName, *host)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnResourceUpdated(res *models.ResourceDefinitionInfo) {
|
||||
store.Resources.Put(res.ResourceName, *res)
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnResourceLocationUpdated(res *models.ResourceDistributionInfo) {
|
||||
key := res.ResourceName + ":" + res.Location
|
||||
store.ResourceLocations.Put(key, *res)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue