(candidates: &[ChangeCandidate])
| 654 | } |
| 655 | |
| 656 | fn scan_token(candidates: &[ChangeCandidate]) -> ChangeSourceToken { |
| 657 | let mut bytes = b"atomic.scan-token-v1\0".to_vec(); |
| 658 | for candidate in candidates { |
| 659 | bytes.extend_from_slice(&(candidate.path.as_bytes().len() as u64).to_le_bytes()); |
| 660 | bytes.extend_from_slice(candidate.path.as_bytes()); |
| 661 | match &candidate.observation { |
| 662 | CandidateObservation::Missing => bytes.push(0), |
| 663 | CandidateObservation::Present(file) => { |
| 664 | bytes.push(1); |
| 665 | bytes.extend_from_slice(&file.device.unwrap_or(u64::MAX).to_le_bytes()); |
| 666 | bytes.extend_from_slice(&file.inode.unwrap_or(u64::MAX).to_le_bytes()); |
| 667 | bytes.extend_from_slice(&file.size.to_le_bytes()); |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | ChangeSourceToken(Hash::of(&bytes).as_bytes().to_vec()) |
| 672 | } |
| 673 | |
| 674 | fn canonical_kind(kind: ObservedKind) -> Option<InodeKind> { |
| 675 | match kind { |
no test coverage detected