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.go 1.5 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 StorageAddress interface {
  8. GetType() string
  9. // 输出调试用的字符串,不要包含敏感信息
  10. String() string
  11. }
  12. var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[StorageAddress](
  13. (*LocalStorageAddress)(nil),
  14. )), "type")
  15. type LocalStorageAddress struct {
  16. serder.Metadata `union:"Local"`
  17. }
  18. func (a *LocalStorageAddress) GetType() string {
  19. return "Local"
  20. }
  21. func (a *LocalStorageAddress) String() string {
  22. return "Local"
  23. }
  24. type Storage struct {
  25. StorageID StorageID `json:"storageID" gorm:"column:StorageID; primaryKey; autoIncrement;"`
  26. Name string `json:"name" gorm:"column:Name; not null"`
  27. // 存储服务的地址,包含鉴权所需数据
  28. Address StorageAddress `json:"address" gorm:"column:Address; type:json; not null; serializer:union"`
  29. // 存储服务拥有的特别功能
  30. Features []StorageFeature `json:"features" gorm:"column:Features; type:json; serializer:union"`
  31. }
  32. // 共享存储服务的配置数据
  33. type SharedStorage struct {
  34. StorageID StorageID `json:"storageID" gorm:"column:StorageID; primaryKey"`
  35. // 调度文件时保存文件的根路径
  36. LoadBase string `json:"loadBase" gorm:"column:LoadBase; not null"`
  37. // 回源数据时数据存放位置的根路径
  38. DataReturnBase string `json:"dataReturnBase" gorm:"column:DataReturnBase; not null"`
  39. }