summaryrefslogtreecommitdiffstats
path: root/deps_index/src
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-03-08 13:10:04 +0000
committerKornel <kornel@geekhood.net>2020-03-08 15:28:59 +0000
commit4c0cee6a6a86eb81d9a38ba014694e0665766e3c (patch)
tree109b18f963d35fb46b2112abe801863dbb158d57 /deps_index/src
parent9754de633660203ac7f2e289d2a103110ff67de2 (diff)
Don't store crates index obj
Diffstat (limited to 'deps_index/src')
-rw-r--r--deps_index/src/index.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/deps_index/src/index.rs b/deps_index/src/index.rs
index c55d9fd..940d3fe 100644
--- a/deps_index/src/index.rs
+++ b/deps_index/src/index.rs
@@ -16,7 +16,7 @@ use semver::Version as SemVer;
use semver::VersionReq;
use serde_derive::*;
use std::iter;
-use std::path::Path;
+use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;
use string_interner::StringInterner;
@@ -128,7 +128,7 @@ impl ICrate for RichCrateVersion {
pub struct Index {
indexed_crates: FxHashMap<Box<str>, Crate>,
- pub crates_io_index: crates_index::Index,
+ pub crates_index_path: PathBuf,
git_index: GitIndex,
pub inter: RwLock<StringInterner<Sym>>,
@@ -138,7 +138,8 @@ pub struct Index {
impl Index {
pub fn new(data_dir: &Path) -> Result<Self, DepsErr> {
- let crates_io_index = crates_index::Index::new(data_dir.join("index"));
+ let crates_index_path = data_dir.join("index");
+ let crates_io_index = crates_index::Index::new(&crates_index_path);
let indexed_crates: FxHashMap<_,_> = crates_io_index.crate_index_paths().par_bridge()
.filter_map(|path| {
let c = crates_index::Crate::new_checked(path).ok()?;
@@ -154,12 +155,12 @@ impl Index {
inter: RwLock::new(StringInterner::new()),
deps_stats: DoubleCheckedCell::new(),
indexed_crates,
- crates_io_index,
+ crates_index_path,
})
}
pub fn update(&self) {
- let _ = self.crates_io_index.update().map_err(|e| eprintln!("{}", e));
+ let _ = crates_index::Index::new(&self.crates_index_path).update().map_err(|e| eprintln!("{}", e));
}
/// Crates available in the crates.io index