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.

pubshards.go 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package pubshards
  2. import (
  3. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/storage/factory/reg"
  4. stgtypes "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/storage/types"
  5. jcstypes "gitlink.org.cn/cloudream/jcs-pub/common/types"
  6. )
  7. func init() {
  8. reg.RegisterBuilder[*jcstypes.PubShardsType](newBuilder)
  9. }
  10. type builder struct {
  11. stgtypes.EmptyBuilder
  12. detail *jcstypes.UserSpaceDetail
  13. }
  14. func newBuilder(detail *jcstypes.UserSpaceDetail) stgtypes.StorageBuilder {
  15. return &builder{
  16. detail: detail,
  17. }
  18. }
  19. func (b *builder) FeatureDesc() stgtypes.FeatureDesc {
  20. return stgtypes.FeatureDesc{}
  21. }
  22. func (b *builder) CreateShardStore(typeOnly bool) (stgtypes.ShardStore, error) {
  23. stgType := b.detail.UserSpace.Storage.(*jcstypes.PubShardsType)
  24. if typeOnly {
  25. return (*ShardStore)(nil), nil
  26. }
  27. return NewShardStore(b.detail, stgType)
  28. }
  29. func (b *builder) CreateBaseStore(typeOnly bool) (stgtypes.BaseStore, error) {
  30. stgType := b.detail.UserSpace.Storage.(*jcstypes.PubShardsType)
  31. newDeatil := jcstypes.UserSpaceDetail{
  32. UserID: b.detail.UserID,
  33. UserSpace: jcstypes.UserSpace{
  34. Storage: stgType.Base,
  35. Credential: b.detail.UserSpace.Credential,
  36. ShardStore: b.detail.UserSpace.ShardStore,
  37. Features: b.detail.UserSpace.Features,
  38. WorkingDir: b.detail.UserSpace.WorkingDir,
  39. },
  40. RecommendHub: b.detail.RecommendHub,
  41. }
  42. blder := reg.GetBuilderInternal(&newDeatil)
  43. return blder.CreateBaseStore(typeOnly)
  44. }

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