pub struct RegistryIndex<'cfg> {
source_id: SourceId,
path: Filesystem,
summaries_cache: HashMap<InternedString, Summaries>,
config: &'cfg Config,
}
Expand description
Manager for handling the on-disk index.
Note that local and remote registries store the index differently. Local
is a simple on-disk tree of files of the raw index. Remote registries are
stored as a raw git repository. The different means of access are handled
via the RegistryData
trait abstraction.
This transparently handles caching of the index in a more efficient format.
Fields§
§source_id: SourceId
§path: Filesystem
Root directory of the index for the registry.
summaries_cache: HashMap<InternedString, Summaries>
Cache of summary data.
This is keyed off the package name. The Summaries
value handles
loading the summary data. It keeps an optimized on-disk representation
of the JSON files, which is created in an as-needed fashion. If it
hasn’t been cached already, it uses RegistryData::load
to access
to JSON files from the index, and the creates the optimized on-disk
summary cache.
config: &'cfg Config
Config
reference for convenience.
Implementations§
source§impl<'cfg> RegistryIndex<'cfg>
impl<'cfg> RegistryIndex<'cfg>
pub fn new( source_id: SourceId, path: &Filesystem, config: &'cfg Config ) -> RegistryIndex<'cfg>
sourcepub fn hash(
&mut self,
pkg: PackageId,
load: &mut dyn RegistryData
) -> Poll<CargoResult<&str>>
pub fn hash( &mut self, pkg: PackageId, load: &mut dyn RegistryData ) -> Poll<CargoResult<&str>>
Returns the hash listed for a specified PackageId
.
sourcepub fn summaries<'a, 'b>(
&'a mut self,
name: InternedString,
req: &'b OptVersionReq,
load: &mut dyn RegistryData
) -> Poll<CargoResult<impl Iterator<Item = &'a IndexSummary> + 'b>>where
'a: 'b,
pub fn summaries<'a, 'b>( &'a mut self, name: InternedString, req: &'b OptVersionReq, load: &mut dyn RegistryData ) -> Poll<CargoResult<impl Iterator<Item = &'a IndexSummary> + 'b>>where 'a: 'b,
Load a list of summaries for name
package in this registry which
match req
This function will semantically parse the on-disk index, match all versions, and then return an iterator over all summaries which matched. Internally there’s quite a few layer of caching to amortize this cost though since this method is called quite a lot on null builds in Cargo.
fn load_summaries( &mut self, name: InternedString, load: &mut dyn RegistryData ) -> Poll<CargoResult<&mut Summaries>>
sourcepub fn clear_summaries_cache(&mut self)
pub fn clear_summaries_cache(&mut self)
Clears the in-memory summaries cache.
pub fn query_inner( &mut self, dep: &Dependency, load: &mut dyn RegistryData, yanked_whitelist: &HashSet<PackageId>, f: &mut dyn FnMut(Summary) ) -> Poll<CargoResult<()>>
fn query_inner_with_online( &mut self, dep: &Dependency, load: &mut dyn RegistryData, yanked_whitelist: &HashSet<PackageId>, f: &mut dyn FnMut(Summary), online: bool ) -> Poll<CargoResult<usize>>
pub fn is_yanked( &mut self, pkg: PackageId, load: &mut dyn RegistryData ) -> Poll<CargoResult<bool>>
Auto Trait Implementations§
impl<'cfg> !RefUnwindSafe for RegistryIndex<'cfg>
impl<'cfg> !Send for RegistryIndex<'cfg>
impl<'cfg> !Sync for RegistryIndex<'cfg>
impl<'cfg> Unpin for RegistryIndex<'cfg>
impl<'cfg> !UnwindSafe for RegistryIndex<'cfg>
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 88 bytes