aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-05-10 03:50:30 -0700
committerChris Lu <chris.lu@gmail.com>2020-05-10 03:50:30 -0700
commit39e72fb23ca0d23cc563da50746c7a717bfa01e6 (patch)
treee5d4e94cd94f166dcf77ddcb3d332acdd8c916fa
parent6bf3eb69cb9abd02e1d63ecdee485d198a3cab9a (diff)
downloadseaweedfs-39e72fb23ca0d23cc563da50746c7a717bfa01e6.tar.xz
seaweedfs-39e72fb23ca0d23cc563da50746c7a717bfa01e6.zip
go fmt
-rw-r--r--weed/command/benchmark.go2
-rw-r--r--weed/command/filer_copy.go2
-rw-r--r--weed/filer2/reader_at.go2
-rw-r--r--weed/filer2/stream.go2
-rw-r--r--weed/messaging/broker/broker_grpc_server_subscribe.go3
-rw-r--r--weed/messaging/broker/consistent_distribution.go4
-rw-r--r--weed/messaging/broker/consistent_distribution_test.go4
-rw-r--r--weed/messaging/broker/topic_lock.go2
-rw-r--r--weed/messaging/msgclient/client.go1
-rw-r--r--weed/messaging/msgclient/publisher.go1
-rw-r--r--weed/messaging/msgclient/subscriber.go2
-rw-r--r--weed/operation/submit.go2
-rw-r--r--weed/util/log_buffer/sealed_buffer.go2
13 files changed, 15 insertions, 14 deletions
diff --git a/weed/command/benchmark.go b/weed/command/benchmark.go
index 5b2e31622..ee21914b3 100644
--- a/weed/command/benchmark.go
+++ b/weed/command/benchmark.go
@@ -232,7 +232,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stat) {
Reader: &FakeReader{id: uint64(id), size: fileSize, random: random},
FileSize: fileSize,
MimeType: "image/bench", // prevent gzip benchmark content
- Fsync: *b.fsync,
+ Fsync: *b.fsync,
}
ar := &operation.VolumeAssignRequest{
Count: 1,
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go
index 322ab20d5..2d6ba94d6 100644
--- a/weed/command/filer_copy.go
+++ b/weed/command/filer_copy.go
@@ -428,7 +428,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File,
uploadError = fmt.Errorf("upload %v to %s result: %v\n", fileName, targetUrl, uploadResult.Error)
return
}
- chunksChan <- uploadResult.ToPbFileChunk(assignResult.FileId, i * chunkSize)
+ chunksChan <- uploadResult.ToPbFileChunk(assignResult.FileId, i*chunkSize)
fmt.Printf("uploaded %s-%d to %s [%d,%d)\n", fileName, i+1, targetUrl, i*chunkSize, i*chunkSize+int64(uploadResult.Size))
}(i)
diff --git a/weed/filer2/reader_at.go b/weed/filer2/reader_at.go
index a9772da5b..53fff7672 100644
--- a/weed/filer2/reader_at.go
+++ b/weed/filer2/reader_at.go
@@ -59,7 +59,7 @@ func LookupFn(filerClient filer_pb.FilerClient) LookupFileIdFunctionType {
func NewChunkReaderAtFromClient(filerClient filer_pb.FilerClient, chunkViews []*ChunkView, chunkCache *chunk_cache.ChunkCache) *ChunkReadAt {
return &ChunkReadAt{
- chunkViews: chunkViews,
+ chunkViews: chunkViews,
lookupFileId: LookupFn(filerClient),
bufferOffset: -1,
chunkCache: chunkCache,
diff --git a/weed/filer2/stream.go b/weed/filer2/stream.go
index 4c8213b07..033a8dd13 100644
--- a/weed/filer2/stream.go
+++ b/weed/filer2/stream.go
@@ -103,7 +103,7 @@ func NewChunkStreamReader(filerClient filer_pb.FilerClient, chunks []*filer_pb.F
chunkViews := ViewFromChunks(chunks, 0, math.MaxInt32)
return &ChunkStreamReader{
- chunkViews: chunkViews,
+ chunkViews: chunkViews,
lookupFileId: LookupFn(filerClient),
}
}
diff --git a/weed/messaging/broker/broker_grpc_server_subscribe.go b/weed/messaging/broker/broker_grpc_server_subscribe.go
index 86ee6923d..76cbdef24 100644
--- a/weed/messaging/broker/broker_grpc_server_subscribe.go
+++ b/weed/messaging/broker/broker_grpc_server_subscribe.go
@@ -37,8 +37,7 @@ func (broker *MessageBroker) Subscribe(stream messaging_pb.SeaweedMessaging_Subs
// IsTransient: true,
}
- if err = stream.Send(&messaging_pb.BrokerMessage{
- }); err != nil {
+ if err = stream.Send(&messaging_pb.BrokerMessage{}); err != nil {
return err
}
diff --git a/weed/messaging/broker/consistent_distribution.go b/weed/messaging/broker/consistent_distribution.go
index dd7d34f86..465a2a8f2 100644
--- a/weed/messaging/broker/consistent_distribution.go
+++ b/weed/messaging/broker/consistent_distribution.go
@@ -1,8 +1,8 @@
package broker
import (
- "github.com/cespare/xxhash"
"github.com/buraksezer/consistent"
+ "github.com/cespare/xxhash"
)
type Member string
@@ -35,4 +35,4 @@ func PickMember(members []string, key []byte) string {
m := c.LocateKey(key)
return m.String()
-} \ No newline at end of file
+}
diff --git a/weed/messaging/broker/consistent_distribution_test.go b/weed/messaging/broker/consistent_distribution_test.go
index 192516092..f58fe4e0e 100644
--- a/weed/messaging/broker/consistent_distribution_test.go
+++ b/weed/messaging/broker/consistent_distribution_test.go
@@ -18,7 +18,7 @@ func TestPickMember(t *testing.T) {
total := 1000
distribution := make(map[string]int)
- for i:=0;i<total;i++{
+ for i := 0; i < total; i++ {
tp := fmt.Sprintf("tp:%2d", i)
m := PickMember(servers, []byte(tp))
// println(tp, "=>", m)
@@ -29,4 +29,4 @@ func TestPickMember(t *testing.T) {
fmt.Printf("member: %s, key count: %d load=%.2f\n", member, count, float64(count*100)/float64(total/len(servers)))
}
-} \ No newline at end of file
+}
diff --git a/weed/messaging/broker/topic_lock.go b/weed/messaging/broker/topic_lock.go
index 4c4803275..9ae446df3 100644
--- a/weed/messaging/broker/topic_lock.go
+++ b/weed/messaging/broker/topic_lock.go
@@ -16,9 +16,11 @@ type TopicPartition struct {
Topic string
Partition int32
}
+
const (
TopicPartitionFmt = "%s/%s_%02d"
)
+
func (tp *TopicPartition) String() string {
return fmt.Sprintf(TopicPartitionFmt, tp.Namespace, tp.Topic, tp.Partition)
}
diff --git a/weed/messaging/msgclient/client.go b/weed/messaging/msgclient/client.go
index f4e11232e..4d7ef2b8e 100644
--- a/weed/messaging/msgclient/client.go
+++ b/weed/messaging/msgclient/client.go
@@ -28,7 +28,6 @@ func NewMessagingClient(bootstrapBrokers ...string) *MessagingClient {
}
}
-
func (mc *MessagingClient) findBroker(tp broker.TopicPartition) (*grpc.ClientConn, error) {
for _, broker := range mc.bootstrapBrokers {
diff --git a/weed/messaging/msgclient/publisher.go b/weed/messaging/msgclient/publisher.go
index 08f1d278a..ebb6d3f2a 100644
--- a/weed/messaging/msgclient/publisher.go
+++ b/weed/messaging/msgclient/publisher.go
@@ -16,6 +16,7 @@ type Publisher struct {
messageCount uint64
publisherId string
}
+
/*
func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*Publisher, error) {
// read topic configuration
diff --git a/weed/messaging/msgclient/subscriber.go b/weed/messaging/msgclient/subscriber.go
index d3066d6ef..efbfa0337 100644
--- a/weed/messaging/msgclient/subscriber.go
+++ b/weed/messaging/msgclient/subscriber.go
@@ -5,8 +5,8 @@ import (
"io"
"time"
- "google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
+ "google.golang.org/grpc"
)
type Subscriber struct {
diff --git a/weed/operation/submit.go b/weed/operation/submit.go
index 7cf5b9645..e8bec382a 100644
--- a/weed/operation/submit.go
+++ b/weed/operation/submit.go
@@ -27,7 +27,7 @@ type FilePart struct {
Ttl string
Server string //this comes from assign result
Fid string //this comes from assign result, but customizable
- Fsync bool
+ Fsync bool
}
type SubmitResult struct {
diff --git a/weed/util/log_buffer/sealed_buffer.go b/weed/util/log_buffer/sealed_buffer.go
index cade45dd1..d133cf8d3 100644
--- a/weed/util/log_buffer/sealed_buffer.go
+++ b/weed/util/log_buffer/sealed_buffer.go
@@ -59,4 +59,4 @@ func (mb *MemBuffer) locateByTs(lastReadTime time.Time) (pos int) {
func (mb *MemBuffer) String() string {
return fmt.Sprintf("[%v,%v] bytes:%d", mb.startTime, mb.stopTime, mb.size)
-} \ No newline at end of file
+}