MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / open_existing

Method open_existing

atomic-repository/src/changestore/mod.rs:230–243  ·  view source on GitHub ↗

Open an existing change store without creating or modifying directories.

(changes_dir: PathBuf, cache_capacity: usize)

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 1

is_dirMethod · 0.80

Tested by

no test coverage detected