2012-08-29 07:58:03 +00:00
|
|
|
package topology
|
|
|
|
|
|
|
|
import (
|
|
|
|
"pkg/storage"
|
2012-08-31 08:35:11 +00:00
|
|
|
_ "fmt"
|
2012-08-29 07:58:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
Node
|
|
|
|
volumes map[storage.VolumeId]*storage.VolumeInfo
|
|
|
|
Ip NodeId
|
|
|
|
Port int
|
|
|
|
PublicUrl string
|
|
|
|
}
|
2012-08-31 08:35:11 +00:00
|
|
|
func NewServer(id NodeId) *Server{
|
|
|
|
s := &Server{}
|
|
|
|
s.Node.Id = id
|
|
|
|
s.volumes = make(map[storage.VolumeId]*storage.VolumeInfo)
|
|
|
|
return s
|
|
|
|
}
|
2012-08-29 07:58:03 +00:00
|
|
|
func (s *Server) CreateOneVolume(r int, vid storage.VolumeId) storage.VolumeId {
|
|
|
|
s.AddVolume(&storage.VolumeInfo{Id:vid, Size: 32*1024*1024*1024})
|
|
|
|
return vid
|
|
|
|
}
|
|
|
|
func (s *Server) AddVolume(v *storage.VolumeInfo){
|
|
|
|
s.volumes[v.Id] = v
|
|
|
|
s.Node.AddVolume(v)
|
|
|
|
}
|