Add optional admin port to volume server, to seperate admin operations from normal file operations.

This commit is contained in:
Chris Lu
2015-01-18 17:03:38 -08:00
parent 7b10d62096
commit 7b4a53b2c1
12 changed files with 74 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ type DataNode struct {
volumes map[storage.VolumeId]storage.VolumeInfo
Ip string
Port int
AdminPort int
PublicUrl string
LastSeen int64 // unix time in seconds
Dead bool
@@ -28,7 +29,7 @@ func NewDataNode(id string) *DataNode {
}
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)
return fmt.Sprintf("Node:%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) {
@@ -89,6 +90,10 @@ func (dn *DataNode) Url() string {
return dn.Ip + ":" + strconv.Itoa(dn.Port)
}
func (dn *DataNode) AdminUrl() string {
return dn.Ip + ":" + strconv.Itoa(dn.AdminPort)
}
func (dn *DataNode) ToMap() interface{} {
ret := make(map[string]interface{})
ret["Url"] = dn.Url()