diff --git a/Cargo.lock b/Cargo.lock index 7135a4de..3e904263 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "getrandom", "once_cell", "version_check", @@ -205,7 +205,7 @@ dependencies = [ "aws-smithy-json", "aws-smithy-types", "aws-types", - "bytes", + "bytes 1.4.0", "fastrand 1.9.0", "hex", "http", @@ -256,7 +256,7 @@ dependencies = [ "aws-smithy-http", "aws-smithy-types", "aws-types", - "bytes", + "bytes 1.4.0", "http", "http-body", "lazy_static", @@ -286,7 +286,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "bytes", + "bytes 1.4.0", "http", "http-body", "once_cell", @@ -315,7 +315,7 @@ dependencies = [ "aws-smithy-json", "aws-smithy-types", "aws-types", - "bytes", + "bytes 1.4.0", "http", "regex", "tokio-stream", @@ -342,7 +342,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "bytes", + "bytes 1.4.0", "http", "regex", "tower", @@ -372,7 +372,7 @@ checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c" dependencies = [ "aws-smithy-eventstream", "aws-smithy-http", - "bytes", + "bytes 1.4.0", "form_urlencoded", "hex", "hmac", @@ -405,7 +405,7 @@ checksum = "07ed8b96d95402f3f6b8b57eb4e0e45ee365f78b1a924faf20ff6e97abf1eae6" dependencies = [ "aws-smithy-http", "aws-smithy-types", - "bytes", + "bytes 1.4.0", "crc32c", "crc32fast", "hex", @@ -428,7 +428,7 @@ dependencies = [ "aws-smithy-http", "aws-smithy-http-tower", "aws-smithy-types", - "bytes", + "bytes 1.4.0", "fastrand 1.9.0", "http", "http-body", @@ -449,7 +449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460c8da5110835e3d9a717c61f5556b20d03c32a1dec57f8fc559b360f733bb8" dependencies = [ "aws-smithy-types", - "bytes", + "bytes 1.4.0", "crc32fast", ] @@ -461,7 +461,7 @@ checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28" dependencies = [ "aws-smithy-eventstream", "aws-smithy-types", - "bytes", + "bytes 1.4.0", "bytes-utils", "futures-core", "http", @@ -484,7 +484,7 @@ checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9" dependencies = [ "aws-smithy-http", "aws-smithy-types", - "bytes", + "bytes 1.4.0", "http", "http-body", "pin-project-lite", @@ -545,7 +545,7 @@ dependencies = [ "aws-smithy-http", "aws-smithy-types", "http", - "rustc_version", + "rustc_version 0.4.0", "tracing", ] @@ -568,7 +568,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", "miniz_oxide", "object", @@ -654,6 +654,16 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "1.4.0" @@ -666,7 +676,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9" dependencies = [ - "bytes", + "bytes 1.4.0", "either", ] @@ -686,6 +696,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" @@ -711,7 +727,7 @@ dependencies = [ "serde", "time 0.1.45", "wasm-bindgen", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -766,6 +782,15 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -803,7 +828,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" dependencies = [ - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -812,7 +837,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -821,8 +846,8 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "cfg-if", - "crossbeam-utils", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", ] [[package]] @@ -832,8 +857,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", - "cfg-if", - "crossbeam-utils", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", "memoffset", "scopeguard", ] @@ -844,8 +869,19 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if", - "crossbeam-utils", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", ] [[package]] @@ -854,7 +890,7 @@ version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -908,7 +944,7 @@ version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "num_cpus", ] @@ -946,7 +982,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] @@ -958,7 +994,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -979,7 +1015,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -1095,9 +1131,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags 1.3.2", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + [[package]] name = "futures" version = "0.3.28" @@ -1206,11 +1264,11 @@ dependencies = [ "aws-sdk-s3", "backtrace", "base64 0.21.3", - "bytes", + "bytes 1.4.0", "bytesize", "chrono", "format_table", - "futures", + "futures 0.3.28", "futures-util", "garage_api", "garage_block", @@ -1242,6 +1300,7 @@ dependencies = [ "structopt", "timeago", "tokio", + "tokio-unix-tcp", "toml", "tracing", "tracing-subscriber", @@ -1253,12 +1312,12 @@ version = "0.9.0" dependencies = [ "async-trait", "base64 0.21.3", - "bytes", + "bytes 1.4.0", "chrono", "crypto-common", "err-derive", "form_urlencoded", - "futures", + "futures 0.3.28", "futures-util", "garage_block", "garage_model", @@ -1289,6 +1348,7 @@ dependencies = [ "sha2", "tokio", "tokio-stream", + "tokio-unix-tcp", "tracing", "url", ] @@ -1300,9 +1360,9 @@ dependencies = [ "arc-swap", "async-compression", "async-trait", - "bytes", + "bytes 1.4.0", "bytesize", - "futures", + "futures 0.3.28", "futures-util", "garage_db", "garage_rpc", @@ -1344,7 +1404,7 @@ dependencies = [ "blake2", "chrono", "err-derive", - "futures", + "futures 0.3.28", "futures-util", "garage_block", "garage_db", @@ -1368,11 +1428,11 @@ version = "0.9.0" dependencies = [ "arc-swap", "async-trait", - "bytes", + "bytes 1.4.0", "bytesize", "err-derive", "format_table", - "futures", + "futures 0.3.28", "futures-util", "garage_db", "garage_util", @@ -1394,6 +1454,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", + "tokio-unix-tcp", "tracing", ] @@ -1403,8 +1464,8 @@ version = "0.9.0" dependencies = [ "arc-swap", "async-trait", - "bytes", - "futures", + "bytes 1.4.0", + "futures 0.3.28", "futures-util", "garage_db", "garage_rpc", @@ -1426,12 +1487,12 @@ dependencies = [ "arc-swap", "async-trait", "blake2", - "bytes", + "bytes 1.4.0", "bytesize", "chrono", "digest", "err-derive", - "futures", + "futures 0.3.28", "garage_db", "hex", "hexdump", @@ -1443,11 +1504,12 @@ dependencies = [ "opentelemetry", "rand", "rmp-serde", - "rustc_version", + "rustc_version 0.4.0", "serde", "serde_json", "sha2", "tokio", + "tokio-unix-tcp", "toml", "tracing", "xxhash-rust", @@ -1458,7 +1520,7 @@ name = "garage_web" version = "0.9.0" dependencies = [ "err-derive", - "futures", + "futures 0.3.28", "garage_api", "garage_model", "garage_table", @@ -1469,6 +1531,7 @@ dependencies = [ "opentelemetry", "percent-encoding", "tokio", + "tokio-unix-tcp", "tracing", ] @@ -1498,7 +1561,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1537,7 +1600,7 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ - "bytes", + "bytes 1.4.0", "fnv", "futures-core", "futures-sink", @@ -1665,7 +1728,7 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "bytes", + "bytes 1.4.0", "fnv", "itoa", ] @@ -1676,7 +1739,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes", + "bytes 1.4.0", "http", "pin-project-lite", ] @@ -1717,7 +1780,7 @@ version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "bytes", + "bytes 1.4.0", "futures-channel", "futures-core", "futures-util", @@ -1856,7 +1919,16 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", ] [[package]] @@ -1976,7 +2048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d9455388f4977de4d0934efa9f7d36296295537d774574113a20f6082de03da" dependencies = [ "base64 0.13.1", - "bytes", + "bytes 1.4.0", "chrono", "http", "percent-encoding", @@ -1986,6 +2058,16 @@ dependencies = [ "url", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "kube" version = "0.75.0" @@ -2006,11 +2088,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97e1a80ecd1b1438a2fc004549e155d47250b9e01fbfcf4cfbe9c8b56a085593" dependencies = [ "base64 0.13.1", - "bytes", + "bytes 1.4.0", "chrono", "dirs-next", "either", - "futures", + "futures 0.3.28", "http", "http-body", "hyper", @@ -2075,7 +2157,7 @@ dependencies = [ "ahash", "backoff", "derivative", - "futures", + "futures 0.3.28", "json-patch", "k8s-openapi", "kube-client", @@ -2083,7 +2165,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "smallvec", + "smallvec 1.11.0", "thiserror", "tokio", "tokio-util 0.7.8", @@ -2096,7 +2178,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e33da4b69f23c2ece0b3e729d079cebdc2c0206e493e42f510f500ad81c631d5" dependencies = [ - "futures", + "futures 0.3.28", "hex", "kuska-sodiumoxide", "log", @@ -2172,6 +2254,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.10" @@ -2197,6 +2288,12 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "md-5" version = "0.10.5" @@ -2242,6 +2339,25 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.8.8" @@ -2249,10 +2365,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", + "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio 0.6.23", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "mktemp" version = "0.5.0" @@ -2268,7 +2408,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" dependencies = [ - "bytes", + "bytes 1.4.0", "encoding_rs", "futures-util", "http", @@ -2286,18 +2426,28 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "net2" +version = "0.2.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + [[package]] name = "netapp" version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a00b76cec93e3ae68c9ed5f08e27a1507424987ee23d5ec961ebd4da820a265" +source = "git+https://git.deuxfleurs.fr/networkException/netapp.git?rev=184ad39eeaf5d8615b8800298d8c7e564bb68879#184ad39eeaf5d8615b8800298d8c7e564bb68879" dependencies = [ "arc-swap", "async-trait", - "bytes", - "cfg-if", + "bytes 1.4.0", + "cfg-if 1.0.0", "err-derive", - "futures", + "futures 0.3.28", "hex", "kuska-handshake", "kuska-sodiumoxide", @@ -2310,6 +2460,7 @@ dependencies = [ "serde", "tokio", "tokio-stream", + "tokio-unix-tcp", "tokio-util 0.7.8", ] @@ -2320,7 +2471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ "bitflags 2.4.0", - "cfg-if", + "cfg-if 1.0.0", "libc", ] @@ -2356,7 +2507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2507,7 +2658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" dependencies = [ "async-trait", - "futures", + "futures 0.3.28", "futures-util", "http", "opentelemetry", @@ -2557,7 +2708,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.3", + "rustc_version 0.2.3", ] [[package]] @@ -2567,7 +2729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api", + "lock_api 0.4.10", "parking_lot_core 0.8.6", ] @@ -2577,22 +2739,37 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api", + "lock_api 0.4.10", "parking_lot_core 0.9.8", ] +[[package]] +name = "parking_lot_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "rustc_version 0.2.3", + "smallvec 0.6.14", + "winapi 0.3.9", +] + [[package]] name = "parking_lot_core" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "instant", "libc", "redox_syscall 0.2.16", - "smallvec", - "winapi", + "smallvec 1.11.0", + "winapi 0.3.9", ] [[package]] @@ -2601,10 +2778,10 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "redox_syscall 0.3.5", - "smallvec", + "smallvec 1.11.0", "windows-targets", ] @@ -2707,7 +2884,7 @@ dependencies = [ "libc", "pnet_base", "pnet_sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2717,7 +2894,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf7a58b2803d818a374be9278a1fe8f88fce14b936afbe225000cfcd9c73f16" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2781,7 +2958,7 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fnv", "lazy_static", "memchr", @@ -2796,7 +2973,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ - "bytes", + "bytes 1.4.0", "prost-derive", ] @@ -2806,7 +2983,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" dependencies = [ - "bytes", + "bytes 1.4.0", "heck 0.3.3", "itertools 0.10.5", "lazy_static", @@ -2839,7 +3016,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ - "bytes", + "bytes 1.4.0", "prost", ] @@ -2898,6 +3075,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.2.16" @@ -2978,7 +3161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ "base64 0.21.3", - "bytes", + "bytes 1.4.0", "encoding_rs", "futures-core", "futures-util", @@ -3021,7 +3204,7 @@ dependencies = [ "spin 0.5.2", "untrusted", "web-sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3066,7 +3249,7 @@ dependencies = [ "fallible-streaming-iterator", "hashlink", "libsqlite3-sys", - "smallvec", + "smallvec 1.11.0", ] [[package]] @@ -3075,13 +3258,22 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.18", ] [[package]] @@ -3255,12 +3447,27 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.188" @@ -3362,7 +3569,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -3373,7 +3580,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -3413,7 +3620,7 @@ checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" dependencies = [ "crc32fast", "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-utils 0.8.16", "fs2", "fxhash", "libc", @@ -3421,6 +3628,15 @@ dependencies = [ "parking_lot 0.11.2", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.11.0" @@ -3434,7 +3650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3471,7 +3687,7 @@ dependencies = [ "parking_lot 0.11.2", "parking_lot_core 0.8.6", "static_init_macro", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3572,7 +3788,7 @@ version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fastrand 2.0.0", "redox_syscall 0.3.5", "rustix", @@ -3623,7 +3839,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", ] @@ -3635,7 +3851,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3693,9 +3909,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ "backtrace", - "bytes", + "bytes 1.4.0", "libc", - "mio", + "mio 0.8.8", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", @@ -3705,6 +3921,38 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "tokio-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "tokio-io", +] + +[[package]] +name = "tokio-executor" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", +] + [[package]] name = "tokio-io-timeout" version = "1.2.0" @@ -3726,6 +3974,25 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "tokio-reactor" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "lazy_static", + "log", + "mio 0.6.23", + "num_cpus", + "parking_lot 0.9.0", + "slab", + "tokio-executor", + "tokio-io", + "tokio-sync", +] + [[package]] name = "tokio-rustls" version = "0.23.4" @@ -3758,13 +4025,53 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-sync" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +dependencies = [ + "fnv", + "futures 0.1.31", +] + +[[package]] +name = "tokio-uds" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "libc", + "log", + "mio 0.6.23", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-unix-tcp" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25694660e312eccfaf8cdc29c7d1d9236a81ec14b968a77c5511940a142c30e2" +dependencies = [ + "mio 0.8.8", + "serde", + "tokio", + "tokio-uds", +] + [[package]] name = "tokio-util" version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ - "bytes", + "bytes 1.4.0", "futures-core", "futures-sink", "log", @@ -3778,7 +4085,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ - "bytes", + "bytes 1.4.0", "futures-core", "futures-io", "futures-sink", @@ -3831,7 +4138,7 @@ dependencies = [ "async-stream", "async-trait", "base64 0.13.1", - "bytes", + "bytes 1.4.0", "futures-core", "futures-util", "h2", @@ -3893,7 +4200,7 @@ checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ "base64 0.13.1", "bitflags 1.3.2", - "bytes", + "bytes 1.4.0", "futures-core", "futures-util", "http", @@ -3923,7 +4230,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "log", "pin-project-lite", "tracing-attributes", @@ -3983,7 +4290,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec", + "smallvec 1.11.0", "thread_local", "tracing", "tracing-core", @@ -4149,7 +4456,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] @@ -4174,7 +4481,7 @@ version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -4240,6 +4547,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -4250,6 +4563,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -4262,7 +4581,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4352,10 +4671,20 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "windows-sys", ] +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "xmlparser" version = "0.13.5" diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index e8cbc1c8..0c5129d6 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -39,6 +39,7 @@ futures-util = "0.3" pin-project = "1.0.12" tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio-stream = "0.1" +tokio-unix-tcp = "0.2.0" form_urlencoded = "1.0.0" http = "0.2" diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs index 4779f924..4df5f225 100644 --- a/src/api/admin/api_server.rs +++ b/src/api/admin/api_server.rs @@ -7,6 +7,8 @@ use futures::future::Future; use http::header::{ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ALLOW}; use hyper::{Body, Request, Response, StatusCode}; +use tokio_unix_tcp::NamedSocketAddr; + use opentelemetry::trace::SpanRef; #[cfg(feature = "metrics")] @@ -17,7 +19,6 @@ use prometheus::{Encoder, TextEncoder}; use garage_model::garage::Garage; use garage_rpc::system::ClusterHealthStatus; use garage_util::error::Error as GarageError; -use garage_util::socket_address::UnixOrTCPSocketAddress; use crate::generic_server::*; @@ -62,7 +63,7 @@ impl AdminApiServer { pub async fn run( self, - bind_addr: UnixOrTCPSocketAddress, + bind_addr: NamedSocketAddr, shutdown_signal: impl Future, ) -> Result<(), GarageError> { let region = self.garage.config.s3_api.s3_region.clone(); diff --git a/src/api/admin/cluster.rs b/src/api/admin/cluster.rs index c8107b82..0874a176 100644 --- a/src/api/admin/cluster.rs +++ b/src/api/admin/cluster.rs @@ -1,9 +1,11 @@ -use std::net::SocketAddr; +use std::collections::HashMap; use std::sync::Arc; use hyper::{Body, Request, Response}; use serde::{Deserialize, Serialize}; +use tokio_unix_tcp::SocketAddr; + use garage_util::crdt::*; use garage_util::data::*; diff --git a/src/api/generic_server.rs b/src/api/generic_server.rs index fa346f48..8efda33d 100644 --- a/src/api/generic_server.rs +++ b/src/api/generic_server.rs @@ -16,6 +16,8 @@ use hyperlocal::UnixServerExt; use tokio::net::UnixStream; +use tokio_unix_tcp::NamedSocketAddr; + use opentelemetry::{ global, metrics::{Counter, ValueRecorder}, @@ -26,7 +28,6 @@ use opentelemetry::{ use garage_util::error::Error as GarageError; use garage_util::forwarded_headers; use garage_util::metrics::{gen_trace_id, RecordDuration}; -use garage_util::socket_address::UnixOrTCPSocketAddress; pub(crate) trait ApiEndpoint: Send + Sync + 'static { fn name(&self) -> &'static str; @@ -97,7 +98,7 @@ impl ApiServer { pub async fn run_server( self: Arc, - bind_addr: UnixOrTCPSocketAddress, + bind_addr: NamedSocketAddr, unix_bind_addr_mode: Option, shutdown_signal: impl Future, ) -> Result<(), GarageError> { @@ -134,13 +135,13 @@ impl ApiServer { ); match bind_addr { - UnixOrTCPSocketAddress::TCPSocket(addr) => { + NamedSocketAddr::Inet(addr) => { Server::bind(&addr) .serve(tcp_service) .with_graceful_shutdown(shutdown_signal) .await? } - UnixOrTCPSocketAddress::UnixSocket(ref path) => { + NamedSocketAddr::Unix(ref path) => { if path.exists() { fs::remove_file(path)? } diff --git a/src/api/k2v/api_server.rs b/src/api/k2v/api_server.rs index 3a032aba..ade4b40d 100644 --- a/src/api/k2v/api_server.rs +++ b/src/api/k2v/api_server.rs @@ -5,10 +5,11 @@ use async_trait::async_trait; use futures::future::Future; use hyper::{Body, Method, Request, Response}; +use tokio_unix_tcp::NamedSocketAddr; + use opentelemetry::{trace::SpanRef, KeyValue}; use garage_util::error::Error as GarageError; -use garage_util::socket_address::UnixOrTCPSocketAddress; use garage_model::garage::Garage; @@ -37,7 +38,7 @@ pub(crate) struct K2VApiEndpoint { impl K2VApiServer { pub async fn run( garage: Arc, - bind_addr: UnixOrTCPSocketAddress, + bind_addr: NamedSocketAddr, s3_region: String, shutdown_signal: impl Future, ) -> Result<(), GarageError> { diff --git a/src/api/s3/api_server.rs b/src/api/s3/api_server.rs index d675ab61..a1439473 100644 --- a/src/api/s3/api_server.rs +++ b/src/api/s3/api_server.rs @@ -6,10 +6,11 @@ use futures::future::Future; use hyper::header; use hyper::{Body, Request, Response}; +use tokio_unix_tcp::NamedSocketAddr; + use opentelemetry::{trace::SpanRef, KeyValue}; use garage_util::error::Error as GarageError; -use garage_util::socket_address::UnixOrTCPSocketAddress; use garage_model::garage::Garage; use garage_model::key_table::Key; @@ -46,7 +47,7 @@ pub(crate) struct S3ApiEndpoint { impl S3ApiServer { pub async fn run( garage: Arc, - addr: UnixOrTCPSocketAddress, + addr: NamedSocketAddr, s3_region: String, shutdown_signal: impl Future, ) -> Result<(), GarageError> { diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml index 7c3a79cb..26dece50 100644 --- a/src/garage/Cargo.toml +++ b/src/garage/Cargo.toml @@ -52,8 +52,9 @@ toml = "0.6" futures = "0.3" futures-util = "0.3" tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } +tokio-unix-tcp = "0.2.0" -netapp = "0.10" +netapp = { git = "https://git.deuxfleurs.fr/networkException/netapp.git", rev = "184ad39eeaf5d8615b8800298d8c7e564bb68879" } opentelemetry = { version = "0.17", features = [ "rt-tokio" ] } opentelemetry-prometheus = { version = "0.10", optional = true } diff --git a/src/garage/cli/init.rs b/src/garage/cli/init.rs index 20813f1c..fbca7729 100644 --- a/src/garage/cli/init.rs +++ b/src/garage/cli/init.rs @@ -2,6 +2,8 @@ use std::path::PathBuf; use garage_util::error::*; +use tokio_unix_tcp::NamedSocketAddr; + pub const READ_KEY_ERROR: &str = "Unable to read node key. It will be generated by your garage node the first time is it launched. Ensure that your garage node is currently running. (The node key is supposed to be stored in your metadata directory.)"; pub fn node_id_command(config_file: PathBuf, quiet: bool) -> Result<(), Error> { @@ -21,12 +23,17 @@ pub fn node_id_command(config_file: PathBuf, quiet: bool) -> Result<(), Error> { let idstr = hex::encode(node_id); println!("{}", idstr); - if !quiet { - warn!("WARNING: I don't know the public address to reach this node."); - warn!("In all of the instructions below, replace 127.0.0.1:{} by the appropriate address and port.", config.rpc_bind_addr.port()); - } + match config.rpc_bind_addr { + NamedSocketAddr::Inet(addr) => { + if !quiet { + warn!("WARNING: I don't know the public address to reach this node."); + warn!("In all of the instructions below, replace 127.0.0.1:{} by the appropriate address and port.", addr.port()); + } - format!("{}@127.0.0.1:{}", idstr, config.rpc_bind_addr.port()) + format!("{}@127.0.0.1:{}", idstr, addr.port()) + } + NamedSocketAddr::Unix(path) => format!("{}@{}", idstr, path.to_string_lossy()), + } }; if !quiet { diff --git a/src/garage/main.rs b/src/garage/main.rs index 66403d05..987c7b6e 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -21,6 +21,7 @@ compile_error!("Only one of bundled-libs and system-libs Cargo features must be compile_error!("Must activate the Cargo feature for at least one DB engine: lmdb, sled or sqlite."); use std::net::SocketAddr; +use std::net; use std::path::PathBuf; use structopt::StructOpt; @@ -36,6 +37,8 @@ use garage_rpc::*; use garage_model::helper::error::Error as HelperError; +use tokio_unix_tcp::NamedSocketAddr; + use admin::*; use cli::*; @@ -218,8 +221,8 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { // Find and parse the address of the target host let (id, addr, is_default_addr) = if let Some(h) = opt.rpc_host { - let (id, addrs) = parse_and_resolve_peer_addr(&h).ok_or_else(|| format!("Invalid RPC remote node identifier: {}. Expected format is @:.", h))?; - (id, addrs[0], false) + let (id, addrs) = parse_and_resolve_peer_addr(&h).ok_or_else(|| format!("Invalid RPC remote node identifier: {}. Expected format is @: or @ for unix domain sockets.", h))?; + (id, addrs[0].clone(), false) } else { let node_id = garage_rpc::system::read_node_id(&config.as_ref().unwrap().metadata_dir) .err_context(READ_KEY_ERROR)?; @@ -230,18 +233,24 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { .ok_or_message("unable to resolve rpc_public_addr specified in config file")? .next() .ok_or_message("unable to resolve rpc_public_addr specified in config file")?; - (node_id, a, false) + (node_id, NamedSocketAddr::Inet(a), false) } else { - let default_addr = SocketAddr::new( - "127.0.0.1".parse().unwrap(), - config.as_ref().unwrap().rpc_bind_addr.port(), - ); + let default_addr = + config + .as_ref() + .unwrap() + .rpc_bind_addr + .clone() + .map_inet(|socket_addr| { + net::SocketAddr::new("127.0.0.1".parse().unwrap(), socket_addr.port()) + }); + (node_id, default_addr, true) } }; // Connect to target host - if let Err(e) = netapp.clone().try_connect(addr, id).await { + if let Err(e) = netapp.clone().try_connect(addr.clone().into(), id).await { if is_default_addr { warn!( "Tried to contact Garage node at default address {}, which didn't work. If that address is wrong, consider setting rpc_public_addr in your config file.", diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml index 42b7ffdb..6a6e2673 100644 --- a/src/model/Cargo.toml +++ b/src/model/Cargo.toml @@ -39,7 +39,7 @@ futures-util = "0.3" tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } opentelemetry = "0.17" -netapp = "0.10" +netapp = { git = "https://git.deuxfleurs.fr/networkException/netapp.git", rev = "184ad39eeaf5d8615b8800298d8c7e564bb68879" } [features] default = [ "sled", "lmdb", "sqlite" ] diff --git a/src/rpc/Cargo.toml b/src/rpc/Cargo.toml index f450718f..340cb566 100644 --- a/src/rpc/Cargo.toml +++ b/src/rpc/Cargo.toml @@ -47,9 +47,10 @@ futures = "0.3" futures-util = "0.3" tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio-stream = { version = "0.1", features = ["net"] } +tokio-unix-tcp = "0.2.0" opentelemetry = "0.17" -netapp = { version = "0.10", features = ["telemetry"] } +netapp = { git = "https://git.deuxfleurs.fr/networkException/netapp.git", rev = "184ad39eeaf5d8615b8800298d8c7e564bb68879", features = ["telemetry"] } [features] kubernetes-discovery = [ "kube", "k8s-openapi", "schemars" ] diff --git a/src/rpc/system.rs b/src/rpc/system.rs index 78fcc74b..c73b6632 100644 --- a/src/rpc/system.rs +++ b/src/rpc/system.rs @@ -1,8 +1,9 @@ //! Module containing structs related to membership management use std::collections::HashMap; use std::io::{Read, Write}; -use std::net::{IpAddr, SocketAddr}; +use std::net::{self, IpAddr}; use std::path::{Path, PathBuf}; +use std::str::FromStr; use std::sync::atomic::Ordering; use std::sync::{Arc, RwLock}; use std::time::{Duration, Instant}; @@ -16,6 +17,8 @@ use tokio::select; use tokio::sync::watch; use tokio::sync::Mutex; +use tokio_unix_tcp::{NamedSocketAddr, SocketAddr}; + use netapp::endpoint::{Endpoint, EndpointHandler}; use netapp::message::*; use netapp::peering::fullmesh::FullMeshPeeringStrategy; @@ -77,7 +80,7 @@ impl Rpc for SystemRpc { } #[derive(Serialize, Deserialize)] -pub struct PeerList(Vec<(Uuid, SocketAddr)>); +pub struct PeerList(Vec<(Uuid, NamedSocketAddr)>); impl garage_util::migrate::InitialFormat for PeerList {} /// This node's membership manager @@ -97,9 +100,9 @@ pub struct System { system_endpoint: Arc>, - rpc_listen_addr: SocketAddr, + rpc_listen_addr: NamedSocketAddr, #[cfg(any(feature = "consul-discovery", feature = "kubernetes-discovery"))] - rpc_public_addr: Option, + rpc_public_addr: Option, bootstrap_peers: Vec, #[cfg(feature = "consul-discovery")] @@ -289,33 +292,47 @@ impl System { let ring = Ring::new(cluster_layout, replication_factor); let (update_ring, ring) = watch::channel(Arc::new(ring)); - let rpc_public_addr = match &config.rpc_public_addr { + let rpc_public_addr: Option = match &config.rpc_public_addr { Some(a_str) => { - use std::net::ToSocketAddrs; - match a_str.to_socket_addrs() { - Err(e) => { - error!( - "Cannot resolve rpc_public_addr {} from config file: {}.", - a_str, e - ); - None - } - Ok(a) => { - let a = a.collect::>(); - if a.is_empty() { - error!("rpc_public_addr {} resolve to no known IP address", a_str); + // FIXME: Remove this unwrap + match NamedSocketAddr::from_str(a_str).unwrap() { + NamedSocketAddr::Inet(address) => { + use std::net::ToSocketAddrs; + match address.to_socket_addrs() { + Err(e) => { + error!( + "Cannot resolve rpc_public_addr {} from config file: {}.", + a_str, e + ); + None + } + Ok(a) => { + let a = a.collect::>(); + if a.is_empty() { + error!( + "rpc_public_addr {} resolve to no known IP address", + a_str + ); + } + if a.len() > 1 { + warn!("Multiple possible resolutions for rpc_public_addr: {:?}. Taking the first one.", a); + } + a.into_iter().next().map(NamedSocketAddr::Inet) + } } - if a.len() > 1 { - warn!("Multiple possible resolutions for rpc_public_addr: {:?}. Taking the first one.", a); - } - a.into_iter().next() } + NamedSocketAddr::Unix(path) => Some(path.into()), } } None => { - let addr = - get_default_ip().map(|ip| SocketAddr::new(ip, config.rpc_bind_addr.port())); - if let Some(a) = addr { + let addr: Option = match &config.rpc_bind_addr { + NamedSocketAddr::Inet(address) => { + get_default_ip().map(|ip| net::SocketAddr::new(ip, address.port()).into()) + } + NamedSocketAddr::Unix(path) => Some(path.to_owned().into()), + }; + + if let Some(a) = &addr { warn!("Using autodetected rpc_public_addr: {}. Consider specifying it explicitly in configuration file if possible.", a); } addr @@ -368,7 +385,7 @@ impl System { system_endpoint, replication_mode, replication_factor, - rpc_listen_addr: config.rpc_bind_addr, + rpc_listen_addr: config.rpc_bind_addr.clone().into(), #[cfg(any(feature = "consul-discovery", feature = "kubernetes-discovery"))] rpc_public_addr, bootstrap_peers: config.bootstrap_peers.clone(), @@ -392,7 +409,7 @@ impl System { join!( self.netapp .clone() - .listen(self.rpc_listen_addr, None, must_exit.clone()), + .listen(self.rpc_listen_addr.clone(), None, must_exit.clone()), self.fullmesh.clone().run(must_exit.clone()), self.discovery_loop(must_exit.clone()), self.status_exchange_loop(must_exit.clone()), @@ -410,7 +427,7 @@ impl System { .iter() .map(|n| KnownNodeInfo { id: n.id.into(), - addr: n.addr, + addr: n.addr.clone().to_socket_addr(), is_up: n.is_up(), last_seen_secs_ago: n .last_seen @@ -448,12 +465,17 @@ impl System { })?; let mut errors = vec![]; for addr in addrs.iter() { - match self.netapp.clone().try_connect(*addr, pubkey).await { + match self + .netapp + .clone() + .try_connect(addr.clone().into(), pubkey) + .await + { Ok(()) => return Ok(()), Err(e) => { errors.push(( - *addr, - Error::Message(connect_error_message(*addr, pubkey, e)), + addr.clone(), + Error::Message(connect_error_message(addr.clone().into(), pubkey, e)), )); } } @@ -742,7 +764,12 @@ impl System { // Add peer list from list stored on disk if let Ok(peers) = self.persist_peer_list.load_async().await { - ping_list.extend(peers.0.iter().map(|(id, addr)| ((*id).into(), *addr))) + ping_list.extend( + peers + .0 + .iter() + .map(|(id, addr)| ((*id).into(), addr.clone())), + ) } // Fetch peer list from Consul @@ -783,8 +810,13 @@ impl System { for (node_id, node_addr) in ping_list { let self2 = self.clone(); tokio::spawn(async move { - if let Err(e) = self2.netapp.clone().try_connect(node_addr, node_id).await { - error!("{}", connect_error_message(node_addr, node_id, e)); + if let Err(e) = self2 + .netapp + .clone() + .try_connect(node_addr.clone(), node_id) + .await + { + error!("{}", connect_error_message(node_addr.into(), node_id, e)); } }); } @@ -814,7 +846,7 @@ impl System { .fullmesh .get_peer_list() .iter() - .map(|n| (n.id.into(), n.addr)) + .map(|n| (n.id.into(), n.addr.clone())) .collect::>(); // Before doing it, we read the current peer list file (if it exists) @@ -963,7 +995,7 @@ fn get_default_ip() -> Option { .map(|a| a.ip()) } -async fn resolve_peers(peers: &[String]) -> Vec<(NodeID, SocketAddr)> { +async fn resolve_peers(peers: &[String]) -> Vec<(NodeID, NamedSocketAddr)> { let mut ret = vec![]; for peer in peers.iter() { diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml index 6554ac13..560f2156 100644 --- a/src/util/Cargo.toml +++ b/src/util/Cargo.toml @@ -39,8 +39,9 @@ toml = "0.6" futures = "0.3" tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } +tokio-unix-tcp = { version = "0.2.0", features = ["serde"] } -netapp = "0.10" +netapp = { git = "https://git.deuxfleurs.fr/networkException/netapp.git", rev = "184ad39eeaf5d8615b8800298d8c7e564bb68879" } http = "0.2" hyper = "0.14" diff --git a/src/util/config.rs b/src/util/config.rs index ad5c8e1f..df580478 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -1,13 +1,13 @@ //! Contains type and functions related to Garage configuration file use std::convert::TryFrom; use std::io::Read; -use std::net::SocketAddr; use std::path::PathBuf; +use tokio_unix_tcp::NamedSocketAddr; + use serde::{de, Deserialize}; use crate::error::Error; -use crate::socket_address::UnixOrTCPSocketAddress; /// Represent the whole configuration #[derive(Deserialize, Debug, Clone)] @@ -51,7 +51,8 @@ pub struct Config { pub rpc_secret_file: Option, /// Address to bind for RPC - pub rpc_bind_addr: SocketAddr, + #[serde(deserialize_with = "NamedSocketAddr::deserialize_from_str")] + pub rpc_bind_addr: NamedSocketAddr, /// Public IP address of this node pub rpc_public_addr: Option, @@ -130,7 +131,8 @@ pub struct DataDir { #[derive(Deserialize, Debug, Clone)] pub struct S3ApiConfig { /// Address and port to bind for api serving - pub api_bind_addr: Option, + #[serde(deserialize_with = "NamedSocketAddr::deserialize_from_option_str")] + pub api_bind_addr: Option, /// S3 region to use pub s3_region: String, /// Suffix to remove from domain name to find bucket. If None, @@ -142,14 +144,16 @@ pub struct S3ApiConfig { #[derive(Deserialize, Debug, Clone)] pub struct K2VApiConfig { /// Address and port to bind for api serving - pub api_bind_addr: UnixOrTCPSocketAddress, + #[serde(deserialize_with = "NamedSocketAddr::deserialize_from_str")] + pub api_bind_addr: NamedSocketAddr, } /// Configuration for serving files as normal web server #[derive(Deserialize, Debug, Clone)] pub struct WebConfig { /// Address and port to bind for web serving - pub bind_addr: UnixOrTCPSocketAddress, + #[serde(deserialize_with = "NamedSocketAddr::deserialize_from_str")] + pub bind_addr: NamedSocketAddr, /// Suffix to remove from domain name to find bucket pub root_domain: String, } @@ -158,7 +162,8 @@ pub struct WebConfig { #[derive(Deserialize, Debug, Clone, Default)] pub struct AdminConfig { /// Address and port to bind for admin API serving - pub api_bind_addr: Option, + #[serde(deserialize_with = "NamedSocketAddr::deserialize_from_option_str")] + pub api_bind_addr: Option, /// Bearer token to use to scrape metrics pub metrics_token: Option, diff --git a/src/util/lib.rs b/src/util/lib.rs index 7df77959..15f0f829 100644 --- a/src/util/lib.rs +++ b/src/util/lib.rs @@ -14,7 +14,6 @@ pub mod forwarded_headers; pub mod metrics; pub mod migrate; pub mod persister; -pub mod socket_address; pub mod time; pub mod tranquilizer; pub mod version; diff --git a/src/util/socket_address.rs b/src/util/socket_address.rs deleted file mode 100644 index f01225f6..00000000 --- a/src/util/socket_address.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::fmt::{Debug, Display, Formatter}; -use std::net::SocketAddr; -use std::path::PathBuf; -use std::str::FromStr; - -use serde::de::Error; -use serde::{Deserialize, Deserializer}; - -#[derive(Debug, Clone)] -pub enum UnixOrTCPSocketAddress { - TCPSocket(SocketAddr), - UnixSocket(PathBuf), -} - -impl Display for UnixOrTCPSocketAddress { - fn fmt(&self, formatter: &mut Formatter<'_>) -> std::fmt::Result { - match self { - UnixOrTCPSocketAddress::TCPSocket(address) => write!(formatter, "http://{}", address), - UnixOrTCPSocketAddress::UnixSocket(path) => { - write!(formatter, "http+unix://{}", path.to_string_lossy()) - } - } - } -} - -impl<'de> Deserialize<'de> for UnixOrTCPSocketAddress { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let string = String::deserialize(deserializer)?; - let string = string.as_str(); - - if string.starts_with("/") { - Ok(UnixOrTCPSocketAddress::UnixSocket( - PathBuf::from_str(string).map_err(Error::custom)?, - )) - } else { - Ok(UnixOrTCPSocketAddress::TCPSocket( - SocketAddr::from_str(string).map_err(Error::custom)?, - )) - } - } -} diff --git a/src/web/Cargo.toml b/src/web/Cargo.toml index 88cf1486..477535f4 100644 --- a/src/web/Cargo.toml +++ b/src/web/Cargo.toml @@ -30,5 +30,6 @@ hyper = { version = "0.14", features = ["server", "http1", "runtime", "tcp", "st hyperlocal = { version = "0.8.0", default-features = false, features = ["server"] } tokio = { version = "1.0", default-features = false, features = ["net"] } +tokio-unix-tcp = "0.2.0" opentelemetry = "0.17" diff --git a/src/web/web_server.rs b/src/web/web_server.rs index 73780efb..255018fa 100644 --- a/src/web/web_server.rs +++ b/src/web/web_server.rs @@ -13,6 +13,8 @@ use hyper::{ use hyperlocal::UnixServerExt; +use tokio_unix_tcp::NamedSocketAddr; + use tokio::net::UnixStream; use opentelemetry::{ @@ -38,7 +40,6 @@ use garage_util::data::Uuid; use garage_util::error::Error as GarageError; use garage_util::forwarded_headers; use garage_util::metrics::{gen_trace_id, RecordDuration}; -use garage_util::socket_address::UnixOrTCPSocketAddress; struct WebMetrics { request_counter: Counter, @@ -76,7 +77,7 @@ impl WebServer { /// Run a web server pub async fn run( garage: Arc, - addr: UnixOrTCPSocketAddress, + addr: NamedSocketAddr, root_domain: String, shutdown_signal: impl Future, ) -> Result<(), GarageError> { @@ -116,13 +117,13 @@ impl WebServer { info!("Web server listening on {}", addr); match addr { - UnixOrTCPSocketAddress::TCPSocket(addr) => { + NamedSocketAddr::Inet(addr) => { Server::bind(&addr) .serve(tcp_service) .with_graceful_shutdown(shutdown_signal) .await? } - UnixOrTCPSocketAddress::UnixSocket(ref path) => { + NamedSocketAddr::Unix(ref path) => { if path.exists() { fs::remove_file(path)? }