display remote volumes on volume server ui page

This commit is contained in:
Chris Lu
2019-12-02 23:23:54 -08:00
parent 70648d35ad
commit 1becbce657
7 changed files with 239 additions and 162 deletions

View File

@@ -144,6 +144,7 @@ func (s *Store) VolumeInfos() []*VolumeInfo {
Ttl: v.Ttl,
CompactRevision: uint32(v.CompactionRevision),
}
s.RemoteStorageName, s.RemoteStorageKey = v.RemoteStorageNameKey()
stats = append(stats, s)
}
location.volumesLock.RUnlock()

View File

@@ -203,7 +203,7 @@ func (v *Volume) expiredLongEnough(maxDelayMinutes uint32) bool {
func (v *Volume) ToVolumeInformationMessage() *master_pb.VolumeInformationMessage {
size, _, modTime := v.FileStat()
return &master_pb.VolumeInformationMessage{
volumInfo := &master_pb.VolumeInformationMessage{
Id: uint32(v.Id),
Size: size,
Collection: v.Collection,
@@ -217,4 +217,15 @@ func (v *Volume) ToVolumeInformationMessage() *master_pb.VolumeInformationMessag
CompactRevision: uint32(v.SuperBlock.CompactionRevision),
ModifiedAtSecond: modTime.Unix(),
}
volumInfo.RemoteStorageName, volumInfo.RemoteStorageKey = v.RemoteStorageNameKey()
return volumInfo
}
func (v *Volume) RemoteStorageNameKey() (storageName, storageKey string) {
if len(v.volumeTierInfo.GetFiles()) == 0 {
return
}
return v.volumeTierInfo.GetFiles()[0].BackendName(), v.volumeTierInfo.GetFiles()[0].GetKey()
}

View File

@@ -9,18 +9,20 @@ import (
)
type VolumeInfo struct {
Id needle.VolumeId
Size uint64
ReplicaPlacement *ReplicaPlacement
Ttl *needle.TTL
Collection string
Version needle.Version
FileCount int
DeleteCount int
DeletedByteCount uint64
ReadOnly bool
CompactRevision uint32
ModifiedAtSecond int64
Id needle.VolumeId
Size uint64
ReplicaPlacement *ReplicaPlacement
Ttl *needle.TTL
Collection string
Version needle.Version
FileCount int
DeleteCount int
DeletedByteCount uint64
ReadOnly bool
CompactRevision uint32
ModifiedAtSecond int64
RemoteStorageName string
RemoteStorageKey string
}
func NewVolumeInfo(m *master_pb.VolumeInformationMessage) (vi VolumeInfo, err error) {