1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

feature(manager): skeleton of status API

这个提交包含在:
bigeagle
2016-04-10 22:28:34 +08:00
父节点 350767e501
当前提交 ed896b16c1
共有 3 个文件被更改,包括 75 次插入0 次删除

36
manager/server.go 普通文件
查看文件

@@ -0,0 +1,36 @@
package manager
import (
"net/http"
"github.com/gin-gonic/gin"
)
type worker struct {
// worker name
name string
// url to connect to worker
url string
// session token
token string
}
func makeHTTPServer(debug bool) *gin.Engine {
if !debug {
gin.SetMode(gin.ReleaseMode)
}
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"msg": "pong"})
})
// List jobs, status page
r.GET("/jobs", func(c *gin.Context) {})
// worker online
r.POST("/workers/:name", func(c *gin.Context) {})
// post job list
r.POST("/workers/:name/jobs", func(c *gin.Context) {})
// post job status
r.POST("/workers/:name/jobs/:job", func(c *gin.Context) {})
return r
}