aboutsummaryrefslogtreecommitdiff
path: root/go/storage/store.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/storage/store.go')
-rw-r--r--go/storage/store.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/go/storage/store.go b/go/storage/store.go
index 80d8a30b8..65eed1d0e 100644
--- a/go/storage/store.go
+++ b/go/storage/store.go
@@ -9,10 +9,10 @@ import (
"strconv"
"strings"
- proto "code.google.com/p/goprotobuf/proto"
"github.com/chrislusf/weed-fs/go/glog"
"github.com/chrislusf/weed-fs/go/operation"
"github.com/chrislusf/weed-fs/go/util"
+ "github.com/golang/protobuf/proto"
)
const (
@@ -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)