Also replace HashMap with LinkedHashMap to keep service order
This commit is contained in:
		
							
								
								
									
										7
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -220,6 +220,12 @@ version = "0.2.152"
 | 
				
			|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
 | 
					checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "linked-hash-map"
 | 
				
			||||||
 | 
					version = "0.5.6"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "log"
 | 
					name = "log"
 | 
				
			||||||
version = "0.4.20"
 | 
					version = "0.4.20"
 | 
				
			||||||
@@ -250,6 +256,7 @@ dependencies = [
 | 
				
			|||||||
 "graph-cycles",
 | 
					 "graph-cycles",
 | 
				
			||||||
 "hhmmss",
 | 
					 "hhmmss",
 | 
				
			||||||
 "libc",
 | 
					 "libc",
 | 
				
			||||||
 | 
					 "linked-hash-map",
 | 
				
			||||||
 "nix",
 | 
					 "nix",
 | 
				
			||||||
 "petgraph",
 | 
					 "petgraph",
 | 
				
			||||||
 "serde",
 | 
					 "serde",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,7 @@ daemonize = "0.5.0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
serde = { version = "1.0", features = ["derive"] }
 | 
					serde = { version = "1.0", features = ["derive"] }
 | 
				
			||||||
toml = { version = "0.8.8", features = ["preserve_order"] }
 | 
					toml = { version = "0.8.8", features = ["preserve_order"] }
 | 
				
			||||||
 | 
					linked-hash-map = "0.5.6"
 | 
				
			||||||
shlex = "1.3.0"
 | 
					shlex = "1.3.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
petgraph = "0.6.4"
 | 
					petgraph = "0.6.4"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ struct Data {
 | 
				
			|||||||
    pub epoll: nix::sys::epoll::Epoll,
 | 
					    pub epoll: nix::sys::epoll::Epoll,
 | 
				
			||||||
    pub sigfd: nix::sys::signalfd::SignalFd,
 | 
					    pub sigfd: nix::sys::signalfd::SignalFd,
 | 
				
			||||||
    pub work_queue: Option<std::sync::mpsc::Sender<WorkItem>>,
 | 
					    pub work_queue: Option<std::sync::mpsc::Sender<WorkItem>>,
 | 
				
			||||||
    pub services: std::collections::HashMap<u64, service::Service>
 | 
					    pub services: linked_hash_map::LinkedHashMap<u64, service::Service>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
impl Data {
 | 
					impl Data {
 | 
				
			||||||
    fn new() -> Self {
 | 
					    fn new() -> Self {
 | 
				
			||||||
@@ -35,7 +35,7 @@ impl Data {
 | 
				
			|||||||
            epoll,
 | 
					            epoll,
 | 
				
			||||||
            sigfd,
 | 
					            sigfd,
 | 
				
			||||||
            work_queue: None,
 | 
					            work_queue: None,
 | 
				
			||||||
            services: std::collections::HashMap::new()
 | 
					            services: Default::default()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user