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 3.0 kB

10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. (*S2STransferFeature)(nil),
  18. (*ECMultiplierFeature)(nil),
  19. )), "type")
  20. type TempStore struct {
  21. serder.Metadata `union:"TempStore"`
  22. Type string `json:"type"`
  23. TempRoot string `json:"tempRoot"` // 临时文件存放目录
  24. }
  25. func (f *TempStore) GetFeatureType() string {
  26. return "TempStore"
  27. }
  28. func (f *TempStore) String() string {
  29. return "TempStore"
  30. }
  31. // 存储服务支持被非MasterHub直接上传文件
  32. type BypassWriteFeature struct {
  33. serder.Metadata `union:"BypassWrite"`
  34. Type string `json:"type"`
  35. }
  36. func (f *BypassWriteFeature) GetFeatureType() string {
  37. return "BypassWrite"
  38. }
  39. func (f *BypassWriteFeature) String() string {
  40. return "BypassWrite"
  41. }
  42. // 存储服务支持分段上传
  43. type MultipartUploadFeature struct {
  44. serder.Metadata `union:"MultipartUpload"`
  45. Type string `json:"type"`
  46. TempDir string `json:"tempDir"` // 临时文件存放目录
  47. MinPartSize int64 `json:"minPartSize"` // 最小分段大小
  48. MaxPartSize int64 `json:"maxPartSize"` // 最大分段大小
  49. }
  50. func (f *MultipartUploadFeature) GetFeatureType() string {
  51. return "MultipartUpload"
  52. }
  53. func (f *MultipartUploadFeature) String() string {
  54. return "MultipartUpload"
  55. }
  56. // 在存储服务所在的环境中部署有内部的Serverless服务
  57. type InternalServerlessCallFeature struct {
  58. serder.Metadata `union:"InternalServerlessCall"`
  59. Type string `json:"type"`
  60. CommandDir string `json:"commandDir"` // 存放命令文件的目录
  61. }
  62. func (f *InternalServerlessCallFeature) GetFeatureType() string {
  63. return "InternalServerlessCall"
  64. }
  65. func (f *InternalServerlessCallFeature) String() string {
  66. return "InternalServerlessCall"
  67. }
  68. // 存储服务之间直传文件
  69. type S2STransferFeature struct {
  70. serder.Metadata `union:"S2STransfer"`
  71. Type string `json:"type"`
  72. TempDir string `json:"tempDir"` // 临时文件存放目录
  73. }
  74. func (f *S2STransferFeature) GetFeatureType() string {
  75. return "S2STransfer"
  76. }
  77. func (f *S2STransferFeature) String() string {
  78. return "S2STransfer"
  79. }
  80. // 存储服务提供了能进行EC计算的接口
  81. type ECMultiplierFeature struct {
  82. serder.Metadata `union:"ECMultiplier"`
  83. Type string `json:"type"`
  84. TempDir string `json:"tempDir"` // 临时文件存放目录
  85. }
  86. func (f *ECMultiplierFeature) GetFeatureType() string {
  87. return "ECMultiplier"
  88. }
  89. func (f *ECMultiplierFeature) String() string {
  90. return "ECMultiplier"
  91. }