mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
config transacion add revert and drop start result
This commit is contained in:
parent
2333a8ebf1
commit
2346e38ff4
1 changed files with 5 additions and 3 deletions
|
@ -79,14 +79,14 @@ impl ConfigManager {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_transaction(&mut self) -> Result<ConfigTransaction, ConfigError> {
|
pub fn start_transaction(&mut self) -> ConfigTransaction {
|
||||||
let data = self.shared_data.lock().unwrap();
|
let data = self.shared_data.lock().unwrap();
|
||||||
|
|
||||||
Ok(ConfigTransaction {
|
ConfigTransaction {
|
||||||
finished: false,
|
finished: false,
|
||||||
changes: data.pending_config.clone(),
|
changes: data.pending_config.clone(),
|
||||||
shared_data: data,
|
shared_data: data,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ impl<'a> ConfigTransaction<'a> {
|
||||||
write_config_to_file(PENDING_CONFIG_PATH, ch.clone())?;
|
write_config_to_file(PENDING_CONFIG_PATH, ch.clone())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn revert(mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_file_to_config(path: &str) -> Result<Config, ConfigError> {
|
fn read_file_to_config(path: &str) -> Result<Config, ConfigError> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue