You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
938 B

  1. package storage
  2. import (
  3. "github.com/chrislusf/weed-fs/go/operation"
  4. )
  5. type VolumeInfo struct {
  6. Id VolumeId
  7. Size uint64
  8. ReplicaPlacement *ReplicaPlacement
  9. Ttl *TTL
  10. Collection string
  11. Version Version
  12. FileCount int
  13. DeleteCount int
  14. DeletedByteCount uint64
  15. ReadOnly bool
  16. }
  17. func NewVolumeInfo(m *operation.VolumeInformationMessage) (vi VolumeInfo, err error) {
  18. vi = VolumeInfo{
  19. Id: VolumeId(*m.Id),
  20. Size: *m.Size,
  21. Collection: *m.Collection,
  22. FileCount: int(*m.FileCount),
  23. DeleteCount: int(*m.DeleteCount),
  24. DeletedByteCount: *m.DeletedByteCount,
  25. ReadOnly: *m.ReadOnly,
  26. Version: Version(*m.Version),
  27. }
  28. rp, e := NewReplicaPlacementFromByte(byte(*m.ReplicaPlacement))
  29. if e != nil {
  30. return vi, e
  31. }
  32. vi.ReplicaPlacement = rp
  33. vi.Ttl = LoadTTLFromUint32(*m.Ttl)
  34. return vi, nil
  35. }