diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-01 22:13:47 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-01 22:13:47 -0800 |
| commit | 6a8484b4ae2615c2cc88e3a66d03aead3966ba7c (patch) | |
| tree | 9cd878b35c425f24f22ac5246ed1d0046533dac6 /weed/wdclient/masterclient.go | |
| parent | 0ca68a2a6d87786dbebe87fbd4b786b3318c1dcb (diff) | |
| download | seaweedfs-6a8484b4ae2615c2cc88e3a66d03aead3966ba7c.tar.xz seaweedfs-6a8484b4ae2615c2cc88e3a66d03aead3966ba7c.zip | |
master able to list all master clients by type
Diffstat (limited to 'weed/wdclient/masterclient.go')
| -rw-r--r-- | weed/wdclient/masterclient.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index f197fa6f2..0cf161a63 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -6,14 +6,16 @@ import ( "math/rand" "time" + "google.golang.org/grpc" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" "github.com/chrislusf/seaweedfs/weed/util" - "google.golang.org/grpc" ) type MasterClient struct { name string + grpcPort uint32 currentMaster string masters []string grpcDialOption grpc.DialOption @@ -21,9 +23,10 @@ type MasterClient struct { vidMap } -func NewMasterClient(grpcDialOption grpc.DialOption, clientName string, masters []string) *MasterClient { +func NewMasterClient(grpcDialOption grpc.DialOption, clientName string, clientGrpcPort uint32, masters []string) *MasterClient { return &MasterClient{ name: clientName, + grpcPort: clientGrpcPort, masters: masters, grpcDialOption: grpcDialOption, vidMap: newVidMap(), @@ -72,7 +75,7 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri return err } - if err = stream.Send(&master_pb.KeepConnectedRequest{Name: mc.name}); err != nil { + if err = stream.Send(&master_pb.KeepConnectedRequest{Name: mc.name, GrpcPort: mc.grpcPort}); err != nil { glog.V(0).Infof("%s failed to send to %s: %v", mc.name, master, err) return err } |
