2012-08-24 06:24:32 +00:00
|
|
|
package storage
|
|
|
|
|
2014-04-21 09:11:10 +00:00
|
|
|
import (
|
|
|
|
"code.google.com/p/weed-fs/go/operation"
|
|
|
|
)
|
2012-08-24 06:24:32 +00:00
|
|
|
|
2012-09-10 07:18:07 +00:00
|
|
|
type VolumeInfo struct {
|
2012-12-04 06:54:08 +00:00
|
|
|
Id VolumeId
|
|
|
|
Size uint64
|
2014-03-03 06:16:54 +00:00
|
|
|
ReplicaPlacement *ReplicaPlacement
|
2013-11-12 10:21:22 +00:00
|
|
|
Collection string
|
2012-12-18 00:48:54 +00:00
|
|
|
Version Version
|
2012-12-04 06:54:08 +00:00
|
|
|
FileCount int
|
|
|
|
DeleteCount int
|
|
|
|
DeletedByteCount uint64
|
2013-04-15 02:30:26 +00:00
|
|
|
ReadOnly bool
|
2012-09-10 07:18:07 +00:00
|
|
|
}
|
2014-04-21 09:11:10 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|