1515from __future__ import annotations
1616
1717import asyncio
18- import io
1918import logging
2019from types import TracebackType
21- from typing import Any , Optional , TYPE_CHECKING , Union
20+ from typing import Any , Optional , TYPE_CHECKING
2221
2322import google .auth
2423from google .auth .credentials import with_scopes_if_required
3029from google .cloud .alloydb .connector .enums import RefreshStrategy
3130from google .cloud .alloydb .connector .instance import RefreshAheadCache
3231from google .cloud .alloydb .connector .lazy import LazyRefreshCache
33- from google .cloud .alloydb .connector .static import StaticConnectionInfoCache
32+ from google .cloud .alloydb .connector .types import CacheTypes
3433from google .cloud .alloydb .connector .utils import generate_keys
3534
3635if TYPE_CHECKING :
@@ -61,9 +60,6 @@ class AsyncConnector:
6160 of the following: RefreshStrategy.LAZY ("LAZY") or
6261 RefreshStrategy.BACKGROUND ("BACKGROUND").
6362 Default: RefreshStrategy.BACKGROUND
64- static_conn_info (io.TextIOBase): A file-like JSON object that contains
65- static connection info for the StaticConnectionInfoCache.
66- Defaults to None, which will not use the StaticConnectionInfoCache.
6763 """
6864
6965 def __init__ (
@@ -75,9 +71,8 @@ def __init__(
7571 ip_type : str | IPTypes = IPTypes .PRIVATE ,
7672 user_agent : Optional [str ] = None ,
7773 refresh_strategy : str | RefreshStrategy = RefreshStrategy .BACKGROUND ,
78- static_conn_info : Optional [io .TextIOBase ] = None ,
7974 ) -> None :
80- self ._cache : dict [str , Union [ RefreshAheadCache , LazyRefreshCache ] ] = {}
75+ self ._cache : dict [str , CacheTypes ] = {}
8176 # initialize default params
8277 self ._quota_project = quota_project
8378 self ._alloydb_api_endpoint = alloydb_api_endpoint
@@ -106,7 +101,6 @@ def __init__(
106101 except RuntimeError :
107102 self ._keys = None
108103 self ._client : Optional [AlloyDBClient ] = None
109- self ._static_conn_info = static_conn_info
110104
111105 async def connect (
112106 self ,
@@ -147,11 +141,8 @@ async def connect(
147141 enable_iam_auth = kwargs .pop ("enable_iam_auth" , self ._enable_iam_auth )
148142
149143 # use existing connection info if possible
150- cache : Union [RefreshAheadCache , LazyRefreshCache , StaticConnectionInfoCache ]
151144 if instance_uri in self ._cache :
152145 cache = self ._cache [instance_uri ]
153- elif self ._static_conn_info :
154- cache = StaticConnectionInfoCache (instance_uri , self ._static_conn_info )
155146 else :
156147 if self ._refresh_strategy == RefreshStrategy .LAZY :
157148 logger .debug (
0 commit comments