|
|
@@ -4,8 +4,6 @@ import ( |
|
|
"net/http" |
|
|
"net/http" |
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
"gitlink.org.cn/cloudream/common/consts/errorcode" |
|
|
|
|
|
"gitlink.org.cn/cloudream/common/pkgs/logger" |
|
|
|
|
|
cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1" |
|
|
cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
@@ -20,14 +18,14 @@ func (s *Server) Mount() *MountService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (m *MountService) DumpStatus(ctx *gin.Context) { |
|
|
func (m *MountService) DumpStatus(ctx *gin.Context) { |
|
|
log := logger.WithField("HTTP", "Mount.DumpStatus") |
|
|
|
|
|
|
|
|
// log := logger.WithField("HTTP", "Mount.DumpStatus") |
|
|
|
|
|
|
|
|
var req cliapi.MountDumpStatus |
|
|
|
|
|
if err := ctx.ShouldBindQuery(&req); err != nil { |
|
|
|
|
|
log.Warnf("binding body: %s", err.Error()) |
|
|
|
|
|
ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// var req cliapi.MountDumpStatus |
|
|
|
|
|
// if err := ctx.ShouldBindQuery(&req); err != nil { |
|
|
|
|
|
// log.Warnf("binding body: %s", err.Error()) |
|
|
|
|
|
// ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
dumpStatus := m.svc.Mount.Dump() |
|
|
dumpStatus := m.svc.Mount.Dump() |
|
|
ctx.JSON(http.StatusOK, OK(cliapi.MountDumpStatusResp{ |
|
|
ctx.JSON(http.StatusOK, OK(cliapi.MountDumpStatusResp{ |
|
|
@@ -35,6 +33,20 @@ func (m *MountService) DumpStatus(ctx *gin.Context) { |
|
|
})) |
|
|
})) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *MountService) ReloadFilter(ctx *gin.Context) { |
|
|
|
|
|
// log := logger.WithField("HTTP", "Mount.ReloadFilter") |
|
|
|
|
|
|
|
|
|
|
|
// var req cliapi.MountReloadFilter |
|
|
|
|
|
// if err := ctx.ShouldBindQuery(&req); err != nil { |
|
|
|
|
|
// log.Warnf("binding body: %s", err.Error()) |
|
|
|
|
|
// ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument")) |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
m.svc.Mount.ReloadSyncFilter() |
|
|
|
|
|
ctx.JSON(http.StatusOK, OK(cliapi.MountReloadFilterResp{})) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func (m *MountService) StartReclaimSpace(ctx *gin.Context) { |
|
|
func (m *MountService) StartReclaimSpace(ctx *gin.Context) { |
|
|
// log := logger.WithField("HTTP", "Mount.ReclaimSpace") |
|
|
// log := logger.WithField("HTTP", "Mount.ReclaimSpace") |
|
|
// var req cliapi.MountReclaimSpace |
|
|
// var req cliapi.MountReclaimSpace |
|
|
|