diff --git a/Cargo.lock b/Cargo.lock index 951551847..4252ae67a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "adler32" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -36,7 +36,7 @@ dependencies = [ [[package]] name = "ahash" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "const-random 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -120,11 +120,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -148,12 +148,12 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitvec" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -172,7 +172,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "cfg-if" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -260,7 +260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -273,7 +273,7 @@ name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -291,7 +291,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "const-random-macro 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -299,8 +299,8 @@ name = "const-random-macro" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -322,7 +322,7 @@ name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -342,9 +342,9 @@ dependencies = [ "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -363,7 +363,7 @@ name = "crossbeam" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -394,7 +394,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (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.6.6 (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.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -414,7 +414,7 @@ name = "crossbeam-utils" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (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)", ] @@ -427,7 +427,7 @@ dependencies = [ "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -438,6 +438,15 @@ dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ctrlc" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "derivative" version = "1.0.3" @@ -453,7 +462,7 @@ name = "derive-new" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -501,7 +510,7 @@ name = "encoding_rs" version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -509,7 +518,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -543,7 +552,7 @@ version = "0.4.1" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -555,6 +564,7 @@ name = "feather-core" version = "0.4.1" dependencies = [ "aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "cfb8 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -564,17 +574,18 @@ dependencies = [ "feather-blocks 0.4.1", "feather-codegen 0.4.1", "feather-items 0.4.1", - "flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", "hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash32-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "hematite-nbt 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "multimap 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "nalgebra-glm 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -593,10 +604,10 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "simple_logger 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -622,12 +633,13 @@ name = "feather-server" version = "0.4.1" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitvec 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "derive_deref 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -640,6 +652,7 @@ dependencies = [ "hashbrown 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapless 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "hematite-nbt 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mojang-api 0.3.0 (git+https://github.com/caelunshun/mojang-api-rs?rev=6525e910ad53953fa16028f0fce74b1a19855733)", @@ -651,14 +664,14 @@ dependencies = [ "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand-legacy 0.1.0", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rsa 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rsa-der 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "simdeez 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "simdnoise 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -668,6 +681,7 @@ dependencies = [ "strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -692,12 +706,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.11" +version = "1.0.12" 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)", "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -729,7 +743,7 @@ name = "fuchsia-zircon" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -777,8 +791,8 @@ name = "futures-join-macro-preview" version = "0.3.0-alpha.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -801,8 +815,8 @@ name = "futures-select-macro-preview" version = "0.3.0-alpha.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -825,7 +839,7 @@ dependencies = [ "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.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)", - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -851,7 +865,7 @@ name = "getrandom" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -899,10 +913,10 @@ name = "hashbrown" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ahash 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "ahash 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -931,7 +945,7 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -967,6 +981,23 @@ name = "httparse" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hyper" version = "0.13.0-alpha.4" @@ -1022,7 +1053,7 @@ name = "indexmap" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1095,7 +1126,7 @@ name = "log" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1105,10 +1136,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "matrixmultiply" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1155,7 +1186,7 @@ name = "miniz_oxide" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1205,8 +1236,8 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.10.0-alpha.0 (git+https://github.com/seanmonstar/reqwest?rev=5b55aee1a9ddf785f82d9086c8befc50db268cb8)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1221,7 +1252,7 @@ name = "multimap" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1232,7 +1263,7 @@ dependencies = [ "alga 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", - "matrixmultiply 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1259,10 +1290,10 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1275,7 +1306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "alga 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "nalgebra 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1291,11 +1322,23 @@ name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nix" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -1414,15 +1457,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.24" +version = "0.10.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1432,7 +1475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.49" +version = "0.9.50" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1462,7 +1505,7 @@ name = "parking_lot_core" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "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.62 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1477,7 +1520,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1485,8 +1528,8 @@ name = "paste-impl" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1518,7 +1561,7 @@ name = "pin-project-internal" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1540,10 +1583,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro-hack" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1571,12 +1614,17 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.3" +version = "1.0.4" 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 = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.5.2" @@ -1598,7 +1646,7 @@ name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1633,7 +1681,7 @@ dependencies = [ [[package]] name = "rand" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1780,7 +1828,7 @@ dependencies = [ [[package]] name = "rawpointer" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1870,7 +1918,7 @@ dependencies = [ "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1902,7 +1950,7 @@ dependencies = [ "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1942,7 +1990,7 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1988,30 +2036,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2021,7 +2069,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2168,7 +2216,7 @@ dependencies = [ [[package]] name = "subtle" -version = "2.1.1" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2196,7 +2244,7 @@ name = "syn" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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)", ] @@ -2217,9 +2265,9 @@ name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2264,8 +2312,8 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2416,7 +2464,7 @@ name = "toml" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2438,16 +2486,16 @@ name = "tracing" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing-attributes 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-attributes" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2538,7 +2586,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2556,6 +2604,11 @@ name = "version_check" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "walkdir" version = "2.2.9" @@ -2585,7 +2638,7 @@ name = "wasm-bindgen" version = "0.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2597,7 +2650,7 @@ dependencies = [ "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2608,7 +2661,7 @@ name = "wasm-bindgen-futures" version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures-channel-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)", @@ -2632,7 +2685,7 @@ name = "wasm-bindgen-macro-support" version = "0.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2652,7 +2705,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.4 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2768,11 +2821,11 @@ dependencies = [ ] [metadata] -"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" "checksum aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" "checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" "checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" -"checksum ahash 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e96e12a0287c75063711e04484e9b140d4a59ec074d3fe5f0b1cc90e0e992665" +"checksum ahash 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b58aeefd9396419a4f4f2b9778f2d832a11851b55010e231c5390cf2b1c416b4" "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum alga 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d708cb68c7106ed1844de68f50f0157a7788c2909a6926fad5a87546ef6a4ff8" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" @@ -2783,11 +2836,11 @@ dependencies = [ "checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" -"checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2" +"checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum bitvec 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "461d7d0e952343f575470daeb04d38aad19675b4f170e122c6b5dd618612c8a8" +"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2" +"checksum bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a993f74b4c99c1908d156b8d2e0fb6277736b0ecbd833982fd1241d39b2766a6" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" "checksum bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" @@ -2798,7 +2851,7 @@ dependencies = [ "checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be" "checksum cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" "checksum cfb8 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1b310afa67a25a8d5189eacaf5b14418c8dc3d8bcc5755619d89cab87871260d" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c" "checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -2819,6 +2872,7 @@ dependencies = [ "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" +"checksum ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7dfd2d8b4c82121dfdff120f818e09fc4380b0b7e17a742081a89b94853e87f" "checksum derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "942ca430eef7a3806595a6737bc388bf51adb888d3fc0dd1b50f1c170167ee3a" "checksum derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9" "checksum derive_deref 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11554fdb0aa42363a442e0c4278f51c9621e20c1ce3bac51d79e60646f3b8b8f" @@ -2831,7 +2885,7 @@ dependencies = [ "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" -"checksum flate2 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaffba6388640136149e18ed080b77a78611c1e1d6de75aedcdf78df5d4682" +"checksum flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" @@ -2862,6 +2916,8 @@ dependencies = [ "checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4" "checksum http-body 0.2.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f3aef6f3de2bd8585f5b366f3f550b5774500b4764d00cf00f903c95749eec3" "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +"checksum humantime-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f59e8a805c18bc9ded3f4e596cb5f0157d88a235e875480a7593b5926f95065" "checksum hyper 0.13.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2d05aa523087ac0b9d8b93dd80d5d482a697308ed3b0dca7b0667511a7fa7cdc" "checksum hyper-tls 0.4.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "47cb3975f80cc809efe5dfcc52b73c9b281fde33f2df35a2e5f79f35e384ae7f" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" @@ -2877,7 +2933,7 @@ dependencies = [ "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum matrixmultiply 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfed72d871629daa12b25af198f110e8095d7650f5f4c61c5bac28364604f9b" +"checksum matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf" @@ -2895,6 +2951,7 @@ dependencies = [ "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" "checksum ncollide3d 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ee57cac70a2892e89fab7d5fd295b0ad544d1f877fa70fe8ae4be477514dd61" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f9c3f34cdd24f334cb265d9bf8bfa8a241920d026916785747a92f0e55541a1a" @@ -2908,9 +2965,9 @@ dependencies = [ "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" -"checksum openssl 0.10.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8152bb5a9b5b721538462336e3bef9a539f892715e5037fda0f984577311af15" +"checksum openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2f372b2b53ce10fb823a337aaa674e3a7d072b957c6264d0f4ff0bd86e657449" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fad9e54bd23bd4cbbe48fdc08a1b8091707ac869ef8508edea2fec77dcc884" +"checksum openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)" = "2c42dcccb832556b5926bc9ae61e8775f2a61e725ab07ab3d1e7fcf8ae62c3b6" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "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" @@ -2923,17 +2980,18 @@ dependencies = [ "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" -"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8" +"checksum proc-macro-hack 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "114cdf1f426eb7f550f01af5f53a33c0946156f6814aec939b3bd77e844f9a9d" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8" +"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -"checksum rand 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "59cea0d944b32347a1863e95942fd6ebdb486afb4f038119494f2860380c1d51" +"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" @@ -2949,7 +3007,7 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" "checksum rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e18c91676f670f6f0312764c759405f13afb98d5d73819840cf72a518487bff" -"checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" +"checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" "checksum rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83a27732a533a1be0a0035a111fe76db89ad312f6f0347004c220c57f209a123" "checksum rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98dcf634205083b17d0861252431eb2acbfb698ab7478a2d20de07954f47ec7b" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" @@ -2966,15 +3024,15 @@ dependencies = [ "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" +"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eee63d0f4a9ec776eeb30e220f0bc1e092c3ad744b2a379e3993070364d3adc2" "checksum security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9636f8989cbf61385ae4824b98c1aaa54c994d7d8b41f11c601ed799f0549a56" "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 serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "f4473e8506b213730ff2061073b48fa51dcc66349219e2e7c5608f0296a1d95a" -"checksum serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "11e410fde43e157d789fc290d26bc940778ad0fdd47836426fbac36573710dbb" -"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" +"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" +"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" +"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum shred 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d15d46c92f8c0aed110a132f3c68a8cdd390048f51fa547c89dc571ba1e01191" @@ -2995,7 +3053,7 @@ dependencies = [ "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1c33039533f051704951680f1adfd468fd37ac46816ded0d9ee068e60f05f" "checksum strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47cd23f5c7dee395a00fa20135e2ec0fffcdfa151c56182966d7a3261343432e" -"checksum subtle 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "01f40907d9ffc762709e4ff3eb4a6f6b41b650375a3f09ac92b641942b7fb082" +"checksum subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3af2eb31c42e8f0ccf43548232556c42737e01a96db6e1777b0be108e79799" "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" @@ -3020,7 +3078,7 @@ dependencies = [ "checksum tower-make 0.3.0-alpha.2a (registry+https://github.com/rust-lang/crates.io-index)" = "316d47dd40cde4ac5d88110eaf9a10a4e2a68612d9c056cd2aa24e37dcb484cd" "checksum tower-service 0.3.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "63ff37396cd966ce43bea418bfa339f802857495f797dafa00bea5b7221ebdfa" "checksum tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c21ff9457accc293386c20e8f754d0b059e67e325edf2284f04230d125d7e5ff" -"checksum tracing-attributes 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5e27d1065a1de5d8ad2637e41fe14d3cd14363d4a20cb99090b9012004955637" +"checksum tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff978fd9c9afe2cc9c671e247713421c6406b3422305cbdce5de695d3ab4c3c" "checksum tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "528c8ebaaa16cdac34795180b046c031775b0d56402704d98c096788f33d646a" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum tuple_utils 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44834418e2c5b16f47bedf35c28e148db099187dd5feee6367fb2525863af4f1" @@ -3037,6 +3095,7 @@ dependencies = [ "checksum vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" "checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" diff --git a/core/Cargo.toml b/core/Cargo.toml index 59be6c3f8..a208a1957 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -31,4 +31,6 @@ hash32-derive = "0.1.0" strum = "0.15.0" strum_macros = "0.15.0" tokio = "=0.2.0-alpha.6" -failure = "0.1.5" \ No newline at end of file +failure = "0.1.5" +bitvec = "0.15.2" +multimap = "0.6.0" diff --git a/core/src/inventory.rs b/core/src/inventory.rs index b8eb23ba5..cb5ec2714 100644 --- a/core/src/inventory.rs +++ b/core/src/inventory.rs @@ -261,6 +261,11 @@ impl Inventory { pub fn slot_count(&self) -> u16 { self.items.len() as u16 } + + /// Returns a reference to this inventory's items. + pub fn items(&self) -> &[Option] { + &self.items + } } /// Represents an item stack. diff --git a/core/src/save/entity.rs b/core/src/save/entity.rs index 809ad0bf4..ea2c848c6 100644 --- a/core/src/save/entity.rs +++ b/core/src/save/entity.rs @@ -1,4 +1,6 @@ use crate::Position; +use nbt::Value; +use std::collections::HashMap; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "id")] @@ -13,6 +15,32 @@ pub enum EntityData { Unknown, } +impl EntityData { + pub fn into_nbt_value(self) -> Value { + let mut map = HashMap::new(); + + map.insert( + String::from("id"), + Value::String( + match self { + EntityData::Item(_) => "minecraft:item", + EntityData::Arrow(_) => "minecraft:arrow", + EntityData::Unknown => panic!("Cannot write unknown entities"), + } + .to_string(), + ), + ); + + match self { + EntityData::Item(data) => data.write_to_map(&mut map), + EntityData::Arrow(data) => data.write_to_map(&mut map), + EntityData::Unknown => panic!("Cannot write unknown entities"), + } + + Value::Compound(map) + } +} + /// Common entity tags. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct BaseEntityData { @@ -24,6 +52,23 @@ pub struct BaseEntityData { pub velocity: Vec, } +impl BaseEntityData { + fn write_to_map(self, map: &mut HashMap) { + map.insert( + String::from("Pos"), + Value::List(self.position.into_iter().map(Value::Double).collect()), + ); + map.insert( + String::from("Rotation"), + Value::List(self.rotation.into_iter().map(Value::Float).collect()), + ); + map.insert( + String::from("Motion"), + Value::List(self.velocity.into_iter().map(Value::Double).collect()), + ); + } +} + impl BaseEntityData { /// Reads the position and rotation fields. If the fields are invalid, None is returned. pub fn read_position(self: &BaseEntityData) -> Option { @@ -74,6 +119,13 @@ pub struct ItemData { pub item: String, } +impl ItemData { + fn write_to_map(self, map: &mut HashMap) { + map.insert(String::from("Count"), Value::Byte(self.count as i8)); + map.insert(String::from("id"), Value::String(self.item)); + } +} + /// Data for an Item entity (`minecraft:item`). #[derive(Clone, Default, Serialize, Deserialize, Debug)] pub struct ItemEntityData { @@ -90,6 +142,22 @@ pub struct ItemEntityData { pub item: ItemData, } +impl ItemEntityData { + fn write_to_map(self, map: &mut HashMap) { + self.entity.write_to_map(map); + + let mut item = HashMap::new(); + self.item.write_to_map(&mut item); + map.insert(String::from("Item"), Value::Compound(item)); + + map.insert(String::from("Age"), Value::Short(self.age)); + map.insert( + String::from("PickupDelay"), + Value::Byte(self.pickup_delay as i8), + ); + } +} + /// Data for an Arrow entity (`minecraft:arrow`). #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct ArrowEntityData { @@ -105,6 +173,14 @@ pub struct ArrowEntityData { pub critical: u8, } +impl ArrowEntityData { + fn write_to_map(self, map: &mut HashMap) { + self.entity.write_to_map(map); + + map.insert(String::from("crit"), Value::Byte(self.critical as i8)); + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/core/src/save/player_data.rs b/core/src/save/player_data.rs index 921d158ae..ca331ce2c 100644 --- a/core/src/save/player_data.rs +++ b/core/src/save/player_data.rs @@ -1,11 +1,15 @@ use std::fs::File; use crate::entity::BaseEntityData; -use crate::inventory::SlotIndex; +use crate::inventory::{ + SlotIndex, HOTBAR_SIZE, INVENTORY_SIZE, SLOT_ARMOR_MAX, SLOT_ARMOR_MIN, SLOT_HOTBAR_OFFSET, + SLOT_INVENTORY_OFFSET, SLOT_OFFHAND, +}; use crate::ItemStack; use feather_items::Item; -use std::io::Read; -use std::path::Path; +use std::fs; +use std::io::{Read, Write}; +use std::path::{Path, PathBuf}; use uuid::Uuid; /// Represents the contents of a player data file. @@ -22,7 +26,7 @@ pub struct PlayerData { } /// Represents a single inventory slot (including position index). -#[derive(Default, Debug, Clone, Serialize, Deserialize)] +#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct InventorySlot { #[serde(rename = "Count")] pub count: i8, @@ -41,6 +45,31 @@ impl InventorySlot { } } + /// Converts a network protocol index, item, and count + /// to an `InventorySlot`. + pub fn from_network_index(network: SlotIndex, stack: ItemStack) -> Self { + let slot = if SLOT_HOTBAR_OFFSET <= network && network < SLOT_HOTBAR_OFFSET + HOTBAR_SIZE { + // Hotbar + (network - SLOT_HOTBAR_OFFSET) as i8 + } else if network == SLOT_OFFHAND { + -106 + } else if SLOT_ARMOR_MIN <= network && network <= SLOT_ARMOR_MAX { + ((SLOT_ARMOR_MAX - network) + 100) as i8 + } else if SLOT_INVENTORY_OFFSET <= network + && network < SLOT_INVENTORY_OFFSET + INVENTORY_SIZE + { + network as i8 + } else { + panic!("Invalid slot index {} on server", network); + }; + + Self { + count: stack.amount as i8, + slot, + item: stack.ty.identifier().to_string(), + } + } + /// Converts an NBT inventory index to a network protocol index. /// Returns None if the index is invalid. pub fn convert_index(&self) -> Option { @@ -68,12 +97,27 @@ fn load_from_file(reader: R) -> Result { } pub fn load_player_data(world_dir: &Path, uuid: Uuid) -> Result { - let file_path = world_dir.join("playerdata").join(format!("{}.dat", uuid)); + let file_path = file_path(world_dir, uuid); let file = File::open(file_path)?; let data = load_from_file(file)?; Ok(data) } +fn save_to_file(mut writer: W, data: PlayerData) -> Result<(), nbt::Error> { + nbt::to_gzip_writer(&mut writer, &data, None) +} + +pub fn save_player_data(world_dir: &Path, uuid: Uuid, data: PlayerData) -> Result<(), nbt::Error> { + fs::create_dir_all(world_dir.join("playerdata"))?; + let file_path = file_path(world_dir, uuid); + let file = File::create(file_path)?; + save_to_file(file, data) +} + +fn file_path(world_dir: &Path, uuid: Uuid) -> PathBuf { + world_dir.join("playerdata").join(format!("{}.dat", uuid)) +} + #[cfg(test)] mod tests { use super::*; @@ -135,14 +179,20 @@ mod tests { map.insert(x, x as usize); } + dbg!(map.clone()); + // Check all valid slots for (src, expected) in map { let slot = InventorySlot { slot: src, count: 1, - item: String::from("invalid:identifier"), + item: String::from(Item::Stone.identifier()), }; assert_eq!(slot.convert_index().unwrap(), expected); + assert_eq!( + InventorySlot::from_network_index(expected, ItemStack::new(Item::Stone, 1)), + slot + ); } // Check that invalid slots error out diff --git a/core/src/save/region/blob.rs b/core/src/save/region/blob.rs new file mode 100644 index 000000000..9bb03b988 --- /dev/null +++ b/core/src/save/region/blob.rs @@ -0,0 +1,171 @@ +//! Conversion of `ChunkRoot` to `nbt::Blob`. +//! This is required due to https://github.com/PistonDevelopers/hematite_nbt/issues/27. + +use super::ChunkLevel; +use super::{ChunkRoot, LevelSection}; +use nbt::{Blob, Value}; +use std::collections::HashMap; + +pub fn chunk_root_to_blob(root: ChunkRoot) -> Blob { + let mut blob = Blob::new(); + blob.insert("DataVersion", root.data_version).unwrap(); + + blob.insert("Level", level_to_value(root.level)).unwrap(); + + blob +} + +fn level_to_value(level: ChunkLevel) -> Value { + let mut map = HashMap::new(); + + map.insert(String::from("xPos"), Value::Int(level.x_pos)); + map.insert(String::from("zPos"), Value::Int(level.z_pos)); + map.insert(String::from("LastUpdate"), Value::Long(0)); // TODO + map.insert(String::from("InhabitedTime"), Value::Long(0)); // TODO + map.insert(String::from("Biomes"), Value::IntArray(level.biomes)); + + let mut hmaps = HashMap::new(); + hmaps.insert( + String::from("MOTION_BLOCKING"), + Value::LongArray(vec![0; 32]), + ); // TODO + hmaps.insert( + String::from("MOTION_BLOCKING_NO_LEAVES"), + Value::LongArray(vec![0; 32]), + ); // TODO + hmaps.insert(String::from("OCEAN_FLOOR"), Value::LongArray(vec![0; 32])); // TODO + hmaps.insert( + String::from("OCEAN_FLOOR_WG"), + Value::LongArray(vec![0; 32]), + ); // TODO + hmaps.insert(String::from("WORLD_SURFACE"), Value::LongArray(vec![0; 32])); // TODO + hmaps.insert( + String::from("WORLD_SURFACE_WG"), + Value::LongArray(vec![0; 32]), + ); // TODO + map.insert(String::from("Heightmaps"), Value::Compound(hmaps)); + + let sections = level.sections.into_iter().map(section_to_value).collect(); + map.insert(String::from("Sections"), Value::List(sections)); + + map.insert(String::from("TileEntities"), Value::List(vec![])); // TODO + map.insert(String::from("ToBeTicked"), Value::List(vec![])); // TODO + + let mut liquids_to_be_ticked = vec![]; + (0..16).for_each(|_| liquids_to_be_ticked.push(Value::List(vec![]))); + map.insert( + String::from("LiquidsToBeTicked"), + Value::List(liquids_to_be_ticked), + ); + + let mut tile_ticks = vec![]; + (0..16).for_each(|_| tile_ticks.push(Value::List(vec![]))); + map.insert(String::from("TileTicks"), Value::List(tile_ticks)); + + let mut post_processing = vec![]; + (0..16).for_each(|_| post_processing.push(Value::List(vec![]))); + map.insert(String::from("PostProcessing"), Value::List(post_processing)); + + map.insert(String::from("LiquidTicks"), Value::List(vec![])); + + let mut structures = HashMap::new(); + + { + let mut references = HashMap::new(); + references.insert(String::from("EndCity"), Value::LongArray(vec![])); + references.insert(String::from("Fortress"), Value::LongArray(vec![])); + references.insert(String::from("Monument"), Value::LongArray(vec![])); + references.insert(String::from("Stronghold"), Value::LongArray(vec![])); + references.insert(String::from("Swamp_Hut"), Value::LongArray(vec![])); + + structures.insert(String::from("References"), Value::Compound(references)); + structures.insert(String::from("Starts"), Value::Compound(HashMap::new())); + } + + map.insert( + String::from("Status"), + Value::String(String::from("postprocessed")), + ); + + // Entities + let mut entities = Vec::with_capacity(level.entities.len()); + level.entities.into_iter().for_each(|entity| { + entities.push(entity.into_nbt_value()); + }); + + map.insert(String::from("Entities"), Value::List(entities)); + + Value::Compound(map) +} + +fn section_to_value(section: LevelSection) -> Value { + let mut map = HashMap::new(); + + map.insert(String::from("Y"), Value::Byte(section.y)); + map.insert( + String::from("BlockLight"), + Value::ByteArray(section.block_light), + ); + map.insert( + String::from("SkyLight"), + Value::ByteArray(section.sky_light), + ); + map.insert( + String::from("BlockStates"), + Value::LongArray(section.states), + ); + + let mut entries = vec![]; + for entry in section.palette { + let mut map = HashMap::new(); + map.insert(String::from("Name"), Value::String(entry.name)); + + if let Some(props) = entry.props { + let mut props_map = HashMap::new(); + props.props.into_iter().for_each(|(name, value)| { + props_map.insert(name, Value::String(value)); + }); + map.insert(String::from("Properties"), Value::Compound(props_map)); + } + + entries.push(Value::Compound(map)) + } + + map.insert(String::from("Palette"), Value::List(entries)); + + Value::Compound(map) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::region::DATA_VERSION; + use std::io::Cursor; + + #[test] + fn test_to_blob_roundtrip() { + let root = ChunkRoot { + data_version: DATA_VERSION, + level: ChunkLevel { + x_pos: 0, + z_pos: 0, + sections: vec![LevelSection { + y: 0, + states: vec![0], + palette: vec![], + block_light: vec![0], + sky_light: vec![0], + }], + biomes: vec![10], + entities: vec![], + }, + }; + + let blob = chunk_root_to_blob(root); + + let mut buf = vec![]; + blob.to_writer(&mut buf).unwrap(); + + let _: ChunkRoot = nbt::from_reader(Cursor::new(&buf)).unwrap(); + } +} diff --git a/core/src/save/region.rs b/core/src/save/region/mod.rs similarity index 50% rename from core/src/save/region.rs rename to core/src/save/region/mod.rs index a95b587ec..b471652c1 100644 --- a/core/src/save/region.rs +++ b/core/src/save/region/mod.rs @@ -3,13 +3,13 @@ use std::collections::HashMap; use std::fmt::{self, Display, Formatter}; -use std::fs::File; -use std::io; +use std::fs::{File, OpenOptions}; use std::io::prelude::*; use std::io::{Cursor, SeekFrom}; use std::path::PathBuf; +use std::{fs, io, iter}; -use byteorder::{BigEndian, ReadBytesExt}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use serde::Deserialize; use crate::save::entity::EntityData; @@ -17,6 +17,11 @@ use crate::world::block::*; use crate::world::chunk::{BitArray, Chunk, ChunkSection}; use crate::world::ChunkPosition; use crate::Biome; +use bitvec::bitvec; +use bitvec::vec::BitVec; +use feather_blocks::Block; + +mod blob; /// The length and width of a region, in chunks. const REGION_SIZE: usize = 32; @@ -25,9 +30,12 @@ const REGION_SIZE: usize = 32; /// to 1.13.2. const DATA_VERSION: i32 = 1631; +/// Length, in bytes, of a sector. +const SECTOR_BYTES: usize = 4096; + /// Represents the data for a chunk after the "Chunk [x, y]" tag. #[derive(Serialize, Deserialize, Debug)] -struct ChunkRoot { +pub struct ChunkRoot { #[serde(rename = "Level")] level: ChunkLevel, #[serde(rename = "DataVersion")] @@ -36,7 +44,7 @@ struct ChunkRoot { /// Represents the level data for a chunk. #[derive(Serialize, Deserialize, Debug)] -struct ChunkLevel { +pub struct ChunkLevel { // TODO heightmaps, etc. #[serde(rename = "xPos")] x_pos: i32, @@ -52,7 +60,7 @@ struct ChunkLevel { /// Represents a chunk section in a region file. #[derive(Serialize, Deserialize, Debug)] -struct LevelSection { +pub struct LevelSection { #[serde(rename = "Y")] y: i8, #[serde(rename = "BlockStates")] @@ -67,7 +75,7 @@ struct LevelSection { /// Represents a palette entry in a region file. #[derive(Serialize, Deserialize, Debug)] -struct LevelPaletteEntry { +pub struct LevelPaletteEntry { /// The identifier of the type of this block #[serde(rename = "Name")] name: String, @@ -78,18 +86,29 @@ struct LevelPaletteEntry { /// Represents the proprties for a palette entry. #[derive(Serialize, Deserialize, Debug)] -struct LevelProperties { +pub struct LevelProperties { /// Map containing a list of property names to values. #[serde(flatten)] props: HashMap, } +/// A block of sectors in a region file. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct SectorBlock { + /// Offset, in sectors, from the start of the file (beginning of the header.) + offset: u32, + /// Number of sectors in this block. Each sector is 4KiB. + count: u32, +} + /// A region file handle. pub struct RegionHandle { /// The region file. file: File, /// The region file's header, pre-loaded into memory. header: RegionHeader, + /// Sector allocator to allocate sectors where we can store chunks. + allocator: SectorAllocator, } impl RegionHandle { @@ -112,7 +131,7 @@ impl RegionHandle { // Get the offset of the chunk within the file // so that it can be read. - let offset = self.header.location_for_chunk(pos).offset; + let offset = self.header.location_for_chunk(pos).0.offset; // If the chunk doesn't exist, return early if !self.header.location_for_chunk(pos).exists() { @@ -120,10 +139,10 @@ impl RegionHandle { } // Seek to the offset position. Note that since the offset in the header - // is in "sectors" of 4KiB each, the value needs to be multiplied by 4096 + // is in "sectors" of 4KiB each, the value needs to be multiplied by SECTOR_BYTES // to get the offset in bytes. self.file - .seek(SeekFrom::Start(u64::from(offset) * 4096)) + .seek(SeekFrom::Start(u64::from(offset) * SECTOR_BYTES as u64)) .map_err(Error::Io)?; // A chunk begins with a four-byte, big-endian value @@ -181,8 +200,78 @@ impl RegionHandle { Biome::from_protocol_id(id).ok_or_else(|| Error::InvalidBiomeId(id))?; } + // Chunk was not modified, but it thinks it was: disable this + chunk.check_modified(); + Ok((chunk, level.entities.to_vec())) } + + /// Saves the given chunk to this region file. The header will be updated + /// accordingly and saved as well. + /// + /// Behavior may be unexpected if this region file does not contain the given + /// chunk position. + pub fn save_chunk(&mut self, chunk: &Chunk, entities: Vec) -> Result<(), Error> { + let chunk_pos = chunk.position(); + + let (local_x, local_z) = (chunk_pos.x % 32, chunk_pos.z % 32); + + // Find position in header and deallocate it if it currently exists. + let location = self + .header + .location_for_chunk(ChunkPosition::new(local_x, local_z)); + if location.exists() { + self.allocator.free(location.0); + } + + // Write chunk to `ChunkRoot` tag. + let root = chunk_to_chunk_root(chunk, entities); + + let blob = blob::chunk_root_to_blob(root); + + // Write to intermediate buffer, because we need to know the length. + let mut buf = Vec::with_capacity(4096); + buf.write_u8(2).map_err(Error::Io)?; // Compression type: zlib + + blob.to_zlib_writer(&mut buf) + .expect("Could not write chunk blob"); + + let total_len = buf.len() + 4; // 4 bytes for length header + + let sectors = (total_len + SECTOR_BYTES - 1) / SECTOR_BYTES; + + let block = self.allocator.allocate(sectors as u32); + + // Write to file + self.file + .seek(SeekFrom::Start(block.offset as u64 * SECTOR_BYTES as u64)) + .map_err(Error::Io)?; + + self.file + .write_u32::(buf.len() as u32) + .map_err(Error::Io)?; + self.file.write_all(&buf).map_err(Error::Io)?; + + // Write padding to align to sector count + let padding_count = SECTOR_BYTES - total_len % SECTOR_BYTES; + + for _ in 0..padding_count { + self.file.write_u8(0).map_err(Error::Io)?; + } + + // Update header + self.header + .set_location_for_chunk(ChunkPosition::new(local_x, local_z), ChunkLocation(block)); + self.save_header().map_err(Error::Io)?; + + Ok(()) + } + + fn save_header(&mut self) -> Result<(), io::Error> { + self.file.seek(SeekFrom::Start(0))?; + + self.header.write_to(&mut self.file) + } } fn read_section_into_chunk(section: &LevelSection, chunk: &mut Chunk) -> Result<(), Error> { @@ -257,6 +346,164 @@ fn read_section_into_chunk(section: &LevelSection, chunk: &mut Chunk) -> Result< Ok(()) } +fn chunk_to_chunk_root(chunk: &Chunk, entities: Vec) -> ChunkRoot { + ChunkRoot { + level: ChunkLevel { + x_pos: chunk.position().x, + z_pos: chunk.position().z, + sections: chunk + .sections() + .iter() + .enumerate() + .filter_map(|(y, sec)| sec.map(|sec| (y, sec.clone()))) + .map(|(y, mut section)| { + let palette = convert_palette(&mut section); + LevelSection { + y: y as i8, + states: section.data().inner().iter().map(|x| *x as i64).collect(), + palette, + block_light: slice_u64_to_i8(section.block_light().inner()).to_vec(), + sky_light: slice_u64_to_i8(section.sky_light().inner()).to_vec(), + } + }) + .collect(), + biomes: chunk + .biomes() + .iter() + .map(|biome| biome.protocol_id()) + .collect(), + entities, + }, + data_version: DATA_VERSION, + } +} + +fn convert_palette(section: &mut ChunkSection) -> Vec { + section.convert_palette_to_section(); + raw_palette_to_palette_entries(section.palette().unwrap()) +} + +fn raw_palette_to_palette_entries(palette: &[u16]) -> Vec { + palette + .iter() + .map(|id| { + let block = Block::from_native_state_id(*id).unwrap(); + + let (name, props) = block.to_name_and_props(); + + let mut prop_map = HashMap::new(); + props.into_iter().for_each(|(name, value)| { + prop_map.insert(name.to_string(), value); + }); + + LevelPaletteEntry { + name: name.to_string(), + props: Some(LevelProperties { props: prop_map }), + } + }) + .collect() +} + +fn slice_u64_to_i8(input: &[u64]) -> &[i8] { + // TODO: someone should check this isn't undefined behavior. + // Pretty sure the alignment check makes this sound, + // but I'm not certain. + let (head, body, tail) = unsafe { input.align_to::() }; + + // Ensure that alignment is correct + assert!(head.is_empty()); + assert!(tail.is_empty()); + + body +} + +/// An allocator for sectors. +struct SectorAllocator { + /// Vector of bits, with a bit set for each sector which is in use. + /// + /// TODO: use a more efficient allocation model, such as a `LinkedList` + /// of free blocks. + used_sectors: BitVec, +} + +impl SectorAllocator { + /// Creates a `SectorAllocator` from the given file header + /// and total file size __in sectors.__ + pub fn new(header: &RegionHeader, file_size: u32) -> Self { + let mut used_sectors = bitvec![0; file_size as usize]; + + // Detect used sectors + for chunk_location in &header.locations { + if !chunk_location.exists() { + continue; + } + + let offset = chunk_location.0.offset; + let count = chunk_location.0.count; + (offset..offset + count).for_each(|sector| used_sectors.set(sector as usize, true)); + } + + // Allocate two sectors at start for header + used_sectors.set(0, true); + used_sectors.set(1, true); + + Self { used_sectors } + } + + /// Frees the given block from this allocator. + pub fn free(&mut self, block: SectorBlock) { + (block.offset..block.offset + block.count) + .for_each(|sector| self.used_sectors.set(sector as usize, false)); + } + + /// Allocates a block of sectors with the given + /// minimum size __in sectors__. + /// + /// The returned block may + /// stretch past the end of the file. + pub fn allocate(&mut self, min_size: u32) -> SectorBlock { + // TODO: fairly inefficient way to do this. + let mut start = 0; + let mut length = 0; + + for (index, is_used) in self.used_sectors.iter().enumerate() { + if is_used { + start = 0; + length = 0; + } else { + if start == 0 { + start = index; + } + length += 1; + + if length >= min_size { + let block = SectorBlock { + offset: start as u32, + count: length as u32, + }; + + (block.offset..block.offset + block.count) + .for_each(|sector| self.used_sectors.set(sector as usize, true)); + + return block; + } + } + } + + // No sector found: must allocate into end + + let block = SectorBlock { + offset: self.used_sectors.len() as u32, + count: min_size, + }; + + self.used_sectors + .extend(iter::repeat(true).take(min_size as usize)); + + block + } +} + /// An error which occurred during region file processing. #[derive(Debug)] pub enum Error { @@ -325,15 +572,76 @@ impl std::error::Error for Error {} /// header so that chunks can be retrieved later. pub fn load_region(dir: &PathBuf, pos: RegionPosition) -> Result { let mut file = { - let mut buf = dir.clone(); - buf.push(format!("region/r.{}.{}.mca", pos.x, pos.z)); + let buf = region_file_path(dir, pos); - File::open(buf.as_path()).map_err(Error::Io)? + open_opts() + .create(false) + .open(buf.as_path()) + .map_err(Error::Io)? }; let header = read_header(&mut file)?; - Ok(RegionHandle { file, header }) + let num_sectors = file.metadata().map_err(Error::Io)?.len() / SECTOR_BYTES as u64; + + let allocator = SectorAllocator::new(&header, num_sectors as u32); + + Ok(RegionHandle { + file, + header, + allocator, + }) +} + +/// Creates the region file at the given region position and initializes +/// a handle. +/// +/// The world directory should be the root directory +/// of the world, e.g. `${SERVER_DIR}/world` for +/// normal servers. +/// +/// # Warning +/// If the region file already exist, it will be __overwritten__. +/// Care must be taken to ensure that this function is only called +/// for nonexistent regions. +pub fn create_region(dir: &PathBuf, pos: RegionPosition) -> Result { + create_region_dir(dir).map_err(Error::Io)?; + let mut file = { + let buf = region_file_path(dir, pos); + + open_opts().create(true).open(buf.as_path()) + } + .map_err(Error::Io)?; + + let header = RegionHeader::default(); + header.write_to(&mut file).map_err(Error::Io)?; + + let allocator = SectorAllocator::new(&header, 2); + Ok(RegionHandle { + file, + header, + allocator, + }) +} + +fn open_opts() -> OpenOptions { + OpenOptions::new() + .read(true) + .write(true) + .append(false) + .clone() +} + +fn region_file_path(dir: &PathBuf, pos: RegionPosition) -> PathBuf { + let mut buf = dir.clone(); + buf.push(format!("region/r.{}.{}.mca", pos.x, pos.z)); + buf +} + +fn create_region_dir(dir: &PathBuf) -> Result<(), io::Error> { + let mut dir = dir.clone(); + dir.push("region"); + fs::create_dir_all(dir.as_path()) } /// Reads the region header from the given file. @@ -361,12 +669,11 @@ fn read_header(file: &mut File) -> Result { for _ in 0..1024 { let val = file.read_u32::().map_err(Error::Io)?; let offset = val >> 8; - let sector_count = (val & 0b1111_1111) as u8; + let count = val & 0b1111_1111; - header.locations.push(ChunkLocation { - offset, - sector_count, - }); + header + .locations + .push(ChunkLocation(SectorBlock { offset, count })); } // The next 4 KiB contains timestamp data - one @@ -390,29 +697,65 @@ struct RegionHeader { timestamps: Vec, } +impl Default for RegionHeader { + fn default() -> Self { + Self { + locations: vec![ + ChunkLocation(SectorBlock { + offset: 0, + count: 0 + }); + REGION_SIZE * REGION_SIZE + ], + timestamps: vec![0; REGION_SIZE * REGION_SIZE], + } + } +} + impl RegionHeader { /// Returns the `ChunkLocation` for the given - /// chunk position. If the given position is + /// chunk position. + /// + /// If the given position is /// not inside the region this header is for, /// a panic will occur. fn location_for_chunk(&self, pos: ChunkPosition) -> ChunkLocation { - let index = (pos.x & 31) + (pos.z & 31) * (REGION_SIZE as i32); - self.locations[index as usize] + let index = Self::index(pos); + self.locations[index] + } + + /// Sets the location for the given chunk position. + fn set_location_for_chunk(&mut self, pos: ChunkPosition, location: ChunkLocation) { + let index = Self::index(pos); + self.locations[index] = location; + } + + /// Writes this header to the given writer. + fn write_to(&self, w: &mut W) -> Result<(), io::Error> + where + W: Write, + { + for location in &self.locations { + let value = (location.0.offset << 8) | (location.0.count & 0b1111_1111); + w.write_u32::(value)?; + } + + for timestamp in &self.timestamps { + w.write_u32::(*timestamp)?; + } + + Ok(()) + } + + fn index(pos: ChunkPosition) -> usize { + ((pos.x & 31) + (pos.z & 31) * (REGION_SIZE as i32)) as usize } } /// Contains information about a chunk inside /// a region file. #[derive(Clone, Copy, Debug)] -struct ChunkLocation { - /// The offset of the chunk from the start of the file - /// in 4 KiB sectors such that a value of 2 corresponds - /// to byte 8192 in the file. - offset: u32, - /// The length of the data for the chunk, also - /// in 4 KiB sectors. This value is always rounded up. - sector_count: u8, -} +struct ChunkLocation(SectorBlock); impl ChunkLocation { /// Chunks in a region which have not been generated @@ -420,7 +763,7 @@ impl ChunkLocation { /// This function checks whether a chunk exists /// in a region file or not. pub fn exists(self) -> bool { - self.offset != 0 && self.sector_count != 0 + self.0.offset != 0 && self.0.count != 0 } } @@ -441,3 +784,60 @@ impl RegionPosition { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_sector_allocator() { + let header = RegionHeader { + locations: vec![ + ChunkLocation(SectorBlock { + offset: 0, + count: 0, + }), + ChunkLocation(SectorBlock { + offset: 6, + count: 5, + }), + ], + timestamps: vec![0; 2], + }; + + let mut alloc = SectorAllocator::new(&header, 1024); + + assert_eq!( + alloc.allocate(2), + SectorBlock { + offset: 2, + count: 2 + } + ); + assert_eq!( + alloc.allocate(2), + SectorBlock { + offset: 4, + count: 2 + } + ); + assert_eq!( + alloc.allocate(2), + SectorBlock { + offset: 11, + count: 2, + } + ); + alloc.free(SectorBlock { + offset: 2, + count: 2, + }); + assert_eq!( + alloc.allocate(2), + SectorBlock { + offset: 2, + count: 2 + } + ); + } +} diff --git a/core/src/world/chunk.rs b/core/src/world/chunk.rs index b55804544..7ecd51e8f 100644 --- a/core/src/world/chunk.rs +++ b/core/src/world/chunk.rs @@ -1,6 +1,7 @@ use super::block::*; use super::ChunkPosition; use crate::Biome; +use multimap::MultiMap; /// The number of bits used for each block /// in the global palette. @@ -56,6 +57,9 @@ pub struct Chunk { /// The biomes in this section, indexable by /// ((z << 4) | x). biomes: [Biome; SECTION_WIDTH * SECTION_WIDTH], + /// Whether this chunk has been modified since the most recent + /// call to `check_modified`(). + modified: bool, } impl Default for Chunk { @@ -71,6 +75,7 @@ impl Default for Chunk { Self { location: ChunkPosition::new(0, 0), + modified: true, sections, biomes: [Biome::Plains; SECTION_WIDTH * SECTION_WIDTH], } @@ -83,6 +88,7 @@ impl Chunk { pub fn new(location: ChunkPosition) -> Self { Self { location, + modified: true, ..Default::default() } } @@ -94,6 +100,7 @@ impl Chunk { pub fn new_with_default_biome(location: ChunkPosition, default_biome: Biome) -> Self { Self { location, + modified: true, biomes: [default_biome; SECTION_WIDTH * SECTION_HEIGHT], ..Default::default() } @@ -126,6 +133,8 @@ impl Chunk { /// if `x >= 16 || y >= 256 || z >= 16`. pub fn set_block_at(&mut self, x: usize, y: usize, z: usize, block: Block) { Self::check_coords(x, y, z); + self.modified = true; + let chunk_section = &mut self.sections[y / 16]; let section; @@ -198,6 +207,7 @@ impl Chunk { /// Returns a mutable slice of the 16 sections /// in this chunk. pub fn sections_mut(&mut self) -> Vec> { + self.modified = true; self.sections.iter_mut().map(|sec| sec.as_mut()).collect() } @@ -226,6 +236,7 @@ impl Chunk { /// to be empty, meaning it consists only of air. pub fn section_mut(&mut self, index: usize) -> Option<&mut ChunkSection> { assert!(index < NUM_SECTIONS); + self.modified = true; self.sections[index].as_mut() } @@ -233,6 +244,7 @@ impl Chunk { pub fn set_section_at(&mut self, index: usize, section: Option) { assert!(index < NUM_SECTIONS); self.sections[index] = section; + self.modified = true; } /// Optimizes each section in this chunk. @@ -242,6 +254,7 @@ impl Chunk { /// modified since the last time they were optimized /// are not optimized. pub fn optimize(&mut self) -> u32 { + let modified = self.modified; let mut count = 0; let mut to_remove = vec![]; for (i, s) in self.sections.iter_mut().enumerate() { @@ -261,6 +274,8 @@ impl Chunk { self.set_section_at(i, None); } + self.modified = modified; + count } @@ -271,6 +286,7 @@ impl Chunk { /// Returns a mutable reference to the biomes of this chunk. pub fn biomes_mut(&mut self) -> &mut [Biome] { + self.modified = true; &mut self.biomes } @@ -289,9 +305,18 @@ impl Chunk { /// Panics if `x < 16` or `z < 16`. pub fn set_biome_at(&mut self, x: usize, z: usize, biome: Biome) { let index = Self::biome_index(x, z); + self.modified = true; self.biomes[index] = biome; } + /// Checks whether this chunk has been modified since the last + /// call to this function. + pub fn check_modified(&mut self) -> bool { + let res = self.modified; + self.modified = false; + res + } + fn biome_index(x: usize, z: usize) -> usize { assert!(x < 16); assert!(z < 16); @@ -548,6 +573,38 @@ impl ChunkSection { true // Chunk was optimized } + /// If the global palette is in use, convert it to a section palette. + /// This is used for chunk saving. + pub fn convert_palette_to_section(&mut self) { + if self.palette.is_some() { + // Nothing to do: section palette already in use. + return; + } + + let mut blocks = MultiMap::with_capacity(1024); + for x in 0..16 { + for y in 0..16 { + for z in 0..16 { + blocks.insert(self.block_at(x, y, z), (x, y, z)); + } + } + } + + // Create a palette based on the blocks in the chunk. + // We also have to modify the data array based on the new palette. + let mut palette = Vec::with_capacity(1024); + for (block, positions) in blocks.into_iter() { + palette.push(block.native_state_id()); + + for (x, y, z) in positions { + let index = block_index(x, y, z); + self.data.set(index, (palette.len() - 1) as u64); + } + } + + self.palette = Some(palette); + } + /// Returns the internal data array for this section. pub fn data(&self) -> &BitArray { &self.data @@ -1097,6 +1154,51 @@ mod tests { } } + #[test] + fn test_modified() { + let mut chunk = Chunk::default(); + assert!(chunk.check_modified()); + assert!(!chunk.check_modified()); + + chunk.set_block_at(0, 0, 0, Block::Stone); + assert!(chunk.check_modified()); + assert!(!chunk.check_modified()); + } + + #[test] + fn test_convert_section_to_palette() { + let mut chunk = Chunk::default(); + + let mut counter = 0; + for x in 0..SECTION_WIDTH { + for y in 0..SECTION_HEIGHT { + for z in 0..SECTION_WIDTH { + chunk.set_block_at(x, y, z, Block::from_native_state_id(counter).unwrap()); + counter += 1; + } + } + } + + let section = chunk.section_mut(0).unwrap(); + section.convert_palette_to_section(); + + assert_eq!(section.palette().unwrap().len(), counter as usize); + + // Ensure that data array still represents the same data + counter = 0; + for x in 0..SECTION_WIDTH { + for y in 0..SECTION_HEIGHT { + for z in 0..SECTION_WIDTH { + assert_eq!( + chunk.block_at(x, y, z), + Block::from_native_state_id(counter).unwrap() + ); + counter += 1; + } + } + } + } + #[test] fn test_light() { let mut chunk = Chunk::default(); diff --git a/core/src/world/mod.rs b/core/src/world/mod.rs index 568faf58e..07fa3a7d7 100644 --- a/core/src/world/mod.rs +++ b/core/src/world/mod.rs @@ -325,8 +325,8 @@ impl ChunkMap { /// Removes the chunk at the given location, /// effectively unloading it. - pub fn unload_chunk_at(&mut self, pos: ChunkPosition) { - self.chunk_map.remove(&pos); + pub fn unload_chunk_at(&mut self, pos: ChunkPosition) -> Option { + self.chunk_map.remove(&pos) } /// Returns an immutable reference to the internal map. diff --git a/server/Cargo.toml b/server/Cargo.toml index 6ff7f832c..3280c4b31 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -61,7 +61,10 @@ simdnoise = "3.1.1" simdeez = "0.6.4" bitvec = "0.15.1" tokio = "=0.2.0-alpha.6" +tokio-executor = "=0.2.0-alpha.6" futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] } +humantime-serde = "0.1.1" +ctrlc = "3.1.3" [dev-dependencies] criterion = "0.3.0" diff --git a/server/config/feather.toml b/server/config/feather.toml index 34f5440e6..c7144080a 100644 --- a/server/config/feather.toml +++ b/server/config/feather.toml @@ -53,4 +53,6 @@ generator = "default" # Leaving this value empty will generate a random seed. # If this value is not a valid integer (i64), the string # will be converted using a hash function. -seed = "" \ No newline at end of file +seed = "" +# Interval at which to save modified chunks. +save_interval = "1min" \ No newline at end of file diff --git a/server/src/chunk_logic.rs b/server/src/chunk_logic.rs index 1f771649c..8435af7d9 100644 --- a/server/src/chunk_logic.rs +++ b/server/src/chunk_logic.rs @@ -19,6 +19,7 @@ use crate::systems::{CHUNK_HOLD_REMOVE, CHUNK_LOAD, CHUNK_OPTIMIZE, CHUNK_UNLOAD use crate::worldgen::WorldGenerator; use crate::{chunkworker, current_time_in_millis, TickCount, TPS}; use feather_core::entity::EntityData; +use feather_core::Chunk; use hashbrown::HashSet; use multimap::MultiMap; use specs::storage::BTreeStorage; @@ -30,8 +31,8 @@ use std::sync::Arc; /// worker thread. #[derive(Debug, Clone)] pub struct ChunkWorkerHandle { - sender: Sender, - receiver: Receiver, + pub sender: Sender, + pub receiver: Receiver, } /// Event which is triggered when a chunk is loaded. @@ -47,6 +48,13 @@ pub struct ChunkLoadFailEvent { pub pos: ChunkPosition, } +/// Event which is triggered when a chunk is unloaded. +#[derive(Clone)] +pub struct ChunkUnloadEvent { + /// The chunk which was unloaded. + pub chunk: Arc, +} + /// System for receiving loaded chunks from the chunk worker thread. pub struct ChunkLoadSystem; @@ -61,22 +69,23 @@ impl<'a> System<'a> for ChunkLoadSystem { fn run(&mut self, data: Self::SystemData) { let (mut chunk_map, mut load_events, mut fail_events, handle) = data; - while let Ok((pos, result)) = handle.receiver.try_recv() { - match result { - Ok((chunk, entities)) => { - chunk_map.set_chunk_at(pos, chunk); - - // Trigger event - let event = ChunkLoadEvent { pos, entities }; - load_events.single_write(event); - - trace!("Loaded chunk at {:?}", pos); - } - Err(err) => { - // TODO generate chunk if it didn't exist - warn!("Failed to load chunk at {:?}: {}", pos, err); - let event = ChunkLoadFailEvent { pos }; - fail_events.single_write(event); + while let Ok(reply) = handle.receiver.try_recv() { + if let chunkworker::Reply::LoadedChunk(pos, result) = reply { + match result { + Ok((chunk, entities)) => { + chunk_map.set_chunk_at(pos, chunk); + + // Trigger event + let event = ChunkLoadEvent { pos, entities }; + load_events.single_write(event); + + trace!("Loaded chunk at {:?}", pos); + } + Err(err) => { + warn!("Failed to load chunk at {:?}: {}", pos, err); + let event = ChunkLoadFailEvent { pos }; + fail_events.single_write(event); + } } } } @@ -111,6 +120,14 @@ pub fn load_chunk(handle: &ChunkWorkerHandle, pos: ChunkPosition) { .unwrap(); } +/// Asynchronously saves the chunk at the given position. +pub fn save_chunk(handle: &ChunkWorkerHandle, chunk: Arc, entities: Vec) { + handle + .sender + .send(chunkworker::Request::SaveChunk(chunk, entities)) + .unwrap(); +} + /// The chunk holder map contains a mapping /// of chunk positions to any number of entities, called "holders." /// When a chunk position has no holders, it will be queued @@ -225,6 +242,7 @@ impl ChunkUnloadSystem { impl<'a> System<'a> for ChunkUnloadSystem { type SystemData = ( Write<'a, ChunkMap>, + Write<'a, EventChannel>, Read<'a, EventChannel>, Write<'a, ChunkUnloadQueue>, Read<'a, ChunkHolders>, @@ -232,10 +250,17 @@ impl<'a> System<'a> for ChunkUnloadSystem { ); fn run(&mut self, data: Self::SystemData) { - let (mut chunk_map, events, mut unload_queue, holders, tick_count) = data; + let ( + mut chunk_map, + mut unload_events, + release_events, + mut unload_queue, + holders, + tick_count, + ) = data; // Handle holder release events. - for event in events.read(&mut self.reader.as_mut().unwrap()) { + for event in release_events.read(&mut self.reader.as_mut().unwrap()) { // If the chunk now has zero holders, queue it for unloading. if !holders.chunk_has_holders(event.chunk) { let unload = ChunkUnload { @@ -261,10 +286,14 @@ impl<'a> System<'a> for ChunkUnloadSystem { continue; } - trace!("Unloading chunk at {:?}", unload.chunk); - // Unload chunk and pop from queue. - chunk_map.unload_chunk_at(unload.chunk); + if let Some(chunk) = chunk_map.unload_chunk_at(unload.chunk) { + let event = ChunkUnloadEvent { + chunk: Arc::new(chunk), + }; + unload_events.single_write(event); + } + unload_queue.queue.pop_front(); } else { // We're done - all chunks farther up in @@ -444,7 +473,12 @@ mod tests { let chunk_map = ChunkMap::new(); let pos = ChunkPosition::new(0, 0); - send2.send((pos, Ok((Chunk::new(pos), vec![])))).unwrap(); + send2 + .send(chunkworker::Reply::LoadedChunk( + pos, + Ok((Chunk::new(pos), vec![])), + )) + .unwrap(); let load_event_channel = EventChannel::::new(); let fail_event_channel = EventChannel::::new(); @@ -480,6 +514,9 @@ mod tests { load_chunk(&handle, pos); let recv = recv1.try_recv().unwrap(); - assert_eq!(recv, chunkworker::Request::LoadChunk(pos)); + match recv { + chunkworker::Request::LoadChunk(recv_pos) => assert_eq!(recv_pos, pos), + _ => panic!(), + } } } diff --git a/server/src/chunkworker.rs b/server/src/chunkworker.rs index ac49c2a5b..358a5b799 100644 --- a/server/src/chunkworker.rs +++ b/server/src/chunkworker.rs @@ -1,11 +1,9 @@ -//! This module handles the asynchronous loading of chunks from -//! region files. It runs on a separate thread and receives -//! load requests over a channel. Upon receiving a request, -//! it attempts to load the chunk from the world directory. -//! If the chunk was loaded successfully, it will send -//! the chunk back over a channel. If the chunk did not exist, -//! it will notify the server thread of the incident. -//! In response, the server thread should generate the chunk. +//! This module handles the asynchronous loading and saving +//! of chunks. It receives load and save requests from the server +//! (over a channel) and executes them. +//! +//! If a chunk cannot be loaded, it is generated on the Rayon thread pool +//! instead. use crate::worldgen::WorldGenerator; use crossbeam::channel::{Receiver, Sender}; use feather_core::entity::EntityData; @@ -18,11 +16,16 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; -pub type Reply = (ChunkPosition, Result<(Chunk, Vec), Error>); +#[allow(clippy::large_enum_variant)] +pub enum Reply { + LoadedChunk(ChunkPosition, Result<(Chunk, Vec), Error>), + SavedChunk(ChunkPosition), +} -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Clone)] pub enum Request { LoadChunk(ChunkPosition), + SaveChunk(Arc, Vec), ShutDown, } @@ -117,6 +120,9 @@ fn run(mut worker: ChunkWorker) { while let Ok(request) = worker.receiver.recv() { match request { Request::ShutDown => break, + Request::SaveChunk(chunk, entities) => { + save_chunk(&mut worker, &chunk, entities); + } Request::LoadChunk(pos) => { if let Some(reply) = load_chunk(&mut worker, pos) { worker.sender.send(reply).unwrap(); @@ -131,41 +137,12 @@ fn run(mut worker: ChunkWorker) { /// Attempts to load the chunk at the specified position. fn load_chunk(worker: &mut ChunkWorker, pos: ChunkPosition) -> Option { let rpos = RegionPosition::from_chunk(pos); - if !is_region_loaded(worker, pos) { - // Need to load region into memory - let handle = region::load_region(&worker.dir, rpos); - if handle.is_err() { - // TODO: Create a new region file before generating chunk - schedule_generate_new_chunk( - &Arc::from(worker.sender.clone()), - pos, - &worker.world_generator, - ); - return None; - } - - let handle = handle.unwrap(); - - let last_used = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs(); - - let file = RegionFile { - handle, - _last_used: last_used, - }; - - worker.open_regions.insert(rpos, file); - } + let file = worker_region(&mut worker.open_regions, &worker.dir, rpos); // Load from region file - let file = worker.open_regions.get_mut(&rpos).unwrap(); - let handle = &mut file.handle; - load_chunk_from_handle( pos, - handle, + &mut file.handle, &Arc::from(worker.sender.clone()), &worker.world_generator, ) @@ -180,13 +157,13 @@ fn load_chunk_from_handle( let result = handle.load_chunk(pos); match result { - Ok(chunk) => Some((pos, Ok(chunk))), + Ok(chunk) => Some(Reply::LoadedChunk(pos, Ok(chunk))), Err(e) => match e { region::Error::ChunkNotExist => { schedule_generate_new_chunk(sender, pos, generator); None } - err => Some((pos, Err(Error::LoadError(err)))), + err => Some(Reply::LoadedChunk(pos, Err(Error::LoadError(err)))), }, } } @@ -208,13 +185,57 @@ fn schedule_generate_new_chunk( /// Generates a new chunk synchronously, /// returning a Reply to send to a Sender. fn generate_new_chunk(pos: ChunkPosition, generator: &Arc) -> Reply { - (pos, Ok((generator.generate_chunk(pos), vec![]))) + Reply::LoadedChunk(pos, Ok((generator.generate_chunk(pos), vec![]))) +} + +/// Saves the chunk at the specified position. +fn save_chunk(worker: &mut ChunkWorker, chunk: &Chunk, entities: Vec) { + let rpos = RegionPosition::from_chunk(chunk.position()); + + let file = worker_region(&mut worker.open_regions, &worker.dir, rpos); + + file.handle.save_chunk(chunk, entities).unwrap(); + worker + .sender + .send(Reply::SavedChunk(chunk.position())) + .unwrap(); } /// Returns whether the given chunk's region /// is already loaded. -fn is_region_loaded(worker: &ChunkWorker, chunk_pos: ChunkPosition) -> bool { - worker - .open_regions - .contains_key(&RegionPosition::from_chunk(chunk_pos)) +fn is_region_loaded( + open_regions: &HashMap, + rpos: RegionPosition, +) -> bool { + open_regions.contains_key(&rpos) +} + +fn worker_region<'a>( + open_regions: &'a mut HashMap, + dir: &PathBuf, + rpos: RegionPosition, +) -> &'a mut RegionFile { + if !is_region_loaded(open_regions, rpos) { + // Need to load region into memory + let mut handle = region::load_region(&dir, rpos); + if handle.is_err() { + // Create a new region file + handle = region::create_region(&dir, rpos); + } + + let handle = handle.unwrap(); + + let last_used = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_secs(); + + let file = RegionFile { + handle, + _last_used: last_used, + }; + + open_regions.insert(rpos, file); + } + open_regions.get_mut(&rpos).unwrap() } diff --git a/server/src/config.rs b/server/src/config.rs index ba239e44e..f8c1e0f00 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -1,3 +1,4 @@ +use failure::_core::time::Duration; use std::fs::read_to_string; #[derive(Debug, Fail)] @@ -70,6 +71,8 @@ pub struct World { pub name: String, pub generator: String, pub seed: String, + #[serde(with = "humantime_serde")] + pub save_interval: Duration, } /// Loads the configuration from the given file/ @@ -129,5 +132,6 @@ mod tests { assert_eq!(world.name, "world"); assert_eq!(world.generator, "default"); assert_eq!(world.seed, ""); + assert_eq!(world.save_interval.as_millis(), 1000 * 60); } } diff --git a/server/src/entity/chunk.rs b/server/src/entity/chunk.rs index 966709f2e..d6b929ea9 100644 --- a/server/src/entity/chunk.rs +++ b/server/src/entity/chunk.rs @@ -8,17 +8,19 @@ use crate::util::Util; use feather_core::entity::EntityData; use feather_core::world::ChunkPosition; use feather_core::{Item, ItemStack}; -use fnv::FnvHashMap; -use hashbrown::HashSet; +use hashbrown::{HashMap, HashSet}; use shrev::EventChannel; use specs::storage::ComponentEvent; use specs::{ BitSet, Entities, Entity, Join, Read, ReadStorage, ReaderId, System, World, WorldExt, Write, }; +use std::sync::atomic::{AtomicBool, Ordering}; /// Keeps track of which entities are in which chunk. -#[derive(Debug, Clone, Deref, DerefMut, Default)] -pub struct ChunkEntities(FnvHashMap>); +/// Also has a boolean for each chunk which indicates +/// whether its entities have been updated recently. +#[derive(Debug, Deref, DerefMut, Default)] +pub struct ChunkEntities(HashMap)>); lazy_static! { static ref EMPTY_VEC: Vec = Vec::with_capacity(0); @@ -27,19 +29,35 @@ lazy_static! { impl ChunkEntities { /// Returns all entities in a given chunk. pub fn entities_in_chunk(&self, chunk: ChunkPosition) -> &Vec { - if let Some(entities) = self.0.get(&chunk) { + if let Some((_, entities)) = self.0.get(&chunk) { entities } else { &EMPTY_VEC } } + /// Returns all entities in the chunk, in addition to + /// a boolean indicating whether the entities have been + /// updated since the last call to this function. + pub fn entities_in_chunk_and_modified(&self, chunk: ChunkPosition) -> (bool, &[Entity]) { + if let Some((dirty, entities)) = self.0.get(&chunk) { + let d = dirty.load(Ordering::SeqCst); + dirty.store(false, Ordering::SeqCst); + (d, entities) + } else { + (false, &[]) + } + } + /// Adds an entity to a chunk. pub fn add_to_chunk(&mut self, chunk: ChunkPosition, entity: Entity) { self.0 .entry(chunk) - .and_modify(|vec| vec.push(entity)) - .or_insert_with(|| vec![entity]); + .and_modify(|(dirty, vec)| { + dirty.store(true, Ordering::SeqCst); + vec.push(entity) + }) + .or_insert_with(|| (AtomicBool::new(true), vec![entity])); } /// Removes an entity from a chunk. @@ -48,7 +66,7 @@ impl ChunkEntities { /// May panic in some cases if the entity is not contained /// within the given chunk. pub fn remove_from_chunk(&mut self, chunk: ChunkPosition, entity: Entity) { - let vec = match self.0.get_mut(&chunk) { + let (dirty, vec) = match self.0.get_mut(&chunk) { Some(vec) => vec, _ => return, }; @@ -59,6 +77,8 @@ impl ChunkEntities { }; vec.swap_remove(index); + dirty.store(true, Ordering::SeqCst); + if vec.is_empty() { self.0.remove(&chunk); } @@ -231,7 +251,7 @@ mod tests { use specs::{Builder, World, WorldExt}; #[test] - fn test_entity_chunks() { + fn test_chunk_entities() { let mut chunks = ChunkEntities::default(); let mut world = World::new(); @@ -241,6 +261,8 @@ mod tests { chunks.add_to_chunk(pos, entity); assert_eq!(chunks.entities_in_chunk(pos).as_slice(), &[entity]); + assert!(chunks.entities_in_chunk_and_modified(pos).0); + assert!(!chunks.entities_in_chunk_and_modified(pos).0); } #[test] diff --git a/server/src/entity/item.rs b/server/src/entity/item.rs index 8eb3854c5..1da51e7c1 100644 --- a/server/src/entity/item.rs +++ b/server/src/entity/item.rs @@ -19,11 +19,12 @@ use specs::{ }; /// Component for item entitties. -#[derive(Default)] pub struct ItemComponent { /// The tick at which this item is collectable /// by a player. pub collectable_at: u64, + /// This item's stack. + pub stack: ItemStack, } impl Component for ItemComponent { diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs index 52997a6df..7b36e05b5 100644 --- a/server/src/entity/mod.rs +++ b/server/src/entity/mod.rs @@ -11,13 +11,14 @@ mod falling_block; mod item; pub mod metadata; mod movement; +mod save; mod types; use crate::systems::{ - BLOCK_FALLING_LANDING, CHUNK_CROSS, CHUNK_ENTITIES_LOAD, CHUNK_ENTITIES_UPDATE, ENTITY_DESTROY, - ENTITY_DESTROY_BROADCAST, ENTITY_METADATA_BROADCAST, ENTITY_MOVE_BROADCAST, ENTITY_PHYSICS, - ENTITY_SEND, ENTITY_SPAWN_BROADCAST, ENTITY_VELOCITY_BROADCAST, ITEM_COLLECT, ITEM_MERGE, - ITEM_SPAWN, JOIN_BROADCAST, SHOOT_ARROW, + BLOCK_FALLING_LANDING, CHUNK_CROSS, CHUNK_ENTITIES_LOAD, CHUNK_ENTITIES_UPDATE, CHUNK_SAVE, + ENTITY_DESTROY, ENTITY_DESTROY_BROADCAST, ENTITY_METADATA_BROADCAST, ENTITY_MOVE_BROADCAST, + ENTITY_PHYSICS, ENTITY_SEND, ENTITY_SPAWN_BROADCAST, ENTITY_VELOCITY_BROADCAST, ITEM_COLLECT, + ITEM_MERGE, ITEM_SPAWN, JOIN_BROADCAST, SHOOT_ARROW, }; pub use arrow::{ArrowComponent, ShootArrowEvent}; pub use broadcast::EntitySendSystem; @@ -33,12 +34,15 @@ pub use metadata::{EntityBitMask, Metadata}; pub use movement::broadcast_entity_movement; pub use types::EntityType; +pub use save::save_chunks; + use crate::entity::arrow::ShootArrowSystem; use crate::entity::chunk::EntityChunkLoadSystem; use crate::entity::destroy::EntityDestroyBroadcastSystem; use crate::entity::falling_block::FallingBlockLandSystem; use crate::entity::item::ItemCollectSystem; use crate::entity::metadata::MetadataBroadcastSystem; +use crate::entity::save::ChunkSaveSystem; use broadcast::EntityBroadcastSystem; use component::ComponentResetSystem; use destroy::EntityDestroySystem; @@ -66,6 +70,7 @@ pub fn init_handlers(dispatcher: &mut DispatcherBuilder) { &[], ); dispatcher.add(ShootArrowSystem::default(), SHOOT_ARROW, &[]); + dispatcher.add(ChunkSaveSystem::default(), CHUNK_SAVE, &[]); } pub fn init_broadcast(dispatcher: &mut DispatcherBuilder) { diff --git a/server/src/entity/save.rs b/server/src/entity/save.rs new file mode 100644 index 000000000..085ed0ebd --- /dev/null +++ b/server/src/entity/save.rs @@ -0,0 +1,230 @@ +//! Saving of entity data (and chunk data along with it). + +use crate::chunk_logic; +use crate::chunk_logic::{ChunkUnloadEvent, ChunkWorkerHandle}; +use crate::config::Config; +use crate::entity::{ + ArrowComponent, ChunkEntities, ItemComponent, PositionComponent, VelocityComponent, +}; +use feather_core::entity::{ArrowEntityData, BaseEntityData, EntityData, ItemData, ItemEntityData}; +use feather_core::world::ChunkMap; +use rayon::prelude::*; +use shrev::{EventChannel, ReaderId}; +use specs::{Read, ReadExpect, ReadStorage, System, Write}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::Arc; +use std::time::Instant; + +/// System to save chunk and entity data upon a chunk unload +/// and periodically. +/// +/// This system listens to `ChunkUnloadEvent`s. +#[derive(Default)] +pub struct ChunkSaveSystem { + reader: Option>, +} + +/// Previous time at which chunks were saved. +pub struct PreviousSaveTime(Instant); + +impl Default for PreviousSaveTime { + fn default() -> Self { + Self(Instant::now()) + } +} + +impl<'a> System<'a> for ChunkSaveSystem { + type SystemData = ( + Write<'a, PreviousSaveTime>, + Write<'a, ChunkMap>, + Read<'a, ChunkEntities>, + Read<'a, EventChannel>, + Read<'a, Arc>, + ReadExpect<'a, ChunkWorkerHandle>, + ReadStorage<'a, PositionComponent>, + ReadStorage<'a, VelocityComponent>, + ReadStorage<'a, ItemComponent>, + ReadStorage<'a, ArrowComponent>, + ); + + fn run(&mut self, data: Self::SystemData) { + let ( + mut prev_save_time, + mut chunk_map, + chunk_entities, + unload_events, + config, + worker_handle, + positions, + velocities, + items, + arrows, + ) = data; + + // TODO: entities + + for event in unload_events.read(self.reader.as_mut().unwrap()) { + let entities = vec![]; // TODO + chunk_logic::save_chunk(&worker_handle, Arc::clone(&event.chunk), entities); + } + + if prev_save_time.0.elapsed() >= config.world.save_interval { + // Save chunks + save_chunks( + &mut chunk_map, + &worker_handle, + &chunk_entities, + &positions, + &velocities, + &items, + &arrows, + ); + prev_save_time.0 = Instant::now(); + } + } + + setup_impl!(reader); +} + +/// Saves all modified chunks. +pub fn save_chunks( + chunk_map: &mut ChunkMap, + handle: &ChunkWorkerHandle, + chunk_entities: &ChunkEntities, + positions: &ReadStorage, + velocities: &ReadStorage, + items: &ReadStorage, + arrows: &ReadStorage, +) -> u32 { + let count = AtomicUsize::new(0); + chunk_map + .chunks_mut() + .par_iter_mut() + .map(|(_, chunk)| { + let (dirty, entities) = chunk_entities.entities_in_chunk_and_modified(chunk.position()); + (chunk, entities, dirty) + }) + .for_each(|(chunk, entities, dirty)| { + // If all of the following are true, don't save the chunk: + // * The chunk has not been modified since the last save. + // * The entities in the chunk are empty (if they weren't, it is likely they were modified) + // * The entities in the chunk haven't changed. + if !chunk.check_modified() && (entities.is_empty() && !dirty) { + return; + } + + let entity_data: Vec<_> = entities + .iter() + .filter_map(|entity| { + // Convert entity to entity data. + // If an entity doesn't have position and velocity, + // it won't be saved. This is normal behavior. + let pos = positions.get(*entity)?; + let vel = velocities.get(*entity)?; + let item = items.get(*entity); + let arrow = arrows.get(*entity); + + let base = BaseEntityData { + position: vec![pos.current.x, pos.current.y, pos.current.z], + velocity: vec![vel.x, vel.y, vel.z], + rotation: vec![pos.current.yaw, pos.current.pitch], + }; + if arrow.is_some() { + Some(EntityData::Arrow(ArrowEntityData { + entity: base, + critical: 0, + })) + } else if let Some(item) = item { + Some(EntityData::Item(ItemEntityData { + entity: base, + age: 0, // TODO + pickup_delay: 0, // TODO + item: ItemData { + item: item.stack.ty.identifier().to_string(), + count: item.stack.amount, + }, + })) + } else { + None + } + }) + .collect(); + + chunk_logic::save_chunk(&handle, Arc::new(chunk.clone()), entity_data); + count.fetch_add(1, Ordering::Release); + }); + + let count = count.load(Ordering::Acquire); + debug!("Saving {} chunks", count); + count as u32 +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{chunkworker, testframework as t}; + use failure::_core::time::Duration; + use feather_core::{Chunk, ChunkPosition}; + + #[test] + fn test_chunk_unload() { + let (mut world, mut dispatcher) = t::builder().with(ChunkSaveSystem::default(), "").build(); + + let (tx, rx) = crossbeam::unbounded(); + let (_tx2, rx2) = crossbeam::unbounded(); + world.insert(ChunkWorkerHandle { + sender: tx, + receiver: rx2, + }); + + let event = ChunkUnloadEvent { + chunk: Arc::new(Chunk::default()), + }; + + t::trigger_event(&world, event); + + dispatcher.dispatch(&world); + + let msg = rx.try_recv().unwrap(); + + match msg { + chunkworker::Request::SaveChunk(chunk, entities) => { + assert_eq!(chunk.position(), ChunkPosition::new(0, 0)); + assert!(entities.is_empty()); // TODO + } + _ => panic!(), + } + } + + #[test] + fn test_periodic() { + let (mut world, mut dispatcher) = t::builder().with(ChunkSaveSystem::default(), "").build(); + + let (tx, rx) = crossbeam::unbounded(); + let (_tx2, rx2) = crossbeam::unbounded(); + world.insert(ChunkWorkerHandle { + sender: tx, + receiver: rx2, + }); + + let last_save_time = PreviousSaveTime(Instant::now() - Duration::from_secs(120)); + world.insert(last_save_time); + + let pos = ChunkPosition::new(0, 0); + world + .fetch_mut::() + .set_chunk_at(pos, Chunk::new(pos)); + + dispatcher.dispatch(&world); + + let msg = rx.try_recv().unwrap(); + + match msg { + chunkworker::Request::SaveChunk(chunk, entities) => { + assert_eq!(chunk.position(), pos); + assert!(entities.is_empty()); // TODO + } + _ => panic!(), + } + } +} diff --git a/server/src/lib.rs b/server/src/lib.rs index 0b710da1f..3be07794f 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -28,6 +28,7 @@ extern crate feather_core; extern crate nalgebra_glm as glm; +use crossbeam::Receiver; use std::alloc::System; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; @@ -74,6 +75,7 @@ pub mod network; pub mod physics; pub mod player; pub mod prelude; +pub mod shutdown; pub mod systems; #[cfg(test)] pub mod testframework; @@ -133,6 +135,11 @@ pub fn main() { let (mut world, mut dispatcher) = init_world(config, player_count, io_manager, level); + // Channel used by the shutdown handler to notify the server thread. + let (shutdown_tx, shutdown_rx) = crossbeam::unbounded(); + + shutdown::init(shutdown_tx); + info!("Initialized world"); info!("Generating RSA keypair"); @@ -142,7 +149,19 @@ pub fn main() { load_spawn_chunks(&mut world); info!("Server started"); - run_loop(&mut world, &mut dispatcher); + run_loop(&mut world, &mut dispatcher, shutdown_rx); + + info!("Shutting down"); + + info!("Saving chunks"); + shutdown::save_chunks(&world); + info!("Saving level.dat"); + shutdown::save_level(&world); + info!("Saving player data"); + shutdown::save_player_data(&world); + + info!("Goodbye"); + exit(0); } /// Loads the configuration file, creating a default @@ -263,8 +282,13 @@ fn load_spawn_chunks(world: &mut World) { /// Runs the server loop, blocking until the server /// is shut down. -fn run_loop(world: &mut World, dispatcher: &mut Dispatcher) { +fn run_loop(world: &mut World, dispatcher: &mut Dispatcher, shutdown_rx: Receiver<()>) { loop { + if shutdown_rx.try_recv().is_ok() { + // Shut down + return; + } + let start_time = current_time_in_millis(); dispatcher.dispatch(&world); diff --git a/server/src/player/inventory.rs b/server/src/player/inventory.rs index bf2c2d73e..cfed37950 100644 --- a/server/src/player/inventory.rs +++ b/server/src/player/inventory.rs @@ -24,7 +24,7 @@ use std::ops::{Deref, DerefMut}; /// Component for storing a player's inventory. #[derive(Clone, Debug)] pub struct InventoryComponent { - inventory: Inventory, + pub inventory: Inventory, /// The player's held item. /// This is stored as an index in the range 0..9. pub held_item: SlotIndex, diff --git a/server/src/player/mod.rs b/server/src/player/mod.rs index 55a5c1e34..bde0f03f7 100644 --- a/server/src/player/mod.rs +++ b/server/src/player/mod.rs @@ -22,6 +22,7 @@ mod movement; /// Module for handling player block placements. mod placement; mod resource_pack; +mod save; mod view; pub use broadcast::PlayerDisconnectEvent; @@ -34,15 +35,18 @@ pub use animation::PlayerAnimationEvent; pub use digging::PlayerItemDropEvent; pub use inventory::{InventoryComponent, InventoryUpdateEvent}; +pub use save::save_player_data; use crate::player::inventory::SetSlotSystem; use crate::player::placement::BlockPlacementSystem; +use crate::player::save::PlayerDataSaveSystem; use crate::player::view::ViewUpdateSystem; use crate::systems::{ ANIMATION_BROADCAST, BLOCK_BREAK_BROADCAST, BLOCK_PLACEMENT, CHAT_BROADCAST, CHUNK_CROSS, CHUNK_SEND, CLIENT_CHUNK_UNLOAD, CREATIVE_INVENTORY, DISCONNECT_BROADCAST, EQUIPMENT_SEND, HELD_ITEM_BROADCAST, HELD_ITEM_CHANGE, JOIN_BROADCAST, NETWORK, PLAYER_ANIMATION, PLAYER_CHAT, - PLAYER_DIGGING, PLAYER_INIT, PLAYER_MOVEMENT, RESOURCE_PACK_SEND, SET_SLOT, VIEW_UPDATE, + PLAYER_DATA_SAVE, PLAYER_DIGGING, PLAYER_INIT, PLAYER_MOVEMENT, RESOURCE_PACK_SEND, SET_SLOT, + VIEW_UPDATE, }; use animation::{AnimationBroadcastSystem, PlayerAnimationSystem}; use broadcast::{DisconnectBroadcastSystem, JoinBroadcastSystem}; @@ -68,6 +72,11 @@ pub fn init_logic(dispatcher: &mut DispatcherBuilder) { dispatcher.add(PlayerMovementSystem, PLAYER_MOVEMENT, &[NETWORK]); dispatcher.add(PlayerChatSystem, PLAYER_CHAT, &[NETWORK]); dispatcher.add(BlockPlacementSystem, BLOCK_PLACEMENT, &[NETWORK]); + dispatcher.add( + PlayerDataSaveSystem::default(), + PLAYER_DATA_SAVE, + &[NETWORK], + ); } pub fn init_handlers(dispatcher: &mut DispatcherBuilder) { diff --git a/server/src/player/save.rs b/server/src/player/save.rs new file mode 100644 index 000000000..df1ac1140 --- /dev/null +++ b/server/src/player/save.rs @@ -0,0 +1,101 @@ +//! Saving of player data files and a system to save +//! player data on disconnect. + +use crate::entity::{NamedComponent, PlayerComponent, PositionComponent}; +use crate::player::{InventoryComponent, PlayerDisconnectEvent}; +use crate::prelude::Config; +use crossbeam::Receiver; +use feather_core::entity::BaseEntityData; +use feather_core::inventory::Inventory; +use feather_core::player_data::{InventorySlot, PlayerData}; +use feather_core::{player_data, Gamemode, Position}; +use shrev::{EventChannel, ReaderId}; +use specs::{Read, ReadStorage, System}; +use std::path::Path; +use std::sync::Arc; +use uuid::Uuid; + +/// System to save player data upon disconnect. +/// +/// This system listens to `PlayerDisconnectEvent`s. +#[derive(Default)] +pub struct PlayerDataSaveSystem { + reader: Option>, +} + +impl<'a> System<'a> for PlayerDataSaveSystem { + type SystemData = ( + Read<'a, Arc>, + ReadStorage<'a, PositionComponent>, + ReadStorage<'a, PlayerComponent>, + ReadStorage<'a, NamedComponent>, + ReadStorage<'a, InventoryComponent>, + Read<'a, EventChannel>, + ); + + fn run(&mut self, data: Self::SystemData) { + let (config, positions, players, nameds, inventories, disconnect_events) = data; + + for event in disconnect_events.read(self.reader.as_mut().unwrap()) { + let player = players.get(event.player).unwrap(); + save_player_data( + &config, + positions.get(event.player).unwrap().current, + player.gamemode, + &inventories.get(event.player).unwrap().inventory, + nameds.get(event.player).unwrap().uuid, + ); + } + } + + setup_impl!(reader); +} + +/// Saves a player's data. +/// +/// This operation is performed asynchronously, +/// and a channel is returned which will receive +/// a message upon completion. +pub fn save_player_data( + config: &Config, + position: Position, + gamemode: Gamemode, + inventory: &Inventory, + uuid: Uuid, +) -> Receiver<()> { + let data = PlayerData { + entity: BaseEntityData { + velocity: vec![0.0; 3], // Player velocity has no effect + position: vec![position.x, position.y, position.z], + rotation: vec![position.yaw, position.pitch], + }, + gamemode: gamemode.get_id() as i32, + inventory: inventory + .items() + .iter() + .enumerate() + .filter_map(|(index, item)| match item.clone() { + Some(item) => Some((index, item)), + None => None, + }) + .map(|(index, item)| InventorySlot::from_network_index(index, item)) + .collect(), + }; + + // Channel used to communicate with Tokio task + let (tx, rx) = crossbeam::bounded(1); + + let world_dir = Path::new(&config.world.name).to_owned(); + + tokio_executor::blocking::run(move || { + if let Err(e) = player_data::save_player_data(world_dir.as_path(), uuid, data) { + error!("Failed to save player data for UUID {}: {:?}", uuid, e); + } else { + debug!("Saved player data for UUID {}", uuid); + } + + let _ = tx.send(()); // Channel could have been dropped, so ignore result + }); + + rx +} diff --git a/server/src/shutdown.rs b/server/src/shutdown.rs new file mode 100644 index 000000000..bc4518f2d --- /dev/null +++ b/server/src/shutdown.rs @@ -0,0 +1,99 @@ +//! Shutdown behavior. + +use crate::chunk_logic::ChunkWorkerHandle; +use crate::config::Config; +use crate::entity::{NamedComponent, PlayerComponent, PositionComponent}; +use crate::player; +use crate::player::InventoryComponent; +use crate::time::Time; +use crate::{chunkworker, entity}; +use crossbeam::Sender; +use feather_core::level::{save_level_file, LevelData, Root}; +use feather_core::prelude::ChunkMap; +use specs::{Join, World, WorldExt}; +use std::fs::File; +use std::sync::Arc; + +pub fn init(tx: Sender<()>) { + ctrlc::set_handler(move || { + tx.send(()).unwrap(); + }) + .unwrap(); +} + +pub fn save_chunks(world: &World) { + let mut chunk_map = world.fetch_mut::(); + let handle = world.fetch::(); + let count = entity::save_chunks( + &mut chunk_map, + &handle, + &world.fetch(), + &world.read_component(), + &world.read_component(), + &world.read_component(), + &world.read_component(), + ); + + handle.sender.send(chunkworker::Request::ShutDown).unwrap(); + + let mut saved = 0; + // Wait for chunks to finish saving + while let Ok(msg) = handle.receiver.recv() { + if let chunkworker::Reply::SavedChunk(_) = msg { + saved += 1; + } + + if saved == count { + break; + } + } + + assert!( + count == saved, + "didn't save all chunks: {} != {}", + count, + saved + ); +} + +pub fn save_level(world: &World) { + let mut level = (*world.fetch::()).clone(); + + // Sync world time + level time + let time = world.fetch::