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.

shard_storage.go 799 B

12345678910111213141516171819202122232425262728293031323334
  1. package cdssdk
  2. import (
  3. "fmt"
  4. "gitlink.org.cn/cloudream/common/pkgs/types"
  5. "gitlink.org.cn/cloudream/common/utils/serder"
  6. )
  7. // 分片存储服务的配置数据
  8. type ShardStoreConfig interface {
  9. GetType() string
  10. // 输出调试用的字符串,不要包含敏感信息
  11. String() string
  12. }
  13. var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[ShardStoreConfig](
  14. (*LocalShardStorage)(nil),
  15. )), "type")
  16. type LocalShardStorage struct {
  17. serder.Metadata `union:"Local"`
  18. Type string `json:"type"`
  19. Root string `json:"root"`
  20. MaxSize int64 `json:"maxSize"`
  21. }
  22. func (s *LocalShardStorage) GetType() string {
  23. return "Local"
  24. }
  25. func (s *LocalShardStorage) String() string {
  26. return fmt.Sprintf("Local[root=%s, maxSize=%d]", s.Root, s.MaxSize)
  27. }