add some String() to make codes easier to read and debug

This commit is contained in:
yanyiwu
2015-01-08 15:54:50 +08:00
parent f2b07d6051
commit cacfc85869
8 changed files with 41 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package topology
import (
"fmt"
"strconv"
"github.com/chrislusf/weed-fs/go/glog"
@@ -26,6 +27,10 @@ func NewDataNode(id string) *DataNode {
return s
}
func (dn *DataNode) String() string {
return fmt.Sprintf("NodeImpl:%s ,volumes:%v, Ip:%s, Port:%d, PublicUrl:%s, Dead:%v", dn.NodeImpl.String(), dn.volumes, dn.Ip, dn.Port, dn.PublicUrl, dn.Dead)
}
func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) {
if _, ok := dn.volumes[v.Id]; !ok {
dn.volumes[v.Id] = v