tustvold commented on code in PR #7253: URL: https://github.com/apache/arrow-rs/pull/7253#discussion_r1986070942
########## object_store/src/client/http/spawn.rs: ########## @@ -0,0 +1,162 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::client::{ + HttpError, HttpErrorKind, HttpRequest, HttpResponse, HttpResponseBody, HttpService, +}; +use async_trait::async_trait; +use bytes::Bytes; +use http::Response; +use http_body_util::BodyExt; +use hyper::body::{Body, Frame}; +use std::pin::Pin; +use std::task::{Context, Poll}; +use thiserror::Error; +use tokio::runtime::Handle; +use tokio::task::JoinHandle; + +/// Spawn error +#[derive(Debug, Error)] +#[error("SpawnError")] +struct SpawnError {} + +impl From<SpawnError> for HttpError { + fn from(value: SpawnError) -> Self { + Self::new(HttpErrorKind::Interrupted, value) + } +} + +/// Wraps a provided [`HttpService`] and runs it on a separate tokio runtime +#[derive(Debug)] +pub struct SpawnService<T: HttpService + Clone> { Review Comment: So I originally actually had this wrapping HttpClient, but it ended up a bit weird as you ended up doing ``` let client = HttpClient::new(SpawnService::new(HttpClient::new(reqwest::Client::new()))) ``` As opposed to composing the services to yield the final client ``` let client = HttpClient::new(SpawnService::new(reqwest::Client::new())) ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
