controller

package
v0.0.0-...-9021772 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkDeleteReq

type BulkDeleteReq struct {
	Names []string `json:"names"`
}

type BulkSyncReq

type BulkSyncReq struct {
	Defs []string `json:"defs"`
}

type Controller

type Controller interface {
	// Register 用于注册路由以及控制器初始化
	Register(router *hades.Router)
}

Controller is a interface for controller

func NewErrorController

func NewErrorController(cc *container.Container) Controller

func NewFileSyncController

func NewFileSyncController(cc *container.Container) Controller

func NewHistoryController

func NewHistoryController(cc *container.Container) Controller

func NewJobController

func NewJobController(cc *container.Container) Controller

func NewSettingController

func NewSettingController(cc *container.Container) Controller

func NewWelcomeController

func NewWelcomeController(cc *container.Container) Controller

type DefinitionStatus

type DefinitionStatus struct {
	Name      string    `json:"name"`
	Status    string    `json:"status"`
	UpdatedAt time.Time `json:"updated_at"`
}

type ErrorController

type ErrorController struct {
	// contains filtered or unexported fields
}

func (*ErrorController) Recently

func (e *ErrorController) Recently(ctx *hades.WebContext, req *hades.HttpRequest, messageFactory storage.MessageFactory) hades.HTTPResponse

Recently 返回最近的错误日志 @Summary 返回最近的错误日志 @Tags Errors @Param limit query int false "返回最近的错误日志数目" @Success 200 {array} string @Router /errors/ [get]

func (*ErrorController) Register

func (e *ErrorController) Register(router *hades.Router)

type Event

type Event struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
}

func NewEvent

func NewEvent(typ string, payload EventPayload) Event

func (Event) Encode

func (evt Event) Encode() []byte

type EventPayload

type EventPayload interface {
	Encode() []byte
}

type History

type History struct {
	ID        string              `json:"id"`
	JobID     string              `json:"job_id"`
	Name      string              `json:"name"`
	Status    string              `json:"status"`
	CreatedAt time.Time           `json:"created_at"`
	Job       job.FileSyncJob     `json:"job"`
	Output    collector.Collector `json:"output"`
}

type HistoryController

type HistoryController struct {
	// contains filtered or unexported fields
}

func (*HistoryController) Item

Item 返回指定ID的历史纪录详情 @Summary 返回指定ID的历史纪录详情 @Tags Histories @Param id path string true "记录ID" @Success 200 {object} controller.History @Router /histories/{id}/ [get]

func (*HistoryController) Recently

func (h *HistoryController) Recently(ctx *hades.WebContext, req *hades.HttpRequest, syncQueue queue.SyncQueue, historyStore storage.JobHistoryStore) hades.HTTPResponse

Recently 最近的同步任务历史记录 @Summary 查询最近的文件同步记录 @Tags Histories @Param limit query int false "返回记录数目" @Success 200 {array} controller.History @Router /histories/ [get]

func (*HistoryController) Register

func (h *HistoryController) Register(router *hades.Router)

type JobController

type JobController struct {
	// contains filtered or unexported fields
}

func (*JobController) BulkSync

func (s *JobController) BulkSync(ctx *hades.WebContext, syncQueue queue.SyncQueue, defStore storage.DefinitionStore, statusStore storage.JobStatusStore) hades.HTTPResponse

BulkSync 批量发起文件同步 @Summary 批量发起文件同步 @Tags Jobs @Param body body controller.BulkSyncReq true "同步定义列表" @Success 200 {array} controller.JobStatus @Router /jobs-bulk/ [post]

func (*JobController) DeleteFailedJob

func (s *JobController) DeleteFailedJob(ctx *hades.WebContext, req *hades.HttpRequest, failedStore storage.FailedJobStore) hades.HTTPResponse

DeleteFailedJob 删除失败的任务 @Summary 删除失败的任务 @Tags FailedJobs @Param id path string true "删除失败的 Job ID" @Success 200 {object} job.FileSyncJob @Router /failed-jobs/{id}/ [delete]

func (*JobController) FailedJobs

func (s *JobController) FailedJobs(ctx *hades.WebContext, req *hades.HttpRequest, failedJobStore storage.FailedJobStore) hades.HTTPResponse

FailedJobs 返回失败的所有任务 @Summary 返回失败的所有任务 @Tags FailedJobs @Success 200 {array} job.FileSyncJob @Router /failed-jobs/ [get]

func (*JobController) Jobs

Jobs 返回队列中所有任务 @Summary 返回队列中所有任务 @Tags Jobs @Success 200 {array} job.FileSyncJob @Router /jobs/ [get]

func (*JobController) Register

func (s *JobController) Register(router *hades.Router)

func (*JobController) RetryJob

func (s *JobController) RetryJob(ctx *hades.WebContext, req *hades.HttpRequest, failedStore storage.FailedJobStore, jobQueue queue.SyncQueue) hades.HTTPResponse

RetryJob 重试失败的任务 @Summary 重试失败的任务 @Tags FailedJobs @Param id path string true "要重试的 Job ID" @Success 200 {object} job.FileSyncJob @Router /failed-jobs/{id}/ [put]

func (*JobController) RunningJob

func (s *JobController) RunningJob(ctx *hades.WebContext, ws *hades.WebSocket, collectors *collector.Collectors, statusStore storage.JobStatusStore) hades.HTTPResponse

RunningJob 运行中的任务状态, websocket @Summary 运行中的任务状态,基于websocket @Tags RunningJobs @Router /running-jobs/{id}/ [get]

