aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume.go
diff options
context:
space:
mode:
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(),
+ }
+}