aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dotup/src/depot.rs23
1 files changed, 6 insertions, 17 deletions
diff --git a/dotup/src/depot.rs b/dotup/src/depot.rs
index 5ee8f1a..d1e0946 100644
--- a/dotup/src/depot.rs
+++ b/dotup/src/depot.rs
@@ -3,7 +3,6 @@ use std::{
3 collections::HashMap, 3 collections::HashMap,
4 fs::Metadata, 4 fs::Metadata,
5 path::{Path, PathBuf}, 5 path::{Path, PathBuf},
6 sync::Arc,
7}; 6};
8use thiserror::Error; 7use thiserror::Error;
9 8
@@ -150,17 +149,11 @@ impl std::fmt::Display for Link {
150} 149}
151 150
152#[derive(Debug)] 151#[derive(Debug)]
153struct DepotShared { 152pub struct Depot {
154 /// Must be canonical path 153 // Must be canonical path
155 base_path: PathBuf, 154 base_path: PathBuf,
156 /// Must be canonical path 155 // Must be canonical path
157 archive_path: PathBuf, 156 archive_path: PathBuf,
158}
159
160#[derive(Debug)]
161pub struct Depot {
162 // TODO: remove shared
163 shared: Arc<DepotShared>,
164 // Maps the origin to the link 157 // Maps the origin to the link
165 links: SlotMap<LinkID, Link>, 158 links: SlotMap<LinkID, Link>,
166 links_by_origin: HashMap<PathBuf, LinkID>, 159 links_by_origin: HashMap<PathBuf, LinkID>,
@@ -212,11 +205,11 @@ impl Depot {
212 } 205 }
213 206
214 pub fn base_path(&self) -> &Path { 207 pub fn base_path(&self) -> &Path {
215 &self.shared.base_path 208 &self.base_path
216 } 209 }
217 210
218 pub fn archive_path(&self) -> &Path { 211 pub fn archive_path(&self) -> &Path {
219 &self.shared.archive_path 212 &self.archive_path
220 } 213 }
221} 214}
222 215
@@ -233,13 +226,9 @@ fn depot_create(config: DepotConfig) -> Result<Depot> {
233 .expect("Failed to get parent of archive path") 226 .expect("Failed to get parent of archive path")
234 .to_path_buf(); 227 .to_path_buf();
235 228
236 let depot_shared = DepotShared { 229 let mut depot = Depot {
237 base_path, 230 base_path,
238 archive_path, 231 archive_path,
239 };
240
241 let mut depot = Depot {
242 shared: Arc::new(depot_shared),
243 links: Default::default(), 232 links: Default::default(),
244 links_by_origin: Default::default(), 233 links_by_origin: Default::default(),
245 }; 234 };