You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mount.go 1.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "net/http"
  4. "github.com/gin-gonic/gin"
  5. "gitlink.org.cn/cloudream/common/consts/errorcode"
  6. "gitlink.org.cn/cloudream/common/pkgs/logger"
  7. cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1"
  8. )
  9. type MountService struct {
  10. *Server
  11. }
  12. func (s *Server) Mount() *MountService {
  13. return &MountService{
  14. Server: s,
  15. }
  16. }
  17. func (m *MountService) DumpStatus(ctx *gin.Context) {
  18. log := logger.WithField("HTTP", "Mount.DumpStatus")
  19. var req cliapi.MountDumpStatus
  20. if err := ctx.ShouldBindQuery(&req); err != nil {
  21. log.Warnf("binding body: %s", err.Error())
  22. ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument"))
  23. return
  24. }
  25. dumpStatus := m.svc.Mount.Dump()
  26. ctx.JSON(http.StatusOK, OK(cliapi.MountDumpStatusResp{
  27. MountStatus: dumpStatus,
  28. }))
  29. }
  30. func (m *MountService) StartReclaimSpace(ctx *gin.Context) {
  31. // log := logger.WithField("HTTP", "Mount.ReclaimSpace")
  32. // var req cliapi.MountReclaimSpace
  33. // if err := ctx.ShouldBindJSON(&req); err != nil {
  34. // log.Warnf("binding body: %s", err.Error())
  35. // ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument"))
  36. // return
  37. // }
  38. m.svc.Mount.StartReclaimSpace()
  39. ctx.JSON(http.StatusOK, OK(cliapi.StartMountReclaimSpaceResp{}))
  40. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。