Commit b951f4e9 authored by SamwiseFilmore's avatar SamwiseFilmore

WIP: Remove non-canonical paths; Port to R2018; Other Improvements

Non-canonical paths will ideally be re-implemented better at a later
time. Right now I'm just working on getting something simple with
threading, so non-canonical paths aren't a priority.

Also ported to rust 2018, because why not.
parent 8e5ff06f
Pipeline #2674 passed with stage
in 2 minutes and 26 seconds
[[package]]
name = "arrayvec"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.9" version = "0.3.9"
...@@ -47,42 +39,6 @@ dependencies = [ ...@@ -47,42 +39,6 @@ dependencies = [
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "crossbeam-deque"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-epoch"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-utils"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "either"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "failure" name = "failure"
version = "0.1.3" version = "0.1.3"
...@@ -118,7 +74,6 @@ dependencies = [ ...@@ -118,7 +74,6 @@ dependencies = [
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"generational-arena 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "generational-arena 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
...@@ -126,11 +81,6 @@ dependencies = [ ...@@ -126,11 +81,6 @@ dependencies = [
"toml 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "lazy_static"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.44" version = "0.2.44"
...@@ -144,16 +94,6 @@ dependencies = [ ...@@ -144,16 +94,6 @@ dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "memoffset"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nodrop"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.39" version = "0.1.39"
...@@ -167,14 +107,6 @@ name = "num-traits" ...@@ -167,14 +107,6 @@ name = "num-traits"
version = "0.2.6" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num_cpus"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.24" version = "0.4.24"
...@@ -191,27 +123,6 @@ dependencies = [ ...@@ -191,27 +123,6 @@ dependencies = [
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "rayon"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rayon-core"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.40" version = "0.1.40"
...@@ -222,11 +133,6 @@ name = "rustc-demangle" ...@@ -222,11 +133,6 @@ name = "rustc-demangle"
version = "0.1.9" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scopeguard"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.80" version = "1.0.80"
...@@ -315,34 +221,22 @@ version = "0.4.0" ...@@ -315,34 +221,22 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata] [metadata]
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
"checksum generational-arena 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7519f72ae2a5912271755e9009d4fc72d58e2d901c90f3410cdb66247f606485" "checksum generational-arena 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7519f72ae2a5912271755e9009d4fc72d58e2d901c90f3410cdb66247f606485"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" "checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238"
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473"
"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"
"checksum simple_logger 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25111f1d77db1ac3ee11b62ba4b7a162e6bb3be43e28273f0d3935cc8d3ff7fb" "checksum simple_logger 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25111f1d77db1ac3ee11b62ba4b7a162e6bb3be43e28273f0d3935cc8d3ff7fb"
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
name = "init" name = "init"
description = "Init system for redox, includes service management" description = "Init system for redox, includes service management"
version = "0.1.0" version = "0.1.0"
edition = "2018"
[dependencies] [dependencies]
failure = "0.1" failure = "0.1"
generational-arena = "0.2" generational-arena = "0.2"
log = "0.4" log = "0.4"
rayon = "1.0" #rayon = "1.0"
redox_syscall = "0.1" redox_syscall = "0.1"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
......
...@@ -8,7 +8,7 @@ use std::io::{Read, Result}; ...@@ -8,7 +8,7 @@ use std::io::{Read, Result};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use switch_stdio; use crate::switch_stdio;
pub fn run(file: &Path) -> Result<()> { pub fn run(file: &Path) -> Result<()> {
let mut data = String::new(); let mut data = String::new();
......
//#![deny(warnings)] //#![deny(warnings)]
extern crate failure;
extern crate generational_arena;
#[macro_use]
extern crate log;
extern crate rayon;
#[macro_use]
extern crate serde_derive;
extern crate simple_logger;
extern crate syscall;
extern crate toml;
mod dep_graph; mod dep_graph;
mod legacy; mod legacy;
mod service; mod service;
mod service_tree; mod service_tree;
use std::env;
use std::fs::{self, File}; use std::fs::{self, File};
use std::io::{Error, Result}; use std::io::{Error, Result};
use std::os::unix::io::{AsRawFd, FromRawFd}; use std::os::unix::io::{AsRawFd, FromRawFd};
use std::path::Path; use std::path::Path;
use log::{error, warn};
use syscall::flag::{O_RDONLY, O_WRONLY}; use syscall::flag::{O_RDONLY, O_WRONLY};
use service::services; use crate::service::services;
use service_tree::ServiceTree; use crate::service_tree::ServiceTree;
fn switch_stdio(stdio: &str) -> Result<()> { fn switch_stdio(stdio: &str) -> Result<()> {
let stdin = unsafe { File::from_raw_fd( let stdin = unsafe { File::from_raw_fd(
...@@ -65,36 +54,7 @@ pub fn main() { ...@@ -65,36 +54,7 @@ pub fn main() {
let mut service_graph = ServiceTree::new(); let mut service_graph = ServiceTree::new();
service_graph.push_services(service_list); service_graph.push_services(service_list);
/* service_graph.start_services();
service_graph.provide_hook("file:".to_string(), Box::new(|service_graph| {
info!("setting cwd to file:");
if let Err(err) = env::set_current_dir("file:") {
error!("failed to set cwd: {}", err);
}
info!("setting PATH=file:/bin");
env::set_var("PATH", "file:/bin");
let fs_services = services("/etc/init.d")
.unwrap_or_else(|err| {
warn!("{}", err);
vec![]
});
service_graph.push_services(fs_services);
service_graph.start_services();
}));
service_graph.provide_hook("display:".to_string(), Box::new(|service_graph| {
switch_stdio("display:1")
.unwrap_or_else(|err| {
warn!("{}", err);
});
}));*/
info!("setting PATH=initfs:/bin");
env::set_var("PATH", "initfs:/bin");
service_graph.start_services(true);
} }
// Might should not do this // Might should not do this
......
...@@ -10,7 +10,9 @@ use std::process::Command; ...@@ -10,7 +10,9 @@ use std::process::Command;
//use std::thread; //use std::thread;
use failure::Error; use failure::Error;
use log::{error, info};
//use generational_arena::Index; //use generational_arena::Index;
use serde_derive::Deserialize;
use toml; use toml;
#[derive(Debug)] #[derive(Debug)]
......
use std::collections::HashMap; use std::collections::HashMap;
use generational_arena::Index; use generational_arena::Index;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use log::{error, warn};
use dep_graph::DepGraph; use crate::dep_graph::DepGraph;
use service::{Service, State}; use crate::service::{Service, services, State};
/// Main data structure for init, containing the main interface /// Main data structure for init, containing the main interface
/// for dealing with services /// for dealing with services
...@@ -66,12 +66,12 @@ impl ServiceTree { ...@@ -66,12 +66,12 @@ impl ServiceTree {
/// WIP: This function attempts to run the start method on each service in the graph /// WIP: This function attempts to run the start method on each service in the graph
/// if it is not already running. /// if it is not already running.
pub fn start_services(&mut self, start_file_services: bool) { pub fn start_services(&mut self) {
let resolved = self.graph.grouped_resolve(); let resolved = self.graph.linear_resolve();
for group in resolved.iter() { for index /*group*/ in resolved.iter() {
group.iter().for_each(|index| { //for index in group.iter() {
let service = self.graph.get(*index) let mut service = self.graph.get_mut(*index)
// These should all exist, the resolver can only // These should all exist, the resolver can only
// return indexes that are in the graph anyway // return indexes that are in the graph anyway
.expect("resolved service index did not exist"); .expect("resolved service index did not exist");
...@@ -79,74 +79,33 @@ impl ServiceTree { ...@@ -79,74 +79,33 @@ impl ServiceTree {
if let Some(method) = service.methods.get("start") { if let Some(method) = service.methods.get("start") {
if !service.state.is_running() { if !service.state.is_running() {
method.wait(); method.wait();
service.state = State::Online;
} }
} else { } else {
error!("service {} missing 'start' method", service.name); error!("service {} missing 'start' method", service.name);
} }
});
} if let Some(provides) = &service.provides {
//Nasty hack. TODO: Remove if provides.contains(&"display:".to_string()) {
crate::switch_stdio("display:1")
if start_file_services { .unwrap_or_else(|err| {
use std::env; warn!("{}", err);
use service::services; });
}
// display:
crate::switch_stdio("display:1") if provides.contains(&"file:".to_string()) {
.unwrap_or_else(|err| { let fs_services = services("/etc/init.d")
warn!("{}", err); .unwrap_or_else(|err| {
}); warn!("{}", err);
vec![]
// file: });
info!("setting cwd to file:");
if let Err(err) = env::set_current_dir("file:") { self.push_services(fs_services);
error!("failed to set cwd: {}", err); self.start_services();
}
info!("setting PATH=file:/bin");
env::set_var("PATH", "file:/bin");
let fs_services = services("/etc/init.d")
.unwrap_or_else(|err| {
warn!("{}", err);
vec![]
});
self.push_services(fs_services);
self.start_services(false);
}
/*
for index in resolved.iter() {
let service = self.graph.get_mut(*index)
// These should all exist, we just got them out
.expect("resolved service index did not exist");
if let Some(method) = service.methods.get("start") {
if !service.state.is_running() {
method.wait();
}
} else {
error!("service {} missing 'start' method", service.name);
service.state = State::Failed;
}
//TODO: Better solution to this
// Should be able to get rid of the mutable borrow here I hope
service.state = State::Online;
/*
if let Some(on_provided) = self.provide_hooks.get(&service.name) {
on_provided(self);
}
if let Some(ref provides) = service.provides {
for provide in provides.iter() {
if let Some(on_provided) = self.provide_hooks.get(provide) {
on_provided(self);
} }
} }
}*/ //}
}*/ }
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment