Browse Source

增加ECMultiplier功能

feature_wq
Sydonian 10 months ago
parent
commit
3da3346411
2 changed files with 54 additions and 0 deletions
  1. +38
    -0
      sdks/storage/storage.go
  2. +16
    -0
      sdks/storage/storage_feature.go

+ 38
- 0
sdks/storage/storage.go View File

@@ -39,12 +39,30 @@ type StorageType interface {
}

var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[StorageType](
(*MashupStorageType)(nil),
(*LocalStorageType)(nil),
(*OBSType)(nil),
(*OSSType)(nil),
(*COSType)(nil),
(*EFileType)(nil),
)), "type")

// 多种存储服务的混合存储服务。需谨慎选择存储服务的组合,避免出Bug
type MashupStorageType struct {
serder.Metadata `union:"Mashup"`
Type string `json:"type"`
Agent StorageType `json:"agent"` // 创建Agent时,使用的存储服务类型
Feature StorageType `json:"feature"` // 根据Feature创建组件时使用的存储服务类型
}

func (a *MashupStorageType) GetStorageType() string {
return "Mashup"
}

func (a *MashupStorageType) String() string {
return "Mashup"
}

type LocalStorageType struct {
serder.Metadata `union:"Local"`
Type string `json:"type"`
@@ -112,3 +130,23 @@ func (a *COSType) GetStorageType() string {
func (a *COSType) String() string {
return "COS"
}

type EFileType struct {
serder.Metadata `union:"EFile"`
Type string `json:"type"`
TokenURL string `json:"tokenURL"`
APIURL string `json:"apiURL"`
TokenExpire int `json:"tokenExpire"` // 单位秒
User string `json:"user"`
Password string `json:"password"`
OrgID string `json:"orgID"`
ClusterID string `json:"clusterID"`
}

func (a *EFileType) GetStorageType() string {
return "EFile"
}

func (a *EFileType) String() string {
return "EFile"
}

+ 16
- 0
sdks/storage/storage_feature.go View File

@@ -18,6 +18,7 @@ var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[Storage
(*MultipartUploadFeature)(nil),
(*InternalServerlessCallFeature)(nil),
(*S2STransferFeature)(nil),
(*ECMultiplierFeature)(nil),
)), "type")

type TempStore struct {
@@ -94,3 +95,18 @@ func (f *S2STransferFeature) GetFeatureType() string {
func (f *S2STransferFeature) String() string {
return "S2STransfer"
}

// 存储服务提供了能进行EC计算的接口
type ECMultiplierFeature struct {
serder.Metadata `union:"ECMultiplier"`
Type string `json:"type"`
TempDir string `json:"tempDir"` // 临时文件存放目录
}

func (f *ECMultiplierFeature) GetFeatureType() string {
return "ECMultiplier"
}

func (f *ECMultiplierFeature) String() string {
return "ECMultiplier"
}

Loading…
Cancel
Save