pub struct Fetcher { /* private fields */ }Implementations§
Source§impl Fetcher
impl Fetcher
pub fn new(cache_root: PathBuf, auth: Auth) -> Result<Fetcher>
Sourcepub async fn dist_bytes(
&self,
name: &str,
url: &str,
expected_sha1: Option<&str>,
offline: bool,
) -> Result<(Vec<u8>, Provenance)>
pub async fn dist_bytes( &self, name: &str, url: &str, expected_sha1: Option<&str>, offline: bool, ) -> Result<(Vec<u8>, Provenance)>
Bytes of the dist: cache first (shasum re-checked), network otherwise (3 attempts, backoff), cache fed through temp+rename.
Sourcepub async fn metadata_bytes(&self, url: &str) -> Result<Option<Vec<u8>>>
pub async fn metadata_bytes(&self, url: &str) -> Result<Option<Vec<u8>>>
Metadata GET (packages.json, p2 files): Ok(None) on 404 (unknown
package, tolerated by Composer), error otherwise; 3 attempts on
transport errors.
Sourcepub async fn post_form(&self, url: &str, body: &str) -> Result<MetadataResponse>
pub async fn post_form(&self, url: &str, body: &str) -> Result<MetadataResponse>
application/x-www-form-urlencoded POST (the security advisories
API: packages[]=...), 10 s timeout like Composer, a single attempt;
404 -> NotFound.
Sourcepub async fn metadata_fetch(
&self,
url: &str,
if_modified_since: Option<&str>,
) -> Result<MetadataResponse>
pub async fn metadata_fetch( &self, url: &str, if_modified_since: Option<&str>, ) -> Result<MetadataResponse>
Conditional metadata GET: If-Modified-Since when the cache has a
date, 304 -> NotModified, 404 -> NotFound, else the body and the
Last-Modified header; 3 attempts on transport errors.
Auto Trait Implementations§
impl !RefUnwindSafe for Fetcher
impl !UnwindSafe for Fetcher
impl Freeze for Fetcher
impl Send for Fetcher
impl Sync for Fetcher
impl Unpin for Fetcher
impl UnsafeUnpin for Fetcher
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