-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit-id:d55b5ecb
- Loading branch information
Showing
18 changed files
with
906 additions
and
95 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::core::Summary; | ||
use crate::resolver::algorithm::provider::PubGrubPackage; | ||
use once_map::OnceMap; | ||
use std::sync::Arc; | ||
|
||
/// In-memory index of package metadata. | ||
#[derive(Default, Clone)] | ||
pub struct InMemoryIndex(Arc<SharedInMemoryIndex>); | ||
|
||
#[derive(Default)] | ||
struct SharedInMemoryIndex { | ||
/// A map from package name to the metadata for that package and the index where the metadata | ||
/// came from. | ||
packages: FxOnceMap<PubGrubPackage, Arc<VersionsResponse>>, | ||
} | ||
|
||
pub(crate) type FxOnceMap<K, V> = OnceMap<K, V>; | ||
|
||
impl InMemoryIndex { | ||
/// Returns a reference to the package metadata. | ||
pub fn packages(&self) -> &FxOnceMap<PubGrubPackage, Arc<VersionsResponse>> { | ||
&self.0.packages | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub enum VersionsResponse { | ||
Found(Vec<Summary>), | ||
} |
Oops, something went wrong.