Skip to content

Commit

Permalink
Reword some comments
Browse files Browse the repository at this point in the history
resolves #13
  • Loading branch information
cholcombe973 committed Aug 16, 2018
1 parent e3068c4 commit 3f46318
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ fn check_for_failed_disks(config_dir: &str, simulate: bool) -> Result<(), String
}
// Handle the ones that ended up stuck in Fail
} else if state.state == State::Fail {
//
}else {
error!("Disk {} ended in a Fail state", dev_path.display(),);
} else {
// The rest should be State::Good ?
}
}
Expand Down
30 changes: 12 additions & 18 deletions src/test_disk.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
//! Disk checks are defined here. To define a new
//! check create a struct and impl the DiskCheck trait.
//! To create a remediation should that check fail you
//! should also impl the DiskRemediation trait.
//!
//! +------>disk_is_ok +----->replace_disk
//! + no +no
//! +---->is_filesystem_corrupted +--------> can_i_repair
//! + no + yes + no ^ + yes
//!is_disk_writable +------>is_mounted | +----->repair_disk
//! + yes + yes +
//! +----->disk_is_ok +---->unmount
//! Disk checks are defined here. To define a new check create a new
//! struct and then impl Transition for it. The disks here use a state
//! machine to determine what is and is not possible. To see the state
//! machine as a visual diagram run one of the unit tests and copy the
//! digraph output into a dot file and convert using
//! `dot -Tps example.dot -o example.ps` to postscript or
//! `dot -Tsvg example.dot -o example.svg` to svg.
//! See comments on the run() function for StateMachine and also
//! the comments under setup_state_machine() to learn more about how it works.
extern crate blkid;
extern crate block_utils;
extern crate fstab;
Expand Down Expand Up @@ -251,10 +248,7 @@ mod tests {
}

#[test]
fn test_state_machine_replaced_disk() {}

#[test]
fn test_state_machine_resume() {
fn test_state_machine_replaced_disk() {
TermLogger::init(super::log::LevelFilter::Debug, Config::default()).unwrap();
super::run_smart_checks.mock_safe(|_| MockResult::Return(Ok(true)));

Expand Down Expand Up @@ -805,8 +799,8 @@ impl StateMachine {
fn setup_state_machine(&mut self) {
// GraphMap will run the transitions in the order they're added here
// If Unscanned has 2 edges it will run the first added one first
// and then the second one. To deal with this these
// states are ordered from most ideal outcome first.
// and then the second one. To deal with this the
// states are ordered from most to least ideal outcome.
self.add_transition(State::Unscanned, State::Scanned, Scan::transition, "Scan");
self.add_transition(State::Unscanned, State::Fail, Scan::transition, "Scan");
self.add_transition(
Expand Down

0 comments on commit 3f46318

Please sign in to comment.