seaweedfs/weed-fs/src/pkg/topology/node.go

30 lines
480 B
Go
Raw Normal View History

2012-08-24 03:56:09 +00:00
package topology
2012-08-24 05:56:14 +00:00
import (
"pkg/storage"
)
2012-08-24 03:56:09 +00:00
2012-08-24 05:33:37 +00:00
type NodeId uint32
2012-08-24 03:56:09 +00:00
type Node struct {
2012-08-24 05:56:14 +00:00
volumes map[storage.VolumeId]storage.VolumeInfo
2012-08-24 05:33:37 +00:00
volumeLimit int
Ip string
Port int
PublicUrl string
//transient
allocation *Allocation
2012-08-24 03:56:09 +00:00
}
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
}