Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
PING_INTERVAL = 1 * time.Second
)
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics interface {
IncConnections()
}
func NewMetricsStore ¶
func NewMetricsStore() Metrics
type Runtime ¶
type Runtime interface {
Listen() error
HandleConnections()
ControlLoop()
Close()
AddWorker(conn net.Conn) *WorkerConnection
HandleJob(rw http.ResponseWriter, req *http.Request)
HandleListJobQueue(rw http.ResponseWriter, req *http.Request)
HandleListWorkers(rw http.ResponseWriter, req *http.Request)
}
type WorkerConnection ¶
type WorkerConnection struct {
Conn net.Conn
ID string
Capacity uint
// State
// - new
// - hello
// - alive
State string
LastSeen time.Time
// Server assigned jobs that have not been accepted or sent
JobQueue []proto.Job
// Server assigned jobs that have not been accepted
AssignJobQueue []proto.Job
// Jobs accepted by the worker
AcceptedJobs []proto.Job
// contains filtered or unexported fields
}
func NewWorkerConnection ¶
func NewWorkerConnection(logger zerolog.Logger, conn net.Conn) *WorkerConnection
NewWorkerConnection handles the connection and state for a worker connection
func (*WorkerConnection) AssignJob ¶
func (wc *WorkerConnection) AssignJob(job proto.Job)
func (*WorkerConnection) Handle ¶
func (wc *WorkerConnection) Handle()
Click to show internal directories.
Click to hide internal directories.