forked from JointCloud/JCC-CSScheduler
110 lines
3.5 KiB
Go
110 lines
3.5 KiB
Go
package executor
|
|
|
|
import (
|
|
"gitlink.org.cn/cloudream/common/models"
|
|
"gitlink.org.cn/cloudream/common/pkgs/mq"
|
|
)
|
|
|
|
type StorageService interface {
|
|
StartStorageLoadPackage(msg *StartStorageLoadPackage) (*StartStorageLoadPackageResp, *mq.CodeMessage)
|
|
|
|
StartStorageCreatePackage(msg *StartStorageCreatePackage) (*StartStorageCreatePackageResp, *mq.CodeMessage)
|
|
|
|
StartCacheMovePackage(msg *StartCacheMovePackage) (*StartCacheMovePackageResp, *mq.CodeMessage)
|
|
}
|
|
|
|
// 启动存储系统调度文件任务
|
|
var _ = Register(Service.StartStorageLoadPackage)
|
|
|
|
type StartStorageLoadPackage struct {
|
|
mq.MessageBodyBase
|
|
UserID int64 `json:"userID"`
|
|
PackageID int64 `json:"packageID"`
|
|
StorageID int64 `json:"storageID"`
|
|
}
|
|
type StartStorageLoadPackageResp struct {
|
|
mq.MessageBodyBase
|
|
TaskID string `json:"taskID"`
|
|
}
|
|
|
|
func NewStartStorageLoadPackage(packageID int64, userID int64) *StartStorageLoadPackage {
|
|
return &StartStorageLoadPackage{
|
|
PackageID: packageID,
|
|
UserID: userID,
|
|
}
|
|
}
|
|
func NewStartStorageLoadPackageResp(taskID string) *StartStorageLoadPackageResp {
|
|
return &StartStorageLoadPackageResp{
|
|
TaskID: taskID,
|
|
}
|
|
}
|
|
func (c *Client) StartStorageLoadPackage(msg *StartStorageLoadPackage, opts ...mq.RequestOption) (*StartStorageLoadPackageResp, error) {
|
|
return mq.Request(Service.StartStorageLoadPackage, c.rabbitCli, msg, opts...)
|
|
}
|
|
|
|
// 启动存储系统从存储服务上传文件任务
|
|
var _ = Register(Service.StartStorageCreatePackage)
|
|
|
|
type StartStorageCreatePackage struct {
|
|
mq.MessageBodyBase
|
|
UserID int64 `json:"userID"`
|
|
StorageID int64 `json:"storageID"`
|
|
Path string `json:"path"`
|
|
BucketID int64 `json:"bucketID"`
|
|
Name string `json:"name"`
|
|
Redundancy models.TypedRedundancyInfo `json:"redundancy"`
|
|
}
|
|
type StartStorageCreatePackageResp struct {
|
|
mq.MessageBodyBase
|
|
TaskID string `json:"taskID"`
|
|
}
|
|
|
|
func NewStartStorageCreatePackage(userID int64, storageID int64, filePath string, bucketID int64, name string, redundancy models.TypedRedundancyInfo) *StartStorageCreatePackage {
|
|
return &StartStorageCreatePackage{
|
|
UserID: userID,
|
|
StorageID: storageID,
|
|
Path: filePath,
|
|
BucketID: bucketID,
|
|
Name: name,
|
|
Redundancy: redundancy,
|
|
}
|
|
}
|
|
func NewStartStorageCreatePackageResp(taskID string) *StartStorageCreatePackageResp {
|
|
return &StartStorageCreatePackageResp{
|
|
TaskID: taskID,
|
|
}
|
|
}
|
|
func (c *Client) StartStorageCreatePackage(msg *StartStorageCreatePackage, opts ...mq.RequestOption) (*StartStorageCreatePackageResp, error) {
|
|
return mq.Request(Service.StartStorageCreatePackage, c.rabbitCli, msg, opts...)
|
|
}
|
|
|
|
// 启动存储系统调度文件到某个节点的缓存的任务
|
|
var _ = Register(Service.StartCacheMovePackage)
|
|
|
|
type StartCacheMovePackage struct {
|
|
mq.MessageBodyBase
|
|
UserID int64 `json:"userID"`
|
|
PackageID int64 `json:"packageID"`
|
|
StgNodeID int64 `json:"stgNodeID"`
|
|
}
|
|
type StartCacheMovePackageResp struct {
|
|
mq.MessageBodyBase
|
|
TaskID string `json:"taskID"`
|
|
}
|
|
|
|
func NewStartCacheMovePackage(userID int64, packageID int64, stgNodeID int64) *StartCacheMovePackage {
|
|
return &StartCacheMovePackage{
|
|
UserID: userID,
|
|
PackageID: packageID,
|
|
StgNodeID: stgNodeID,
|
|
}
|
|
}
|
|
func NewStartCacheMovePackageResp(taskID string) *StartCacheMovePackageResp {
|
|
return &StartCacheMovePackageResp{
|
|
TaskID: taskID,
|
|
}
|
|
}
|
|
func (c *Client) StartCacheMovePackage(msg *StartCacheMovePackage, opts ...mq.RequestOption) (*StartCacheMovePackageResp, error) {
|
|
return mq.Request(Service.StartCacheMovePackage, c.rabbitCli, msg, opts...)
|
|
}
|