pub struct DeployState { /* private fields */ }Implementations§
Source§impl DeployState
impl DeployState
pub fn new(state_dir: &Path) -> Self
Sourcepub fn lock(&mut self) -> Result<()>
pub fn lock(&mut self) -> Result<()>
Acquire an exclusive file lock without loading existing state.
pub fn load(state_dir: &Path) -> Result<Self>
Sourcepub fn load_locked(state_dir: &Path) -> Result<Self>
pub fn load_locked(state_dir: &Path) -> Result<Self>
Load state with an exclusive file lock to prevent concurrent access. The lock is held until the DeployState is dropped.
pub fn save(&self) -> Result<()>
pub fn record(&mut self, entry: DeployEntry)
pub fn entries(&self) -> &[DeployEntry]
pub fn remove_targets(&mut self, targets: &[PathBuf])
pub fn update_entry_hash(&mut self, index: usize, new_hash: String)
pub fn check_entry_status(&self, entry: &DeployEntry) -> FileStatus
pub fn originals_dir(&self) -> PathBuf
pub fn store_original(&self, content_hash: &str, content: &[u8]) -> Result<()>
pub fn load_original(&self, content_hash: &str) -> Result<Vec<u8>>
pub fn migrate_storage(state_dir: &Path) -> Result<()>
Sourcepub fn restore(&mut self, package_filter: Option<&str>) -> Result<usize>
pub fn restore(&mut self, package_filter: Option<&str>) -> Result<usize>
Restore files to their pre-dotm state. Files with original_hash get their original content written back with original metadata. Files without original_hash (dotm created them) get removed. Returns the count of restored files.
Sourcepub fn undeploy_package(
&mut self,
package: &str,
packages: Option<&HashMap<String, PackageConfig>>,
cwd: &Path,
) -> Result<usize>
pub fn undeploy_package( &mut self, package: &str, packages: Option<&HashMap<String, PackageConfig>>, cwd: &Path, ) -> Result<usize>
Remove managed files for a single package and save updated state.
cwd is the working directory for hook execution. Note: deploy hooks
run from the package’s target directory, but undeploy hooks run from
whatever cwd the caller provides (typically the dotfiles source dir),
since the target directory may be partially torn down during undeploy.
Sourcepub fn undeploy(
&self,
packages: Option<&HashMap<String, PackageConfig>>,
cwd: &Path,
) -> Result<usize>
pub fn undeploy( &self, packages: Option<&HashMap<String, PackageConfig>>, cwd: &Path, ) -> Result<usize>
Remove all managed files and return a count of removed files.
cwd is the working directory for hook execution (see
undeploy_package for details on the
asymmetry with deploy hooks).