diff --git a/Cargo.lock b/Cargo.lock index 5fc8b329..e58ef64b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "anyhow" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "arc-swap" version = "0.4.4" @@ -46,110 +51,138 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-core" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-executor" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-macro" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-sink" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-task" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-util" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (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.11 (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)", ] +[[package]] +name = "genawaiter" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "genawaiter-macro 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)", + "genawaiter-proc-macro 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "genawaiter-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "genawaiter-proc-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro-error 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "h2" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hermit-abi" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -178,14 +211,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -194,14 +227,14 @@ dependencies = [ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "indexmap" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -212,7 +245,7 @@ name = "iovec" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -233,15 +266,20 @@ dependencies = [ name = "lambda" version = "0.1.0" dependencies = [ + "anyhow 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "genawaiter 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", "lambda-attributes 0.1.0", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-error 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-futures 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -249,8 +287,8 @@ name = "lambda-attributes" version = "0.1.0" dependencies = [ "proc-macro2 0.4.30 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -260,7 +298,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -273,7 +311,7 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.0" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -286,7 +324,7 @@ dependencies = [ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -311,7 +349,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -341,7 +379,7 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -350,8 +388,8 @@ name = "num_cpus" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -367,9 +405,9 @@ name = "pin-project-internal" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -382,14 +420,38 @@ name = "pin-utils" version = "0.1.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proc-macro-error" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro-error-attr 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro-hack" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -407,7 +469,7 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.9" 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)", @@ -415,10 +477,10 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -428,7 +490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ryu" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -444,28 +506,36 @@ name = "serde_derive" version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.45" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sharded-slab" +version = "0.0.8" +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)", +] + [[package]] name = "signal-hook-registry" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -479,43 +549,53 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn-mid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (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.66 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -523,18 +603,18 @@ dependencies = [ "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-macros" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -543,11 +623,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -555,6 +635,60 @@ name = "tower-service" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "tracing" +version = "0.1.13" +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)", + "tracing-attributes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-core" +version = "0.1.10" +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)", +] + +[[package]] +name = "tracing-error" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-subscriber 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-futures" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "sharded-slab 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "try-lock" version = "0.2.2" @@ -570,6 +704,11 @@ name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "version_check" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "want" version = "0.3.0" @@ -618,6 +757,7 @@ dependencies = [ ] [metadata] +"checksum anyhow 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "013a6e0a2cbe3d20f9c60b65458f7a7f7a5e636c5d0f45a5a6aee5d4b1f01785" "checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" @@ -626,29 +766,32 @@ dependencies = [ "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" -"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" -"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" -"checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" -"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" -"checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" -"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" -"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" -"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" -"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1" -"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" +"checksum futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +"checksum futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +"checksum futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +"checksum genawaiter 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c86bd0361bcbde39b13475e6e36cb24c329964aa2611be285289d1e4b751c1a0" +"checksum genawaiter-macro 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b32dfe1fdfc0bbde1f22a5da25355514b5e450c33a6af6770884c8750aedfbc" +"checksum genawaiter-proc-macro 0.99.1 (registry+https://github.com/rust-lang/crates.io-index)" = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" +"checksum h2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9d5c295d1c0c68e4e42003d75f908f5e16a1edd1cbe0b0d02e4dc2006a384f47" +"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" "checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" "checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" -"checksum hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8bf49cfb32edee45d890537d9057d1b02ed55f53b7b6a30bae83a38c9231749e" -"checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc" +"checksum hyper 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7b15203263d1faa615f9337d79c1d37959439dc46c2b4faab33286fadc2a1c5" +"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" "checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" @@ -660,28 +803,39 @@ dependencies = [ "checksum pin-project-internal 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" "checksum pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" +"checksum proc-macro-error 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e7959c6467d962050d639361f7703b2051c43036d03493c36f01d440fdd3138a" +"checksum proc-macro-error-attr 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e4002d9f55991d5e019fb940a90e1a95eb80c24e77cb2462dd4dc869604d543a" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" +"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" +"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" +"checksum sharded-slab 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ae75d0445b5d3778c9da3d1f840faa16d0627c8607f78a74daf69e5b988c39a1" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" +"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" +"checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" -"checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c" +"checksum tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "0fa5e81d6bc4e67fe889d5783bd2a128ab2e0cfa487e0be16b6a8d177b101616" +"checksum tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +"checksum tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" +"checksum tracing-attributes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" +"checksum tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +"checksum tracing-error 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24" +"checksum tracing-futures 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "58b0b7fd92dc7b71f29623cc6836dd7200f32161a2313dd78be233a8405694f6" +"checksum tracing-subscriber 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dedebcf5813b02261d6bab3a12c6a8ae702580c0405a2e8ec16c3713caf14c20" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" diff --git a/lambda/Cargo.toml b/lambda/Cargo.toml index e7a96f1b..6e3c3c7e 100644 --- a/lambda/Cargo.toml +++ b/lambda/Cargo.toml @@ -4,6 +4,12 @@ version = "0.1.0" authors = ["David Barsky "] edition = "2018" +[features] +# no features by default +default = ["simulated", "derive"] +simulated = [] +derive = ["lambda-attributes"] + [dependencies] tokio = { version = "0.2.4", features = ["full"] } hyper = "0.13" @@ -12,5 +18,10 @@ serde_json = "1.0.39" tower-service = "0.3" bytes = "0.5" http = "0.2" -lambda-attributes = { path = "../lambda-attributes", version = "0.1.0" } -futures = "0.3.1" +lambda-attributes = { path = "../lambda-attributes", version = "0.1.0", optional = true} +genawaiter = { version = "0.99", features = ["futures03"] } +futures = "0.3" +tracing = "0.1.13" +tracing-futures = "0.2.3" +tracing-error = "0.1.2" +anyhow = "1.0.27" diff --git a/lambda/src/client.rs b/lambda/src/client.rs index c58a4cd3..ff518241 100644 --- a/lambda/src/client.rs +++ b/lambda/src/client.rs @@ -1,47 +1,79 @@ -use crate::{ - requests::{IntoResponse, NextEventResponse}, - types::Diagnostic, - Err, -}; -use bytes::buf::ext::BufExt; -use futures::future; +use crate::requests::{IntoResponse, NextEventResponse}; +use anyhow::Error; use http::{ uri::{PathAndQuery, Scheme}, HeaderValue, Method, Request, Response, StatusCode, Uri, }; -use hyper::Body; +use hyper::{client::HttpConnector, server::conn::Http, service::service_fn, Body}; use serde_json::json; -use std::{ - convert::{TryFrom, TryInto}, - future::Future, - pin::Pin, - task::{Context, Poll}, +use std::convert::TryFrom; +use tokio::{ + io::{AsyncRead, AsyncWrite}, + select, + sync::oneshot, }; -use tower_service::Service; +use tracing::{error, info, instrument}; + +#[instrument] +async fn hello(req: Request) -> Result, Error> { + Ok(Response::new(Body::from("hello"))) +} + +async fn handle_incoming(req: Request) -> Result, Error> { + let path: Vec<&str> = req + .uri() + .path_and_query() + .unwrap() + .as_str() + .split("/") + .collect::>(); + match &path[1..] { + ["2018-06-01", "runtime", "invocation", "next"] => next_event(&req).await, + ["2018-06-01", "runtime", "invocation", id, "response"] => complete_event(&req, id).await, + ["2018-06-01", "runtime", "invocation", id, "error"] => event_err(&req, id).await, + ["2018-06-01", "runtime", "init", "error"] => unimplemented!(), + _ => unimplemented!(), + } +} -type Fut<'a, T> = Pin + 'a + Send>>; +#[instrument(skip(io, rx))] +async fn handle(io: I, rx: oneshot::Receiver<()>) -> Result<(), hyper::error::Error> +where + I: AsyncRead + AsyncWrite + Unpin + 'static, +{ + let conn = Http::new().serve_connection(io, service_fn(handle_incoming)); + select! { + _ = rx => { + info!("Received cancelation signal"); + return Ok(()) + } + res = conn => { + match res { + Ok(()) => return Ok(()), + Err(e) => { + error!(message = "Got error serving connection", e = %e); + return Err(e); + } + } + } + } +} -#[derive(Debug, Clone)] -pub(crate) struct Client { +#[derive(Debug)] +pub(crate) struct Client { base: Uri, - client: S, + client: hyper::Client, } -impl Client +impl Client where - S: Service, Response = Response>, - S::Error: std::error::Error + Send + Sync + 'static, + C: hyper::client::connect::Connect + Sync + Send + Clone + 'static, { - pub fn with(base: T, client: S) -> Result - where - T: TryInto, - >::Error: std::error::Error + Send + Sync + 'static, - { - let base = base.try_into()?; - Ok(Self { base, client }) + pub fn with(base: Uri, client: hyper::Client) -> Self { + Self { base, client } } - fn set_origin(&self, req: Request) -> Result, Err> { + fn set_origin(&self, req: Request) -> Result, Error> { let (mut parts, body) = req.into_parts(); let (scheme, authority) = { let scheme = self.base.scheme().unwrap_or(&Scheme::HTTP); @@ -61,49 +93,17 @@ where Ok(Request::from_parts(parts, body)) } - pub(crate) async fn call(&mut self, req: Request) -> Result, Err> { + pub(crate) async fn call(&self, req: Request) -> Result, Error> { let req = self.set_origin(req)?; let (parts, body) = req.into_parts(); let body = Body::from(body); let req = Request::from_parts(parts, body); - let response = self.client.call(req).await?; + let response = self.client.request(req).await?; Ok(response) } } -pub struct EndpointSvc; - -impl Service> for EndpointSvc { - type Response = Response; - type Error = crate::Err; - type Future = Fut<'static, Result>; - - fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } - - fn call(&mut self, req: Request) -> Self::Future { - let fut = async move { - let path: Vec<&str> = req - .uri() - .path_and_query() - .unwrap() - .as_str() - .split("/") - .collect::>(); - match &path[1..] { - ["2018-06-01", "runtime", "invocation", "next"] => next_event(&req).await, - ["2018-06-01", "runtime", "invocation", id, "response"] => complete_event(&req, id).await, - ["2018-06-01", "runtime", "invocation", id, "error"] => event_err(&req, id).await, - ["2018-06-01", "runtime", "init", "error"] => unimplemented!(), - _ => unimplemented!(), - } - }; - Box::pin(fut) - } -} - -async fn next_event(req: &Request) -> Result, Err> { +async fn next_event(req: &Request) -> Result, Error> { let path = "/2018-06-01/runtime/invocation/next"; assert_eq!(req.method(), Method::GET); assert_eq!(req.uri().path_and_query().unwrap(), &PathAndQuery::from_static(path)); @@ -116,10 +116,10 @@ async fn next_event(req: &Request) -> Result, Err> { trace_id: "Root=1-5bef4de7-ad49b0e87f6ef6c87fc2e700;Parent=9a9197af755a6419", body: serde_json::to_vec(&body)?, }; - rsp.into_rsp() + rsp.into_rsp().map_err(|e| e.into()) } -async fn complete_event(req: &Request, id: &str) -> Result, Err> { +async fn complete_event(req: &Request, id: &str) -> Result, Error> { assert_eq!(Method::POST, req.method()); let rsp = Response::builder() .status(StatusCode::ACCEPTED) @@ -132,7 +132,7 @@ async fn complete_event(req: &Request, id: &str) -> Result, Ok(rsp) } -async fn event_err(req: &Request, id: &str) -> Result, Err> { +async fn event_err(req: &Request, id: &str) -> Result, Error> { let expected = format!("/2018-06-01/runtime/invocation/{}/error", id); assert_eq!(expected, req.uri().path()); @@ -145,160 +145,183 @@ async fn event_err(req: &Request, id: &str) -> Result, Err> Ok(rsp) } -pub struct MakeSvc; +fn set_origin(base: Uri, req: Request) -> Result, Error> { + let (mut parts, body) = req.into_parts(); + let (scheme, authority) = { + let scheme = base.scheme().unwrap_or(&Scheme::HTTP); + let authority = base.authority().expect("Authority not found"); + (scheme, authority) + }; + let path = parts.uri.path_and_query().expect("PathAndQuery not found"); -impl Service for MakeSvc { - type Response = EndpointSvc; - type Error = std::io::Error; - type Future = future::Ready>; + let uri = Uri::builder() + .scheme(scheme.clone()) + .authority(authority.clone()) + .path_and_query(path.clone()) + .build() + .expect("Unable to build URI"); - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { - Ok(()).into() - } - - fn call(&mut self, _: T) -> Self::Future { - future::ok(EndpointSvc) - } + parts.uri = uri; + Ok(Request::from_parts(parts, body)) } #[cfg(test)] mod endpoint_tests { - use super::{Client, MakeSvc}; + use super::{handle, set_origin}; use crate::{ - handler_fn, requests::{EventCompletionRequest, EventErrorRequest, IntoRequest, NextEventRequest}, - run_simulated, + simulated::SimulatedConnector, types::Diagnostic, - Err, INVOCATION_CTX, - }; - use http::{HeaderValue, StatusCode}; - use std::{ - convert::TryFrom, - net::{SocketAddr, TcpListener}, }; - use tokio::select; - - /// `race` selects over two tasks. - /// - /// The first task to complete is joined and checked for errors. - /// In this test suite, we don't expect that the "server" task - /// will ever complete because it is continuously listening for - /// incoming events. - macro_rules! race { - ($left:ident, $right:ident) => { - select! { - $left = $left => { $left?? }, - $right = $right => { $right?? } - }; - }; - } - - fn setup() -> Result<(TcpListener, SocketAddr), Err> { - let listener = TcpListener::bind("127.0.0.1:0")?; - let addr = listener.local_addr()?; - Ok((listener, addr)) - } + use anyhow::Error; + use http::{HeaderValue, StatusCode, Uri}; + use std::convert::TryFrom; + use tokio::sync; #[tokio::test] - async fn next_event() -> Result<(), Err> { - let (listener, addr) = setup()?; - let url = format!("http://{}/", addr); + async fn next_event() -> Result<(), Error> { + let (client, server) = crate::simulated::chan(); + let base = Uri::from_static("http://localhost:9001"); - let server = tokio::spawn(async move { - let svc = hyper::Server::from_tcp(listener)?.serve(MakeSvc); - svc.await + let (tx, rx) = sync::oneshot::channel(); + let server = tokio::spawn(async { + handle(server, rx).await.expect("Unable to handle request"); }); - let client = tokio::spawn(async { - let mut client = Client::with(url, hyper::Client::new())?; - let req = NextEventRequest.into_req()?; - let rsp = client.call(req).await?; - - assert_eq!(rsp.status(), StatusCode::OK); - let header = "lambda-runtime-deadline-ms"; - assert_eq!(rsp.headers()[header], &HeaderValue::try_from("1542409706888")?); - Ok::<(), Err>(()) - }); - race!(client, server); - Ok(()) - } + let conn = SimulatedConnector { inner: client }; + let client = hyper::Client::builder().build(conn); - #[tokio::test] - async fn ok_response() -> Result<(), Err> { - let (listener, addr) = setup()?; - let url = format!("http://{}/", addr); + let req = NextEventRequest.into_req()?; + let req = set_origin(base, req)?; + let rsp = client.request(req).await.expect("Unable to send request"); - let server = tokio::spawn(async move { - let svc = hyper::Server::from_tcp(listener)?.serve(MakeSvc); - svc.await - }); + assert_eq!(rsp.status(), StatusCode::OK); + let header = "lambda-runtime-deadline-ms"; + assert_eq!(rsp.headers()[header], &HeaderValue::try_from("1542409706888")?); - let client = tokio::spawn(async { - let mut client = Client::with(url, hyper::Client::new())?; - let req = EventCompletionRequest { - request_id: "156cb537-e2d4-11e8-9b34-d36013741fb9", - body: "done", - }; - let req = req.into_req()?; - let rsp = client.call(req).await?; - assert_eq!(rsp.status(), StatusCode::ACCEPTED); - Ok::<(), Err>(()) - }); - race!(client, server); - Ok(()) + // shutdown server... + tx.send(()).expect("Reciever has been dropped"); + match server.await { + Ok(_) => Ok(()), + Err(e) if e.is_panic() => return Err::<(), anyhow::Error>(e.into()), + Err(_) => unreachable!("This branch shouldn't be reachable"), + } } #[tokio::test] - async fn error_response() -> Result<(), Err> { - let (listener, addr) = setup()?; - let url = format!("http://{}/", addr); + async fn ok_response() -> Result<(), Error> { + let (client, server) = crate::simulated::chan(); + let (tx, rx) = sync::oneshot::channel(); + let base = Uri::from_static("http://localhost:9001"); - let server = tokio::spawn(async move { - let svc = hyper::Server::from_tcp(listener)?.serve(MakeSvc); - svc.await + let server = tokio::spawn(async { + handle(server, rx).await.expect("Unable to handle request"); }); - let client = tokio::spawn(async { - let mut client = Client::with(url, hyper::Client::new())?; - let req = EventErrorRequest { - request_id: "156cb537-e2d4-11e8-9b34-d36013741fb9", - diagnostic: Diagnostic { - error_type: "InvalidEventDataError".to_string(), - error_message: "Error parsing event data".to_string(), - }, - }; - let req = req.into_req()?; - let rsp = client.call(req).await?; - assert_eq!(rsp.status(), StatusCode::ACCEPTED); - Ok::<(), Err>(()) - }); - race!(client, server); - Ok(()) + let conn = SimulatedConnector { inner: client }; + let client = hyper::Client::builder().build(conn); + + let req = EventCompletionRequest { + request_id: "156cb537-e2d4-11e8-9b34-d36013741fb9", + body: "done", + }; + let req = req.into_req()?; + let req = set_origin(base, req)?; + + let rsp = client.request(req).await?; + assert_eq!(rsp.status(), StatusCode::ACCEPTED); + + // shutdown server + tx.send(()).expect("Reciever has been dropped"); + match server.await { + Ok(_) => Ok(()), + Err(e) if e.is_panic() => return Err::<(), anyhow::Error>(e.into()), + Err(_) => unreachable!("This branch shouldn't be reachable"), + } } #[tokio::test] - async fn run_end_to_end() -> Result<(), Err> { - use serde_json::Value; - let (listener, addr) = setup()?; - let url = format!("http://{}/", addr); - - let server = tokio::spawn(async move { - let svc = hyper::Server::from_tcp(listener)?.serve(MakeSvc); - svc.await + async fn error_response() -> Result<(), Error> { + let (client, server) = crate::simulated::chan(); + let (tx, rx) = sync::oneshot::channel(); + let base = Uri::from_static("http://localhost:9001"); + + let server = tokio::spawn(async { + handle(server, rx).await.expect("Unable to handle request"); }); - async fn handler(s: Value) -> Result { - INVOCATION_CTX.with(|ctx| { - assert!(ctx.xray_trace_id.is_some()); - }); - Ok(s) + let conn = SimulatedConnector { inner: client }; + let client = hyper::Client::builder().build(conn); + + let req = EventErrorRequest { + request_id: "156cb537-e2d4-11e8-9b34-d36013741fb9", + diagnostic: Diagnostic { + error_type: "InvalidEventDataError".to_string(), + error_message: "Error parsing event data".to_string(), + }, + }; + let req = req.into_req()?; + let req = set_origin(base, req)?; + let rsp = client.request(req).await?; + assert_eq!(rsp.status(), StatusCode::ACCEPTED); + + // shutdown server + tx.send(()).expect("Reciever has been dropped"); + match server.await { + Ok(_) => Ok(()), + Err(e) if e.is_panic() => return Err::<(), anyhow::Error>(e.into()), + Err(_) => unreachable!("This branch shouldn't be reachable"), } - let handler = handler_fn(handler); - let client = tokio::spawn(async move { - run_simulated(handler, &url).await?; - Ok::<(), Err>(()) - }); - race!(client, server); - Ok(()) } + + // #[tokio::test] + // async fn run_end_to_end() -> Result<(), Error> { + // use serde_json::Value; + + // let (client, server) = crate::simulated::chan(); + + // let (tx, rx) = sync::oneshot::channel(); + // let server = tokio::spawn(async move { handle(server, rx) }); + + // async fn handler(s: Value) -> Result { + // INVOCATION_CTX.with(|_ctx| {}); + // Ok(s) + // } + // let handler = handler_fn(handler); + // let client = tokio::spawn(async move { + // run_simulated(handler, &url).await?; + // Ok::<(), Error>(()) + // }); + // race!(client, server); + // Ok(()) + // } + + // #[tokio::test] + // async fn test_stream_handler() -> Result<(), Error> { + // let (client, server) = crate::simulated::chan(); + // let req = Request::builder() + // .method(Method::GET) + // .uri("http://httpbin.org") + // .body(Body::empty()) + // .expect("Can't build request"); + + // let conn = SimulatedConnector { inner: client }; + // let client = hyper::Client::builder().build(conn); + + // let (tx, rx) = sync::oneshot::channel(); + // let server = tokio::spawn(async { + // handle(server, rx).await.expect("Unable to handle request"); + // }); + + // let rsp = client.request(req).await.expect("Unable to send request"); + // assert_eq!(rsp.status(), http::StatusCode::OK); + + // // shutdown server + // tx.send(()).expect("Reciever has been dropped"); + // match server.await { + // Ok(_) => Ok(()), + // Err(e) if e.is_panic() => return Err::<(), anyhow::Error>(e.into()), + // Err(_) => unreachable!("This branch shouldn't be reachable"), + // } + // } } diff --git a/lambda/src/lib.rs b/lambda/src/lib.rs index 18568aca..b9b5aa2e 100644 --- a/lambda/src/lib.rs +++ b/lambda/src/lib.rs @@ -34,32 +34,27 @@ //! } //! ``` pub use crate::types::LambdaCtx; +use anyhow::Error; use client::Client; -use http::{Request, Response}; -use hyper::Body; +use futures::stream::{Stream, StreamExt}; +use genawaiter::{sync::gen, yield_}; pub use lambda_attributes::lambda; use serde::{Deserialize, Serialize}; use std::{ - convert::TryFrom, - env, - error::Error, - fmt, + convert::{TryFrom, TryInto}, + env, fmt, future::Future, - pin::Pin, - task::{Context, Poll}, }; -use tower_service::Service; mod client; mod requests; +mod simulated; /// Types availible to a Lambda function. mod types; use requests::{EventCompletionRequest, EventErrorRequest, IntoRequest, NextEventRequest}; use types::Diagnostic; -type Err = Box; - /// Configuration derived from environment variables. #[derive(Debug, Default, Clone, PartialEq)] pub struct Config { @@ -79,7 +74,7 @@ pub struct Config { impl Config { /// Attempts to read configuration from environment variables. - pub fn from_env() -> Result { + pub fn from_env() -> Result { let conf = Config { endpoint: env::var("AWS_LAMBDA_RUNTIME_API")?, function_name: env::var("AWS_LAMBDA_FUNCTION_NAME")?, @@ -99,9 +94,9 @@ tokio::task_local! { /// A trait describing an asynchronous function `A` to `B. pub trait Handler { /// Errors returned by this handler. - type Err; + type Error; /// The future response value of this handler. - type Fut: Future>; + type Fut: Future>; /// Process the incoming event and return the response asynchronously. fn call(&mut self, event: A) -> Self::Fut; } @@ -117,13 +112,13 @@ pub struct HandlerFn { f: F, } -impl Handler for HandlerFn +impl Handler for HandlerFn where F: Fn(A) -> Fut, - Fut: Future> + Send, - Err: Into> + fmt::Debug, + Fut: Future> + Send, + Error: Into> + fmt::Debug, { - type Err = Err; + type Error = Error; type Fut = Fut; fn call(&mut self, req: A) -> Self::Fut { // we pass along the context here @@ -152,104 +147,85 @@ where /// Ok(event) /// } /// ``` -pub async fn run(handler: F) -> Result<(), Err> +pub async fn run(handler: F) -> Result<(), Error> where F: Handler, - >::Err: fmt::Debug, + >::Error: fmt::Debug, A: for<'de> Deserialize<'de>, B: Serialize, { let mut handler = handler; let config = Config::from_env()?; - let client = Client::with(&config.endpoint, hyper::Client::new())?; - let mut exec = Executor { client }; - exec.run(&mut handler, false).await?; + let uri = config.endpoint.try_into().expect("Unable to convert to URL"); + let client = Client::with(uri, hyper::Client::new()); + let incoming = incoming(&client); + run_inner(&client, incoming, &mut handler).await?; Ok(()) } /// Runs the lambda function almost entirely in-memory. This is meant for testing. -pub async fn run_simulated(handler: F, url: &str) -> Result<(), Err> +pub async fn run_simulated(handler: F, url: &str) -> Result<(), Error> where F: Handler, - >::Err: fmt::Debug, + >::Error: fmt::Debug, A: for<'de> Deserialize<'de>, B: Serialize, { let mut handler = handler; - let client = Client::with(url, hyper::Client::new())?; - let mut exec = Executor { client }; - exec.run(&mut handler, true).await?; + let uri = url.try_into().expect("Unable to convert to URL"); + let client = Client::with(uri, hyper::Client::new()); + let incoming = incoming(&client).take(1); + run_inner(&client, incoming, &mut handler).await?; Ok(()) } -struct Executor { - client: Client, -} - -struct Incoming { - client: Client, - future: Option, -} - -impl futures::Stream for Incoming -where - S: Service, Response = Response>, - >>::Error: Error + Send + Sync + 'static, - F: Future, -{ - type Item = Result, S::Error>; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - unimplemented!() - } +fn incoming(client: &Client) -> impl Stream, Error>> + '_ { + gen!({ + let req = NextEventRequest.into_req().expect("Unable to construct request"); + yield_!(client.call(req).await) + }) } -impl Executor +async fn run_inner( + client: &Client, + incoming: impl Stream, Error>> + Unpin, + handler: &mut F, +) -> Result<(), Error> where - S: Service, Response = Response>, - >>::Error: Error + Send + Sync + 'static, + F: Handler, + >::Error: fmt::Debug, + A: for<'de> Deserialize<'de>, + B: Serialize, { - async fn run(&mut self, handler: &mut F, once: bool) -> Result<(), Err> - where - F: Handler, - >::Err: fmt::Debug, - A: for<'de> Deserialize<'de>, - B: Serialize, - { - let client = &mut self.client; - // todo: refactor this into a stream so that the `once` boolean can be replaced - // a `.take(n).await` combinator if we want to run this once, if `n` is `1`. - loop { - let req = NextEventRequest.into_req()?; - let event = client.call(req).await?; - let (parts, body) = event.into_parts(); - - let ctx = LambdaCtx::try_from(parts.headers)?; - let body = hyper::body::to_bytes(body).await?; - let body = serde_json::from_slice(&body)?; - - let request_id = &ctx.request_id.clone(); - let f = INVOCATION_CTX.scope(ctx, { handler.call(body) }); - - let req = match f.await { - Ok(res) => EventCompletionRequest { request_id, body: res }.into_req()?, - Err(err) => EventErrorRequest { - request_id, - diagnostic: Diagnostic { - error_message: format!("{:?}", err), - error_type: type_name_of_val(err).to_owned(), - }, - } - .into_req()?, - }; - client.call(req).await?; - if once { - break Ok(()); + let mut incoming = incoming; + while let Some(event) = incoming.next().await { + let event = event?; + let (parts, body) = event.into_parts(); + + let ctx: LambdaCtx = LambdaCtx::try_from(parts.headers)?; + let body = hyper::body::to_bytes(body).await?; + let body = serde_json::from_slice(&body)?; + + let request_id = &ctx.request_id.clone(); + let f = INVOCATION_CTX.scope(ctx, { handler.call(body) }); + + let req = match f.await { + Ok(res) => EventCompletionRequest { request_id, body: res }.into_req()?, + Err(e) => EventErrorRequest { + request_id, + diagnostic: Diagnostic { + error_message: format!("{:?}", e), + error_type: type_name_of_val(e).to_owned(), + }, } - } + .into_req()?, + }; + client.call(req).await?; } + + Ok(()) } fn type_name_of_val(_: T) -> &'static str { diff --git a/lambda/src/requests.rs b/lambda/src/requests.rs index 2273d9ab..4eabc3c1 100644 --- a/lambda/src/requests.rs +++ b/lambda/src/requests.rs @@ -1,15 +1,16 @@ -use crate::{types::Diagnostic, Err}; +use crate::types::Diagnostic; +use anyhow::Error; use http::{Method, Request, Response, Uri}; use hyper::Body; use serde::Serialize; use std::str::FromStr; pub(crate) trait IntoRequest { - fn into_req(self) -> Result, Err>; + fn into_req(self) -> Result, Error>; } pub(crate) trait IntoResponse { - fn into_rsp(self) -> Result, Err>; + fn into_rsp(self) -> Result, Error>; } // /runtime/invocation/next @@ -17,7 +18,7 @@ pub(crate) trait IntoResponse { pub(crate) struct NextEventRequest; impl IntoRequest for NextEventRequest { - fn into_req(self) -> Result, Err> { + fn into_req(self) -> Result, Error> { let req = Request::builder() .method(Method::GET) .uri(Uri::from_static("/2018-06-01/runtime/invocation/next")) @@ -41,7 +42,7 @@ pub struct NextEventResponse<'a> { } impl<'a> IntoResponse for NextEventResponse<'a> { - fn into_rsp(self) -> Result, Err> { + fn into_rsp(self) -> Result, Error> { let rsp = Response::builder() .header("lambda-runtime-aws-request-id", self.request_id) .header("lambda-runtime-deadline-ms", self.deadline) @@ -69,7 +70,7 @@ impl<'a, T> IntoRequest for EventCompletionRequest<'a, T> where T: for<'serialize> Serialize, { - fn into_req(self) -> Result, Err> { + fn into_req(self) -> Result, Error> { let uri = format!("/2018-06-01/runtime/invocation/{}/response", self.request_id); let uri = Uri::from_str(&uri)?; let body = serde_json::to_vec(&self.body)?; @@ -99,7 +100,7 @@ pub(crate) struct EventErrorRequest<'a> { } impl<'a> IntoRequest for EventErrorRequest<'a> { - fn into_req(self) -> Result, Err> { + fn into_req(self) -> Result, Error> { let uri = format!("/2018-06-01/runtime/invocation/{}/error", self.request_id); let uri = Uri::from_str(&uri)?; let body = serde_json::to_vec(&self.diagnostic)?; @@ -133,7 +134,7 @@ fn test_event_error_request() { struct InitErrorRequest; impl IntoRequest for InitErrorRequest { - fn into_req(self) -> Result, Err> { + fn into_req(self) -> Result, Error> { let uri = format!("/2018-06-01/runtime/init/error"); let uri = Uri::from_str(&uri)?; diff --git a/lambda/src/simulated.rs b/lambda/src/simulated.rs new file mode 100644 index 00000000..b59f0754 --- /dev/null +++ b/lambda/src/simulated.rs @@ -0,0 +1,229 @@ +use http::Uri; +use hyper::client::connect::Connection; +use std::{ + cmp::min, + collections::VecDeque, + future::Future, + io::Result as IoResult, + pin::Pin, + sync::{Arc, Mutex}, + task::{Context, Poll, Waker}, +}; +use tokio::io::{AsyncRead, AsyncWrite}; +use tower_service::Service; + +/// Creates a pair of AsyncReadWrite data streams, where the write end of each member of the pair +/// is the read end of the other member of the pair. This allows us to emulate the behavior of a TcpStream +/// but in-memory, deterministically, and with full control over failure injection. +pub(crate) fn chan() -> (SimStream, SimStream) { + // Set up two reference-counted, lock-guarded byte VecDeques, one for each direction of the + // connection + let one = Arc::new(Mutex::new(BufferState::new())); + let two = Arc::new(Mutex::new(BufferState::new())); + + // Use buf1 for the read-side of left, use buf2 for the write-side of left + let left = SimStream { + read: ReadHalf { buffer: one.clone() }, + write: WriteHalf { buffer: two.clone() }, + }; + + // Now swap the buffers for right + let right = SimStream { + read: ReadHalf { buffer: two }, + write: WriteHalf { buffer: one }, + }; + + (left, right) +} + +#[derive(Clone)] +pub struct SimulatedConnector { + pub inner: SimStream, +} + +impl Service for SimulatedConnector { + type Response = SimStream; + type Error = std::io::Error; + type Future = Pin> + Send>>; + + fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + + fn call(&mut self, _: Uri) -> Self::Future { + let inner = self.inner.clone(); + Box::pin(async move { Ok(inner) }) + } +} + +impl Connection for SimStream { + fn connected(&self) -> hyper::client::connect::Connected { + hyper::client::connect::Connected::new() + } +} + +/// A struct that implements AsyncRead + AsyncWrite (similarly to TcpStream) using in-memory +/// bytes only. Unfortunately tokio does not provide an operation that is the opposite of +/// `tokio::io::split`, as that would negate the need for this struct. +// TODO: Implement the ability to explicitly close a connection +#[derive(Debug, Clone)] +pub struct SimStream { + read: ReadHalf, + write: WriteHalf, +} + +/// Delegates to the underlying `write` member's methods +impl AsyncWrite for SimStream { + fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + Pin::new(&mut self.write).poll_write(cx, buf) + } + + fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.write).poll_flush(cx) + } + + fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.write).poll_shutdown(cx) + } +} + +/// Delegates to the underlying `read` member's methods +impl AsyncRead for SimStream { + fn poll_read(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> { + Pin::new(&mut self.read).poll_read(cx, buf) + } +} + +/// A buffer for use with ReadHalf/WriteHalf that allows bytes to be written at one end of a +/// dequeue and read from the other end. If a `read_waker` is provided, the BufferState will call +/// `wake()` when there is new data to be read. +#[derive(Debug, Clone)] +pub struct BufferState { + buffer: VecDeque, + read_waker: Option, +} + +impl BufferState { + fn new() -> Self { + BufferState { + buffer: VecDeque::new(), + read_waker: None, + } + } + /// Writes data to the front of the deque byte buffer + fn write(&mut self, buf: &[u8]) { + for b in buf { + self.buffer.push_front(*b) + } + + // If somebody is waiting on this data, wake them up. + if let Some(waker) = self.read_waker.take() { + waker.wake(); + } + } + + /// Read data from the end of the deque byte buffer + fn read(&mut self, to_buf: &mut [u8]) -> usize { + // Read no more bytes than we have available, and no more bytes than we were asked for + let bytes_to_read = min(to_buf.len(), self.buffer.len()); + for i in 0..bytes_to_read { + to_buf[i] = self.buffer.pop_back().unwrap(); + } + + bytes_to_read + } +} + +/// An AsyncWrite implementation that uses a VecDeque of bytes as a buffer. The WriteHalf will +/// add new bytes to the front of the deque using push_front. +/// +/// Intended for use with ReadHalf to read from the VecDeque +#[derive(Debug, Clone)] +pub struct WriteHalf { + buffer: Arc>, +} + +impl AsyncWrite for WriteHalf { + fn poll_write(self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &[u8]) -> Poll> { + // Acquire the lock for the buffer + let mut write_to = self + .buffer + .lock() + .expect("Lock was poisoned when acquiring buffer lock for WriteHalf"); + + // write the bytes + write_to.write(buf); + + // This operation completes immediately + Poll::Ready(Ok(buf.len())) + } + + fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + + fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } +} + +#[derive(Debug, Clone)] +pub struct ReadHalf { + buffer: Arc>, +} + +impl AsyncRead for ReadHalf { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> { + // Acquire the lock for the buffer + let mut read_from = self + .buffer + .lock() + .expect("Lock was poisoned when acquiring buffer lock for ReadHalf"); + + let bytes_read = read_from.read(buf); + + // Returning Poll::Ready(Ok(0)) would indicate that there is nothing more to read, which + // means that someone trying to read from a VecDeque that hasn't been written to yet + // would get an Eof error (as I learned the hard way). Instead we should return Poll:Pending + // to indicate that there could be more to read in the future. + if (bytes_read) == 0 { + read_from.read_waker = Some(cx.waker().clone()); + Poll::Pending + } else { + //read_from.read_waker = Some(cx.waker().clone()); + Poll::Ready(Ok(bytes_read)) + } + } +} + +#[cfg(test)] +mod tests { + use super::chan; + use tokio::io::{AsyncReadExt, AsyncWriteExt}; + + #[tokio::test] + async fn ends_should_talk_to_each_other() { + let (mut client, mut server) = chan(); + // Write ping to the side 1 + client.write_all(b"Ping").await.expect("Write should succeed"); + + // Verify we can read it from side 2 + let mut read_on_server = [0u8; 4]; + server + .read_exact(&mut read_on_server) + .await + .expect("Read should succeed"); + assert_eq!(&read_on_server, b"Ping"); + + // Write "Pong" to side 2 + server.write_all(b"Pong").await.expect("Write should succeed"); + + // Verify we can read it from side 1 + let mut read_on_client = [0u8; 4]; + client + .read_exact(&mut read_on_client) + .await + .expect("Read should succeed"); + assert_eq!(&read_on_client, b"Pong"); + } +} diff --git a/lambda/src/types.rs b/lambda/src/types.rs index e33f966a..b744cd46 100644 --- a/lambda/src/types.rs +++ b/lambda/src/types.rs @@ -1,4 +1,5 @@ -use crate::{Config, Err}; +use crate::Config; +use anyhow::Error; use http::HeaderMap; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, convert::TryFrom}; @@ -11,7 +12,7 @@ pub(crate) struct Diagnostic { } #[test] -fn round_trip_lambda_error() -> Result<(), Err> { +fn round_trip_lambda_error() -> Result<(), Error> { use serde_json::{json, Value}; let expected = json!({ "errorType": "InvalidEventDataError", @@ -102,7 +103,7 @@ pub struct LambdaCtx { /// The ARN of the Lambda function being invoked. pub invoked_function_arn: String, /// The X-Ray trace ID for the current invocation. - pub xray_trace_id: Option, + pub xray_trace_id: String, /// The client context object sent by the AWS mobile SDK. This field is /// empty unless the function is invoked using an AWS mobile SDK. pub client_context: Option, @@ -117,7 +118,7 @@ pub struct LambdaCtx { } impl TryFrom for LambdaCtx { - type Error = Err; + type Error = Error; fn try_from(headers: HeaderMap) -> Result { let ctx = LambdaCtx { request_id: headers["lambda-runtime-aws-request-id"] @@ -132,12 +133,10 @@ impl TryFrom for LambdaCtx { .to_str() .expect("Missing arn; this is a bug") .to_owned(), - xray_trace_id: headers.get("lambda-runtime-trace-id").map(|header| { - header - .to_str() - .expect("Invalid XRayTraceID sent by Lambda; this is a bug") - .to_owned() - }), + xray_trace_id: headers["lambda-runtime-trace-id"] + .to_str() + .expect("Invalid XRayTraceID sent by Lambda; this is a bug") + .to_owned(), ..Default::default() }; Ok(ctx)