reduce duplicated code by using a tree of Node
This commit is contained in:
21
weed-fs/src/pkg/topology/server.go
Normal file
21
weed-fs/src/pkg/topology/server.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package topology
|
||||
|
||||
import (
|
||||
"pkg/storage"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
Node
|
||||
volumes map[storage.VolumeId]*storage.VolumeInfo
|
||||
Ip NodeId
|
||||
Port int
|
||||
PublicUrl string
|
||||
}
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user