aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-07 06:12:57 -0800
committerChris Lu <chris.lu@gmail.com>2020-03-07 06:12:57 -0800
commit1ae83c29389c64fedabaa5e401154c5b57add40c (patch)
tree8a4aca03c68bdbeeb053570dd4430e70d1fb71a4
parent564629444befcdd7f71dade1713199b212243226 (diff)
downloadseaweedfs-1ae83c29389c64fedabaa5e401154c5b57add40c.tar.xz
seaweedfs-1ae83c29389c64fedabaa5e401154c5b57add40c.zip
go fmt
-rw-r--r--weed/command/mount.go1
-rw-r--r--weed/command/msg_broker.go6
-rw-r--r--weed/pb/master_pb/master.pb.go20
-rw-r--r--weed/pb/volume_server_pb/volume_server.pb.go26
-rw-r--r--weed/storage/needle/needle.go2
-rw-r--r--weed/topology/node.go4
-rw-r--r--weed/topology/volume_growth_test.go4
7 files changed, 35 insertions, 28 deletions
diff --git a/weed/command/mount.go b/weed/command/mount.go
index 792845083..f1448c6cc 100644
--- a/weed/command/mount.go
+++ b/weed/command/mount.go
@@ -62,4 +62,3 @@ var cmdMount = &Command{
`,
}
-
diff --git a/weed/command/msg_broker.go b/weed/command/msg_broker.go
index 21551df9e..3e13b4730 100644
--- a/weed/command/msg_broker.go
+++ b/weed/command/msg_broker.go
@@ -23,9 +23,9 @@ var (
)
type QueueOptions struct {
- filer *string
- port *int
- defaultTtl *string
+ filer *string
+ port *int
+ defaultTtl *string
}
func init() {
diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go
index c33e2b768..95c9533a1 100644
--- a/weed/pb/master_pb/master.pb.go
+++ b/weed/pb/master_pb/master.pb.go
@@ -428,10 +428,12 @@ type VolumeEcShardInformationMessage struct {
EcIndexBits uint32 `protobuf:"varint,3,opt,name=ec_index_bits,json=ecIndexBits" json:"ec_index_bits,omitempty"`
}
-func (m *VolumeEcShardInformationMessage) Reset() { *m = VolumeEcShardInformationMessage{} }
-func (m *VolumeEcShardInformationMessage) String() string { return proto.CompactTextString(m) }
-func (*VolumeEcShardInformationMessage) ProtoMessage() {}
-func (*VolumeEcShardInformationMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *VolumeEcShardInformationMessage) Reset() { *m = VolumeEcShardInformationMessage{} }
+func (m *VolumeEcShardInformationMessage) String() string { return proto.CompactTextString(m) }
+func (*VolumeEcShardInformationMessage) ProtoMessage() {}
+func (*VolumeEcShardInformationMessage) Descriptor() ([]byte, []int) {
+ return fileDescriptor0, []int{4}
+}
func (m *VolumeEcShardInformationMessage) GetId() uint32 {
if m != nil {
@@ -1422,10 +1424,12 @@ type GetMasterConfigurationResponse struct {
MetricsIntervalSeconds uint32 `protobuf:"varint,2,opt,name=metrics_interval_seconds,json=metricsIntervalSeconds" json:"metrics_interval_seconds,omitempty"`
}
-func (m *GetMasterConfigurationResponse) Reset() { *m = GetMasterConfigurationResponse{} }
-func (m *GetMasterConfigurationResponse) String() string { return proto.CompactTextString(m) }
-func (*GetMasterConfigurationResponse) ProtoMessage() {}
-func (*GetMasterConfigurationResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
+func (m *GetMasterConfigurationResponse) Reset() { *m = GetMasterConfigurationResponse{} }
+func (m *GetMasterConfigurationResponse) String() string { return proto.CompactTextString(m) }
+func (*GetMasterConfigurationResponse) ProtoMessage() {}
+func (*GetMasterConfigurationResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor0, []int{32}
+}
func (m *GetMasterConfigurationResponse) GetMetricsAddress() string {
if m != nil {
diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go
index 56baa0cf7..588b18f2e 100644
--- a/weed/pb/volume_server_pb/volume_server.pb.go
+++ b/weed/pb/volume_server_pb/volume_server.pb.go
@@ -1035,10 +1035,12 @@ func (m *VolumeEcShardsGenerateRequest) GetCollection() string {
type VolumeEcShardsGenerateResponse struct {
}
-func (m *VolumeEcShardsGenerateResponse) Reset() { *m = VolumeEcShardsGenerateResponse{} }
-func (m *VolumeEcShardsGenerateResponse) String() string { return proto.CompactTextString(m) }
-func (*VolumeEcShardsGenerateResponse) ProtoMessage() {}
-func (*VolumeEcShardsGenerateResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} }
+func (m *VolumeEcShardsGenerateResponse) Reset() { *m = VolumeEcShardsGenerateResponse{} }
+func (m *VolumeEcShardsGenerateResponse) String() string { return proto.CompactTextString(m) }
+func (*VolumeEcShardsGenerateResponse) ProtoMessage() {}
+func (*VolumeEcShardsGenerateResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor0, []int{41}
+}
type VolumeEcShardsRebuildRequest struct {
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
@@ -1411,10 +1413,12 @@ func (m *VolumeEcShardsToVolumeRequest) GetCollection() string {
type VolumeEcShardsToVolumeResponse struct {
}
-func (m *VolumeEcShardsToVolumeResponse) Reset() { *m = VolumeEcShardsToVolumeResponse{} }
-func (m *VolumeEcShardsToVolumeResponse) String() string { return proto.CompactTextString(m) }
-func (*VolumeEcShardsToVolumeResponse) ProtoMessage() {}
-func (*VolumeEcShardsToVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} }
+func (m *VolumeEcShardsToVolumeResponse) Reset() { *m = VolumeEcShardsToVolumeResponse{} }
+func (m *VolumeEcShardsToVolumeResponse) String() string { return proto.CompactTextString(m) }
+func (*VolumeEcShardsToVolumeResponse) ProtoMessage() {}
+func (*VolumeEcShardsToVolumeResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor0, []int{57}
+}
type ReadVolumeFileStatusRequest struct {
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
@@ -2081,8 +2085,10 @@ type QueryRequest_InputSerialization_JSONInput struct {
func (m *QueryRequest_InputSerialization_JSONInput) Reset() {
*m = QueryRequest_InputSerialization_JSONInput{}
}
-func (m *QueryRequest_InputSerialization_JSONInput) String() string { return proto.CompactTextString(m) }
-func (*QueryRequest_InputSerialization_JSONInput) ProtoMessage() {}
+func (m *QueryRequest_InputSerialization_JSONInput) String() string {
+ return proto.CompactTextString(m)
+}
+func (*QueryRequest_InputSerialization_JSONInput) ProtoMessage() {}
func (*QueryRequest_InputSerialization_JSONInput) Descriptor() ([]byte, []int) {
return fileDescriptor0, []int{70, 1, 1}
}
diff --git a/weed/storage/needle/needle.go b/weed/storage/needle/needle.go
index f906062de..d3969e868 100644
--- a/weed/storage/needle/needle.go
+++ b/weed/storage/needle/needle.go
@@ -48,7 +48,6 @@ func (n *Needle) String() (str string) {
return
}
-
func CreateNeedleFromRequest(r *http.Request, fixJpgOrientation bool, sizeLimit int64) (n *Needle, originalSize int, e error) {
n = new(Needle)
pu, e := ParseUpload(r, sizeLimit)
@@ -60,7 +59,6 @@ func CreateNeedleFromRequest(r *http.Request, fixJpgOrientation bool, sizeLimit
n.LastModified = pu.ModifiedTime
n.Ttl = pu.Ttl
-
if len(pu.FileName) < 256 {
n.Name = []byte(pu.FileName)
n.SetHasName()
diff --git a/weed/topology/node.go b/weed/topology/node.go
index 501a22623..ceeb96d60 100644
--- a/weed/topology/node.go
+++ b/weed/topology/node.go
@@ -85,11 +85,11 @@ func (n *NodeImpl) PickNodesByWeight(numberOfNodes int, filterFirstNodeFn func(d
//pick nodes randomly by weights, the node picked earlier has higher final weights
sortedCandidates := make([]Node, 0, len(candidates))
- for i:=0; i<len(candidates); i++ {
+ for i := 0; i < len(candidates); i++ {
weightsInterval := rand.Int63n(totalWeights)
lastWeights := int64(0)
for k, weights := range candidatesWeights {
- if (weightsInterval>=lastWeights) && (weightsInterval<lastWeights + weights) {
+ if (weightsInterval >= lastWeights) && (weightsInterval < lastWeights+weights) {
sortedCandidates = append(sortedCandidates, candidates[k])
candidatesWeights[k] = 0
totalWeights -= weights
diff --git a/weed/topology/volume_growth_test.go b/weed/topology/volume_growth_test.go
index 83671cd2b..6ff5be0eb 100644
--- a/weed/topology/volume_growth_test.go
+++ b/weed/topology/volume_growth_test.go
@@ -321,7 +321,7 @@ func TestFindEmptySlotsForOneVolumeScheduleByWeight(t *testing.T) {
distribution := map[NodeId]int{}
// assign 1000 volumes
- for i:=0;i<1000 ;i++ {
+ for i := 0; i < 1000; i++ {
servers, err := vg.findEmptySlotsForOneVolume(topo, volumeGrowOption)
if err != nil {
fmt.Println("finding empty slots error :", err)
@@ -339,4 +339,4 @@ func TestFindEmptySlotsForOneVolumeScheduleByWeight(t *testing.T) {
for k, v := range distribution {
fmt.Printf("%s : %d\n", k, v)
}
-} \ No newline at end of file
+}