mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 07:17:25 +08:00
go fmt
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
}
|
||||
}
|
||||
|
@@ -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)))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user