Skip to content

Commit 90effc4

Browse files
fix: remove client side gRPC receive limits (#192)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * fix: remove client recv msg limit fix: add enums to `types/__init__.py` PiperOrigin-RevId: 347055288 Source-Author: Google APIs <[email protected]> Source-Date: Fri Dec 11 12:44:37 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: dd372aa22ded7a8ba6f0e03a80e06358a3fa0907 Source-Link: googleapis/googleapis@dd372aa * docs: revert unsupported docstring headers Co-authored-by: larkee <[email protected]> Co-authored-by: larkee <[email protected]>
1 parent c000ec4 commit 90effc4

File tree

16 files changed

+98
-28
lines changed

16 files changed

+98
-28
lines changed

google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = DatabaseAdminGrpcTransport
2929
_transport_registry["grpc_asyncio"] = DatabaseAdminGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"DatabaseAdminTransport",
3433
"DatabaseAdminGrpcTransport",

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ def __init__(
158158
ssl_credentials=ssl_credentials,
159159
scopes=scopes or self.AUTH_SCOPES,
160160
quota_project_id=quota_project_id,
161+
options=[
162+
("grpc.max_send_message_length", -1),
163+
("grpc.max_receive_message_length", -1),
164+
],
161165
)
162166
self._ssl_channel_credentials = ssl_credentials
163167
else:
@@ -176,9 +180,14 @@ def __init__(
176180
ssl_credentials=ssl_channel_credentials,
177181
scopes=scopes or self.AUTH_SCOPES,
178182
quota_project_id=quota_project_id,
183+
options=[
184+
("grpc.max_send_message_length", -1),
185+
("grpc.max_receive_message_length", -1),
186+
],
179187
)
180188

181189
self._stubs = {} # type: Dict[str, Callable]
190+
self._operations_client = None
182191

183192
# Run the base constructor.
184193
super().__init__(
@@ -202,7 +211,7 @@ def create_channel(
202211
) -> grpc.Channel:
203212
"""Create and return a gRPC channel object.
204213
Args:
205-
address (Optionsl[str]): The host for the channel to use.
214+
address (Optional[str]): The host for the channel to use.
206215
credentials (Optional[~.Credentials]): The
207216
authorization credentials to attach to requests. These
208217
credentials identify this application to the service. If
@@ -249,13 +258,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
249258
client.
250259
"""
251260
# Sanity check: Only create a new client if we do not already have one.
252-
if "operations_client" not in self.__dict__:
253-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
254-
self.grpc_channel
255-
)
261+
if self._operations_client is None:
262+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
256263

257264
# Return the client from cache.
258-
return self.__dict__["operations_client"]
265+
return self._operations_client
259266

260267
@property
261268
def list_databases(

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def __init__(
203203
ssl_credentials=ssl_credentials,
204204
scopes=scopes or self.AUTH_SCOPES,
205205
quota_project_id=quota_project_id,
206+
options=[
207+
("grpc.max_send_message_length", -1),
208+
("grpc.max_receive_message_length", -1),
209+
],
206210
)
207211
self._ssl_channel_credentials = ssl_credentials
208212
else:
@@ -221,6 +225,10 @@ def __init__(
221225
ssl_credentials=ssl_channel_credentials,
222226
scopes=scopes or self.AUTH_SCOPES,
223227
quota_project_id=quota_project_id,
228+
options=[
229+
("grpc.max_send_message_length", -1),
230+
("grpc.max_receive_message_length", -1),
231+
],
224232
)
225233

226234
# Run the base constructor.
@@ -234,6 +242,7 @@ def __init__(
234242
)
235243

236244
self._stubs = {}
245+
self._operations_client = None
237246

238247
@property
239248
def grpc_channel(self) -> aio.Channel:
@@ -253,13 +262,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
253262
client.
254263
"""
255264
# Sanity check: Only create a new client if we do not already have one.
256-
if "operations_client" not in self.__dict__:
257-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
265+
if self._operations_client is None:
266+
self._operations_client = operations_v1.OperationsAsyncClient(
258267
self.grpc_channel
259268
)
260269

261270
# Return the client from cache.
262-
return self.__dict__["operations_client"]
271+
return self._operations_client
263272

264273
@property
265274
def list_databases(

google/cloud/spanner_admin_database_v1/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
RestoreDatabaseRequest,
4848
RestoreDatabaseMetadata,
4949
OptimizeRestoredDatabaseMetadata,
50+
RestoreSourceType,
5051
)
5152

52-
5353
__all__ = (
5454
"OperationProgress",
5555
"Backup",
@@ -80,4 +80,5 @@
8080
"RestoreDatabaseRequest",
8181
"RestoreDatabaseMetadata",
8282
"OptimizeRestoredDatabaseMetadata",
83+
"RestoreSourceType",
8384
)

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = InstanceAdminGrpcTransport
2929
_transport_registry["grpc_asyncio"] = InstanceAdminGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"InstanceAdminTransport",
3433
"InstanceAdminGrpcTransport",

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def __init__(
171171
ssl_credentials=ssl_credentials,
172172
scopes=scopes or self.AUTH_SCOPES,
173173
quota_project_id=quota_project_id,
174+
options=[
175+
("grpc.max_send_message_length", -1),
176+
("grpc.max_receive_message_length", -1),
177+
],
174178
)
175179
self._ssl_channel_credentials = ssl_credentials
176180
else:
@@ -189,9 +193,14 @@ def __init__(
189193
ssl_credentials=ssl_channel_credentials,
190194
scopes=scopes or self.AUTH_SCOPES,
191195
quota_project_id=quota_project_id,
196+
options=[
197+
("grpc.max_send_message_length", -1),
198+
("grpc.max_receive_message_length", -1),
199+
],
192200
)
193201

194202
self._stubs = {} # type: Dict[str, Callable]
203+
self._operations_client = None
195204

196205
# Run the base constructor.
197206
super().__init__(
@@ -215,7 +224,7 @@ def create_channel(
215224
) -> grpc.Channel:
216225
"""Create and return a gRPC channel object.
217226
Args:
218-
address (Optionsl[str]): The host for the channel to use.
227+
address (Optional[str]): The host for the channel to use.
219228
credentials (Optional[~.Credentials]): The
220229
authorization credentials to attach to requests. These
221230
credentials identify this application to the service. If
@@ -262,13 +271,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
262271
client.
263272
"""
264273
# Sanity check: Only create a new client if we do not already have one.
265-
if "operations_client" not in self.__dict__:
266-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
267-
self.grpc_channel
268-
)
274+
if self._operations_client is None:
275+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
269276

270277
# Return the client from cache.
271-
return self.__dict__["operations_client"]
278+
return self._operations_client
272279

273280
@property
274281
def list_instance_configs(

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ def __init__(
216216
ssl_credentials=ssl_credentials,
217217
scopes=scopes or self.AUTH_SCOPES,
218218
quota_project_id=quota_project_id,
219+
options=[
220+
("grpc.max_send_message_length", -1),
221+
("grpc.max_receive_message_length", -1),
222+
],
219223
)
220224
self._ssl_channel_credentials = ssl_credentials
221225
else:
@@ -234,6 +238,10 @@ def __init__(
234238
ssl_credentials=ssl_channel_credentials,
235239
scopes=scopes or self.AUTH_SCOPES,
236240
quota_project_id=quota_project_id,
241+
options=[
242+
("grpc.max_send_message_length", -1),
243+
("grpc.max_receive_message_length", -1),
244+
],
237245
)
238246

239247
# Run the base constructor.
@@ -247,6 +255,7 @@ def __init__(
247255
)
248256

249257
self._stubs = {}
258+
self._operations_client = None
250259

251260
@property
252261
def grpc_channel(self) -> aio.Channel:
@@ -266,13 +275,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
266275
client.
267276
"""
268277
# Sanity check: Only create a new client if we do not already have one.
269-
if "operations_client" not in self.__dict__:
270-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
278+
if self._operations_client is None:
279+
self._operations_client = operations_v1.OperationsAsyncClient(
271280
self.grpc_channel
272281
)
273282

274283
# Return the client from cache.
275-
return self.__dict__["operations_client"]
284+
return self._operations_client
276285

277286
@property
278287
def list_instance_configs(

google/cloud/spanner_admin_instance_v1/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
UpdateInstanceMetadata,
3333
)
3434

35-
3635
__all__ = (
3736
"ReplicaInfo",
3837
"InstanceConfig",

google/cloud/spanner_v1/services/spanner/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = SpannerGrpcTransport
2929
_transport_registry["grpc_asyncio"] = SpannerGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"SpannerTransport",
3433
"SpannerGrpcTransport",

google/cloud/spanner_v1/services/spanner/transports/grpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def __init__(
151151
ssl_credentials=ssl_credentials,
152152
scopes=scopes or self.AUTH_SCOPES,
153153
quota_project_id=quota_project_id,
154+
options=[
155+
("grpc.max_send_message_length", -1),
156+
("grpc.max_receive_message_length", -1),
157+
],
154158
)
155159
self._ssl_channel_credentials = ssl_credentials
156160
else:
@@ -169,6 +173,10 @@ def __init__(
169173
ssl_credentials=ssl_channel_credentials,
170174
scopes=scopes or self.AUTH_SCOPES,
171175
quota_project_id=quota_project_id,
176+
options=[
177+
("grpc.max_send_message_length", -1),
178+
("grpc.max_receive_message_length", -1),
179+
],
172180
)
173181

174182
self._stubs = {} # type: Dict[str, Callable]
@@ -195,7 +203,7 @@ def create_channel(
195203
) -> grpc.Channel:
196204
"""Create and return a gRPC channel object.
197205
Args:
198-
address (Optionsl[str]): The host for the channel to use.
206+
address (Optional[str]): The host for the channel to use.
199207
credentials (Optional[~.Credentials]): The
200208
authorization credentials to attach to requests. These
201209
credentials identify this application to the service. If

0 commit comments

Comments
 (0)