24 lines
1.3 KiB
Go
24 lines
1.3 KiB
Go
package services
|
|
|
|
import (
|
|
"gitlink.org.cn/cloudream/common/pkgs/mq"
|
|
execmq "gitlink.org.cn/cloudream/scheduler/common/pkgs/mq/executor"
|
|
schtsk "gitlink.org.cn/cloudream/scheduler/executor/internal/task"
|
|
)
|
|
|
|
func (svc *Service) StartStorageLoadPackage(msg *execmq.StartStorageLoadPackage) (*execmq.StartStorageLoadPackageResp, *mq.CodeMessage) {
|
|
tsk := svc.taskManager.StartNew(schtsk.NewStorageLoadPackage(msg.UserID, msg.PackageID, msg.StorageID))
|
|
return mq.ReplyOK(execmq.NewStartStorageLoadPackageResp(tsk.ID()))
|
|
}
|
|
|
|
func (svc *Service) StartStorageCreatePackage(msg *execmq.StartStorageCreatePackage) (*execmq.StartStorageCreatePackageResp, *mq.CodeMessage) {
|
|
tsk := svc.taskManager.StartNew(schtsk.NewStorageCreatePackage(msg.UserID, msg.StorageID, msg.Path, msg.BucketID, msg.Name, msg.Redundancy))
|
|
return mq.ReplyOK(execmq.NewStartStorageCreatePackageResp(tsk.ID()))
|
|
}
|
|
|
|
func (svc *Service) StartCacheMovePackage(msg *execmq.StartCacheMovePackage) (*execmq.StartCacheMovePackageResp, *mq.CodeMessage) {
|
|
tsk := svc.taskManager.StartNew(schtsk.NewCacheMovePackage(msg.UserID, msg.PackageID, msg.StgNodeID))
|
|
// tsk := svc.taskManager.StartNew(task.TaskBody[schtsk.NewCacheMovePackage(msg.UserID, msg.PackageID, msg.NodeID)])
|
|
return mq.ReplyOK(execmq.NewStartCacheMovePackageResp(tsk.ID()))
|
|
}
|