| 150 | |
| 151 | impl ScanChangeSource { |
| 152 | pub fn changes_with_provider( |
| 153 | &self, |
| 154 | request: ChangeSourceRequest<'_>, |
| 155 | provider: &dyn FilesystemProvider, |
| 156 | ) -> Result<ChangeSourceResult, ChangeSourceError> { |
| 157 | let mut candidates = Vec::with_capacity(request.tracked_paths.len()); |
| 158 | let mut stats = ChangeSourceStats { |
| 159 | tracked_paths: request.tracked_paths.len(), |
| 160 | ..ChangeSourceStats::default() |
| 161 | }; |
| 162 | for path in request.tracked_paths { |
| 163 | stats.metadata_reads += 1; |
| 164 | candidates.push(provider.observe( |
| 165 | request.root, |
| 166 | path, |
| 167 | ChangeCandidateReason::FullScan, |
| 168 | )?); |
| 169 | } |
| 170 | candidates.sort_by(|left, right| left.path.cmp(&right.path)); |
| 171 | stats.candidates = candidates.len(); |
| 172 | Ok(ChangeSourceResult { |
| 173 | root: request.root.to_path_buf(), |
| 174 | source: ChangeSourceKind::Scan, |
| 175 | fallback_source: None, |
| 176 | token: scan_token(&candidates), |
| 177 | candidates, |
| 178 | complete: true, |
| 179 | fallback: None, |
| 180 | stats, |
| 181 | }) |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | impl ChangeSource for ScanChangeSource { |