pub struct RemoteSparseIndex {
pub index: SparseIndex,
pub client: Client,
}sparse only.Expand description
Allows blocking access to a remote HTTP sparse registry index
Fields§
§index: SparseIndexThe local index this remote is wrapping
client: ClientThe client used to make requests to the remote index
Implementations§
Source§impl RemoteSparseIndex
impl RemoteSparseIndex
Sourcepub fn new(index: SparseIndex, client: Client) -> Self
pub fn new(index: SparseIndex, client: Client) -> Self
Creates a new Self that can access and write local cache entries,
and contact the remote index to retrieve the latest index information
Sourcepub fn krate(
&self,
name: KrateName<'_>,
write_cache_entry: bool,
lock: &FileLock,
) -> Result<Option<IndexKrate>, Error>
pub fn krate( &self, name: KrateName<'_>, write_cache_entry: bool, lock: &FileLock, ) -> Result<Option<IndexKrate>, Error>
Gets the latest index metadata for the crate
Network I/O is always performed when calling this method, however the response from the remote registry will be empty of contents other than headers if the local cache entry for the crate is up to date with the latest in the index
Sourcepub fn cached_krate(
&self,
name: KrateName<'_>,
lock: &FileLock,
) -> Result<Option<IndexKrate>, Error>
pub fn cached_krate( &self, name: KrateName<'_>, lock: &FileLock, ) -> Result<Option<IndexKrate>, Error>
Attempts to read the locally cached crate information
This method does no network I/O unlike Self::krate, but does not
guarantee that the cache information is up to date with the latest in
the remote index
Sourcepub fn krates(
&self,
krates: BTreeSet<String>,
write_cache_entries: bool,
lock: &FileLock,
) -> BTreeMap<String, Result<Option<IndexKrate>, Error>>
pub fn krates( &self, krates: BTreeSet<String>, write_cache_entries: bool, lock: &FileLock, ) -> BTreeMap<String, Result<Option<IndexKrate>, Error>>
Helper method for downloading multiple crates in parallel
Note that in most cases using AsyncRemoteSparseIndex::krates_blocking
will outperform this method, especially on lower core counts
Trait Implementations§
Source§impl From<RemoteSparseIndex> for ComboIndex
Available on crate feature __git only.
impl From<RemoteSparseIndex> for ComboIndex
__git only.Source§fn from(index: RemoteSparseIndex) -> Self
fn from(index: RemoteSparseIndex) -> Self
Auto Trait Implementations§
impl Freeze for RemoteSparseIndex
impl !RefUnwindSafe for RemoteSparseIndex
impl Send for RemoteSparseIndex
impl Sync for RemoteSparseIndex
impl Unpin for RemoteSparseIndex
impl !UnwindSafe for RemoteSparseIndex
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more