|
|
@ -33,6 +33,10 @@ type MasterNodes struct { |
|
|
|
lastNode int |
|
|
|
} |
|
|
|
|
|
|
|
func (mn *MasterNodes) String() string { |
|
|
|
return fmt.Sprintf("nodes:%v, lastNode:%d", mn.nodes, mn.lastNode) |
|
|
|
} |
|
|
|
|
|
|
|
func NewMasterNodes(bootstrapNode string) (mn *MasterNodes) { |
|
|
|
mn = &MasterNodes{nodes: []string{bootstrapNode}, lastNode: -1} |
|
|
|
return |
|
|
@ -65,6 +69,9 @@ func (mn *MasterNodes) findMaster() (string, error) { |
|
|
|
return mn.nodes[mn.lastNode], nil |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* A VolumeServer contains one Store |
|
|
|
*/ |
|
|
|
type Store struct { |
|
|
|
Port int |
|
|
|
Ip string |
|
|
@ -77,6 +84,11 @@ type Store struct { |
|
|
|
masterNodes *MasterNodes |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Store) String() (str string) { |
|
|
|
str = fmt.Sprintf("Ip:%s, Port:%d, PublicUrl:%s, dataCenter:%s, rack:%s, connected:%v, volumeSizeLimit:%d, masterNodes:%s", s.Ip, s.Port, s.PublicUrl, s.dataCenter, s.rack, s.connected, s.volumeSizeLimit, s.masterNodes) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func NewStore(port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int) (s *Store) { |
|
|
|
s = &Store{Port: port, Ip: ip, PublicUrl: publicUrl} |
|
|
|
s.Locations = make([]*DiskLocation, 0) |
|
|
|