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

Method new

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

Create a new change store with the given directory and cache capacity. The changes directory will be created if it doesn't exist. # Arguments `changes_dir` - Path to the directory where changes will be stored `cache_capacity` - Maximum number of changes to keep in memory # Errors Returns an error if the directory cannot be created. # Example ```rust,ignore let store = ChangeStore::new(".ato

(changes_dir: PathBuf, cache_capacity: usize)

Source from the content-addressed store, hash-verified

215 /// let store = ChangeStore::new(".atomic/changes".into(), 100)?;
216 /// ```
217 pub fn new(changes_dir: PathBuf, cache_capacity: usize) -> ChangeStoreResult<Self> {
218 // Ensure the directory exists
219 fs::create_dir_all(&changes_dir)?;
220
221 Ok(Self {
222 changes_dir,
223 cache: RwLock::new(LruCache::new(cache_capacity)),
224 verified_cache: RwLock::new(LruCache::new(cache_capacity)),
225 spans: RwLock::new(SpanOverlay::default()),
226 })
227 }
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> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected