yui/absorb.rs
1//! Drift detection + auto-absorb decision logic.
2//!
3//! When a target was once linked but is now a separate inode (e.g. an editor
4//! atomic-saved over the hardlink), classify the situation and decide how to
5//! recover. See design doc for the truth table.
6
7use camino::Utf8Path;
8
9use crate::Result;
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum AbsorbDecision {
13 /// Inode broken but contents identical — relink only.
14 RelinkOnly,
15 /// target.mtime > source.mtime, contents differ → backup source, copy target → source, relink.
16 AutoAbsorb,
17 /// source.mtime ≥ target.mtime, contents differ → diff + ask (anomaly).
18 NeedsConfirm,
19 /// target equals source via current link mode — nothing to do.
20 InSync,
21 /// target missing → re-link from source.
22 Restore,
23}
24
25pub fn classify(_source: &Utf8Path, _target: &Utf8Path) -> Result<AbsorbDecision> {
26 todo!("absorb::classify")
27}