aboutsummaryrefslogtreecommitdiff
path: root/weed/pb/grpc_client_server.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-12 18:10:59 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-12 18:10:59 -0700
commit5571f4f70a2e304343e76638caacc3bd0338a8d1 (patch)
treedca89320167ca82dae6f9ede85eed00a78a08f06 /weed/pb/grpc_client_server.go
parent5469019852cf1399b64683cbcc54f4c077377afb (diff)
downloadseaweedfs-5571f4f70a2e304343e76638caacc3bd0338a8d1.tar.xz
seaweedfs-5571f4f70a2e304343e76638caacc3bd0338a8d1.zip
master: add master.follower to handle read file id lookup requests
Diffstat (limited to 'weed/pb/grpc_client_server.go')
-rw-r--r--weed/pb/grpc_client_server.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go
index fac8adcb3..15dc917e9 100644
--- a/weed/pb/grpc_client_server.go
+++ b/weed/pb/grpc_client_server.go
@@ -213,6 +213,21 @@ func WithMasterClient(master string, grpcDialOption grpc.DialOption, fn func(cli
}
+func WithOneOfGrpcMasterClients(masterGrpcAddresses []string, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) (err error) {
+
+ for _, masterGrpcAddress := range masterGrpcAddresses {
+ err = WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
+ client := master_pb.NewSeaweedClient(grpcConnection)
+ return fn(client)
+ }, masterGrpcAddress, grpcDialOption)
+ if err == nil {
+ return nil
+ }
+ }
+
+ return err
+}
+
func WithBrokerGrpcClient(brokerGrpcAddress string, grpcDialOption grpc.DialOption, fn func(client messaging_pb.SeaweedMessagingClient) error) error {
return WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {