You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "adriangb (via GitHub)" <gi...@apache.org> on 2026/04/27 20:43:26 UTC

[PR] feat: add TowerHttpConnector [arrow-rs-object-store]

adriangb opened a new pull request, #704:
URL: https://github.com/apache/arrow-rs-object-store/pull/704

   ## Summary
   
   Adapts any \`tower::Service<http::Request<HttpRequestBody>, Response = http::Response<HttpResponseBody>>\` into an \`HttpConnector\`, unlocking the \`tower-http\` and \`tower-otel-*\` ecosystems against \`object_store\` — \`TraceLayer\`, \`TimeoutLayer\`, \`RetryLayer\`, \`PropagateHeaderLayer\`, OpenTelemetry tower layers, etc.
   
   Body types match natively (object_store already uses \`http::Request<HttpRequestBody>\` / \`http::Response<HttpResponseBody>\` internally), so no wire-format conversion is required.
   
   ## Design
   
   - Gated behind a new opt-in \`tower\` feature (off by default).
   - The feature does **not** imply \`cloud\`. The whole point of the adapter is transport-agnostic — users can plug in \`hyper::Client\`, \`ureq\`, an in-process mock via \`tower::service_fn\`, or a wasm-friendly client without pulling reqwest in at all.
   - Error mapping starts simple: \`poll_ready\` failures → \`HttpErrorKind::Connect\`, \`call\` failures → \`HttpErrorKind::Request\`. Can iterate later to mirror \`HttpError::reqwest\`'s richer classification if needed.
   - \`HttpService::call\` takes \`&self\` whereas \`tower::Service::call\` takes \`&mut self\`, so each request clones the inner service before driving it. This is the standard tower idiom for shared services.
   
   ## Usage
   
   \`\`\`rust
   use object_store::client::TowerHttpConnector;
   use object_store::ClientOptions;
   use tower::ServiceBuilder;
   use tower_http::trace::TraceLayer;
   
   let make = move |_opts: &ClientOptions| {
       let inner = my_reqwest_tower_adapter()?; // or hyper, ureq, mock, …
       Ok(ServiceBuilder::new()
           .layer(TraceLayer::new_for_http())
           .service(inner))
   };
   HttpBuilder::new()
       .with_http_connector(TowerHttpConnector(make))
       .build();
   \`\`\`
   
   ## Independence
   
   One of three independent additions for better HTTP integration seams. The others are \`impl HttpService for ClientWithMiddleware\` (#702) and \`ObjectStoreOperation\` extension (#703). Each PR is self-contained; they can be reviewed in any order. A tracking issue will follow once all three drafts are CI-green.
   
   ## Test plan
   
   - [x] 2 new unit tests using \`tower::service_fn\` covering happy path and \`call\` error → \`Request\` mapping
   - [x] \`cargo test --features=cloud,tower --lib\` (191 tests pass)
   - [x] \`cargo check --no-default-features --features tower\` (feature isolation; transport-agnostic)
   - [x] \`cargo test --features=aws,azure,gcp,http,tower --lib\` (full suite still green)
   - [x] \`cargo fmt --all -- --check\`
   - [x] \`cargo clippy --features=aws,azure,gcp,http,tower --lib --tests -- -D warnings\`
   - [ ] CI green
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org