pub struct HttpTransport { /* private fields */ }Expand description
POSTs JSON documents to one endpoint.
Implementations§
Source§impl HttpTransport
impl HttpTransport
Sourcepub fn new(
endpoint: Endpoint,
tls: Option<Arc<ClientConfig>>,
bearer: Option<Secret>,
transport_timeout: Option<Duration>,
) -> Result<Self, EndpointError>
pub fn new( endpoint: Endpoint, tls: Option<Arc<ClientConfig>>, bearer: Option<Secret>, transport_timeout: Option<Duration>, ) -> Result<Self, EndpointError>
Refuses plain http to anything but loopback. tls overrides the
default configuration for https (a private root, for example).
Sourcepub fn with_pool(self, pool: Arc<HttpPool>, material: KeyMaterial) -> Self
pub fn with_pool(self, pool: Arc<HttpPool>, material: KeyMaterial) -> Self
Reuse connections from pool under the isolation key material
names (spec 020, 3.5), for Self::post_observed. The per-exchange
principal digest is filled in per call.
Sourcepub fn with_phases(self, phases: TransportPhases) -> Self
pub fn with_phases(self, phases: TransportPhases) -> Self
Divide every exchange’s budget into phase ceilings (spec 020, 3.4). The caller validates the policy first; disabled changes nothing.
pub fn phases(&self) -> &TransportPhases
pub fn endpoint(&self) -> &Endpoint
Sourcepub async fn post(
&self,
path: &str,
body: Vec<u8>,
max_response_bytes: usize,
budget: &Budget,
sent: &SentTracker,
) -> Result<HttpReply, TransportError>
pub async fn post( &self, path: &str, body: Vec<u8>, max_response_bytes: usize, budget: &Budget, sent: &SentTracker, ) -> Result<HttpReply, TransportError>
POST body to path under the endpoint’s base path, within the
budget (and the transport timeout, when shorter). Request bytes are
tracked by sent; an aborted tracker refuses to send.
Source§impl HttpTransport
impl HttpTransport
Sourcepub async fn post_observed(
&self,
path: &str,
body: Vec<u8>,
max_response_bytes: usize,
budget: &Budget,
sent: &SentTracker,
principal_digest: Option<String>,
) -> (Result<HttpReply, TransportError>, Option<ConnectionObservation>)
pub async fn post_observed( &self, path: &str, body: Vec<u8>, max_response_bytes: usize, budget: &Budget, sent: &SentTracker, principal_digest: Option<String>, ) -> (Result<HttpReply, TransportError>, Option<ConnectionObservation>)
Self::post, on a pooled connection when a pool is configured:
an idle connection under exactly this exchange’s isolation key, or a
fresh one within the pool’s bounds. Also returns what evidence
states about the connection. A pool with no room is
transport_unsent; a stale connection fails as its bytes say, and
is never replaced mid-exchange (spec 020, 3.5).