50 lines
937 B
Go
50 lines
937 B
Go
package runnermanager
|
|
|
|
import (
|
|
"nhooyr.io/websocket"
|
|
|
|
"git.ohea.xyz/cursorius/server/config"
|
|
"git.ohea.xyz/cursorius/server/database"
|
|
)
|
|
|
|
type RunnerManagerChans struct {
|
|
Allocation chan RunnerAllocationRequest
|
|
Release chan RunnerReleaseRequest
|
|
Registration chan RunnerRegistrationRequest
|
|
}
|
|
|
|
type runnerManager struct {
|
|
chans RunnerManagerChans
|
|
connectedRunners []Runner
|
|
numConnectedRunners uint64
|
|
configuredRunners map[string]config.Runner
|
|
db database.Database
|
|
}
|
|
|
|
type RunnerAllocationRequest struct {
|
|
Tags []string
|
|
RespChan chan RunnerAllocationResponse
|
|
CancelChan chan string
|
|
}
|
|
|
|
type RunnerAllocationResponse struct {
|
|
Runner *Runner
|
|
Err error
|
|
}
|
|
|
|
type RunnerReleaseRequest struct {
|
|
Runner *Runner
|
|
}
|
|
|
|
type RunnerRegistrationRequest struct {
|
|
Secret string
|
|
Id string
|
|
Tags []string
|
|
conn *websocket.Conn
|
|
}
|
|
|
|
type runnerJob struct {
|
|
Id string
|
|
URL string
|
|
}
|