func toGRPC(c *clientv3.Client) grpcAPI { return grpcAPI{ pb.NewClusterClient(c.ActiveConnection()), pb.NewKVClient(c.ActiveConnection()), pb.NewLeaseClient(c.ActiveConnection()), pb.NewWatchClient(c.ActiveConnection()), pb.NewMaintenanceClient(c.ActiveConnection()), } }
func toGRPC(c *clientv3.Client) grpcAPI { if v, ok := proxies[c]; ok { return v } return grpcAPI{ pb.NewClusterClient(c.ActiveConnection()), grpcproxy.KvServerToKvClient(grpcproxy.NewKvProxy(c)), pb.NewLeaseClient(c.ActiveConnection()), grpcproxy.WatchServerToWatchClient(grpcproxy.NewWatchProxy(c)), pb.NewMaintenanceClient(c.ActiveConnection()), } }
func toGRPC(c *clientv3.Client) grpcAPI { pmu.Lock() defer pmu.Unlock() if v, ok := proxies[c]; ok { return v } api := grpcAPI{ pb.NewClusterClient(c.ActiveConnection()), grpcproxy.KvServerToKvClient(grpcproxy.NewKvProxy(c)), pb.NewLeaseClient(c.ActiveConnection()), grpcproxy.WatchServerToWatchClient(grpcproxy.NewWatchProxy(c)), pb.NewMaintenanceClient(c.ActiveConnection()), } proxies[c] = api return api }