google-cloud-bigtable 2.32.0__tar.gz → 2.33.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_cloud_bigtable-2.32.0/google_cloud_bigtable.egg-info → google_cloud_bigtable-2.33.0}/PKG-INFO +2 -2
- google_cloud_bigtable-2.33.0/google/cloud/bigtable/data/_async/_swappable_channel.py +139 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_async/client.py +184 -49
- google_cloud_bigtable-2.33.0/google/cloud/bigtable/data/_sync_autogen/_swappable_channel.py +96 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_sync_autogen/client.py +158 -37
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +60 -36
- google_cloud_bigtable-2.33.0/google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py +265 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_reader.py +25 -5
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py +48 -28
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/metadata.py +24 -0
- {google_cloud_bigtable-2.32.0/google/cloud/bigtable_admin → google_cloud_bigtable-2.33.0/google/cloud/bigtable}/gapic_version.py +1 -1
- {google_cloud_bigtable-2.32.0/google/cloud/bigtable_admin_v2 → google_cloud_bigtable-2.33.0/google/cloud/bigtable_admin}/gapic_version.py +1 -1
- {google_cloud_bigtable-2.32.0/google/cloud/bigtable → google_cloud_bigtable-2.33.0/google/cloud/bigtable_admin_v2}/gapic_version.py +1 -1
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py +871 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py +871 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py +971 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py +971 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/instance.py +19 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/gapic_version.py +1 -1
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/async_client.py +18 -30
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/client.py +18 -30
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/grpc_asyncio.py +0 -1
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/types.py +66 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0/google_cloud_bigtable.egg-info}/PKG-INFO +2 -2
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google_cloud_bigtable.egg-info/SOURCES.txt +4 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google_cloud_bigtable.egg-info/requires.txt +1 -1
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/setup.py +1 -1
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/admin_overlay/test_system_async.py +24 -13
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/admin_overlay/test_system_autogen.py +21 -12
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/data/test_system_async.py +28 -7
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/data/test_system_autogen.py +30 -21
- google_cloud_bigtable-2.33.0/tests/unit/data/_async/test__swappable_channel.py +135 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/test_client.py +141 -67
- google_cloud_bigtable-2.33.0/tests/unit/data/_sync_autogen/test__swappable_channel.py +100 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/test_client.py +119 -56
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/_async/test_query_iterator.py +121 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/_sync_autogen/test_query_iterator.py +103 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/sql_helpers.py +12 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/test_execute_query_parameters_parsing.py +13 -0
- google_cloud_bigtable-2.33.0/tests/unit/data/execute_query/test_query_result_parsing_utils.py +1695 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/test_query_result_row_reader.py +39 -3
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py +1 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/bigtable_v2/test_bigtable.py +414 -243
- google_cloud_bigtable-2.32.0/google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py +0 -134
- google_cloud_bigtable-2.32.0/tests/unit/data/execute_query/test_query_result_parsing_utils.py +0 -715
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/LICENSE +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/MANIFEST.in +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/README.rst +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/app_profile.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/backup.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/cluster.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/column_family.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_async/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_async/_mutate_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_async/_read_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_async/mutations_batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_cross_sync/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_cross_sync/_decorators.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_cross_sync/_mapping_meta.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_cross_sync/cross_sync.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_helpers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_sync_autogen/_read_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/exceptions.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_async/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_byte_cursor.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_checksum.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/_parameters_formatting.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/execute_query/values.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/mutations.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/read_modify_write_rules.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/read_rows_query.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/row.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/data/row_filters.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/encryption_info.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/enums.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/error.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/helpers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/instance.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/policy.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/py.typed +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/row.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/row_data.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/row_filters.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/row_merger.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/row_set.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable/table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin/py.typed +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/gapic_metadata.json +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/services/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/async_client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/async_consistency.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/async_restore_table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/consistency.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/restore_table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/overlay/types/wait_for_consistency_request.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/py.typed +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/pagers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc_asyncio.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest_base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/common.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/types/types.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/utils/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_admin_v2/utils/oneof_message.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/gapic_metadata.json +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/py.typed +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/grpc.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/rest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/services/bigtable/transports/rest_base.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/bigtable.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/data.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/feature_flags.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/request_stats.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google/cloud/bigtable_v2/types/response_params.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google_cloud_bigtable.egg-info/dependency_links.txt +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google_cloud_bigtable.egg-info/not-zip-safe +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/google_cloud_bigtable.egg-info/top_level.txt +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/scripts/fixup_admin_v2_keywords.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/scripts/fixup_bigtable_v2_keywords.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/setup.cfg +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/admin_overlay/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/admin_overlay/conftest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/conftest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cases/async_to_sync.yaml +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cases/cross_sync_files.yaml +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cases/rm_aio.yaml +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cases/strip_async_conditional_branches.yaml +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cases/symbol_replacer.yaml +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/cross_sync/test_cross_sync_e2e.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/data/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/data/setup_fixtures.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/_helpers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/conftest.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/test_data_api.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/test_instance_admin.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/system/v2_client/test_table_admin.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/my_oneof_message.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_admin_packaging.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_async_client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_async_consistency.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_async_restore_table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_consistency.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_oneof_message.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/admin_overlay/test_restore_table.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/test__mutate_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/test__read_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/test_mutations_batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_async/test_read_rows_acceptance.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_cross_sync/test_cross_sync.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_cross_sync/test_cross_sync_decorators.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/test__mutate_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/test__read_rows.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/test_mutations_batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/_sync_autogen/test_read_rows_acceptance.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/_async/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/_sync_autogen/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/test_byte_cursor.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/test_checksum.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/execute_query/test_metadata.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/read-rows-acceptance-test.json +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test__helpers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_exceptions.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_helpers.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_mutations.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_read_modify_write_rules.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_read_rows_query.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_row.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_row_filters.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/data/test_sync_up_to_date.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/bigtable_admin_v2/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/gapic/bigtable_v2/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/test_packaging.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/test_sql_routing_parameters.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/__init__.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/_testing.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/read-rows-acceptance-test.json +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_app_profile.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_backup.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_batcher.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_client.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_cluster.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_column_family.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_encryption_info.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_error.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_instance.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_policy.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_row.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_row_data.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_row_filters.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_row_merger.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_row_set.py +0 -0
- {google_cloud_bigtable-2.32.0 → google_cloud_bigtable-2.33.0}/tests/unit/v2_client/test_table.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-bigtable
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.33.0
|
|
4
4
|
Summary: Google Cloud Bigtable API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/python-bigtable
|
|
6
6
|
Author: Google LLC
|
|
@@ -23,7 +23,7 @@ Requires-Python: >=3.7
|
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: google-api-core[grpc]<3.0.0,>=2.17.0
|
|
25
25
|
Requires-Dist: google-cloud-core<3.0.0,>=1.4.4
|
|
26
|
-
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.
|
|
26
|
+
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.23.0
|
|
27
27
|
Requires-Dist: grpc-google-iam-v1<1.0.0,>=0.12.4
|
|
28
28
|
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
29
29
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Copyright 2023 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from typing import Callable
|
|
18
|
+
|
|
19
|
+
from google.cloud.bigtable.data._cross_sync import CrossSync
|
|
20
|
+
|
|
21
|
+
from grpc import ChannelConnectivity
|
|
22
|
+
|
|
23
|
+
if CrossSync.is_async:
|
|
24
|
+
from grpc.aio import Channel
|
|
25
|
+
else:
|
|
26
|
+
from grpc import Channel
|
|
27
|
+
|
|
28
|
+
__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen._swappable_channel"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@CrossSync.convert_class(sync_name="_WrappedChannel", rm_aio=True)
|
|
32
|
+
class _AsyncWrappedChannel(Channel):
|
|
33
|
+
"""
|
|
34
|
+
A wrapper around a gRPC channel. All methods are passed
|
|
35
|
+
through to the underlying channel.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, channel: Channel):
|
|
39
|
+
self._channel = channel
|
|
40
|
+
|
|
41
|
+
def unary_unary(self, *args, **kwargs):
|
|
42
|
+
return self._channel.unary_unary(*args, **kwargs)
|
|
43
|
+
|
|
44
|
+
def unary_stream(self, *args, **kwargs):
|
|
45
|
+
return self._channel.unary_stream(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
def stream_unary(self, *args, **kwargs):
|
|
48
|
+
return self._channel.stream_unary(*args, **kwargs)
|
|
49
|
+
|
|
50
|
+
def stream_stream(self, *args, **kwargs):
|
|
51
|
+
return self._channel.stream_stream(*args, **kwargs)
|
|
52
|
+
|
|
53
|
+
async def channel_ready(self):
|
|
54
|
+
return await self._channel.channel_ready()
|
|
55
|
+
|
|
56
|
+
@CrossSync.convert(
|
|
57
|
+
sync_name="__enter__", replace_symbols={"__aenter__": "__enter__"}
|
|
58
|
+
)
|
|
59
|
+
async def __aenter__(self):
|
|
60
|
+
await self._channel.__aenter__()
|
|
61
|
+
return self
|
|
62
|
+
|
|
63
|
+
@CrossSync.convert(sync_name="__exit__", replace_symbols={"__aexit__": "__exit__"})
|
|
64
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
65
|
+
return await self._channel.__aexit__(exc_type, exc_val, exc_tb)
|
|
66
|
+
|
|
67
|
+
def get_state(self, try_to_connect: bool = False) -> ChannelConnectivity:
|
|
68
|
+
return self._channel.get_state(try_to_connect=try_to_connect)
|
|
69
|
+
|
|
70
|
+
async def wait_for_state_change(self, last_observed_state):
|
|
71
|
+
return await self._channel.wait_for_state_change(last_observed_state)
|
|
72
|
+
|
|
73
|
+
def __getattr__(self, name):
|
|
74
|
+
return getattr(self._channel, name)
|
|
75
|
+
|
|
76
|
+
async def close(self, grace=None):
|
|
77
|
+
if CrossSync.is_async:
|
|
78
|
+
return await self._channel.close(grace=grace)
|
|
79
|
+
else:
|
|
80
|
+
# grace not supported by sync version
|
|
81
|
+
return self._channel.close()
|
|
82
|
+
|
|
83
|
+
if not CrossSync.is_async:
|
|
84
|
+
# add required sync methods
|
|
85
|
+
|
|
86
|
+
def subscribe(self, callback, try_to_connect=False):
|
|
87
|
+
return self._channel.subscribe(callback, try_to_connect)
|
|
88
|
+
|
|
89
|
+
def unsubscribe(self, callback):
|
|
90
|
+
return self._channel.unsubscribe(callback)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@CrossSync.convert_class(
|
|
94
|
+
sync_name="SwappableChannel",
|
|
95
|
+
replace_symbols={"_AsyncWrappedChannel": "_WrappedChannel"},
|
|
96
|
+
)
|
|
97
|
+
class AsyncSwappableChannel(_AsyncWrappedChannel):
|
|
98
|
+
"""
|
|
99
|
+
Provides a grpc channel wrapper, that allows the internal channel to be swapped out
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
- channel_fn: a nullary function that returns a new channel instance.
|
|
103
|
+
It should be a partial with all channel configuration arguments built-in
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
def __init__(self, channel_fn: Callable[[], Channel]):
|
|
107
|
+
self._channel_fn = channel_fn
|
|
108
|
+
self._channel = channel_fn()
|
|
109
|
+
|
|
110
|
+
def create_channel(self) -> Channel:
|
|
111
|
+
"""
|
|
112
|
+
Create a fresh channel using the stored `channel_fn` partial
|
|
113
|
+
"""
|
|
114
|
+
new_channel = self._channel_fn()
|
|
115
|
+
if CrossSync.is_async:
|
|
116
|
+
# copy over interceptors
|
|
117
|
+
# this is needed because of how gapic attaches the LoggingClientAIOInterceptor
|
|
118
|
+
# sync channels add interceptors by wrapping, so this step isn't needed
|
|
119
|
+
new_channel._unary_unary_interceptors = (
|
|
120
|
+
self._channel._unary_unary_interceptors
|
|
121
|
+
)
|
|
122
|
+
new_channel._unary_stream_interceptors = (
|
|
123
|
+
self._channel._unary_stream_interceptors
|
|
124
|
+
)
|
|
125
|
+
new_channel._stream_unary_interceptors = (
|
|
126
|
+
self._channel._stream_unary_interceptors
|
|
127
|
+
)
|
|
128
|
+
new_channel._stream_stream_interceptors = (
|
|
129
|
+
self._channel._stream_stream_interceptors
|
|
130
|
+
)
|
|
131
|
+
return new_channel
|
|
132
|
+
|
|
133
|
+
def swap_channel(self, new_channel: Channel) -> Channel:
|
|
134
|
+
"""
|
|
135
|
+
Replace the wrapped channel with a new instance. Typically created using `create_channel`
|
|
136
|
+
"""
|
|
137
|
+
old_channel = self._channel
|
|
138
|
+
self._channel = new_channel
|
|
139
|
+
return old_channel
|
|
@@ -58,6 +58,8 @@ from google.api_core import retry as retries
|
|
|
58
58
|
from google.api_core.exceptions import DeadlineExceeded
|
|
59
59
|
from google.api_core.exceptions import ServiceUnavailable
|
|
60
60
|
from google.api_core.exceptions import Aborted
|
|
61
|
+
from google.protobuf.message import Message
|
|
62
|
+
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
|
|
61
63
|
|
|
62
64
|
import google.auth.credentials
|
|
63
65
|
import google.auth._default
|
|
@@ -92,13 +94,22 @@ if CrossSync.is_async:
|
|
|
92
94
|
from google.cloud.bigtable_v2.services.bigtable.transports import (
|
|
93
95
|
BigtableGrpcAsyncIOTransport as TransportType,
|
|
94
96
|
)
|
|
97
|
+
from google.cloud.bigtable_v2.services.bigtable import (
|
|
98
|
+
BigtableAsyncClient as GapicClient,
|
|
99
|
+
)
|
|
95
100
|
from google.cloud.bigtable.data._async.mutations_batcher import _MB_SIZE
|
|
101
|
+
from google.cloud.bigtable.data._async._swappable_channel import (
|
|
102
|
+
AsyncSwappableChannel,
|
|
103
|
+
)
|
|
96
104
|
else:
|
|
97
105
|
from typing import Iterable # noqa: F401
|
|
98
106
|
from grpc import insecure_channel
|
|
99
|
-
from grpc import intercept_channel
|
|
100
107
|
from google.cloud.bigtable_v2.services.bigtable.transports import BigtableGrpcTransport as TransportType # type: ignore
|
|
108
|
+
from google.cloud.bigtable_v2.services.bigtable import BigtableClient as GapicClient # type: ignore
|
|
101
109
|
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE
|
|
110
|
+
from google.cloud.bigtable.data._sync_autogen._swappable_channel import ( # noqa: F401
|
|
111
|
+
SwappableChannel,
|
|
112
|
+
)
|
|
102
113
|
|
|
103
114
|
|
|
104
115
|
if TYPE_CHECKING:
|
|
@@ -182,7 +193,6 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
182
193
|
client_options = cast(
|
|
183
194
|
Optional[client_options_lib.ClientOptions], client_options
|
|
184
195
|
)
|
|
185
|
-
custom_channel = None
|
|
186
196
|
self._emulator_host = os.getenv(BIGTABLE_EMULATOR)
|
|
187
197
|
if self._emulator_host is not None:
|
|
188
198
|
warnings.warn(
|
|
@@ -191,11 +201,11 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
191
201
|
stacklevel=2,
|
|
192
202
|
)
|
|
193
203
|
# use insecure channel if emulator is set
|
|
194
|
-
custom_channel = insecure_channel(self._emulator_host)
|
|
195
204
|
if credentials is None:
|
|
196
205
|
credentials = google.auth.credentials.AnonymousCredentials()
|
|
197
206
|
if project is None:
|
|
198
207
|
project = _DEFAULT_BIGTABLE_EMULATOR_CLIENT
|
|
208
|
+
|
|
199
209
|
# initialize client
|
|
200
210
|
ClientWithProject.__init__(
|
|
201
211
|
self,
|
|
@@ -203,14 +213,28 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
203
213
|
project=project,
|
|
204
214
|
client_options=client_options,
|
|
205
215
|
)
|
|
206
|
-
self._gapic_client =
|
|
216
|
+
self._gapic_client = GapicClient(
|
|
207
217
|
credentials=credentials,
|
|
208
218
|
client_options=client_options,
|
|
209
219
|
client_info=self.client_info,
|
|
210
220
|
transport=lambda *args, **kwargs: TransportType(
|
|
211
|
-
*args, **kwargs, channel=
|
|
221
|
+
*args, **kwargs, channel=self._build_grpc_channel
|
|
212
222
|
),
|
|
213
223
|
)
|
|
224
|
+
if (
|
|
225
|
+
credentials
|
|
226
|
+
and credentials.universe_domain != self.universe_domain
|
|
227
|
+
and self._emulator_host is None
|
|
228
|
+
):
|
|
229
|
+
# validate that the universe domain of the credentials matches the
|
|
230
|
+
# universe domain configured in client_options
|
|
231
|
+
raise ValueError(
|
|
232
|
+
f"The configured universe domain ({self.universe_domain}) does "
|
|
233
|
+
"not match the universe domain found in the credentials "
|
|
234
|
+
f"({self._credentials.universe_domain}). If you haven't "
|
|
235
|
+
"configured the universe domain explicitly, `googleapis.com` "
|
|
236
|
+
"is the default."
|
|
237
|
+
)
|
|
214
238
|
self._is_closed = CrossSync.Event()
|
|
215
239
|
self.transport = cast(TransportType, self._gapic_client.transport)
|
|
216
240
|
# keep track of active instances to for warmup on channel refresh
|
|
@@ -220,7 +244,7 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
220
244
|
self._instance_owners: dict[_WarmedInstanceKey, Set[int]] = {}
|
|
221
245
|
self._channel_init_time = time.monotonic()
|
|
222
246
|
self._channel_refresh_task: CrossSync.Task[None] | None = None
|
|
223
|
-
self._executor = (
|
|
247
|
+
self._executor: concurrent.futures.ThreadPoolExecutor | None = (
|
|
224
248
|
concurrent.futures.ThreadPoolExecutor() if not CrossSync.is_async else None
|
|
225
249
|
)
|
|
226
250
|
if self._emulator_host is None:
|
|
@@ -235,6 +259,47 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
235
259
|
stacklevel=2,
|
|
236
260
|
)
|
|
237
261
|
|
|
262
|
+
@CrossSync.convert(replace_symbols={"AsyncSwappableChannel": "SwappableChannel"})
|
|
263
|
+
def _build_grpc_channel(self, *args, **kwargs) -> AsyncSwappableChannel:
|
|
264
|
+
"""
|
|
265
|
+
This method is called by the gapic transport to create a grpc channel.
|
|
266
|
+
|
|
267
|
+
The init arguments passed down are captured in a partial used by AsyncSwappableChannel
|
|
268
|
+
to create new channel instances in the future, as part of the channel refresh logic
|
|
269
|
+
|
|
270
|
+
Emulators always use an inseucre channel
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
- *args: positional arguments passed by the gapic layer to create a new channel with
|
|
274
|
+
- **kwargs: keyword arguments passed by the gapic layer to create a new channel with
|
|
275
|
+
Returns:
|
|
276
|
+
a custom wrapped swappable channel
|
|
277
|
+
"""
|
|
278
|
+
if self._emulator_host is not None:
|
|
279
|
+
# emulators use insecure channel
|
|
280
|
+
create_channel_fn = partial(insecure_channel, self._emulator_host)
|
|
281
|
+
else:
|
|
282
|
+
create_channel_fn = partial(TransportType.create_channel, *args, **kwargs)
|
|
283
|
+
return AsyncSwappableChannel(create_channel_fn)
|
|
284
|
+
|
|
285
|
+
@property
|
|
286
|
+
def universe_domain(self) -> str:
|
|
287
|
+
"""Return the universe domain used by the client instance.
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
str: The universe domain used by the client instance.
|
|
291
|
+
"""
|
|
292
|
+
return self._gapic_client.universe_domain
|
|
293
|
+
|
|
294
|
+
@property
|
|
295
|
+
def api_endpoint(self) -> str:
|
|
296
|
+
"""Return the API endpoint used by the client instance.
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
str: The API endpoint used by the client instance.
|
|
300
|
+
"""
|
|
301
|
+
return self._gapic_client.api_endpoint
|
|
302
|
+
|
|
238
303
|
@staticmethod
|
|
239
304
|
def _client_version() -> str:
|
|
240
305
|
"""
|
|
@@ -332,7 +397,12 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
332
397
|
)
|
|
333
398
|
return [r or None for r in result_list]
|
|
334
399
|
|
|
335
|
-
|
|
400
|
+
def _invalidate_channel_stubs(self):
|
|
401
|
+
"""Helper to reset the cached stubs. Needed when changing out the grpc channel"""
|
|
402
|
+
self.transport._stubs = {}
|
|
403
|
+
self.transport._prep_wrapped_messages(self.client_info)
|
|
404
|
+
|
|
405
|
+
@CrossSync.convert(replace_symbols={"AsyncSwappableChannel": "SwappableChannel"})
|
|
336
406
|
async def _manage_channel(
|
|
337
407
|
self,
|
|
338
408
|
refresh_interval_min: float = 60 * 35,
|
|
@@ -357,13 +427,17 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
357
427
|
grace_period: time to allow previous channel to serve existing
|
|
358
428
|
requests before closing, in seconds
|
|
359
429
|
"""
|
|
430
|
+
if not isinstance(self.transport.grpc_channel, AsyncSwappableChannel):
|
|
431
|
+
warnings.warn("Channel does not support auto-refresh.")
|
|
432
|
+
return
|
|
433
|
+
super_channel: AsyncSwappableChannel = self.transport.grpc_channel
|
|
360
434
|
first_refresh = self._channel_init_time + random.uniform(
|
|
361
435
|
refresh_interval_min, refresh_interval_max
|
|
362
436
|
)
|
|
363
437
|
next_sleep = max(first_refresh - time.monotonic(), 0)
|
|
364
438
|
if next_sleep > 0:
|
|
365
439
|
# warm the current channel immediately
|
|
366
|
-
await self._ping_and_warm_instances(channel=
|
|
440
|
+
await self._ping_and_warm_instances(channel=super_channel)
|
|
367
441
|
# continuously refresh the channel every `refresh_interval` seconds
|
|
368
442
|
while not self._is_closed.is_set():
|
|
369
443
|
await CrossSync.event_wait(
|
|
@@ -376,24 +450,11 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
376
450
|
break
|
|
377
451
|
start_timestamp = time.monotonic()
|
|
378
452
|
# prepare new channel for use
|
|
379
|
-
|
|
380
|
-
old_channel = self.transport.grpc_channel
|
|
381
|
-
new_channel = self.transport.create_channel()
|
|
382
|
-
if CrossSync.is_async:
|
|
383
|
-
new_channel._unary_unary_interceptors.append(
|
|
384
|
-
self.transport._interceptor
|
|
385
|
-
)
|
|
386
|
-
else:
|
|
387
|
-
new_channel = intercept_channel(
|
|
388
|
-
new_channel, self.transport._interceptor
|
|
389
|
-
)
|
|
453
|
+
new_channel = super_channel.create_channel()
|
|
390
454
|
await self._ping_and_warm_instances(channel=new_channel)
|
|
391
455
|
# cycle channel out of use, with long grace window before closure
|
|
392
|
-
|
|
393
|
-
self.
|
|
394
|
-
# invalidate caches
|
|
395
|
-
self.transport._stubs = {}
|
|
396
|
-
self.transport._prep_wrapped_messages(self.client_info)
|
|
456
|
+
old_channel = super_channel.swap_channel(new_channel)
|
|
457
|
+
self._invalidate_channel_stubs()
|
|
397
458
|
# give old_channel a chance to complete existing rpcs
|
|
398
459
|
if CrossSync.is_async:
|
|
399
460
|
await old_channel.close(grace_period)
|
|
@@ -401,7 +462,7 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
401
462
|
if grace_period:
|
|
402
463
|
self._is_closed.wait(grace_period) # type: ignore
|
|
403
464
|
old_channel.close() # type: ignore
|
|
404
|
-
# subtract
|
|
465
|
+
# subtract the time spent waiting for the channel to be replaced
|
|
405
466
|
next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)
|
|
406
467
|
next_sleep = max(next_refresh - (time.monotonic() - start_timestamp), 0)
|
|
407
468
|
|
|
@@ -415,7 +476,8 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
415
476
|
async def _register_instance(
|
|
416
477
|
self,
|
|
417
478
|
instance_id: str,
|
|
418
|
-
|
|
479
|
+
app_profile_id: Optional[str],
|
|
480
|
+
owner_id: int,
|
|
419
481
|
) -> None:
|
|
420
482
|
"""
|
|
421
483
|
Registers an instance with the client, and warms the channel for the instance
|
|
@@ -425,13 +487,15 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
425
487
|
|
|
426
488
|
Args:
|
|
427
489
|
instance_id: id of the instance to register.
|
|
428
|
-
|
|
490
|
+
app_profile_id: id of the app profile calling the instance.
|
|
491
|
+
owner_id: integer id of the object owning the instance. Owners will be tracked in
|
|
429
492
|
_instance_owners, and instances will only be unregistered when all
|
|
430
|
-
owners call _remove_instance_registration
|
|
493
|
+
owners call _remove_instance_registration. Can be obtained by calling
|
|
494
|
+
`id` identity funcion, using `id(owner)`
|
|
431
495
|
"""
|
|
432
496
|
instance_name = self._gapic_client.instance_path(self.project, instance_id)
|
|
433
|
-
instance_key = _WarmedInstanceKey(instance_name,
|
|
434
|
-
self._instance_owners.setdefault(instance_key, set()).add(
|
|
497
|
+
instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
|
|
498
|
+
self._instance_owners.setdefault(instance_key, set()).add(owner_id)
|
|
435
499
|
if instance_key not in self._active_instances:
|
|
436
500
|
self._active_instances.add(instance_key)
|
|
437
501
|
if self._channel_refresh_task:
|
|
@@ -449,10 +513,11 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
449
513
|
"_DataApiTargetAsync": "_DataApiTarget",
|
|
450
514
|
}
|
|
451
515
|
)
|
|
452
|
-
|
|
516
|
+
def _remove_instance_registration(
|
|
453
517
|
self,
|
|
454
518
|
instance_id: str,
|
|
455
|
-
|
|
519
|
+
app_profile_id: Optional[str],
|
|
520
|
+
owner_id: int,
|
|
456
521
|
) -> bool:
|
|
457
522
|
"""
|
|
458
523
|
Removes an instance from the client's registered instances, to prevent
|
|
@@ -462,17 +527,17 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
462
527
|
|
|
463
528
|
Args:
|
|
464
529
|
instance_id: id of the instance to remove
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
530
|
+
app_profile_id: id of the app profile calling the instance.
|
|
531
|
+
owner_id: integer id of the object owning the instance. Can be
|
|
532
|
+
obtained by the `id` identity funcion, using `id(owner)`.
|
|
468
533
|
Returns:
|
|
469
534
|
bool: True if instance was removed, else False
|
|
470
535
|
"""
|
|
471
536
|
instance_name = self._gapic_client.instance_path(self.project, instance_id)
|
|
472
|
-
instance_key = _WarmedInstanceKey(instance_name,
|
|
537
|
+
instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
|
|
473
538
|
owner_list = self._instance_owners.get(instance_key, set())
|
|
474
539
|
try:
|
|
475
|
-
owner_list.remove(
|
|
540
|
+
owner_list.remove(owner_id)
|
|
476
541
|
if len(owner_list) == 0:
|
|
477
542
|
self._active_instances.remove(instance_key)
|
|
478
543
|
return True
|
|
@@ -625,6 +690,7 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
625
690
|
DeadlineExceeded,
|
|
626
691
|
ServiceUnavailable,
|
|
627
692
|
),
|
|
693
|
+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
|
|
628
694
|
) -> "ExecuteQueryIteratorAsync":
|
|
629
695
|
"""
|
|
630
696
|
Executes an SQL query on an instance.
|
|
@@ -673,6 +739,62 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
673
739
|
If None, defaults to prepare_operation_timeout.
|
|
674
740
|
prepare_retryable_errors: a list of errors that will be retried if encountered during prepareQuery.
|
|
675
741
|
Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
|
|
742
|
+
column_info: (Optional) A dictionary mapping column names to Protobuf message classes or EnumTypeWrapper objects.
|
|
743
|
+
This dictionary provides the necessary type information for deserializing PROTO and
|
|
744
|
+
ENUM column values from the query results. When an entry is provided
|
|
745
|
+
for a PROTO or ENUM column, the client library will attempt to deserialize the raw data.
|
|
746
|
+
|
|
747
|
+
- For PROTO columns: The value in the dictionary should be the
|
|
748
|
+
Protobuf Message class (e.g., ``my_pb2.MyMessage``).
|
|
749
|
+
- For ENUM columns: The value should be the Protobuf EnumTypeWrapper
|
|
750
|
+
object (e.g., ``my_pb2.MyEnum``).
|
|
751
|
+
|
|
752
|
+
Example::
|
|
753
|
+
|
|
754
|
+
import my_pb2
|
|
755
|
+
|
|
756
|
+
column_info = {
|
|
757
|
+
"my_proto_column": my_pb2.MyMessage,
|
|
758
|
+
"my_enum_column": my_pb2.MyEnum
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
If ``column_info`` is not provided, or if a specific column name is not found
|
|
762
|
+
in the dictionary:
|
|
763
|
+
|
|
764
|
+
- PROTO columns will be returned as raw bytes.
|
|
765
|
+
- ENUM columns will be returned as integers.
|
|
766
|
+
|
|
767
|
+
Note for Nested PROTO or ENUM Fields:
|
|
768
|
+
|
|
769
|
+
To specify types for PROTO or ENUM fields within STRUCTs or MAPs, use a dot-separated
|
|
770
|
+
path from the top-level column name.
|
|
771
|
+
|
|
772
|
+
- For STRUCTs: ``struct_column_name.field_name``
|
|
773
|
+
- For MAPs: ``map_column_name.key`` or ``map_column_name.value`` to specify types
|
|
774
|
+
for the map keys or values, respectively.
|
|
775
|
+
|
|
776
|
+
Example::
|
|
777
|
+
|
|
778
|
+
import my_pb2
|
|
779
|
+
|
|
780
|
+
column_info = {
|
|
781
|
+
# Top-level column
|
|
782
|
+
"my_proto_column": my_pb2.MyMessage,
|
|
783
|
+
"my_enum_column": my_pb2.MyEnum,
|
|
784
|
+
|
|
785
|
+
# Nested field in a STRUCT column named 'my_struct'
|
|
786
|
+
"my_struct.nested_proto_field": my_pb2.OtherMessage,
|
|
787
|
+
"my_struct.nested_enum_field": my_pb2.AnotherEnum,
|
|
788
|
+
|
|
789
|
+
# Nested field in a MAP column named 'my_map'
|
|
790
|
+
"my_map.key": my_pb2.MapKeyEnum, # If map keys were enums
|
|
791
|
+
"my_map.value": my_pb2.MapValueMessage,
|
|
792
|
+
|
|
793
|
+
# PROTO field inside a STRUCT, where the STRUCT is the value in a MAP column
|
|
794
|
+
"struct_map.value.nested_proto_field": my_pb2.DeeplyNestedProto,
|
|
795
|
+
"struct_map.value.nested_enum_field": my_pb2.DeeplyNestedEnum
|
|
796
|
+
}
|
|
797
|
+
|
|
676
798
|
Returns:
|
|
677
799
|
ExecuteQueryIteratorAsync: an asynchronous iterator that yields rows returned by the query
|
|
678
800
|
Raises:
|
|
@@ -682,6 +804,7 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
682
804
|
google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
|
|
683
805
|
google.cloud.bigtable.data.exceptions.ParameterTypeInferenceFailed: Raised if
|
|
684
806
|
a parameter is passed without an explicit type, and the type cannot be infered
|
|
807
|
+
google.protobuf.message.DecodeError: raised if the deserialization of a PROTO/ENUM value fails.
|
|
685
808
|
"""
|
|
686
809
|
instance_name = self._gapic_client.instance_path(self.project, instance_id)
|
|
687
810
|
converted_param_types = _to_param_types(parameters, parameter_types)
|
|
@@ -739,6 +862,7 @@ class BigtableDataClientAsync(ClientWithProject):
|
|
|
739
862
|
attempt_timeout,
|
|
740
863
|
operation_timeout,
|
|
741
864
|
retryable_excs=retryable_excs,
|
|
865
|
+
column_info=column_info,
|
|
742
866
|
)
|
|
743
867
|
|
|
744
868
|
@CrossSync.convert(sync_name="__enter__")
|
|
@@ -863,30 +987,39 @@ class _DataApiTargetAsync(abc.ABC):
|
|
|
863
987
|
self.table_name = self.client._gapic_client.table_path(
|
|
864
988
|
self.client.project, instance_id, table_id
|
|
865
989
|
)
|
|
866
|
-
self.app_profile_id = app_profile_id
|
|
990
|
+
self.app_profile_id: str | None = app_profile_id
|
|
867
991
|
|
|
868
|
-
self.default_operation_timeout = default_operation_timeout
|
|
869
|
-
self.default_attempt_timeout = default_attempt_timeout
|
|
870
|
-
self.default_read_rows_operation_timeout =
|
|
871
|
-
|
|
872
|
-
|
|
992
|
+
self.default_operation_timeout: float = default_operation_timeout
|
|
993
|
+
self.default_attempt_timeout: float | None = default_attempt_timeout
|
|
994
|
+
self.default_read_rows_operation_timeout: float = (
|
|
995
|
+
default_read_rows_operation_timeout
|
|
996
|
+
)
|
|
997
|
+
self.default_read_rows_attempt_timeout: float | None = (
|
|
998
|
+
default_read_rows_attempt_timeout
|
|
999
|
+
)
|
|
1000
|
+
self.default_mutate_rows_operation_timeout: float = (
|
|
873
1001
|
default_mutate_rows_operation_timeout
|
|
874
1002
|
)
|
|
875
|
-
self.default_mutate_rows_attempt_timeout =
|
|
1003
|
+
self.default_mutate_rows_attempt_timeout: float | None = (
|
|
1004
|
+
default_mutate_rows_attempt_timeout
|
|
1005
|
+
)
|
|
876
1006
|
|
|
877
|
-
self.default_read_rows_retryable_errors = (
|
|
1007
|
+
self.default_read_rows_retryable_errors: Sequence[type[Exception]] = (
|
|
878
1008
|
default_read_rows_retryable_errors or ()
|
|
879
1009
|
)
|
|
880
|
-
self.default_mutate_rows_retryable_errors = (
|
|
1010
|
+
self.default_mutate_rows_retryable_errors: Sequence[type[Exception]] = (
|
|
881
1011
|
default_mutate_rows_retryable_errors or ()
|
|
882
1012
|
)
|
|
883
|
-
self.default_retryable_errors =
|
|
1013
|
+
self.default_retryable_errors: Sequence[type[Exception]] = (
|
|
1014
|
+
default_retryable_errors or ()
|
|
1015
|
+
)
|
|
884
1016
|
|
|
885
1017
|
try:
|
|
886
1018
|
self._register_instance_future = CrossSync.create_task(
|
|
887
1019
|
self.client._register_instance,
|
|
888
1020
|
self.instance_id,
|
|
889
|
-
self,
|
|
1021
|
+
self.app_profile_id,
|
|
1022
|
+
id(self),
|
|
890
1023
|
sync_executor=self.client._executor,
|
|
891
1024
|
)
|
|
892
1025
|
except RuntimeError as e:
|
|
@@ -1597,7 +1730,9 @@ class _DataApiTargetAsync(abc.ABC):
|
|
|
1597
1730
|
"""
|
|
1598
1731
|
if self._register_instance_future:
|
|
1599
1732
|
self._register_instance_future.cancel()
|
|
1600
|
-
|
|
1733
|
+
self.client._remove_instance_registration(
|
|
1734
|
+
self.instance_id, self.app_profile_id, id(self)
|
|
1735
|
+
)
|
|
1601
1736
|
|
|
1602
1737
|
@CrossSync.convert(sync_name="__enter__")
|
|
1603
1738
|
async def __aenter__(self):
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Copyright 2023 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# This file is automatically generated by CrossSync. Do not edit manually.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
from typing import Callable
|
|
20
|
+
from grpc import ChannelConnectivity
|
|
21
|
+
from grpc import Channel
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class _WrappedChannel(Channel):
|
|
25
|
+
"""
|
|
26
|
+
A wrapper around a gRPC channel. All methods are passed
|
|
27
|
+
through to the underlying channel.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, channel: Channel):
|
|
31
|
+
self._channel = channel
|
|
32
|
+
|
|
33
|
+
def unary_unary(self, *args, **kwargs):
|
|
34
|
+
return self._channel.unary_unary(*args, **kwargs)
|
|
35
|
+
|
|
36
|
+
def unary_stream(self, *args, **kwargs):
|
|
37
|
+
return self._channel.unary_stream(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
def stream_unary(self, *args, **kwargs):
|
|
40
|
+
return self._channel.stream_unary(*args, **kwargs)
|
|
41
|
+
|
|
42
|
+
def stream_stream(self, *args, **kwargs):
|
|
43
|
+
return self._channel.stream_stream(*args, **kwargs)
|
|
44
|
+
|
|
45
|
+
def channel_ready(self):
|
|
46
|
+
return self._channel.channel_ready()
|
|
47
|
+
|
|
48
|
+
def __enter__(self):
|
|
49
|
+
self._channel.__enter__()
|
|
50
|
+
return self
|
|
51
|
+
|
|
52
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
53
|
+
return self._channel.__exit__(exc_type, exc_val, exc_tb)
|
|
54
|
+
|
|
55
|
+
def get_state(self, try_to_connect: bool = False) -> ChannelConnectivity:
|
|
56
|
+
return self._channel.get_state(try_to_connect=try_to_connect)
|
|
57
|
+
|
|
58
|
+
def wait_for_state_change(self, last_observed_state):
|
|
59
|
+
return self._channel.wait_for_state_change(last_observed_state)
|
|
60
|
+
|
|
61
|
+
def __getattr__(self, name):
|
|
62
|
+
return getattr(self._channel, name)
|
|
63
|
+
|
|
64
|
+
def close(self, grace=None):
|
|
65
|
+
return self._channel.close()
|
|
66
|
+
|
|
67
|
+
def subscribe(self, callback, try_to_connect=False):
|
|
68
|
+
return self._channel.subscribe(callback, try_to_connect)
|
|
69
|
+
|
|
70
|
+
def unsubscribe(self, callback):
|
|
71
|
+
return self._channel.unsubscribe(callback)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class SwappableChannel(_WrappedChannel):
|
|
75
|
+
"""
|
|
76
|
+
Provides a grpc channel wrapper, that allows the internal channel to be swapped out
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
- channel_fn: a nullary function that returns a new channel instance.
|
|
80
|
+
It should be a partial with all channel configuration arguments built-in
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def __init__(self, channel_fn: Callable[[], Channel]):
|
|
84
|
+
self._channel_fn = channel_fn
|
|
85
|
+
self._channel = channel_fn()
|
|
86
|
+
|
|
87
|
+
def create_channel(self) -> Channel:
|
|
88
|
+
"""Create a fresh channel using the stored `channel_fn` partial"""
|
|
89
|
+
new_channel = self._channel_fn()
|
|
90
|
+
return new_channel
|
|
91
|
+
|
|
92
|
+
def swap_channel(self, new_channel: Channel) -> Channel:
|
|
93
|
+
"""Replace the wrapped channel with a new instance. Typically created using `create_channel`"""
|
|
94
|
+
old_channel = self._channel
|
|
95
|
+
self._channel = new_channel
|
|
96
|
+
return old_channel
|