addNewSpeed apend the new speed to tail, remove the oldest one
(s float32)
| 104 | |
| 105 | //addNewSpeed apend the new speed to tail, remove the oldest one |
| 106 | func (this *NodeWeight) AppendNewSpeed(s float32) { |
| 107 | copy(this.speed[0:SYNC_NODE_RECORD_SPEED_CNT-1], this.speed[1:]) |
| 108 | this.speed[SYNC_NODE_RECORD_SPEED_CNT-1] = s |
| 109 | } |
| 110 | |
| 111 | //Weight calculate node's weight for sort. Highest weight node will be accessed first for next request. |
| 112 | func (this *NodeWeight) Weight() float32 { |