Documentation ¶
Index ¶
- Constants
- type CachedTaskInfo
- type CreateTask
- type DispatchFile
- type DispatchInfo
- type Server
- func (s *Server) CancelTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Server) CheckAllClient(ips []string) map[string]string
- func (s *Server) CheckAllClientIp(ips []string)
- func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Server) CreateTaskNoHttp(t *CreateTask) error
- func (svc *Server) Json(r int, s interface{}, w http.ResponseWriter)
- func (s *Server) OnStart(cfg *common.Config, e *httprouter.Router) error
- func (s *Server) OnStop(c *common.Config, e *httprouter.Router)
- func (s *Server) QueryTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (s *Server) QueryTaskNoHttp(id string) (*TaskInfo, error)
- func (s *Server) ReportTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (svc *Server) String(r int, s string, w http.ResponseWriter)
- type TaskInfo
- type TaskStatus
Constants ¶
View Source
const ( // For use with functions that take an expiration time. NoExpiration time.Duration = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedTaskInfo ¶
type CachedTaskInfo struct {
// contains filtered or unexported fields
}
CachedTaskInfo 每一个Task,对应一个缓存对象,所有与它关联的操作都由一个Goroutine来处理
func NewCachedTaskInfo ¶
func NewCachedTaskInfo(s *Server, t *CreateTask) *CachedTaskInfo
NewCachedTaskInfo ...
func (*CachedTaskInfo) EqualCmp ¶
func (ct *CachedTaskInfo) EqualCmp(t *CreateTask) bool
EqualCmp ...
type CreateTask ¶
type CreateTask struct { ID string `json:"id"` DispatchFiles []string `json:"dispatchFiles"` DestIPs []string `json:"destIPs"` }
CreateTask 创建分发任务
type DispatchFile ¶
DispatchFile 单个文件分发状态
type DispatchInfo ¶
type DispatchInfo struct { Status string `json:"status"` PercentComplete float32 `json:"percentComplete"` StartedAt time.Time `json:"startedAt"` FinishedAt time.Time `json:"finishedAt"` DispatchFiles []*DispatchFile `json:"dispatchFiles"` }
DispatchInfo 单个IP的分发信息
type Server ¶
type Server struct { common.BaseService // contains filtered or unexported fields }
func (*Server) CancelTask ¶
func (s *Server) CancelTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
CancelTask DELETE /api/v1/server/tasks/:id
func (*Server) CheckAllClient ¶
给所有客户端是否存在
func (*Server) CreateTask ¶
func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
CreateTask POST /api/v1/server/tasks
func (*Server) CreateTaskNoHttp ¶
func (s *Server) CreateTaskNoHttp(t *CreateTask) error
func (*Server) QueryTask ¶
func (s *Server) QueryTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
QueryTask GET /api/v1/server/tasks/:id
func (*Server) ReportTask ¶
func (s *Server) ReportTask(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReportTask POST /api/v1/server/tasks/status
type TaskInfo ¶
type TaskInfo struct { ID string `json:"id"` Status string `json:"status"` StartedAt time.Time `json:"startedAt"` FinishedAt time.Time `json:"finishedAt"` DispatchInfos map[string]*DispatchInfo `json:"dispatchInfos,omitempty"` }
TaskInfo 查询分发任务
type TaskStatus ¶
type TaskStatus int
TaskStatus 任务状态
const ( TaskNotExist TaskStatus = iota TaskExist TaskInit TaskFailed TaskCompleted TaskInProgress TaskFileNotExist )
the enum of TaskStatus
Click to show internal directories.
Click to hide internal directories.