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
|
2012-08-27 20:52:02 +00:00
|
|
|
|
|
|
|
//transient
|
|
|
|
allocation *Allocation
|
2012-08-24 03:56:09 +00:00
|
|
|
}
|
2012-08-27 20:52:02 +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
|
|
|
|
}
|
|
|
|
|