[−][src]Function tweetr::ops::start_daemon::verify
pub fn verify(
config_dir: &(String, PathBuf)
) -> Result<(PathBuf, PathBuf, PathBuf), Outcome>
Verify if, given the current configuration, it's permitted to continue with the subsequent steps of the start-daemon
subsystem.
The return value contains either the path to the file containing the global app configuration, the path to the file containing the global users data and the path to the file containing the global queued tweets data or why getting them failed.
Examples
Verifying with everything existing.
let tf = temp_dir().join("tweetr-doctest").join("ops-start-daemon-verify-0"); fs::create_dir_all(&tf).unwrap(); File::create(tf.join("app.toml")).unwrap().write(&[]).unwrap(); File::create(tf.join("users.toml")).unwrap().write(&[]).unwrap(); File::create(tf.join("tweets.toml")).unwrap().write(&[]).unwrap(); assert_eq!(start_daemon::verify(&("$TEMP/ops-start-daemon-verify-0".to_string(), tf.clone())), Ok((tf.join("app.toml"), tf.join("users.toml"), tf.join("tweets.toml"))));
Verifying with users data nonexistant.
let tf = temp_dir().join("tweetr-doctest").join("ops-start-daemon-verify-1"); fs::create_dir_all(&tf).unwrap(); File::create(tf.join("app.toml")).unwrap().write(&[]).unwrap(); File::create(tf.join("tweets.toml")).unwrap().write(&[]).unwrap(); assert_eq!(start_daemon::verify(&("$TEMP/ops-start-daemon-verify-1".to_string(), tf)), Err(Outcome::RequiredFileFromSubsystemNonexistant { subsys: "add-user", fname: "$TEMP/ops-start-daemon-verify-1/users.toml".to_string(), }));