From b00c0b14a56eb45ebe8049d8fba0f566e6361614 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Wed, 15 Apr 2020 16:11:50 +0200 Subject: [PATCH] Use Guards to Ensure That Only One Request Creates or Deletes an App This commit ensures that subsequent DELETE requests of the same app name wait for the results of the first DELETE request. This makes the DELETE idempotent. Additionally, it ensures that POST and DELETE requests use the same guard based on the app name. --- api-tests/Cargo.lock | 220 ++++++------ api-tests/Cargo.toml | 2 +- api/Cargo.lock | 328 +++++++++--------- api/src/apps/apps.rs | 227 +++++++++--- api/src/apps/routes.rs | 13 +- .../infrastructure/dummy_infrastructure.rs | 46 ++- .../kubernetes/infrastructure.rs | 4 +- api/src/models/app_name.rs | 2 +- api/src/models/service.rs | 6 +- api/src/services/images_service.rs | 2 +- 10 files changed, 516 insertions(+), 334 deletions(-) diff --git a/api-tests/Cargo.lock b/api-tests/Cargo.lock index 2ccf26b..87479a9 100644 --- a/api-tests/Cargo.lock +++ b/api-tests/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5e63fd144e18ba274ae7095c0197a870a7b9468abc801dd62f190d80817d2ec" +checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" dependencies = [ "memchr", ] @@ -61,9 +61,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byte-tools" @@ -83,15 +83,6 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" -[[package]] -name = "c2-chacha" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -dependencies = [ - "ppv-lite86", -] - [[package]] name = "cc" version = "1.0.50" @@ -106,9 +97,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "core-foundation" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" dependencies = [ "core-foundation-sys", "libc", @@ -116,9 +107,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" [[package]] name = "crypto-mac" @@ -132,9 +123,9 @@ dependencies = [ [[package]] name = "derivative" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942ca430eef7a3806595a6737bc388bf51adb888d3fc0dd1b50f1c170167ee3a" +checksum = "3c6d883546668a3e2011b6a716a7330b82eabb0151b138217f632c8243e17135" dependencies = [ "proc-macro2 0.4.30", "quote 0.6.13", @@ -276,9 +267,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -334,9 +325,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5c295d1c0c68e4e42003d75f908f5e16a1edd1cbe0b0d02e4dc2006a384f47" +checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" dependencies = [ "bytes", "fnv", @@ -353,9 +344,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" dependencies = [ "libc", ] @@ -378,9 +369,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ "bytes", "fnv", @@ -414,9 +405,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7b15203263d1faa615f9337d79c1d37959439dc46c2b4faab33286fadc2a1c5" +checksum = "ed6081100e960d9d74734659ffc9cc91daf1c0fc7aceb8eaa94ee1a3f5046f2e" dependencies = [ "bytes", "futures-channel", @@ -486,9 +477,9 @@ checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[package]] name = "js-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cb931d43e71f560c81badb0191596562bafad2be06a3f9025b845c847c60df5" +checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" dependencies = [ "wasm-bindgen", ] @@ -511,9 +502,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.67" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" [[package]] name = "log" @@ -585,9 +576,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" +checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" dependencies = [ "lazy_static", "libc", @@ -620,9 +611,9 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "openssl" -version = "0.10.28" +version = "0.10.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52" +checksum = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" dependencies = [ "bitflags", "cfg-if", @@ -640,9 +631,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.54" +version = "0.9.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986" +checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" dependencies = [ "autocfg", "cc", @@ -659,22 +650,22 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" +checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" +checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -718,20 +709,15 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.11" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -dependencies = [ - "proc-macro2 1.0.9", - "quote 1.0.3", - "syn 1.0.16", -] +checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" [[package]] name = "proc-macro-nested" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" +checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" @@ -744,9 +730,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" +checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" dependencies = [ "unicode-xid 0.2.0", ] @@ -772,7 +758,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", ] [[package]] @@ -790,11 +776,11 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "c2-chacha", + "ppv-lite86", "rand_core", ] @@ -824,9 +810,9 @@ checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" [[package]] name = "regex" -version = "1.3.4" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" +checksum = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" dependencies = [ "aho-corasick", "memchr", @@ -836,9 +822,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.16" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1" +checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" [[package]] name = "remove_dir_all" @@ -887,15 +873,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" [[package]] name = "schannel" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507a9e6e8ffe0a4e0ebb9a10293e62fdf7657c06f1b8bb07a8fcf697d2abf295" +checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" dependencies = [ "lazy_static", "winapi 0.3.8", @@ -903,10 +889,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.3.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df" +checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" dependencies = [ + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -915,38 +902,39 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.3.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895" +checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" dependencies = [ "core-foundation-sys", + "libc", ] [[package]] name = "serde" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" +checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] name = "serde_json" -version = "1.0.48" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" +checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" dependencies = [ "itoa", "ryu", @@ -985,9 +973,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" [[package]] name = "subtle" @@ -1008,11 +996,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" +checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", "unicode-xid 0.2.0", ] @@ -1042,8 +1030,9 @@ dependencies = [ [[package]] name = "testcontainers" -version = "0.8.1" -source = "git+https://github.com/testcontainers/testcontainers-rs.git#b6f9dbe82478f28f5c5b46686bcc4dfe422fd9ea" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af06783709f5254b087f0a1ea4557e372a5c2c597ca4a1157fbe536b1de2fb19" dependencies = [ "derivative", "hex", @@ -1077,12 +1066,13 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.13" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa5e81d6bc4e67fe889d5783bd2a128ab2e0cfa487e0be16b6a8d177b101616" +checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" dependencies = [ "bytes", "fnv", + "futures-core", "iovec", "lazy_static", "memchr", @@ -1098,9 +1088,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -1115,9 +1105,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ "bytes", "futures-core", @@ -1141,9 +1131,9 @@ checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" [[package]] name = "typenum" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicase" @@ -1235,9 +1225,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557c397ab5a8e347d434782bcd31fc1483d927a6826804cec05cc792ee2519d" +checksum = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" dependencies = [ "cfg-if", "serde", @@ -1247,24 +1237,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0da9c9a19850d3af6df1cb9574970b566d617ecfaf36eb0b706b6f3ef9bd2f8" +checksum = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457414a91863c0ec00090dba537f88ab955d93ca6555862c29b6d860990b8a8a" +checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" dependencies = [ "cfg-if", "js-sys", @@ -1274,9 +1264,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205" +checksum = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" dependencies = [ "quote 1.0.3", "wasm-bindgen-macro-support", @@ -1284,28 +1274,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d" +checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8" +checksum = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" [[package]] name = "web-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721c6263e2c66fd44501cc5efbfa2b7dfa775d13e4ea38c46299646ed1f9c70a" +checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" dependencies = [ "js-sys", "wasm-bindgen", @@ -1341,9 +1331,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" +checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" dependencies = [ "winapi 0.3.8", ] diff --git a/api-tests/Cargo.toml b/api-tests/Cargo.toml index 2944bbb..8121da5 100644 --- a/api-tests/Cargo.toml +++ b/api-tests/Cargo.toml @@ -12,6 +12,6 @@ lazy_static = "1.4" reqwest = { version = "0.10", features = ["json"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -testcontainers = { git = "https://github.com/testcontainers/testcontainers-rs.git", branch = "master" } +testcontainers = { version = "0.9" } tokio = { version = "0.2", features = ["macros"] } uuid = { version = "0.8", features = ["serde", "v4"] } diff --git a/api/Cargo.lock b/api/Cargo.lock index f4a0fc0..6c3dbe2 100644 --- a/api/Cargo.lock +++ b/api/Cargo.lock @@ -49,9 +49,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d37ca0ddff0c8afe8307cd4cc3636c19f0fa09ecfc642344b1597d08a19d1a2" +checksum = "be3e94dc198f93aa4107649e68fbb7f4d759398643d36f498eb72a2ee8256652" dependencies = [ "bytes 0.5.4", "flate2", @@ -76,20 +76,20 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] name = "async-trait" -version = "0.1.24" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "750b1c38a1dfadd108da0f01c08f4cdc7ff1bb39b325f9c82cc972361780a6e1" +checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -117,9 +117,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad235dabf00f36301792cfe82499880ba54c6486be094d1047b02bacb67c14e8" +checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" dependencies = [ "backtrace-sys", "cfg-if", @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "backtrace-sys" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca797db0057bae1a7aa2eef3283a874695455cecf08a43bfb8507ee0ebc1ed69" +checksum = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" dependencies = [ "cc", "libc", @@ -162,6 +162,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +[[package]] +name = "base64" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3" + [[package]] name = "bitflags" version = "1.2.1" @@ -202,9 +208,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byte-tools" @@ -476,13 +482,13 @@ dependencies = [ [[package]] name = "dkregistry" version = "0.4.0-alpha.0" -source = "git+https://github.com/camallo/dkregistry-rs#cb22b538d788f7a88bf390e34bece4a503cefecb" +source = "git+https://github.com/camallo/dkregistry-rs#082c8b42cd41a109570fa5d27ab0578fb2cdb7fb" dependencies = [ "async-stream", - "base64 0.11.0", + "base64 0.12.0", "error-chain", "futures 0.3.4", - "http 0.2.0", + "http 0.2.1", "libflate", "log 0.4.8", "mime 0.3.16", @@ -494,7 +500,7 @@ dependencies = [ "strum", "strum_macros", "tar", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -547,9 +553,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9db393664b0e6c6230a14115e7e798f80b70f54038dc21165db24c6b7f28fc" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -568,9 +574,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "synstructure", ] @@ -582,9 +588,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d" +checksum = "f59efc38004c988e4201d11d263b8171f49a2e7ec0bdbb71773433f271504a5e" dependencies = [ "cfg-if", "libc", @@ -594,9 +600,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" +checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" dependencies = [ "cfg-if", "crc32fast", @@ -737,9 +743,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -851,20 +857,20 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5c295d1c0c68e4e42003d75f908f5e16a1edd1cbe0b0d02e4dc2006a384f47" +checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" dependencies = [ "bytes 0.5.4", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.0", + "http 0.2.1", "indexmap", "log 0.4.8", "slab", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-util", ] @@ -904,9 +910,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" dependencies = [ "libc", ] @@ -930,9 +936,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ "bytes 0.5.4", "fnv", @@ -970,7 +976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ "bytes 0.5.4", - "http 0.2.0", + "http 0.2.1", ] [[package]] @@ -1039,16 +1045,16 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7b15203263d1faa615f9337d79c1d37959439dc46c2b4faab33286fadc2a1c5" +checksum = "ed6081100e960d9d74734659ffc9cc91daf1c0fc7aceb8eaa94ee1a3f5046f2e" dependencies = [ "bytes 0.5.4", "futures-channel", "futures-core", "futures-util", - "h2 0.2.2", - "http 0.2.0", + "h2 0.2.4", + "http 0.2.1", "http-body 0.3.1", "httparse", "itoa", @@ -1056,7 +1062,7 @@ dependencies = [ "net2", "pin-project", "time", - "tokio 0.2.13", + "tokio 0.2.18", "tower-service", "want 0.3.0", ] @@ -1081,9 +1087,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" dependencies = [ "bytes 0.5.4", - "hyper 0.13.3", + "hyper 0.13.4", "native-tls", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-tls", ] @@ -1094,9 +1100,9 @@ source = "git+https://github.com/danieleades/hyperlocal?branch=update-hyper#5c1d dependencies = [ "futures-util", "hex", - "hyper 0.13.3", + "hyper 0.13.4", "pin-project", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -1167,9 +1173,9 @@ checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[package]] name = "js-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cb931d43e71f560c81badb0191596562bafad2be06a3f9025b845c847c60df5" +checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" dependencies = [ "wasm-bindgen", ] @@ -1213,7 +1219,7 @@ dependencies = [ "either", "futures 0.3.4", "futures-timer", - "http 0.2.0", + "http 0.2.1", "k8s-openapi", "log 0.4.8", "openssl", @@ -1247,9 +1253,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" -version = "0.2.67" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" [[package]] name = "libflate" @@ -1280,9 +1286,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ "scopeguard 1.1.0", ] @@ -1331,11 +1337,11 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memoffset" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" +checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" dependencies = [ - "rustc_version", + "autocfg 1.0.0", ] [[package]] @@ -1428,9 +1434,9 @@ dependencies = [ [[package]] name = "multimap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97fbd5d00e0e37bfb10f433af8f5aaf631e739368dc9fc28286ca81ca4948dc" +checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" dependencies = [ "serde", ] @@ -1528,9 +1534,9 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "openssl" -version = "0.10.28" +version = "0.10.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52" +checksum = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" dependencies = [ "bitflags", "cfg-if", @@ -1548,9 +1554,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.54" +version = "0.9.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986" +checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" dependencies = [ "autocfg 1.0.0", "cc", @@ -1584,7 +1590,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ - "lock_api 0.3.3", + "lock_api 0.3.4", "parking_lot_core 0.6.2", "rustc_version", ] @@ -1672,15 +1678,15 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e5277315f6b4f27e0e6744feb5d5ba1891e7164871033d3c8344c6783b349a" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -1696,22 +1702,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" +checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" +checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -1774,7 +1780,7 @@ dependencies = [ "serde_yaml", "sha2", "shiplift", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-core", "toml", "url 2.1.1", @@ -1783,46 +1789,41 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7959c6467d962050d639361f7703b2051c43036d03493c36f01d440fdd3138a" +checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "version_check 0.9.1", ] [[package]] name = "proc-macro-error-attr" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4002d9f55991d5e019fb940a90e1a95eb80c24e77cb2462dd4dc869604d543a" +checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "syn-mid", "version_check 0.9.1", ] [[package]] name = "proc-macro-hack" -version = "0.5.11" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -dependencies = [ - "proc-macro2 1.0.9", - "quote 1.0.3", - "syn 1.0.16", -] +checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" [[package]] name = "proc-macro-nested" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" +checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" @@ -1835,9 +1836,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" +checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" dependencies = [ "unicode-xid 0.2.0", ] @@ -1876,7 +1877,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", ] [[package]] @@ -2054,9 +2055,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.5" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048" +checksum = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" dependencies = [ "aho-corasick", "memchr", @@ -2125,9 +2126,9 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http 0.2.0", + "http 0.2.1", "http-body 0.3.1", - "hyper 0.13.3", + "hyper 0.13.4", "hyper-tls 0.4.1", "js-sys", "lazy_static", @@ -2141,7 +2142,7 @@ dependencies = [ "serde_json", "serde_urlencoded 0.6.1", "time", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-tls", "url 2.1.1", "wasm-bindgen", @@ -2237,7 +2238,7 @@ dependencies = [ "indexmap", "pear", "percent-encoding 1.0.1", - "smallvec 1.2.0", + "smallvec 1.3.0", "state", "time", "unicode-xid 0.1.0", @@ -2293,9 +2294,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507a9e6e8ffe0a4e0ebb9a10293e62fdf7657c06f1b8bb07a8fcf697d2abf295" +checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" dependencies = [ "lazy_static", "winapi 0.3.8", @@ -2331,21 +2332,22 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97bbedbe81904398b6ebb054b3e912f99d55807125790f3198ac990d98def5b0" +checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", + "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fd2f23e31ef68dd2328cc383bd493142e46107a3a0e24f7d734e3f3b80fe4c" +checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" dependencies = [ "core-foundation-sys", "libc", @@ -2368,9 +2370,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ "serde_derive", ] @@ -2387,20 +2389,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" +checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] name = "serde_json" -version = "1.0.48" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" +checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" dependencies = [ "itoa", "ryu", @@ -2488,8 +2490,8 @@ dependencies = [ "flate2", "futures-util", "futures_codec", - "http 0.2.0", - "hyper 0.13.3", + "http 0.2.1", + "hyper 0.13.4", "hyperlocal", "log 0.4.8", "mime 0.3.16", @@ -2497,7 +2499,7 @@ dependencies = [ "serde", "serde_json", "tar", - "tokio 0.2.13", + "tokio 0.2.18", "url 2.1.1", ] @@ -2518,9 +2520,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" [[package]] name = "state" @@ -2556,9 +2558,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6e163a520367c465f59e0a61a23cfae3b10b6546d78b6f672a382be79f7110" dependencies = [ "heck", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -2574,11 +2576,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" +checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", "unicode-xid 0.2.0", ] @@ -2589,9 +2591,9 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -2600,9 +2602,9 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "unicode-xid 0.2.0", ] @@ -2658,22 +2660,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee14bf8e6767ab4c687c9e8bc003879e042a96fd67a3ba5934eadb6536bef4db" +checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b51e1fbc44b5a0840be594fbc0f960be09050f2617e61e6aa43bef97cd3ef4" +checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", ] [[package]] @@ -2722,9 +2724,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.13" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa5e81d6bc4e67fe889d5783bd2a128ab2e0cfa487e0be16b6a8d177b101616" +checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" dependencies = [ "bytes 0.5.4", "fnv", @@ -2901,7 +2903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828" dependencies = [ "native-tls", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -2939,16 +2941,16 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ "bytes 0.5.4", "futures-core", "futures-sink", "log 0.4.8", "pin-project-lite", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -2995,9 +2997,9 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" [[package]] name = "typenum" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "ucd-trie" @@ -3038,7 +3040,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" dependencies = [ - "smallvec 1.2.0", + "smallvec 1.3.0", ] [[package]] @@ -3167,9 +3169,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557c397ab5a8e347d434782bcd31fc1483d927a6826804cec05cc792ee2519d" +checksum = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" dependencies = [ "cfg-if", "serde", @@ -3179,24 +3181,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0da9c9a19850d3af6df1cb9574970b566d617ecfaf36eb0b706b6f3ef9bd2f8" +checksum = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" dependencies = [ "bumpalo", "lazy_static", "log 0.4.8", - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457414a91863c0ec00090dba537f88ab955d93ca6555862c29b6d860990b8a8a" +checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" dependencies = [ "cfg-if", "js-sys", @@ -3206,9 +3208,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205" +checksum = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" dependencies = [ "quote 1.0.3", "wasm-bindgen-macro-support", @@ -3216,28 +3218,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d" +checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" dependencies = [ - "proc-macro2 1.0.9", + "proc-macro2 1.0.10", "quote 1.0.3", - "syn 1.0.16", + "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8" +checksum = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" [[package]] name = "web-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721c6263e2c66fd44501cc5efbfa2b7dfa775d13e4ea38c46299646ed1f9c70a" +checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" dependencies = [ "js-sys", "wasm-bindgen", @@ -3273,9 +3275,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" +checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" dependencies = [ "winapi 0.3.8", ] diff --git a/api/src/apps/apps.rs b/api/src/apps/apps.rs index e366aba..5be9a7d 100644 --- a/api/src/apps/apps.rs +++ b/api/src/apps/apps.rs @@ -36,10 +36,10 @@ use cached::{Cached, SizedCache}; use chrono::{DateTime, FixedOffset, Utc}; use handlebars::TemplateRenderError; use multimap::MultiMap; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use std::convert::{From, TryInto}; use std::str::FromStr; -use std::sync::Mutex; +use std::sync::{Arc, Condvar, Mutex}; use std::time::Duration; use tokio::runtime::Runtime; use tokio::sync::mpsc; @@ -48,19 +48,81 @@ use yansi::Paint; pub struct AppsService { config: Config, infrastructure: Box, - apps_in_deployment: Mutex>, + app_guards: Mutex>>, web_host_meta_cache: Mutex>, } -struct DeploymentGuard<'a, 'b> { - apps_service: &'a AppsService, - app_name: &'b String, +type GuardedResult = Result, AppsServiceError>; + +#[derive(Debug, Copy, Clone, PartialEq)] +enum AppGuardKind { + Deployment, + Deletion, +} + +/// This helper struct ensures that there is only one thread interacting with an application through +/// the infrastructure while multiple threads requests want to interact at the same time. +/// +/// With [#40](https://github.com/aixigo/PREvant/issues/40) this should be replaced with an worker/ +/// producer approach. +struct AppGuard { + app_name: AppName, + kind: AppGuardKind, + process_mutex: Mutex<(bool, Option)>, + condvar: Condvar, } -impl<'a, 'b> Drop for DeploymentGuard<'a, 'b> { - fn drop(&mut self) { - let mut apps_in_deployment = self.apps_service.apps_in_deployment.lock().unwrap(); - apps_in_deployment.remove(self.app_name); +impl AppGuard { + fn new(app_name: AppName, kind: AppGuardKind) -> Self { + AppGuard { + app_name, + kind, + process_mutex: Mutex::new((false, None)), + condvar: Condvar::new(), + } + } + + fn is_first(&self) -> bool { + let mut guard = self.process_mutex.lock().unwrap(); + if (*guard).0 { + false + } else { + (*guard).0 = true; + true + } + } + + fn wait_for_result(&self) -> GuardedResult { + let mut guard = self.process_mutex.lock().unwrap(); + while (*guard).1.is_none() { + trace!("waiting for the result of {}", self.app_name); + guard = self.condvar.wait(guard).unwrap(); + } + (*guard) + .1 + .as_ref() + .cloned() + .expect("Here it is expected that the deletion result is always present") + } + + #[must_use] + fn notify_with_result( + &self, + apps_service: &AppsService, + result: GuardedResult, + ) -> GuardedResult { + let mut guard = self.process_mutex.lock().unwrap(); + (*guard).1 = Some(result.clone()); + self.condvar.notify_all(); + + let mut apps_in_deletion = apps_service.app_guards.lock().unwrap(); + let removed_guard = apps_in_deletion.remove(&self.app_name); + trace!( + "Dropped guard for {:?}", + removed_guard.as_ref().map(|g| &*g.app_name) + ); + + result } } @@ -72,7 +134,7 @@ impl AppsService { Ok(AppsService { config, infrastructure, - apps_in_deployment: Mutex::new(HashSet::new()), + app_guards: Mutex::new(HashMap::new()), web_host_meta_cache: Mutex::new(SizedCache::with_size(500)), }) } @@ -245,17 +307,24 @@ impl AppsService { (app_name, service, meta) } - fn create_deployment_guard<'a, 'b>( - &'a self, - app_name: &'b String, - ) -> Option> { - let mut apps_in_deployment = self.apps_in_deployment.lock().unwrap(); - match apps_in_deployment.insert(app_name.clone()) { - true => Some(DeploymentGuard { - apps_service: self, - app_name, - }), - false => None, + #[must_use] + fn create_or_get_app_guard( + &self, + app_name: AppName, + kind: AppGuardKind, + ) -> Result, AppsServiceError> { + let mut apps_in_deletion = self.app_guards.lock().unwrap(); + let guard = &*apps_in_deletion + .entry(app_name.clone()) + .or_insert_with(|| Arc::new(AppGuard::new(app_name.clone(), kind))); + + if &guard.kind != &kind { + match guard.kind { + AppGuardKind::Deletion => Err(AppsServiceError::AppIsInDeletion { app_name }), + AppGuardKind::Deployment => Err(AppsServiceError::AppIsInDeployment { app_name }), + } + } else { + Ok(guard.clone()) } } @@ -285,7 +354,7 @@ impl AppsService { .filter(|config| !service_names.contains(config.service_name())) .filter(|config| !running_service_names.contains(config.service_name())) .map(|config| { - let mut replicated_config = config.clone(); + let mut replicated_config = config; replicated_config.set_container_type(ContainerType::Replica); replicated_config }) @@ -307,15 +376,26 @@ impl AppsService { replicate_from: Option, service_configs: &Vec, ) -> Result, AppsServiceError> { - let _guard = match self.create_deployment_guard(app_name) { - None => { - return Err(AppsServiceError::AppIsInDeployment { - app_name: app_name.clone(), - }) - } - Some(guard) => guard, - }; + let guard = self.create_or_get_app_guard(app_name.clone(), AppGuardKind::Deployment)?; + + if !guard.is_first() { + return Err(AppsServiceError::AppIsInDeployment { + app_name: app_name.clone(), + }); + } + + guard.notify_with_result( + self, + self.create_or_update_impl(app_name, replicate_from, service_configs), + ) + } + fn create_or_update_impl( + &self, + app_name: &AppName, + replicate_from: Option, + service_configs: &Vec, + ) -> Result, AppsServiceError> { let mut runtime = Runtime::new().expect("Should create runtime"); let mut configs: Vec = service_configs.clone(); @@ -361,6 +441,16 @@ impl AppsService { /// Deletes all services for the given `app_name`. pub fn delete_app(&self, app_name: &AppName) -> Result, AppsServiceError> { + let guard = self.create_or_get_app_guard(app_name.clone(), AppGuardKind::Deletion)?; + + if !guard.is_first() { + guard.wait_for_result() + } else { + guard.notify_with_result(self, self.delete_app_impl(app_name)) + } + } + + fn delete_app_impl(&self, app_name: &AppName) -> Result, AppsServiceError> { let mut runtime = Runtime::new().expect("Should create runtime"); let services = runtime.block_on(self.infrastructure.stop_services(app_name))?; @@ -415,43 +505,54 @@ impl AppsService { } /// Defines error cases for the `AppService` -#[derive(Debug, Fail)] +#[derive(Debug, Clone, Fail)] pub enum AppsServiceError { /// Will be used when no app with a given name is found #[fail(display = "Cannot find app {}.", app_name)] AppNotFound { app_name: AppName }, #[fail( - display = "The app {} is currently beeing deployed in by another request.", + display = "The app {} is currently within deployment by another request.", app_name )] AppIsInDeployment { app_name: AppName }, + #[fail( + display = "The app {} is currently within deletion in by another request.", + app_name + )] + AppIsInDeletion { app_name: AppName }, /// Will be used when the service cannot interact correctly with the infrastructure. #[fail(display = "Cannot interact with infrastructure: {}", error)] - InfrastructureError { error: failure::Error }, + InfrastructureError { error: Arc }, /// Will be used if the service configuration cannot be loaded. #[fail(display = "Invalid configuration: {}", error)] - InvalidServerConfiguration { error: ConfigError }, + InvalidServerConfiguration { error: Arc }, #[fail(display = "Invalid configuration (invalid template): {}", error)] - InvalidTemplateFormat { error: TemplateRenderError }, + InvalidTemplateFormat { error: Arc }, #[fail(display = "Unable to resolve information about image: {}", error)] UnableToResolveImage { error: ImagesServiceError }, } impl From for AppsServiceError { fn from(error: ConfigError) -> Self { - AppsServiceError::InvalidServerConfiguration { error } + AppsServiceError::InvalidServerConfiguration { + error: Arc::new(error), + } } } impl From for AppsServiceError { fn from(error: failure::Error) -> Self { - AppsServiceError::InfrastructureError { error } + AppsServiceError::InfrastructureError { + error: Arc::new(error), + } } } impl From for AppsServiceError { fn from(error: TemplateRenderError) -> Self { - AppsServiceError::InvalidTemplateFormat { error } + AppsServiceError::InvalidTemplateFormat { + error: Arc::new(error), + } } } @@ -894,4 +995,52 @@ Log msg 3 of service-a of app master Ok(()) } + + #[test] + fn should_delete_apps() -> Result<(), AppsServiceError> { + let config = Config::default(); + let infrastructure = Box::new(Dummy::new()); + let apps = AppsService::new(config, infrastructure)?; + + let app_name = AppName::from_str("master").unwrap(); + apps.create_or_update(&app_name, None, &service_configs!("service-a"))?; + let deleted_services = apps.delete_app(&app_name)?; + + assert_eq!( + deleted_services, + vec![ServiceBuilder::new() + .id("service-a".to_string()) + .app_name("master".to_string()) + .config(sc!("service-a")) + .started_at( + DateTime::parse_from_rfc3339("2019-07-18T07:25:00.000000000Z") + .unwrap() + .with_timezone(&Utc), + ) + .build() + .unwrap()], + ); + + Ok(()) + } + + #[test] + fn should_delete_apps_from_parallel_threads_returning_the_same_result( + ) -> Result<(), AppsServiceError> { + let config = Config::default(); + let infrastructure = Box::new(Dummy::with_delay(std::time::Duration::from_millis(500))); + let apps = Arc::new(AppsService::new(config, infrastructure)?); + + let app_name = AppName::from_str("master").unwrap(); + apps.create_or_update(&app_name, None, &service_configs!("service-a"))?; + + let apps_clone = apps.clone(); + let handle1 = std::thread::spawn(move || apps_clone.delete_app(&app_name)); + let app_name = AppName::from_str("master").unwrap(); + let handle2 = std::thread::spawn(move || apps.delete_app(&app_name)); + + assert_eq!(handle1.join().unwrap()?, handle2.join().unwrap()?,); + + Ok(()) + } } diff --git a/api/src/apps/routes.rs b/api/src/apps/routes.rs index a13c2e4..850825d 100644 --- a/api/src/apps/routes.rs +++ b/api/src/apps/routes.rs @@ -237,12 +237,13 @@ impl Responder<'static> for ServiceStatusResponse { impl From for HttpApiProblem { fn from(error: AppsError) -> Self { let status = match error { - AppsError::AppNotFound { app_name: _ } => StatusCode::NOT_FOUND, - AppsError::AppIsInDeployment { app_name: _ } => StatusCode::CONFLICT, - AppsError::InfrastructureError { error: _ } - | AppsError::InvalidServerConfiguration { error: _ } - | AppsError::InvalidTemplateFormat { error: _ } - | AppsError::UnableToResolveImage { error: _ } => { + AppsError::AppNotFound { .. } => StatusCode::NOT_FOUND, + AppsError::AppIsInDeployment { .. } => StatusCode::CONFLICT, + AppsError::AppIsInDeletion { .. } => StatusCode::CONFLICT, + AppsError::InfrastructureError { .. } + | AppsError::InvalidServerConfiguration { .. } + | AppsError::InvalidTemplateFormat { .. } + | AppsError::UnableToResolveImage { .. } => { error!("Internal server error: {}", error); StatusCode::INTERNAL_SERVER_ERROR } diff --git a/api/src/infrastructure/dummy_infrastructure.rs b/api/src/infrastructure/dummy_infrastructure.rs index fc19c70..bc03fea 100644 --- a/api/src/infrastructure/dummy_infrastructure.rs +++ b/api/src/infrastructure/dummy_infrastructure.rs @@ -33,21 +33,40 @@ use chrono::{DateTime, FixedOffset, Utc}; use multimap::MultiMap; use std::collections::HashSet; use std::sync::Mutex; +use std::time::Duration; #[cfg(test)] pub struct DummyInfrastructure { + delay: Option, services: Mutex>, } #[cfg(test)] impl DummyInfrastructure { - pub fn new() -> DummyInfrastructure { + pub fn new() -> Self { DummyInfrastructure { + delay: None, + services: Mutex::new(MultiMap::new()), + } + } + + pub fn with_delay(delay: Duration) -> Self { + DummyInfrastructure { + delay: Some(delay), services: Mutex::new(MultiMap::new()), } } } +#[cfg(test)] +impl DummyInfrastructure { + async fn delay_if_configured(&self) { + if let Some(delay) = &self.delay { + tokio::time::delay_for(delay.clone()).await; + } + } +} + #[cfg(test)] #[async_trait] impl Infrastructure for DummyInfrastructure { @@ -83,6 +102,8 @@ impl Infrastructure for DummyInfrastructure { configs: &Vec, _container_config: &ContainerConfig, ) -> Result, failure::Error> { + self.delay_if_configured().await; + let mut services = self.services.lock().unwrap(); if let Some(running_services) = services.get_vec_mut(app_name) { @@ -102,9 +123,28 @@ impl Infrastructure for DummyInfrastructure { } async fn stop_services(&self, app_name: &String) -> Result, failure::Error> { + self.delay_if_configured().await; + let mut services = self.services.lock().unwrap(); - services.remove(app_name); - Ok(vec![]) + match services.remove(app_name) { + Some(services) => Ok(services + .into_iter() + .map(|sc| { + ServiceBuilder::new() + .app_name(app_name.clone()) + .id(sc.service_name().clone()) + .config(sc) + .started_at( + DateTime::parse_from_rfc3339("2019-07-18T07:25:00.000000000Z") + .unwrap() + .with_timezone(&Utc), + ) + .build() + .unwrap() + }) + .collect()), + None => Ok(vec![]), + } } async fn get_logs( diff --git a/api/src/infrastructure/kubernetes/infrastructure.rs b/api/src/infrastructure/kubernetes/infrastructure.rs index 2053e5d..f439b67 100644 --- a/api/src/infrastructure/kubernetes/infrastructure.rs +++ b/api/src/infrastructure/kubernetes/infrastructure.rs @@ -415,8 +415,8 @@ impl KubernetesInfrastructure { } } - async fn stop_service<'a>( - &self, + async fn stop_service<'a, 'b: 'a>( + &'b self, app_name: &String, service: &'a Service, ) -> Result<&'a Service, KubernetesInfrastructureError> { diff --git a/api/src/models/app_name.rs b/api/src/models/app_name.rs index 9d0947b..fbb3bcd 100644 --- a/api/src/models/app_name.rs +++ b/api/src/models/app_name.rs @@ -32,7 +32,7 @@ use std::collections::HashSet; use std::ops::Deref; use std::str::{FromStr, Utf8Error}; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct AppName(String); impl Deref for AppName { diff --git a/api/src/models/service.rs b/api/src/models/service.rs index fc4892f..211cbd2 100644 --- a/api/src/models/service.rs +++ b/api/src/models/service.rs @@ -33,7 +33,7 @@ use std::net::IpAddr; use std::str::FromStr; use url::Url; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub struct Service { /// An unique identifier of the service, e.g. the container id id: String, @@ -45,7 +45,7 @@ pub struct Service { config: ServiceConfig, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] struct ServiceEndpoint { internal_addr: IpAddr, exposed_port: u16, @@ -61,7 +61,7 @@ impl ServiceEndpoint { } } -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct State { status: ServiceStatus, diff --git a/api/src/services/images_service.rs b/api/src/services/images_service.rs index 252df01..e79db83 100644 --- a/api/src/services/images_service.rs +++ b/api/src/services/images_service.rs @@ -144,7 +144,7 @@ impl ImageConfig { } } -#[derive(Debug, Fail)] +#[derive(Debug, Clone, Fail)] pub enum ImagesServiceError { #[fail(display = "Unknown manifest format for {}", image)] UnknownManifestFormat { image: Image },