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.2 kB

6 months ago
6 months ago
6 months ago
6 months ago
1234567891011121314151617181920212223242526272829303132333435363738
  1. package reqbuilder
  2. import (
  3. "strconv"
  4. "gitlink.org.cn/cloudream/jcs-pub/client/internal/publock/lockprovider"
  5. "gitlink.org.cn/cloudream/jcs-pub/client/internal/publock/types"
  6. jcstypes "gitlink.org.cn/cloudream/jcs-pub/common/types"
  7. )
  8. type UserSpaceLockReqBuilder[T any] struct {
  9. *LockRequestBuilder[T]
  10. }
  11. func (b *LockRequestBuilder[T]) UserSpace() *UserSpaceLockReqBuilder[T] {
  12. return &UserSpaceLockReqBuilder[T]{LockRequestBuilder: b}
  13. }
  14. func (b *UserSpaceLockReqBuilder[T]) Buzy(spaceID jcstypes.UserSpaceID) *UserSpaceLockReqBuilder[T] {
  15. b.Locks = append(b.Locks, types.Lock{
  16. Path: b.makePath(spaceID),
  17. Name: lockprovider.UserSpaceBuzyLock,
  18. Target: lockprovider.NewEmptyTarget(),
  19. })
  20. return b
  21. }
  22. func (b *UserSpaceLockReqBuilder[T]) GC(spaceID jcstypes.UserSpaceID) *UserSpaceLockReqBuilder[T] {
  23. b.Locks = append(b.Locks, types.Lock{
  24. Path: b.makePath(spaceID),
  25. Name: lockprovider.UserSpaceGCLock,
  26. Target: lockprovider.NewEmptyTarget(),
  27. })
  28. return b
  29. }
  30. func (b *UserSpaceLockReqBuilder[T]) makePath(hubID jcstypes.UserSpaceID) []string {
  31. return []string{lockprovider.UserSpaceLockPathPrefix, strconv.FormatInt(int64(hubID), 10)}
  32. }

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