Files
seaweedFS/weed-fs/src/pkg/topology/node.go
Chris Lu 2dceb44ae4 add more for volume placement
fix possible nil volume cases
2012-08-27 13:52:02 -07:00

30 lines
480 B
Go

package topology
import (
"pkg/storage"
)
type NodeId uint32
type Node struct {
volumes map[storage.VolumeId]storage.VolumeInfo
volumeLimit int
Ip string
Port int
PublicUrl string
//transient
allocation *Allocation
}
type Allocation struct {
count int
limit int
}
func (n *Node) GetAllocation() *Allocation{
if n.allocation == nil {
n.allocation = &Allocation{count:len(n.volumes), limit : n.volumeLimit}
}
return n.allocation
}