2012-08-24 14:24:32 +08:00
|
|
|
package storage
|
|
|
|
|
2014-04-21 17:11:10 +08:00
|
|
|
import (
|
2014-12-14 16:20:21 +08:00
|
|
|
"github.com/mcqueenorama/weed-fs/go/operation"
|
2014-04-21 17:11:10 +08:00
|
|
|
)
|
2012-08-24 14:24:32 +08:00
|
|
|
|
2012-09-10 15:18:07 +08:00
|
|
|
type VolumeInfo struct {
|
2012-12-04 14:54:08 +08:00
|
|
|
Id VolumeId
|
|
|
|
Size uint64
|
2014-03-03 14:16:54 +08:00
|
|
|
ReplicaPlacement *ReplicaPlacement
|
2014-09-21 03:38:59 +08:00
|
|
|
Ttl *TTL
|
2013-11-12 18:21:22 +08:00
|
|
|
Collection string
|
2012-12-18 08:48:54 +08:00
|
|
|
Version Version
|
2012-12-04 14:54:08 +08:00
|
|
|
FileCount int
|
|
|
|
DeleteCount int
|
|
|
|
DeletedByteCount uint64
|
2013-04-15 10:30:26 +08:00
|
|
|
ReadOnly bool
|
2012-09-10 15:18:07 +08:00
|
|
|
}
|
2014-04-21 17:11:10 +08: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
|
2014-09-21 03:38:59 +08:00
|
|
|
vi.Ttl = LoadTTLFromUint32(*m.Ttl)
|
2014-04-21 17:11:10 +08:00
|
|
|
return vi, nil
|
|
|
|
}
|