feat(catalog-rest): parse server-advertised endpoints from GET /v1/config#2692
Open
huan233usc wants to merge 1 commit into
Open
feat(catalog-rest): parse server-advertised endpoints from GET /v1/config#2692huan233usc wants to merge 1 commit into
huan233usc wants to merge 1 commit into
Conversation
9f2517e to
a0837b8
Compare
…nfig The REST spec lets a server advertise the routes it supports in the `endpoints` field of its `GET /v1/config` response, so clients can negotiate optional capabilities instead of assuming every server implements every operation. The Rust client currently ignores this field. Add an `Endpoint` type (HTTP method + path template) parsed from the `"<method> <path>"` wire form via `FromStr` — which validates the method and the single-space shape — with serde delegating to it. The method is stored as a typed `http::Method` (kept out of the public API). Parse the config response's `endpoints` into `Option<Vec<Endpoint>>` so an absent field and an explicit empty list are modelled distinctly, store the negotiated set on the catalog's runtime context, and expose `RestCatalog::supports_endpoint`. When the field is absent a standard base set of namespace/table operations is assumed; an explicit list — even an empty one — is used verbatim. Building block for endpoint-gated features (e.g. server-side scan planning), mirroring the capability negotiation Java gained in apache/iceberg#10929.
8d72566 to
c769500
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Related to #1690 (server-side scan planning), which relies on endpoint
negotiation. This PR lands the negotiation piece on its own so it can be
reviewed independently.
What changes are included in this PR?
The REST spec lets a server advertise the routes it supports in the
endpointsfield of its
GET /v1/configresponse, so clients can negotiate optionalcapabilities instead of assuming every server implements every operation. The
Rust client currently ignores this field.
This mirrors the capability negotiation the Java client gained in
apache/iceberg#10929 (the
endpointsfield in the config response, theEndpointtype, and the default-endpoint fallback when a server omits the list).This PR:
Endpointtype (HTTP method + path template) parsed from the"<method> <path>"wire form viaFromStr— which validates the single-spaceshape and the HTTP method — with serde delegating to it. The method is stored
as a typed
http::Method(kept out of the public API;method()returns&str).endpointsintoOption<Vec<Endpoint>>so anabsent field and an explicit empty list are modelled distinctly, and stores
the negotiated set on the catalog's runtime context.
field → a standard base set of namespace/table operations is assumed (so an
older server still resolves its core operations as supported); a present list
— even an empty one — is used verbatim. Optional endpoints outside the base
set stay unsupported unless explicitly advertised.
RestCatalog::supports_endpoint(&Endpoint)to query the negotiatedset.
No existing behaviour changes for callers that don't consult
supports_endpoint.Are these changes tested?
Yes:
Endpoint:FromStr/serde round-trip, rejection of malformedinput (no / extra / leading / trailing space, empty), HTTP-method
normalization, and the default endpoint set.
mockitocatalog tests: a server that advertisesendpoints(assertingsupports_endpointis true/false for listed/unlisted routes), a server thatomits the field (base operations resolve as supported), and a server that
sends an explicit empty list (nothing is supported).