forked from phc/cluster-dashboard
feat: added basic scaffolding for host executor
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
type Database interface {
|
||||
GetNodeStatus(hostname string) (*model.Node, error)
|
||||
GetJobStatus(id int) (*model.Job, error)
|
||||
GetNode(hostname string) (*model.Node, error)
|
||||
GetJob(id string) (*model.Job, error)
|
||||
|
||||
AllNodes() ([]*model.Node, error)
|
||||
AllJobs() ([]*model.Job, error)
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"git.phc.dm.unipi.it/phc/cluster-dashboard/backend/executor"
|
||||
"git.phc.dm.unipi.it/phc/cluster-dashboard/backend/model"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
// simpleDB è una implementazione di [database.Database] che tiene giusto una cache in memoria e
|
||||
@@ -17,10 +18,10 @@ type simpleDB struct {
|
||||
lastUpdate *time.Time
|
||||
|
||||
// Nodes is a map from hostname to node info
|
||||
nodes map[string]model.Node
|
||||
nodes map[string]*model.Node
|
||||
|
||||
// Jobs is a map from job id to job info
|
||||
jobs map[int]model.Job
|
||||
jobs map[string]*model.Job
|
||||
|
||||
// The following are maps from hostname to a list of sampled temperatures, used memory, used storage space and network upload and download rate.
|
||||
|
||||
@@ -35,20 +36,20 @@ func NewSimpleDatabase(ex executor.Service) Database {
|
||||
return &simpleDB{Executor: ex}
|
||||
}
|
||||
|
||||
func (s *simpleDB) GetNodeStatus(hostname string) (*model.Node, error) {
|
||||
func (s *simpleDB) GetNode(hostname string) (*model.Node, error) {
|
||||
panic("todo")
|
||||
}
|
||||
|
||||
func (s *simpleDB) GetJobStatus(id int) (*model.Job, error) {
|
||||
func (s *simpleDB) GetJob(id string) (*model.Job, error) {
|
||||
panic("todo")
|
||||
}
|
||||
|
||||
func (s *simpleDB) AllNodes() ([]*model.Node, error) {
|
||||
panic("todo")
|
||||
return maps.Values(s.nodes), nil
|
||||
}
|
||||
|
||||
func (s *simpleDB) AllJobs() ([]*model.Job, error) {
|
||||
panic("todo")
|
||||
return maps.Values(s.jobs), nil
|
||||
}
|
||||
|
||||
func (s *simpleDB) QueryTemperatureSamples(from, to time.Time) ([]model.Sample[float64], error) {
|
||||
|
||||
Reference in New Issue
Block a user