diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-22 22:44:28 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-22 22:44:28 -0700 |
| commit | 7180520889c57bffcd060820954fd3288a388196 (patch) | |
| tree | ba324284619d166fd10f938f179127cc90bc503d /weed/topology/data_node.go | |
| parent | 17ac1290c0087a8264827e2ab1e9662f3ab4d257 (diff) | |
| download | seaweedfs-7180520889c57bffcd060820954fd3288a388196.tar.xz seaweedfs-7180520889c57bffcd060820954fd3288a388196.zip | |
ec shard info can be queried via VolumeList()
Diffstat (limited to 'weed/topology/data_node.go')
| -rw-r--r-- | weed/topology/data_node.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go index ad2837fd6..ff160e178 100644 --- a/weed/topology/data_node.go +++ b/weed/topology/data_node.go @@ -2,8 +2,10 @@ package topology import ( "fmt" + "sync" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" + "github.com/chrislusf/seaweedfs/weed/storage/erasure_coding" "github.com/chrislusf/seaweedfs/weed/storage/needle" "strconv" @@ -14,11 +16,13 @@ import ( type DataNode struct { NodeImpl - volumes map[needle.VolumeId]storage.VolumeInfo - Ip string - Port int - PublicUrl string - LastSeen int64 // unix time in seconds + volumes map[needle.VolumeId]storage.VolumeInfo + Ip string + Port int + PublicUrl string + LastSeen int64 // unix time in seconds + ecShards map[needle.VolumeId]erasure_coding.EcVolumeInfo + ecShardsLock sync.RWMutex } func NewDataNode(id string) *DataNode { @@ -26,6 +30,7 @@ func NewDataNode(id string) *DataNode { s.id = NodeId(id) s.nodeType = "DataNode" s.volumes = make(map[needle.VolumeId]storage.VolumeInfo) + s.ecShards = make(map[needle.VolumeId]erasure_coding.EcVolumeInfo) s.NodeImpl.value = s return s } @@ -158,5 +163,8 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo { for _, v := range dn.GetVolumes() { m.VolumeInfos = append(m.VolumeInfos, v.ToVolumeInformationMessage()) } + for _, ecv := range dn.GetEcShards() { + m.EcShardInfos = append(m.EcShardInfos, ecv.ToVolumeEcShardInformationMessage()...) + } return m } |
