[control] Store and recovery fixes: cross-process token lock, revert keeps its journal until done, epoch and deny list never roll back, journal errors propagate, lost confirm reloads edge, trial hash checked
This commit is contained in:
@@ -114,6 +114,7 @@ pub fn read_json<T: DeserializeOwned>(path: &Path) -> Result<Option<T>, String>
|
||||
|
||||
/// Write a JSON state file atomically, readable by its owner only.
|
||||
pub fn write_json<T: Serialize>(path: &Path, value: &T) -> Result<(), String> {
|
||||
crate::crash::fail_write(path)?;
|
||||
let mut text = serde_json::to_vec_pretty(value).map_err(|e| e.to_string())?;
|
||||
text.push(b'\n');
|
||||
write_atomic(path, &text, 0o600).map_err(|e| format!("cannot write {}: {e}", path.display()))
|
||||
|
||||
Reference in New Issue
Block a user