NewClientV3 creates a new grpc client connection to the member
(m *Member)
| 898 | |
| 899 | // NewClientV3 creates a new grpc client connection to the member |
| 900 | func NewClientV3(m *Member) (*clientv3.Client, error) { |
| 901 | if m.GRPCURL == "" { |
| 902 | return nil, fmt.Errorf("member not configured for grpc") |
| 903 | } |
| 904 | |
| 905 | cfg := clientv3.Config{ |
| 906 | Endpoints: []string{m.GRPCURL}, |
| 907 | DialTimeout: 5 * time.Second, |
| 908 | DialOptions: []grpc.DialOption{grpc.WithBlock()}, |
| 909 | MaxCallSendMsgSize: m.ClientMaxCallSendMsgSize, |
| 910 | MaxCallRecvMsgSize: m.ClientMaxCallRecvMsgSize, |
| 911 | Logger: m.Logger.Named("client"), |
| 912 | } |
| 913 | |
| 914 | if m.ClientTLSInfo != nil { |
| 915 | tls, err := m.ClientTLSInfo.ClientConfig() |
| 916 | if err != nil { |
| 917 | return nil, err |
| 918 | } |
| 919 | cfg.TLS = tls |
| 920 | } |
| 921 | if m.DialOptions != nil { |
| 922 | cfg.DialOptions = append(cfg.DialOptions, m.DialOptions...) |
| 923 | } |
| 924 | return newClientV3(cfg) |
| 925 | } |
| 926 | |
| 927 | // Clone returns a member with the same server configuration. The returned |
| 928 | // member will not set PeerListeners and ClientListeners. |
no test coverage detected
searching dependent graphs…