aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@uber.com>2019-03-17 20:27:08 -0700
committerChris Lu <chris.lu@uber.com>2019-03-17 20:27:08 -0700
commitaca653c08bfaae205e3a62ae9e58ce327a5a583f (patch)
tree83cc519f45f0186c10365c5a332e8a995fdb00ed /weed/storage/volume.go
parent22fbbf023b180e3c51261b0746a52be715e86648 (diff)
downloadseaweedfs-aca653c08bfaae205e3a62ae9e58ce327a5a583f.tar.xz
seaweedfs-aca653c08bfaae205e3a62ae9e58ce327a5a583f.zip
weed shell: list volumes
Diffstat (limited to 'weed/storage/volume.go')
-rw-r--r--weed/storage/volume.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 07c72ecb4..5cec0c5ed 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -2,6 +2,7 @@ package storage
import (
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"os"
"path"
"sync"
@@ -134,3 +135,18 @@ func (v *Volume) expiredLongEnough(maxDelayMinutes uint32) bool {
}
return false
}
+
+func (v *Volume) ToVolumeInformationMessage() *master_pb.VolumeInformationMessage {
+ return &master_pb.VolumeInformationMessage{
+ Id: uint32(v.Id),
+ Size: uint64(v.Size()),
+ Collection: v.Collection,
+ FileCount: uint64(v.nm.FileCount()),
+ DeleteCount: uint64(v.nm.DeletedCount()),
+ DeletedByteCount: v.nm.DeletedSize(),
+ ReadOnly: v.readOnly,
+ ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()),
+ Version: uint32(v.Version()),
+ Ttl: v.Ttl.ToUint32(),
+ }
+}