mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-04 11:09:03 +08:00
b9aee2defb
The volume TTL and file TTL are not necessarily the same. as long as file TTL is smaller than volume TTL, it'll be fine. volume TTL is used when assigning file id, e.g. http://.../dir/assign?ttl=3h file TTL is used when uploading
39 lines
935 B
Go
39 lines
935 B
Go
package storage
|
|
|
|
import (
|
|
"code.google.com/p/weed-fs/go/operation"
|
|
)
|
|
|
|
type VolumeInfo struct {
|
|
Id VolumeId
|
|
Size uint64
|
|
ReplicaPlacement *ReplicaPlacement
|
|
Ttl *TTL
|
|
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
|
|
vi.Ttl = LoadTTLFromUint32(*m.Ttl)
|
|
return vi, nil
|
|
}
|