|
|
@ -14,6 +14,7 @@ type Node interface { |
|
|
|
UpAdjustMaxVolumeCountDelta(maxVolumeCountDelta int) |
|
|
|
UpAdjustActiveVolumeCountDelta(activeVolumeCountDelta int) |
|
|
|
UpAdjustMaxVolumeId(vid storage.VolumeId) |
|
|
|
|
|
|
|
GetActiveVolumeCount() int |
|
|
|
GetMaxVolumeCount() int |
|
|
|
GetMaxVolumeId() storage.VolumeId |
|
|
@ -26,7 +27,7 @@ type Node interface { |
|
|
|
Children() map[NodeId]Node |
|
|
|
Parent() Node |
|
|
|
|
|
|
|
GetValue()interface{} //get reference to the topology,dc,rack,datanode
|
|
|
|
GetValue() interface{} //get reference to the topology,dc,rack,datanode
|
|
|
|
} |
|
|
|
type NodeImpl struct { |
|
|
|
id NodeId |
|
|
@ -71,7 +72,7 @@ func (n *NodeImpl) Children() map[NodeId]Node { |
|
|
|
func (n *NodeImpl) Parent() Node { |
|
|
|
return n.parent |
|
|
|
} |
|
|
|
func (n *NodeImpl) GetValue()interface{}{ |
|
|
|
func (n *NodeImpl) GetValue() interface{} { |
|
|
|
return n.value |
|
|
|
} |
|
|
|
func (n *NodeImpl) ReserveOneVolume(r int, vid storage.VolumeId) (bool, *DataNode) { |
|
|
@ -119,7 +120,6 @@ func (n *NodeImpl) UpAdjustMaxVolumeId(vid storage.VolumeId) { //can be negative |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (n *NodeImpl) GetMaxVolumeId() storage.VolumeId { |
|
|
|
return n.maxVolumeId |
|
|
|
} |
|
|
@ -175,7 +175,7 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (n *NodeImpl) GetTopology() *Topology{ |
|
|
|
func (n *NodeImpl) GetTopology() *Topology { |
|
|
|
var p Node |
|
|
|
p = n |
|
|
|
for p.Parent() != nil { |
|
|
|