to be honest I have no clue anymore what I have done
parent
0a7c43ea6a
commit
fb7da7cffc
@ -1,2 +1,3 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
resources/systemd-root
|
||||
|
@ -1,13 +1,565 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "async-attributes"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-macros"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-std"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"async-attributes 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"async-task 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "broadcaster"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel-preview"
|
||||
version = "0.3.0-alpha.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core-preview"
|
||||
version = "0.3.0-alpha.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink-preview"
|
||||
version = "0.3.0-alpha.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-timer"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util-preview"
|
||||
version = "0.3.0-alpha.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kv-log-macro"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "maybe-uninit"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-uds"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net2"
|
||||
version = "0.2.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0-alpha.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysf"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-macros 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"async-std 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysf-init"
|
||||
name = "sysf-unitmgr"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-std 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sysf 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum async-attributes 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423"
|
||||
"checksum async-macros 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "644a5a8de80f2085a1e7e57cd1544a2a7438f6e003c0790999bd43b92a77cdb2"
|
||||
"checksum async-std 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bf6039b315300e057d198b9d3ab92ee029e31c759b7f1afae538145e6f18a3e"
|
||||
"checksum async-task 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "abdb6048336bef96e8c8fc5573536c5cc5b391fbfd0980349959b7c3f7a40d19"
|
||||
"checksum async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c8df72488e87761e772f14ae0c2480396810e51b2c2ade912f97f0f7e5b95e3c"
|
||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum broadcaster 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "07a1446420a56f1030271649ba0da46d23239b3a68c73591cea5247f15a788a0"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c"
|
||||
"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca"
|
||||
"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac"
|
||||
"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
"checksum futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d5e5f4df964fa9c1c2f8bddeb5c3611631cacd93baf810fc8bb2fb4b495c263a"
|
||||
"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866"
|
||||
"checksum futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "b35b6263fb1ef523c3056565fa67b1d16f0a8604ff12b11b08c25f28a734c60a"
|
||||
"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff"
|
||||
"checksum futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "86f148ef6b69f75bb610d4f9a2336d4fc88c4b5b67129d1a340dd0fd362efeec"
|
||||
"checksum futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6"
|
||||
"checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d"
|
||||
"checksum hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f629dc602392d3ec14bfc8a09b5e644d7ffd725102b48b81e59f90f2633621d7"
|
||||
"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||
"checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
||||
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
|
||||
"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
|
||||
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
||||
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
|
||||
"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed"
|
||||
"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
|
||||
"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
|
||||
"checksum pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0af6cbca0e6e3ce8692ee19fb8d734b641899e07b68eb73e9bbbd32f1703991"
|
||||
"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
|
||||
"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
|
||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
||||
"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"sysf",
|
||||
"sysf-init"
|
||||
"sysf-unitmgr"
|
||||
]
|
||||
|
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e;
|
||||
|
||||
cd "$(dirname "$0")/..";
|
||||
TARGET_DIR="$PWD/resources/systemd-root";
|
||||
test -d "$TARGET_DIR" || mkdir "$TARGET_DIR";
|
||||
docker run --rm -v "$TARGET_DIR:/out" -u 1000 archlinux sh -c 'tar -C / -Oc usr/lib/systemd usr/share/systemd var/lib/systemd etc/systemd | tar -C /out -xf-'
|
||||
chmod a+rw -R "$TARGET_DIR";
|
@ -1,8 +0,0 @@
|
||||
[package]
|
||||
name = "sysf-init"
|
||||
version = "0.1.0"
|
||||
authors = ["eater <=@eater.me>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sysf = { path = "../sysf" }
|
@ -1,9 +0,0 @@
|
||||
extern crate sysf;
|
||||
|
||||
use sysf::unit::Unit;
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = Unit::new("hello");
|
||||
println!("{:?}", x);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "sysf-unitmgr"
|
||||
version = "0.1.0"
|
||||
authors = ["eater <=@eater.me>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
async-std = { version = "1.4.0", features = ["default", "unstable", "attributes"] }
|
||||
sysf = { path = "../sysf" }
|
@ -0,0 +1,27 @@
|
||||
extern crate sysf;
|
||||
extern crate async_std;
|
||||
|
||||
use sysf::config::loader::Loader;
|
||||
use async_std::task;
|
||||
use crate::manager::{Manager, ManagerSignal};
|
||||
use std::time::Duration;
|
||||
use async_std::process::exit;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
mod manager;
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() {
|
||||
let loader = Loader::with_root("/home/eater/projects/systemf/resources/systemd-root");
|
||||
let mut manager = Manager::new(loader);
|
||||
manager.target("sysinit.target");
|
||||
|
||||
let mut remote = manager.get_remote();
|
||||
|
||||
task::spawn(async move {
|
||||
task::sleep(Duration::from_secs(10)).await;
|
||||
remote.signal(ManagerSignal::Noop);
|
||||
});
|
||||
|
||||
manager.run().await;
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
use sysf::registry::{DependencyTree, Registry};
|
||||
use sysf::unit::UnitState;
|
||||
use std::collections::HashMap;
|
||||
use sysf::config::loader::Loader;
|
||||
use sysf::utils::asyn::AsyncQueue;
|
||||
use async_std::prelude::StreamExt;
|
||||
use async_std::task;
|
||||
use crate::manager::ManagerSignal::*;
|
||||
use async_std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ManagerSignal {
|
||||
TargetUpdate(String),
|
||||
Noop,
|
||||
}
|
||||
|
||||
impl Default for ManagerSignal {
|
||||
fn default() -> Self {
|
||||
Noop
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct Manager {
|
||||
state: Arc<Mutex<ManagerState>>,
|
||||
queue: AsyncQueue<ManagerSignal>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct ManagerState {
|
||||
dependency_tree: DependencyTree,
|
||||
unit_status: HashMap<String, UnitState>,
|
||||
registry: Registry,
|
||||
queue: AsyncQueue<ManagerSignal>,
|
||||
}
|
||||
|
||||
impl Manager {
|
||||
pub fn new(loader: Loader) -> Manager {
|
||||
let queue = AsyncQueue::new();
|
||||
|
||||
Manager {
|
||||
state: Arc::new(Mutex::new(ManagerState {
|
||||
dependency_tree: DependencyTree::default(),
|
||||
unit_status: HashMap::new(),
|
||||
registry: Registry::with_loader(loader),
|
||||
queue: queue.clone(),
|
||||
})),
|
||||
queue,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn with<F>(&mut self, block: F)
|
||||
where F: FnOnce(MutexGuard<ManagerState>)
|
||||
{
|
||||
block(self.state.lock().await)
|
||||
}
|
||||
|
||||
pub fn target(&mut self, target: &str) {
|
||||
self.queue.push(ManagerSignal::TargetUpdate(target.to_string()));
|
||||
}
|
||||
|
||||
pub fn signal(&mut self, signal: ManagerSignal) {
|
||||
self.queue.push(signal);
|
||||
}
|
||||
|
||||
pub async fn run(&mut self) {
|
||||
while let Some(signal) = self.queue.next().await {
|
||||
let mut copy: Manager = self.clone();
|
||||
task::spawn(async {
|
||||
match signal {
|
||||
TargetUpdate(target) => {
|
||||
copy.update_target(target).await;
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_remote(&self) -> ManagerRemote {
|
||||
ManagerRemote(self.queue.clone())
|
||||
}
|
||||
|
||||
async fn update_target(mut self, target: String) {
|
||||
let mut me = self.state.lock().await;
|
||||
let tree = me.registry.get_dependency_tree(&target).await;
|
||||
me.dependency_tree = tree;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ManagerRemote(AsyncQueue<ManagerSignal>);
|
||||
|
||||
impl ManagerRemote {
|
||||
pub fn signal(&mut self, signal: ManagerSignal) {
|
||||
self.0.push(signal);
|
||||
}
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
use async_std::path::Path;
|
||||
use async_std::prelude::*;
|
||||
use std::cell::Cell;
|
||||
use crate::utils::asyn::IntoResults;
|
||||
use std::io::{ErrorKind, Error};
|
||||
use async_std::fs::{read_to_string, read_dir, ReadDir, DirEntry};
|
||||
use async_std::task;
|
||||
use crate::config::Config;
|
||||
use std::collections::HashSet;
|
||||
use crate::unit::Unit;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct LoaderConfig {
|
||||
pub locations: Vec<String>,
|
||||
}
|
||||
|
||||
impl LoaderConfig {
|
||||
pub fn default() -> Self {
|
||||
LoaderConfig {
|
||||
locations: vec![
|
||||
"etc/systemd/system/".to_string(),
|
||||
"run/systemd/system/".to_string(),
|
||||
"usr/lib/systemd/system/".to_string(),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Loader {
|
||||
root: String,
|
||||
config: LoaderConfig,
|
||||
}
|
||||
|
||||
impl Default for Loader {
|
||||
fn default() -> Self {
|
||||
Self::new("/", LoaderConfig::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl Loader {
|
||||
pub fn with_root(root: &str) -> Loader {
|
||||
Self::new(root, LoaderConfig::default())
|
||||
}
|
||||
|
||||
pub fn new(root: &str, config: LoaderConfig) -> Loader {
|
||||
Loader { root: root.to_string(), config }
|
||||
}
|
||||
|
||||
|
||||
pub async fn load_unit(&self, unit_name: &str) -> Option<Unit> {
|
||||
let config = self.load_config(unit_name).await;
|
||||
let mut unit = config.get_unit()?;
|
||||
let read_items = |postfix: String| {
|
||||
async {
|
||||
let futures = self.config
|
||||
.locations
|
||||
.iter()
|
||||
.map(move |loc| {
|
||||
let path = Path::new(&self.root).join(loc).join(format!("{}.{}", unit_name, postfix));
|
||||
read_dir(path)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.into_results()
|
||||
.await
|
||||
.into_iter()
|
||||
.filter_map(|result: Result<ReadDir, Error>| {
|
||||
result.ok()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
|
||||
let mut results = vec![];
|
||||
|
||||
for future in futures {
|
||||
let mut reader = future;
|
||||
while let Some(item) = reader.next().await {
|
||||
if let Ok(item) = item {
|
||||
if let Some(name) = item.file_name().to_str() {
|
||||
results.push(String::from(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
results
|
||||
}
|
||||
};
|
||||
|
||||
unit.requires.append(&mut read_items("requires".to_string()).await);
|
||||
unit.wants.append(&mut read_items("wants".to_string()).await);
|
||||
|
||||
Some(unit)
|
||||
}
|
||||
|
||||
pub async fn load_config(&self, unit_name: &str) -> Config {
|
||||
let mut futures = Vec::new();
|
||||
let mut paths = HashSet::new();
|
||||
let mut config_dirs = HashSet::new();
|
||||
|
||||
for location in &self.config.locations {
|
||||
let current_loc = Path::new(&self.root).join(&location);
|
||||
paths.insert(current_loc.join(unit_name));
|
||||
|
||||
let (unit_type, name) = {
|
||||
let mut items = unit_name.rsplitn(2, ".");
|
||||
(items.next().unwrap(), items.next().unwrap())
|
||||
};
|
||||
|
||||
let parts: Vec<&str> = name.split("-").collect();
|
||||
let mut builder = String::new();
|
||||
for part_index in 0..parts.len() - 1 {
|
||||
let part = parts[part_index];
|
||||
builder += part;
|
||||
builder += "-";
|
||||
config_dirs.insert(current_loc.join(format!("{}.{}.d", builder, unit_type)));
|
||||
}
|
||||
|
||||
// for unit test@nice.service it should also check test@.service.d
|
||||
if name.contains('@') && !name.ends_with('@') {
|
||||
let mut parts = name.splitn(2, '@');
|
||||
config_dirs.insert(current_loc.join(format!("{}@.{}.d", parts.next().unwrap(), unit_type)));
|
||||
}
|
||||
|
||||
config_dirs.insert(current_loc.join(unit_name.to_string() + ".d"));
|
||||
}
|
||||
|
||||
for config_dir in config_dirs {
|
||||
let dir_res: Result<ReadDir, std::io::Error> = read_dir(config_dir).await;
|
||||
match dir_res {
|
||||
Ok(mut dir) => {
|
||||
while let Some(item) = dir.next().await {
|
||||
if item.is_err() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let item: DirEntry = item.unwrap();
|
||||
if item.path().extension().map(|x| x == "conf").unwrap_or(false) {
|
||||
paths.insert(item.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
if err.kind() != ErrorKind::NotFound {
|
||||
// Log?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for location in paths {
|
||||
let path = location.to_str().unwrap().to_string();
|
||||
futures.push(async {
|
||||
let result: Result<String, std::io::Error> = read_to_string(&path).await;
|
||||
match result {
|
||||
Ok(contents) => {
|
||||
Some((path, contents))
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
if err.kind() != ErrorKind::NotFound {
|
||||
// Log?
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let mut results: Vec<(String, String)> = futures
|
||||
.into_results().await
|
||||
.into_iter()
|
||||
.filter(|o| o.is_some())
|
||||
.map(|x| x.unwrap())
|
||||
.collect();
|
||||
|
||||
let mut config = Config::new(unit_name);
|
||||
let mut configs = Vec::new();
|
||||
|
||||
results.sort();
|
||||
|
||||
for (path, contents) in results {
|
||||
if path.ends_with(".conf") {
|
||||
configs.push((path, contents));
|
||||
continue;
|
||||
}
|
||||
|
||||
config.load_file(&path, &contents).unwrap();
|
||||
}
|
||||
|
||||
for (path, contents) in configs {
|
||||
config.load_file(&path, &contents).unwrap();
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
@ -1,3 +1,10 @@
|
||||
extern crate async_std;
|
||||
extern crate async_macros;
|
||||
#[macro_use]
|
||||
extern crate async_trait;
|
||||
|
||||
pub mod registry;
|
||||
pub mod config;
|
||||
pub mod unit;
|
||||
pub mod time;
|
||||
pub mod utils;
|
@ -0,0 +1,146 @@
|
||||
use crate::unit::{UnitHandle, Unit};
|
||||
use std::collections::{HashMap, VecDeque, HashSet};
|
||||
use crate::config::loader::Loader;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct DependencyTree {
|
||||
known: HashSet<String>,
|
||||
dependents: HashMap<String, HashSet<String>>,
|
||||
dependencies: HashMap<String, HashSet<String>>,
|
||||
}
|
||||
|
||||
impl DependencyTree {
|
||||
pub fn add_owner(&mut self, owner: String) {
|
||||
self.known.insert(owner);
|
||||
}
|
||||
|
||||
pub fn add_dependency(&mut self, owner: String, dependency: String) {
|
||||
if owner == dependency {
|
||||
return;
|
||||
}
|
||||
|
||||
self.dependencies
|
||||
.entry(owner.clone())
|
||||
.or_default()
|
||||
.insert(dependency.clone());
|
||||
|
||||
self.dependents
|
||||
.entry(dependency.clone())
|
||||
.or_default()
|
||||
.insert(owner.clone());
|
||||
|
||||
self.known.insert(dependency);
|
||||
self.known.insert(owner);
|
||||
}
|
||||
|
||||
/// Gets the bottom of the dependency tree
|
||||
/// These are the items -without- dependencies
|
||||
pub fn get_bottom(&self) -> Vec<String> {
|
||||
self
|
||||
.known
|
||||
.iter()
|
||||
.filter(|item| !self.dependencies.get(*item).map(|l| l.len() == 0).unwrap_or(true))
|
||||
.map(|item| item.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Gets the top of the dependency tree
|
||||
/// These are the items -without- dependents
|
||||
pub fn get_top(&self) -> Vec<String> {
|
||||
self
|
||||
.known
|
||||
.iter()
|
||||
.filter(|item| self.dependents.get(*item).map(|l| l.len() == 0).unwrap_or(true))
|
||||
.map(|item| item.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn get_dependencies(&self, item: &str) -> Vec<String> {
|
||||
self
|
||||
.dependencies
|
||||
.get(item)
|
||||
.map(|set| set.iter().map(|x| x.clone()).collect::<Vec<_>>())
|
||||
.unwrap_or(Vec::new())
|
||||
}
|
||||
|
||||
pub fn get_depedents(&self, item: &str) -> Vec<String> {
|
||||
self
|
||||
.dependents
|
||||
.get(item)
|
||||
.map(|set| set.iter().map(|x| x.clone()).collect::<Vec<_>>())
|
||||
.unwrap_or(Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Registry {
|
||||
loader: Loader,
|
||||
units: HashMap<String, UnitHandle>,
|
||||
}
|
||||
|
||||
impl Registry {
|
||||
pub fn with_loader(loader: Loader) -> Registry {
|
||||
Registry {
|
||||
loader,
|
||||
units: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_dependency_tree(&mut self, unit_name: &str) -> DependencyTree {
|
||||
let mut queue = VecDeque::new();
|
||||
let mut done = HashSet::new();
|
||||
let mut dependencies: DependencyTree = Default::default();
|
||||
|
||||
queue.push_back(unit_name.to_string());
|
||||
|
||||
while let Some(item) = queue.pop_front() {
|
||||
let unit = if let Some(unit) = self.load_unit(&item).await {
|
||||
unit
|
||||
} else {
|
||||
done.insert(item);
|
||||
continue;
|
||||
};
|
||||
|
||||
for dep in &unit.wants {
|
||||
if done.contains(dep) {
|
||||
continue;
|
||||
}
|
||||
|
||||
queue.push_back(dep.clone());
|
||||
}
|
||||
|
||||
for dep in &unit.requires {
|
||||
if done.contains(dep) {
|
||||
continue;
|
||||
}
|
||||
|
||||
queue.push_back(dep.clone());
|
||||
}
|
||||
|
||||
for before in &unit.before {
|
||||
dependencies.add_dependency(before.clone(), unit.name.clone());
|
||||
}
|
||||
|
||||
for after in &unit.after {
|
||||
dependencies.add_dependency(unit.name.clone(), after.clone());
|
||||
}
|
||||
}
|
||||
|
||||
dependencies
|
||||
}
|
||||
|
||||
pub async fn load_unit(&mut self, unit_name: &str) -> Option<&Unit> {
|
||||
let config = self
|
||||
.units
|
||||
.entry(unit_name.to_string())
|
||||
.or_insert_with(|| UnitHandle::unloaded(unit_name));
|
||||
|
||||
if !config.is_loaded() {
|
||||
if let Some(unit) = self.loader.load_unit(unit_name).await {
|
||||
config.update(unit);
|
||||
}
|
||||
}
|
||||
|
||||
config.get_config()
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
use std::future::Future;
|
||||
use async_macros::utils::poll_fn;
|
||||
use std::task::{Context, Poll, Waker};
|
||||
use std::pin::Pin;
|
||||
use async_macros::MaybeDone;
|
||||
use async_std::stream::Stream;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Mutex;
|
||||
use async_std::sync::Arc;
|
||||
|
||||
#[async_trait]
|
||||
pub trait IntoResults<T: Send> {
|
||||
async fn into_results<'a>(self) -> T where Self: 'a, T: 'a;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<O: Send, F: Future<Output=O> + Send> IntoResults<Vec<O>> for Vec<F> {
|
||||
async fn into_results<'a>(self) -> Vec<O> where Self: 'a, O: 'a {
|
||||
let mut futures: Vec<MaybeDone<F>> = self.into_iter().map(MaybeDone::new).collect();
|
||||
return poll_fn(|cx: &mut Context<'_>| -> Poll<Vec<O>> {
|
||||
let mut ready = true;
|
||||
|
||||
for future in &mut futures {
|
||||
let fut = unsafe { Pin::new_unchecked(future) };
|
||||
ready &= Future::poll(fut, cx).is_ready();
|
||||
}
|
||||
|
||||
if ready {
|
||||
let mut results = Vec::new();
|
||||
for future in &mut futures {
|
||||
let fut = unsafe { Pin::new_unchecked(future) };
|
||||
results.push(fut.take().unwrap());
|
||||
}
|
||||
|
||||
Poll::Ready(results)
|
||||
} else {
|
||||
Poll::Pending
|
||||
}
|
||||
}).await;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AsyncQueue<T>(Arc<Mutex<AsyncQueueState<T>>>);
|
||||
|
||||
impl<T> AsyncQueue<T> {
|
||||
pub fn push(&mut self, value: T) {
|
||||
let mut res = self.0.lock().unwrap();
|
||||
res.queue.push_back(value);
|
||||
if let Some(waker) = &res.waker {
|
||||
waker.wake_by_ref();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close(&mut self) {
|
||||
let mut res = self.0.lock().unwrap();
|
||||
res.closed = true;
|
||||
if let Some(waker) = &res.waker {
|
||||
waker.wake_by_ref();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new() -> AsyncQueue<T> {
|
||||
AsyncQueue(Arc::new(Mutex::new(AsyncQueueState {
|
||||
closed: false,
|
||||
waker: None,
|
||||
queue: VecDeque::new(),
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct AsyncQueueState<T> {
|
||||
closed: bool,
|
||||
waker: Option<Waker>,
|
||||
queue: VecDeque<T>,
|
||||
}
|
||||
|
||||
impl<T> Stream for AsyncQueue<T> {
|
||||
type Item = T;
|
||||
|
||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<T>> {
|
||||
if let Ok(mut res) = self.0.lock() {
|
||||
res.waker = Some(cx.waker().clone());
|
||||
if let Some(data) = res.queue.pop_front() {
|
||||
return Poll::Ready(Some(data));
|
||||
}
|
||||
|
||||
if res.closed {
|
||||
return Poll::Ready(None);
|
||||
}
|
||||
}
|
||||
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod asyn;
|
Loading…
Reference in New Issue