rename Server to DataNode

formatting
This commit is contained in:
Chris Lu
2012-09-08 16:25:44 -07:00
parent 9bde067f16
commit 9f4630736d
10 changed files with 47 additions and 50 deletions

View File

@@ -5,26 +5,23 @@ import (
"pkg/storage"
)
type Server struct {
type DataNode struct {
NodeImpl
volumes map[storage.VolumeId]*storage.VolumeInfo
Ip NodeId
Port int
PublicUrl string
}
func NewServer(id string) *Server {
s := &Server{}
func NewDataNode(id string) *DataNode {
s := &DataNode{}
s.id = NodeId(id)
s.nodeType = "Server"
s.nodeType = "DataNode"
s.volumes = make(map[storage.VolumeId]*storage.VolumeInfo)
return s
}
func (s *Server) CreateOneVolume(r int, vid storage.VolumeId) storage.VolumeId {
func (s *DataNode) 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) {
func (s *DataNode) AddVolume(v *storage.VolumeInfo) {
s.volumes[v.Id] = v
s.UpAdjustActiveVolumeCountDelta(1)
s.UpAdjustMaxVolumeId(v.Id)