seaweedfs/go/storage/volume_info.go

37 lines
876 B
Go
Raw Normal View History

2012-08-24 06:24:32 +00:00
package storage
import (
"code.google.com/p/weed-fs/go/operation"
)
2012-08-24 06:24:32 +00:00
type VolumeInfo struct {
Id VolumeId
Size uint64
ReplicaPlacement *ReplicaPlacement
2013-11-12 10:21:22 +00:00
Collection string
Version Version
FileCount int
DeleteCount int
DeletedByteCount uint64
ReadOnly bool
}
func NewVolumeInfo(m *operation.VolumeInformationMessage) (vi VolumeInfo, err error) {
vi = VolumeInfo{
Id: VolumeId(*m.Id),
Size: *m.Size,
Collection: *m.Collection,
FileCount: int(*m.FileCount),
DeleteCount: int(*m.DeleteCount),
DeletedByteCount: *m.DeletedByteCount,
ReadOnly: *m.ReadOnly,
Version: Version(*m.Version),
}
rp, e := NewReplicaPlacementFromByte(byte(*m.ReplicaPlacement))
if e != nil {
return vi, e
}
vi.ReplicaPlacement = rp
return vi, nil
}