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.

storage_feature.go 2.1 kB

11 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package cdssdk
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/types"
  4. "gitlink.org.cn/cloudream/common/utils/serder"
  5. )
  6. // 存储服务特性
  7. type StorageFeature interface {
  8. GetFeatureType() string
  9. // 输出调试用的字符串,不要包含敏感信息
  10. String() string
  11. }
  12. var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[StorageFeature](
  13. (*TempStore)(nil),
  14. (*BypassWriteFeature)(nil),
  15. (*MultipartUploadFeature)(nil),
  16. (*InternalServerlessCallFeature)(nil),
  17. )), "type")
  18. type TempStore struct {
  19. serder.Metadata `union:"TempStore"`
  20. Type string `json:"type"`
  21. TempRoot string `json:"tempRoot"` // 临时文件存放目录
  22. }
  23. func (f *TempStore) GetFeatureType() string {
  24. return "TempStore"
  25. }
  26. func (f *TempStore) String() string {
  27. return "TempStore"
  28. }
  29. // 存储服务支持被非MasterHub直接上传文件
  30. type BypassWriteFeature struct {
  31. serder.Metadata `union:"BypassWrite"`
  32. Type string `json:"type"`
  33. }
  34. func (f *BypassWriteFeature) GetFeatureType() string {
  35. return "BypassWrite"
  36. }
  37. func (f *BypassWriteFeature) String() string {
  38. return "BypassWrite"
  39. }
  40. // 存储服务支持分段上传
  41. type MultipartUploadFeature struct {
  42. serder.Metadata `union:"MultipartUpload"`
  43. Type string `json:"type"`
  44. TempDir string `json:"tempDir"` // 临时文件存放目录
  45. MinPartSize int64 `json:"minPartSize"` // 最小分段大小
  46. MaxPartSize int64 `json:"maxPartSize"` // 最大分段大小
  47. }
  48. func (f *MultipartUploadFeature) GetFeatureType() string {
  49. return "MultipartUpload"
  50. }
  51. func (f *MultipartUploadFeature) String() string {
  52. return "MultipartUpload"
  53. }
  54. // 在存储服务所在的环境中部署有内部的Serverless服务
  55. type InternalServerlessCallFeature struct {
  56. serder.Metadata `union:"InternalServerlessCall"`
  57. Type string `json:"type"`
  58. CommandDir string `json:"commandDir"` // 存放命令文件的目录
  59. }
  60. func (f *InternalServerlessCallFeature) GetFeatureType() string {
  61. return "InternalServerlessCall"
  62. }
  63. func (f *InternalServerlessCallFeature) String() string {
  64. return "InternalServerlessCall"
  65. }