Skip to content

Commit b48ccf4

Browse files
committed
minor renaming for better API consistency
1 parent 324084e commit b48ccf4

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

paradedb/localstack_paradedb/extension.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def tcp_connection_matcher(self, data: bytes) -> bool:
8383

8484
return False
8585

86-
def should_proxy_request(self, headers: Headers) -> bool:
86+
def http2_request_matcher(self, headers: Headers) -> bool:
8787
"""
88-
Define whether a request should be proxied based on request headers.
88+
Define whether an HTTP2 request should be proxied based on request headers.
8989
Not used for TCP connections - see tcp_connection_matcher instead.
9090
"""
9191
return False

typedb/localstack_typedb/extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self):
3737
http2_ports=http2_ports,
3838
)
3939

40-
def should_proxy_request(self, headers: Headers) -> bool:
40+
def http2_request_matcher(self, headers: Headers) -> bool:
4141
# determine if this is a gRPC request targeting TypeDB
4242
content_type = headers.get("content-type") or ""
4343
req_path = headers.get(":path") or ""

utils/localstack_extensions/utils/docker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def update_gateway_routes(self, router: http.Router[http.RouteHandler]):
124124
# apply patches to serve HTTP/2 requests
125125
for port in self.http2_ports or []:
126126
apply_http2_patches_for_grpc_support(
127-
self.container_host, port, self.should_proxy_request
127+
self.container_host, port, self.http2_request_matcher
128128
)
129129

130130
# set up raw TCP proxies with protocol detection
@@ -174,8 +174,8 @@ def _setup_tcp_protocol_routing(self):
174174
)
175175

176176
@abstractmethod
177-
def should_proxy_request(self, headers: Headers) -> bool:
178-
"""Define whether a request should be proxied, based on request headers."""
177+
def http2_request_matcher(self, headers: Headers) -> bool:
178+
"""Define whether an HTTP2 request should be proxied, based on request headers."""
179179

180180
def on_platform_shutdown(self):
181181
self._remove_container()

utils/localstack_extensions/utils/h2_proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def close(self):
6464

6565

6666
def apply_http2_patches_for_grpc_support(
67-
target_host: str, target_port: int, should_proxy_request: ProxyRequestMatcher
67+
target_host: str, target_port: int, http2_request_matcher: ProxyRequestMatcher
6868
):
6969
"""
7070
Apply some patches to proxy incoming gRPC requests and forward them to a target port.
@@ -123,7 +123,7 @@ def received_from_http2_client(self, data, default_handler: Callable):
123123
buffered_data = b"".join(self.buffer)
124124
self.buffer = []
125125

126-
if should_proxy_request(headers):
126+
if http2_request_matcher(headers):
127127
self.state = ForwardingState.FORWARDING
128128
self.backend.send(buffered_data)
129129
else:

utils/tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _tcp_health_check():
5555
health_check_fn=_tcp_health_check,
5656
)
5757

58-
def should_proxy_request(self, headers: Headers) -> bool:
58+
def http2_request_matcher(self, headers: Headers) -> bool:
5959
"""
6060
gRPC services use direct TCP connections, not HTTP gateway routing.
6161
This method is not used in these tests but is required by the base class.

utils/tests/integration/test_extension_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def test_extension_implements_required_methods(self, grpcbin_extension):
4242
"""Test that the extension properly implements the required abstract methods."""
4343
from werkzeug.datastructures import Headers
4444

45-
# should_proxy_request should be callable
46-
result = grpcbin_extension.should_proxy_request(Headers())
45+
# http2_request_matcher should be callable
46+
result = grpcbin_extension.http2_request_matcher(Headers())
4747
assert result is False, "gRPC services should not proxy through HTTP gateway"
4848

4949
def test_multiple_ports_configured(self, grpcbin_extension):

utils/tests/unit/test_tcp_protocol_detector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def tcp_connection_matcher(self, data: bytes) -> bool:
113113
matcher = create_signature_matcher(b"\xde\xad\xbe\xef", offset=4)
114114
return matcher(data)
115115

116-
def should_proxy_request(self, headers: Headers) -> bool:
116+
def http2_request_matcher(self, headers: Headers) -> bool:
117117
return False
118118

119119
extension = CustomProtocolExtension()
@@ -145,7 +145,7 @@ def tcp_connection_matcher(self, data: bytes) -> bool:
145145
variant2 = create_prefix_matcher(b"V2:")
146146
return combine_matchers(variant1, variant2)(data)
147147

148-
def should_proxy_request(self, headers: Headers) -> bool:
148+
def http2_request_matcher(self, headers: Headers) -> bool:
149149
return False
150150

151151
extension = MultiProtocolExtension()
@@ -172,7 +172,7 @@ def tcp_connection_matcher(self, data: bytes) -> bool:
172172
# Inline custom logic without helper functions
173173
return len(data) >= 8 and data.startswith(b"MAGIC") and data[7] == 0x42
174174

175-
def should_proxy_request(self, headers: Headers) -> bool:
175+
def http2_request_matcher(self, headers: Headers) -> bool:
176176
return False
177177

178178
extension = InlineMatcherExtension()

0 commit comments

Comments
 (0)