func (*JobController) Status

Status 任务执行状态查询 @Summary 查询文件同步任务执行状态 @Tags Jobs @Param id path string true "Job ID" @Success 200 {object} controller.JobStatus @Router /jobs/{id}/ [get]

func (*JobController) Sync

Sync 发起文件同步 Parameters:

  • def 同步定义名称

@Summary 发起文件同步任务 @Tags Jobs @Param def query string true "同步定义名称" @Success 200 {object} controller.JobStatus @Router /jobs/ [post]

type JobProgress

type JobProgress struct {
	Name       string  `json:"name"`
	Status     string  `json:"status"`
	Percentage float32 `json:"percentage"`
	Total      int     `json:"total"`
	Max        int     `json:"max"`
}

func (JobProgress) Encode

func (jrs JobProgress) Encode() []byte

type JobRunningStatus

type JobRunningStatus struct {
	Console collector.StageMessage `json:"console"`
}

func (JobRunningStatus) Encode

func (jrs JobRunningStatus) Encode() []byte

type JobStatus

type JobStatus struct {
	ID             string `json:"id"`
	DefinitionName string `json:"definition_name,omitempty"`
	Status         string `json:"status"`
}

type SettingController

type SettingController struct {
	// contains filtered or unexported fields
}

func (*SettingController) GlobalSyncSetting

func (s *SettingController) GlobalSyncSetting(ctx *hades.WebContext, settingFactory storage.SettingFactory) hades.HTTPResponse

GlobalSyncSetting 全局同步配置 @Summary 全局同步配置 @Tags Setting @Param format query string false "输出格式:yaml/json" @Success 200 {object} meta.GlobalFileSyncSetting @Router /setting/global-sync/ [get]

func (*SettingController) Register

func (s *SettingController) Register(router *hades.Router)

func (*SettingController) UpdateGlobalSyncSetting

func (s *SettingController) UpdateGlobalSyncSetting(ctx *hades.WebContext, settingFactory storage.SettingFactory) hades.HTTPResponse

UpdateGlobalSyncSetting 更新全局同步配置 @Summary 更新全局同步配置 @Tags Setting @Param def body meta.GlobalFileSyncSetting true "全局同步定义" @Router /setting/global-sync/ [post]

type SyncDefinitionController

type SyncDefinitionController struct {
	// contains filtered or unexported fields
}

func (*SyncDefinitionController) AllDefinitionStatus

func (s *SyncDefinitionController) AllDefinitionStatus(
	ctx *hades.WebContext,
	defStore storage.DefinitionStore,
	statusStore storage.JobStatusStore,
) hades.HTTPResponse

AllDefinitionStatus return all definition's status @Summary 查询所有文件同步定义的状态 @Tags SyncStatus @Success 200 {array} controller.DefinitionStatus @Router /sync-stat/ [get]

func (*SyncDefinitionController) AllDefinitions

func (s *SyncDefinitionController) AllDefinitions(
	ctx *hades.WebContext,
	req *hades.HttpRequest,
	defStore storage.DefinitionStore,
	settingFactory storage.SettingFactory,
) hades.HTTPResponse

AllDefinitions return all definitions @Summary 查询所有文件同步定义 @Tags Sync @Param format query string false "输出格式:yaml/json" @Success 200 {array} meta.FileSyncGroup @Router /sync/ [get]

func (*SyncDefinitionController) BulkDelete

func (s *SyncDefinitionController) BulkDelete(
	ctx *hades.WebContext,
	syncQueue queue.SyncQueue,
	defStore storage.DefinitionStore,
	statusStore storage.JobStatusStore,
) hades.HTTPResponse

BulkDelete 批量删除同步定义 @Summary 批量删除同步定义 @Tags Sync @Param body body controller.BulkDeleteReq true "定义名称列表" @Success 200 {string} string @Router /sync-bulk/ [delete]

func (*SyncDefinitionController) DeleteDefinition

DeleteDefinition delete a definition by name @Summary 删除单个文件同步定义 @Tags Sync @Param name path string true "定义名称" @Success 200 {string} string @Router /sync/{name}/ [delete]

func (*SyncDefinitionController) QueryDefinition

QueryDefinition get a definition by id @Summary 查询单个文件同步定义 @Tags Sync @Param name path string true "定义名称" @Param format query string false "输出格式:yaml/json" @Success 200 {array} meta.FileSyncGroup @Router /sync/{name}/ [get]

func (*SyncDefinitionController) Register

func (s *SyncDefinitionController) Register(router *hades.Router)

func (*SyncDefinitionController) UpdateDefinitions

func (s *SyncDefinitionController) UpdateDefinitions(
	ctx *hades.WebContext,
	req *hades.HttpRequest,
	defStore storage.DefinitionStore,
	conf *config.Config,
	actionFactory action.Factory,
) hades.HTTPResponse

UpdateDefinitions update sync definitions @Summary 更新文件同步定义 @Tags Sync @Accept json @Produce json @Param def body []meta.FileSyncGroup true "文件同步定义" @Success 200 {array} meta.FileSyncGroup @Router /sync/ [post]

type WelcomeController

type WelcomeController struct {
	// contains filtered or unexported fields
}

func (*WelcomeController) Home

Home 欢迎页面,API版本信息 @Summary 欢迎页面,API版本信息 @Success 200 {object} controller.WelcomeMessage @Router / [get]

func (*WelcomeController) Register

func (w *WelcomeController) Register(router *hades.Router)

type WelcomeMessage

type WelcomeMessage struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL