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.

36 lines
876 B

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