(&mut self, path: &str)
| 341 | |
| 342 | impl super::materialize::MaterializationEffectExecutor for SwitchMaterializationExecutor<'_> { |
| 343 | fn create_directory(&mut self, path: &str) -> Result<bool, RepositoryError> { |
| 344 | if self |
| 345 | .effect_for_expected_new(path, |value| { |
| 346 | matches!(value, EffectValue::File(state) if state.kind == FileKind::Directory) |
| 347 | }) |
| 348 | .is_none() |
| 349 | { |
| 350 | return match std::fs::symlink_metadata(self.repository.root().join(path)) { |
| 351 | Ok(metadata) if metadata.is_dir() => Ok(false), |
| 352 | Ok(_) => Err(RepositoryError::InvalidOperation { |
| 353 | message: format!("unleased non-directory entry blocks '{path}'"), |
| 354 | }), |
| 355 | Err(error) if error.kind() == std::io::ErrorKind::NotFound => { |
| 356 | Err(RepositoryError::InvalidOperation { |
| 357 | message: format!("switch operation omitted directory lease for '{path}'"), |
| 358 | }) |
| 359 | } |
| 360 | Err(error) => Err(RepositoryError::Io(error)), |
| 361 | }; |
| 362 | } |
| 363 | let pending = self.execute_directory(path)?; |
| 364 | self.record(pending) |
| 365 | } |
| 366 | |
| 367 | fn write_file(&mut self, path: &str, content: &[u8]) -> Result<bool, RepositoryError> { |
| 368 | let content_hash = Hash::of(content); |
no test coverage detected