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

Method has_change

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

Check if a change with the given hash exists on disk. This checks both the cache and the filesystem. Note that this doesn't verify the integrity of the change file. # Arguments `hash` - The hash of the change to check # Example ```rust,ignore if store.has_change(&hash) { let change = store.load_change(&hash)?; } ```

(&self, hash: &Hash)

Source from the content-addressed store, hash-verified

259 /// }
260 /// ```
261 pub fn has_change(&self, hash: &Hash) -> bool {
262 // Check cache first
263 if self
264 .cache
265 .read()
266 .map(|c| c.contains_key(hash))
267 .unwrap_or(false)
268 {
269 return true;
270 }
271
272 // Check filesystem
273 self.change_path(hash).exists()
274 }
275
276 /// Save a change to disk.
277 ///

Callers

nothing calls this directly

Calls 3

contains_keyMethod · 0.80
existsMethod · 0.45
change_pathMethod · 0.45

Tested by

no test coverage detected