Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit 9c69bc6

Browse files
committed
Merge pull request #146 from inklesspen/api_config_speed
Boost API config handling speed
2 parents 3c1ca51 + 1d717d4 commit 9c69bc6

12 files changed

Lines changed: 187 additions & 695 deletions

endpoints/api_backend.py

Lines changed: 0 additions & 102 deletions
This file was deleted.

endpoints/api_backend_service.py

Lines changed: 0 additions & 186 deletions
This file was deleted.

endpoints/api_config_manager.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class ApiConfigManager(object):
3636
"""Manages loading api configs and method lookup."""
3737

3838
def __init__(self):
39-
self._rpc_method_dict = {}
4039
self._rest_methods = []
4140
self._configs = {}
4241
self._config_lock = threading.Lock()
@@ -75,7 +74,6 @@ def process_api_config_response(self, config_json):
7574

7675

7776
for method_name, method in sorted_methods:
78-
self._save_rpc_method(method_name, api_version, method)
7977
self._save_rest_method(method_name, name, path_version, method)
8078

8179
def _get_sorted_methods(self, methods):
@@ -167,23 +165,6 @@ def _get_path_params(match):
167165
result[actual_var_name] = urllib.unquote_plus(value)
168166
return result
169167

170-
def lookup_rpc_method(self, method_name, version):
171-
"""Lookup the JsonRPC method at call time.
172-
173-
The method is looked up in self._rpc_method_dict, the dictionary that
174-
it is saved in for SaveRpcMethod().
175-
176-
Args:
177-
method_name: A string containing the name of the method.
178-
version: A string containing the version of the API.
179-
180-
Returns:
181-
Method descriptor as specified in the API configuration.
182-
"""
183-
with self._config_lock:
184-
method = self._rpc_method_dict.get((method_name, version))
185-
return method
186-
187168
def lookup_rest_method(self, path, http_method):
188169
"""Look up the rest method at call time.
189170
@@ -319,19 +300,6 @@ def replace_variable(match):
319300
replace_variable, pattern)
320301
return re.compile(pattern + '/?$')
321302

322-
def _save_rpc_method(self, method_name, version, method):
323-
"""Store JsonRpc api methods in a map for lookup at call time.
324-
325-
(rpcMethodName, apiVersion) => method.
326-
327-
Args:
328-
method_name: A string containing the name of the API method.
329-
version: A string containing the version of the API.
330-
method: A dict containing the method descriptor (as in the api config
331-
file).
332-
"""
333-
self._rpc_method_dict[(method_name, version)] = method
334-
335303
def _save_rest_method(self, method_name, api_name, version, method):
336304
"""Store Rest api methods in a list for lookup at call time.
337305

endpoints/api_request.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,5 @@ def reconstruct_full_url(self, port_override=None):
179179
def copy(self):
180180
return copy.deepcopy(self)
181181

182-
def is_rpc(self):
183-
# Google's JsonRPC protocol creates a handler at /rpc for any Cloud
184-
# Endpoints API, with api name, version, and method name being in the
185-
# body of the request.
186-
# If the request is sent to /rpc, we will treat it as JsonRPC.
187-
# The client libraries for iOS's Objective C use RPC and not the REST
188-
# versions of the API.
189-
return self.path == 'rpc'
190-
191182
def is_batch(self):
192183
return self._is_batch

0 commit comments

Comments
 (0)