Skip to content

Commit

Permalink
skeletal code
Browse files Browse the repository at this point in the history
  • Loading branch information
runabol committed Jul 26, 2023
1 parent df840f4 commit b5fa7e8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
30 changes: 30 additions & 0 deletions manager/manager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package manager

import (
"fmt"

"github.com/golang-collections/collections/queue"
"github.com/google/uuid"
"github.com/tork/task"
)

type Manager struct {
Pending queue.Queue
TaskDB map[string][]task.Task
EventDB map[string][]task.TaskEvent
Workers []string
WorkerTaskMap map[string][]uuid.UUID
TaskWorkerMap map[uuid.UUID]string
}

func (m *Manager) SelectWorker() {
fmt.Println("I will select an appropriate worker")
}

func (m *Manager) UpdateTasks() {
fmt.Println("I will update tasks")
}

func (m *Manager) SendWork() {
fmt.Println("I will send work to workers")
}
13 changes: 13 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package node

type Node struct {
Name string
IP string
Cores int
Memory int
MemoryAllocated int
Disk int
DiskAllocated int
Role string
TaskCount int
}
7 changes: 7 additions & 0 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package scheduler

type Scheduler interface {
SelectCandidateNodes()
Score()
Pick()
}
20 changes: 19 additions & 1 deletion worker/worker.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package worker

import (
"fmt"

"github.com/golang-collections/collections/queue"
"github.com/google/uuid"
"github.com/tork/task"
Expand All @@ -9,6 +11,22 @@ import (
type Worker struct {
Name string
Queue queue.Queue
Db map[uuid.UUID]task.Task
DB map[uuid.UUID]task.Task
TaskCount int
}

func (w *Worker) CollectStats() {
fmt.Println("I will collect stats")
}

func (w *Worker) RunTask() {
fmt.Println("I will start or stop a task")
}

func (w *Worker) StartTask() {
fmt.Println("I will start a task")
}

func (w *Worker) StopTask() {
fmt.Println("I will stop a task")
}

0 comments on commit b5fa7e8

Please sign in to comment.