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

Method next_from_files

atomic-repository/src/changestore/iterators.rs:39–67  ·  view source on GitHub ↗

Try to get the next hash from the current file iterator.

(&mut self)

Source from the content-addressed store, hash-verified

37
38 /// Try to get the next hash from the current file iterator.
39 fn next_from_files(&mut self) -> Option<ChangeStoreResult<Hash>> {
40 let file_iter = self.file_iter.as_mut()?;
41
42 for entry_result in file_iter {
43 match entry_result {
44 Ok(entry) => {
45 let path = entry.path();
46
47 // Skip if not a file
48 if !path.is_file() {
49 continue;
50 }
51
52 // Check for .change extension
53 if path.extension().is_none_or(|e| e != CHANGE_EXTENSION) {
54 continue;
55 }
56
57 // Extract the hash from the filename
58 if let Some(hash) = Self::hash_from_path(&path) {
59 return Some(Ok(hash));
60 }
61 }
62 Err(e) => return Some(Err(ChangeStoreError::Io(e))),
63 }
64 }
65
66 None
67 }
68
69 /// Extract a hash from a change file path.
70 fn hash_from_path(path: &Path) -> Option<Hash> {

Callers 1

nextMethod · 0.80

Calls 5

extensionMethod · 0.80
pathMethod · 0.45
is_fileMethod · 0.45
nextMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected