Open an existing change store without creating or modifying directories.
(changes_dir: PathBuf, cache_capacity: usize)
| 228 | |
| 229 | /// Open an existing change store without creating or modifying directories. |
| 230 | pub fn open_existing(changes_dir: PathBuf, cache_capacity: usize) -> ChangeStoreResult<Self> { |
| 231 | if !changes_dir.is_dir() { |
| 232 | return Err(ChangeStoreError::Io(std::io::Error::new( |
| 233 | std::io::ErrorKind::NotFound, |
| 234 | format!("change store does not exist: {}", changes_dir.display()), |
| 235 | ))); |
| 236 | } |
| 237 | Ok(Self { |
| 238 | changes_dir, |
| 239 | cache: RwLock::new(LruCache::new(cache_capacity)), |
| 240 | verified_cache: RwLock::new(LruCache::new(cache_capacity)), |
| 241 | spans: RwLock::new(SpanOverlay::default()), |
| 242 | }) |
| 243 | } |
| 244 | |
| 245 | /// Create a change store from a repository root directory. |
| 246 | /// |