@@ -3,6 +3,8 @@ package ydb
33import (
44 "context"
55
6+ "google.golang.org/grpc"
7+
68 "github.com/ydb-platform/ydb-go-sdk/v3/coordination"
79 "github.com/ydb-platform/ydb-go-sdk/v3/discovery"
810 "github.com/ydb-platform/ydb-go-sdk/v3/internal/errors"
@@ -15,9 +17,9 @@ import (
1517)
1618
1719type proxyConnection struct {
18- endpoint string
19- secure bool
20- meta meta.Meta
20+ connection Connection
21+
22+ meta meta.Meta
2123
2224 table table.Client
2325 scripting scripting.Client
@@ -27,18 +29,47 @@ type proxyConnection struct {
2729 ratelimiter ratelimiter.Client
2830}
2931
30- func newProxy (c Connection , meta meta.Meta ) * proxyConnection {
32+ func (c * proxyConnection ) Invoke (
33+ ctx context.Context ,
34+ method string ,
35+ args interface {},
36+ reply interface {},
37+ opts ... grpc.CallOption ,
38+ ) error {
39+ return c .connection .Invoke (
40+ ctx ,
41+ method ,
42+ args ,
43+ reply ,
44+ opts ... ,
45+ )
46+ }
47+
48+ func (c * proxyConnection ) NewStream (
49+ ctx context.Context ,
50+ desc * grpc.StreamDesc ,
51+ method string ,
52+ opts ... grpc.CallOption ,
53+ ) (grpc.ClientStream , error ) {
54+ return c .connection .NewStream (
55+ ctx ,
56+ desc ,
57+ method ,
58+ opts ... ,
59+ )
60+ }
61+
62+ func newProxy (connection Connection , meta meta.Meta ) * proxyConnection {
3163 return & proxyConnection {
32- endpoint : c .Endpoint (),
33- secure : c .Secure (),
34- meta : meta ,
35-
36- table : proxy .Table (c .Table (), meta ),
37- scripting : proxy .Scripting (c .Scripting (), meta ),
38- scheme : proxy .Scheme (c .Scheme (), meta ),
39- discovery : proxy .Discovery (c .Discovery (), meta ),
40- coordination : proxy .Coordination (c .Coordination (), meta ),
41- ratelimiter : proxy .Ratelimiter (c .Ratelimiter (), meta ),
64+ connection : connection ,
65+ meta : meta ,
66+
67+ table : proxy .Table (connection .Table (), meta ),
68+ scripting : proxy .Scripting (connection .Scripting (), meta ),
69+ scheme : proxy .Scheme (connection .Scheme (), meta ),
70+ discovery : proxy .Discovery (connection .Discovery (), meta ),
71+ coordination : proxy .Coordination (connection .Coordination (), meta ),
72+ ratelimiter : proxy .Ratelimiter (connection .Ratelimiter (), meta ),
4273 }
4374}
4475
@@ -66,15 +97,15 @@ func (c *proxyConnection) Close(ctx context.Context) error {
6697}
6798
6899func (c * proxyConnection ) Endpoint () string {
69- return c .endpoint
100+ return c .connection . Endpoint ()
70101}
71102
72103func (c * proxyConnection ) Name () string {
73104 return c .meta .Database ()
74105}
75106
76107func (c * proxyConnection ) Secure () bool {
77- return c .secure
108+ return c .connection . Secure ()
78109}
79110
80111func (c * proxyConnection ) Table (opts ... CustomOption ) table.Client {
0 commit comments