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.

user_space.go 1.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package rpc
  2. import (
  3. "context"
  4. "gitlink.org.cn/cloudream/common/consts/errorcode"
  5. "gitlink.org.cn/cloudream/common/pkgs/logger"
  6. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
  7. hubrpc "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc/hub"
  8. )
  9. func (svc *Service) PublicStoreListAll(context context.Context, msg *hubrpc.PublicStoreListAll) (*hubrpc.PublicStoreListAllResp, *rpc.CodeError) {
  10. pub, err := svc.stgPool.GetPublicStore(&msg.UserSpace)
  11. if err != nil {
  12. return nil, rpc.Failed(errorcode.OperationFailed, err.Error())
  13. }
  14. es, err := pub.ListAll(msg.Path)
  15. if err != nil {
  16. return nil, rpc.Failed(errorcode.OperationFailed, err.Error())
  17. }
  18. return &hubrpc.PublicStoreListAllResp{
  19. Entries: es,
  20. }, nil
  21. }
  22. func (svc *Service) PublicStoreMkdirs(context context.Context, msg *hubrpc.PublicStoreMkdirs) (*hubrpc.PublicStoreMkdirsResp, *rpc.CodeError) {
  23. pub, err := svc.stgPool.GetPublicStore(&msg.UserSpace)
  24. if err != nil {
  25. return nil, rpc.Failed(errorcode.OperationFailed, err.Error())
  26. }
  27. var suc []bool
  28. for _, p := range msg.Pathes {
  29. if err := pub.Mkdir(p); err != nil {
  30. suc = append(suc, false)
  31. logger.Warnf("userspace %v mkdir %s: %v", msg.UserSpace, p, err)
  32. } else {
  33. suc = append(suc, true)
  34. }
  35. }
  36. return &hubrpc.PublicStoreMkdirsResp{
  37. Successes: suc,
  38. }, nil
  39. }

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