Skip to main content

Module http

Module http 

Source
Expand description

Client: the reqwest-backed Transport (feature http).

It applies the same policy as the GCS store: HTTPS only (loopback http for emulators and tests), redirects refused, bounded bodies, bearer tokens from any TokenProvider (plus the quota-project header for user credentials), and jittered exponential backoff that honours Retry-After. One client holds one connection pool; with HTTP/2 many concurrent calls share a connection.

Every request first passes the client’s RequestPolicy (default Permissive): RequestPolicy::check on the method and parsed URL, then, for a BigQuery query job, RequestPolicy::check_query on its SQL text, which the client isolates itself (see crate::policy). A refusal is Error::Policy, before a token is fetched or a byte sent.

use objstore_r::transport::{Request, Transport};
use objstore_r::{http::Client, token::Adc, Bytes};

let client = Client::new(Adc::discover()?, Default::default())?;
let url = "https://us-central1-aiplatform.googleapis.com/v1/projects/p/locations/us-central1/publishers/google/models/m:generateContent";
let resp = client.send(Request::post_json(url, Bytes::from_static(b"{}"))).await?.error_for_status()?;

Structs§

Chunks
A bounded chunked body: each chunk must arrive within the idle timeout. Dropping it aborts the transfer.
Client
An authorised HTTPS client under request policy P. See the module docs.
HttpConfig
Settings.

Functions§

block_on
Run fut to completion on a single-threaded runtime driving this transport’s I/O and timers — for command-line tools with a synchronous main. Libraries should stay runtime-agnostic and leave this to the binary. Fails only if the runtime cannot start.