Skip to content

Commit 2b47c00

Browse files
fix: remove client recv msg limit fix: add enums to types/__init__.py (#274)
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 Co-authored-by: Bu Sun Kim <[email protected]>
1 parent 1bbd3a0 commit 2b47c00

File tree

11 files changed

+63
-17
lines changed

11 files changed

+63
-17
lines changed

google/cloud/firestore_admin_v1/services/firestore_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"] = FirestoreAdminGrpcTransport
2929
_transport_registry["grpc_asyncio"] = FirestoreAdminGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"FirestoreAdminTransport",
3433
"FirestoreAdminGrpcTransport",

google/cloud/firestore_admin_v1/services/firestore_admin/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def __init__(
152152
ssl_credentials=ssl_credentials,
153153
scopes=scopes or self.AUTH_SCOPES,
154154
quota_project_id=quota_project_id,
155+
options=[
156+
("grpc.max_send_message_length", -1),
157+
("grpc.max_receive_message_length", -1),
158+
],
155159
)
156160
self._ssl_channel_credentials = ssl_credentials
157161
else:
@@ -170,9 +174,14 @@ def __init__(
170174
ssl_credentials=ssl_channel_credentials,
171175
scopes=scopes or self.AUTH_SCOPES,
172176
quota_project_id=quota_project_id,
177+
options=[
178+
("grpc.max_send_message_length", -1),
179+
("grpc.max_receive_message_length", -1),
180+
],
173181
)
174182

175183
self._stubs = {} # type: Dict[str, Callable]
184+
self._operations_client = None
176185

177186
# Run the base constructor.
178187
super().__init__(
@@ -196,7 +205,7 @@ def create_channel(
196205
) -> grpc.Channel:
197206
"""Create and return a gRPC channel object.
198207
Args:
199-
address (Optionsl[str]): The host for the channel to use.
208+
address (Optional[str]): The host for the channel to use.
200209
credentials (Optional[~.Credentials]): The
201210
authorization credentials to attach to requests. These
202211
credentials identify this application to the service. If
@@ -243,13 +252,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
243252
client.
244253
"""
245254
# Sanity check: Only create a new client if we do not already have one.
246-
if "operations_client" not in self.__dict__:
247-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
248-
self.grpc_channel
249-
)
255+
if self._operations_client is None:
256+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
250257

251258
# Return the client from cache.
252-
return self.__dict__["operations_client"]
259+
return self._operations_client
253260

254261
@property
255262
def create_index(

google/cloud/firestore_admin_v1/services/firestore_admin/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ def __init__(
197197
ssl_credentials=ssl_credentials,
198198
scopes=scopes or self.AUTH_SCOPES,
199199
quota_project_id=quota_project_id,
200+
options=[
201+
("grpc.max_send_message_length", -1),
202+
("grpc.max_receive_message_length", -1),
203+
],
200204
)
201205
self._ssl_channel_credentials = ssl_credentials
202206
else:
@@ -215,6 +219,10 @@ def __init__(
215219
ssl_credentials=ssl_channel_credentials,
216220
scopes=scopes or self.AUTH_SCOPES,
217221
quota_project_id=quota_project_id,
222+
options=[
223+
("grpc.max_send_message_length", -1),
224+
("grpc.max_receive_message_length", -1),
225+
],
218226
)
219227

220228
# Run the base constructor.
@@ -228,6 +236,7 @@ def __init__(
228236
)
229237

230238
self._stubs = {}
239+
self._operations_client = None
231240

232241
@property
233242
def grpc_channel(self) -> aio.Channel:
@@ -247,13 +256,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
247256
client.
248257
"""
249258
# Sanity check: Only create a new client if we do not already have one.
250-
if "operations_client" not in self.__dict__:
251-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
259+
if self._operations_client is None:
260+
self._operations_client = operations_v1.OperationsAsyncClient(
252261
self.grpc_channel
253262
)
254263

255264
# Return the client from cache.
256-
return self.__dict__["operations_client"]
265+
return self._operations_client
257266

258267
@property
259268
def create_index(

google/cloud/firestore_admin_v1/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
ImportDocumentsMetadata,
3939
ExportDocumentsResponse,
4040
Progress,
41+
OperationState,
4142
)
4243

43-
4444
__all__ = (
4545
"Index",
4646
"Field",
@@ -62,4 +62,5 @@
6262
"ImportDocumentsMetadata",
6363
"ExportDocumentsResponse",
6464
"Progress",
65+
"OperationState",
6566
)

google/cloud/firestore_v1/services/firestore/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"] = FirestoreGrpcTransport
2929
_transport_registry["grpc_asyncio"] = FirestoreGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"FirestoreTransport",
3433
"FirestoreGrpcTransport",

google/cloud/firestore_v1/services/firestore/transports/grpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def __init__(
156156
ssl_credentials=ssl_credentials,
157157
scopes=scopes or self.AUTH_SCOPES,
158158
quota_project_id=quota_project_id,
159+
options=[
160+
("grpc.max_send_message_length", -1),
161+
("grpc.max_receive_message_length", -1),
162+
],
159163
)
160164
self._ssl_channel_credentials = ssl_credentials
161165
else:
@@ -174,6 +178,10 @@ def __init__(
174178
ssl_credentials=ssl_channel_credentials,
175179
scopes=scopes or self.AUTH_SCOPES,
176180
quota_project_id=quota_project_id,
181+
options=[
182+
("grpc.max_send_message_length", -1),
183+
("grpc.max_receive_message_length", -1),
184+
],
177185
)
178186

179187
self._stubs = {} # type: Dict[str, Callable]
@@ -200,7 +208,7 @@ def create_channel(
200208
) -> grpc.Channel:
201209
"""Create and return a gRPC channel object.
202210
Args:
203-
address (Optionsl[str]): The host for the channel to use.
211+
address (Optional[str]): The host for the channel to use.
204212
credentials (Optional[~.Credentials]): The
205213
authorization credentials to attach to requests. These
206214
credentials identify this application to the service. If

google/cloud/firestore_v1/services/firestore/transports/grpc_asyncio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ def __init__(
201201
ssl_credentials=ssl_credentials,
202202
scopes=scopes or self.AUTH_SCOPES,
203203
quota_project_id=quota_project_id,
204+
options=[
205+
("grpc.max_send_message_length", -1),
206+
("grpc.max_receive_message_length", -1),
207+
],
204208
)
205209
self._ssl_channel_credentials = ssl_credentials
206210
else:
@@ -219,6 +223,10 @@ def __init__(
219223
ssl_credentials=ssl_channel_credentials,
220224
scopes=scopes or self.AUTH_SCOPES,
221225
quota_project_id=quota_project_id,
226+
options=[
227+
("grpc.max_send_message_length", -1),
228+
("grpc.max_receive_message_length", -1),
229+
],
222230
)
223231

224232
# Run the base constructor.

google/cloud/firestore_v1/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
BatchWriteResponse,
7070
)
7171

72-
7372
__all__ = (
7473
"DocumentMask",
7574
"Precondition",

synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-firestore.git",
7-
"sha": "b8ca0b36a0debbfd24ce623706cc102d55eb5ca7"
7+
"sha": "b9b8705dd5c03790e004d81f09ebb6411edcec35"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "0c9e3f8cb3a0c75983fe9a7897f0ef048d81e999",
15-
"internalRef": "342123525"
14+
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
15+
"internalRef": "347055288"
1616
}
1717
},
1818
{

tests/unit/gapic/firestore_admin_v1/test_firestore_admin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,10 @@ def test_firestore_admin_transport_channel_mtls_with_client_cert_source(
26742674
),
26752675
ssl_credentials=mock_ssl_cred,
26762676
quota_project_id=None,
2677+
options=[
2678+
("grpc.max_send_message_length", -1),
2679+
("grpc.max_receive_message_length", -1),
2680+
],
26772681
)
26782682
assert transport.grpc_channel == mock_grpc_channel
26792683
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -2718,6 +2722,10 @@ def test_firestore_admin_transport_channel_mtls_with_adc(transport_class):
27182722
),
27192723
ssl_credentials=mock_ssl_cred,
27202724
quota_project_id=None,
2725+
options=[
2726+
("grpc.max_send_message_length", -1),
2727+
("grpc.max_receive_message_length", -1),
2728+
],
27212729
)
27222730
assert transport.grpc_channel == mock_grpc_channel
27232731

0 commit comments

Comments
 (0)