Struct tame_index::index::RemoteSparseIndex
source · 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: SparseIndex
The local index this remote is wrapping
client: Client
The 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.