pub struct HttpFetcher { /* private fields */ }Expand description
A client for one remote file.
Implementations§
Source§impl HttpFetcher
impl HttpFetcher
Sourcepub fn new(
headers: &BTreeMap<String, String>,
retries: u32,
) -> Result<Self, FaucetError>
pub fn new( headers: &BTreeMap<String, String>, retries: u32, ) -> Result<Self, FaucetError>
Build the client once with the default timeouts (30 s to connect, 300 s
without a byte); headers were validated with the config.
Sourcepub fn with_timeouts(
headers: &BTreeMap<String, String>,
retries: u32,
connect_timeout: Duration,
read_timeout: Duration,
) -> Result<Self, FaucetError>
pub fn with_timeouts( headers: &BTreeMap<String, String>, retries: u32, connect_timeout: Duration, read_timeout: Duration, ) -> Result<Self, FaucetError>
Build the client with explicit connect and read (idle) timeouts.
Sourcepub async fn get(
&self,
url: &str,
slot: &RecorderSlot,
) -> Result<Response, FaucetError>
pub async fn get( &self, url: &str, slot: &RecorderSlot, ) -> Result<Response, FaucetError>
GET the file; the response body is left for the caller to stream.
Sourcepub async fn get_in(
&self,
url: &str,
slot: &RecorderSlot,
calls: &CallContext,
) -> Result<Response, FaucetError>
pub async fn get_in( &self, url: &str, slot: &RecorderSlot, calls: &CallContext, ) -> Result<Response, FaucetError>
get with every attempt and backoff made through calls
(#880): the context’s cancel token and deadline end it.
Sourcepub async fn head(
&self,
url: &str,
slot: &RecorderSlot,
) -> Result<HttpMeta, FaucetError>
pub async fn head( &self, url: &str, slot: &RecorderSlot, ) -> Result<HttpMeta, FaucetError>
HEAD the file for its modification time.
Sourcepub async fn head_in(
&self,
url: &str,
slot: &RecorderSlot,
calls: &CallContext,
) -> Result<HttpMeta, FaucetError>
pub async fn head_in( &self, url: &str, slot: &RecorderSlot, calls: &CallContext, ) -> Result<HttpMeta, FaucetError>
Trait Implementations§
Source§impl Clone for HttpFetcher
impl Clone for HttpFetcher
Auto Trait Implementations§
impl !RefUnwindSafe for HttpFetcher
impl !UnwindSafe for HttpFetcher
impl Forget for HttpFetcher
impl Freeze for HttpFetcher
impl Move for HttpFetcher
impl Send for HttpFetcher
impl Sync for HttpFetcher
impl Unpin for HttpFetcher
impl UnsafeUnpin for HttpFetcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more