From d69f0d8e1e37c58e27caec5576cfe91a6c2dc16c Mon Sep 17 00:00:00 2001 From: vegbir Date: Thu, 16 Jan 2025 02:12:14 +0000 Subject: [PATCH] update dependent protobuf and ttrpc version --- Cargo.lock | 542 +++++++++++++++++++++++++++++-------------- Cargo.toml | 10 +- build.rs | 4 + src/client/client.rs | 135 ++++++----- 4 files changed, 453 insertions(+), 238 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3cc2a33..75400c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,19 +1,19 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "addr2line" -version = "0.15.2" +name = "aho-corasick" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ - "gimli", + "memchr", ] [[package]] -name = "adler" -version = "1.0.2" +name = "anyhow" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "autocfg" @@ -21,21 +21,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "backtrace" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "bitflags" version = "1.2.1" @@ -44,9 +29,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -58,11 +43,20 @@ dependencies = [ "iovec", ] +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + [[package]] name = "cc" -version = "1.0.68" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -82,15 +76,71 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "475bd7aa7680b4ed8f6bb59745e882bcbaeb39326532bb79ffb1716480d9a274" +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "derive-new" version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535" dependencies = [ - "proc-macro2 1.0.27", - "quote 1.0.9", - "syn 1.0.73", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -100,19 +150,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] -name = "failure" -version = "0.1.8" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "fixedbitset" -version = "0.1.9" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" [[package]] name = "getrandom" @@ -126,10 +173,16 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.24.0" +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -140,6 +193,26 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", +] + [[package]] name = "iovec" version = "0.1.4" @@ -151,31 +224,33 @@ dependencies = [ [[package]] name = "itertools" -version = "0.8.2" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lib-shim-v2" version = "0.1.0" dependencies = [ "byteorder", - "bytes", + "bytes 0.4.12", "cmd_lib", "lazy_static", "libc", "log", - "nix", - "protobuf", + "nix 0.16.1", + "protobuf 2.28.0", + "protobuf 3.7.1", + "protobuf-codegen 3.7.1", "protoc-rust", "ttrpc", "ttrpc-codegen", @@ -183,40 +258,36 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.97" +version = "0.2.165" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" [[package]] name = "log" -version = "0.4.14" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.4.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "miniz_oxide" -version = "0.4.4" +name = "memoffset" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ - "adler", "autocfg", ] [[package]] name = "multimap" -version = "0.4.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "nix" @@ -232,65 +303,72 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.25.3" +name = "nix" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ - "memchr", + "bitflags", + "cfg-if 1.0.0", + "libc", + "memoffset", + "pin-utils", ] +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + [[package]] name = "petgraph" -version = "0.4.13" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" dependencies = [ "fixedbitset", + "indexmap 1.9.3", ] [[package]] -name = "ppv-lite86" -version = "0.2.10" +name = "pin-utils" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "ppv-lite86" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ - "unicode-xid 0.2.2", + "unicode-ident", ] [[package]] name = "prost" -version = "0.5.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d14b1c185652833d24aaad41c5832b0be5616a590227c1fbff57c616754b23" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ - "byteorder", - "bytes", + "bytes 1.8.0", "prost-derive", ] [[package]] name = "prost-build" -version = "0.5.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb788126ea840817128183f8f603dce02cb7aea25c2a0b764359d8e20010702e" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ - "bytes", + "bytes 1.8.0", "heck", "itertools", "log", @@ -299,95 +377,127 @@ dependencies = [ "prost", "prost-types", "tempfile", - "which 2.0.1", + "which", ] [[package]] name = "prost-derive" -version = "0.5.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e7dc378b94ac374644181a2247cebf59a6ec1c88b49ac77f3a94b86b79d0e11" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ - "failure", + "anyhow", "itertools", - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "prost-types" -version = "0.5.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de482a366941c8d56d19b650fac09ca08508f2a696119ee7513ad590c8bac6f" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ - "bytes", + "bytes 1.8.0", "prost", ] [[package]] name = "protobuf" -version = "2.24.1" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + +[[package]] +name = "protobuf" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db50e77ae196458ccd3dc58a31ea1a90b0698ab1b7928d89f644c25d72070267" +checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] [[package]] name = "protobuf-codegen" -version = "2.24.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09321cef9bee9ddd36884f97b7f7cc92a586cdc74205c4b3aeba65b5fc9c6f90" +checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" dependencies = [ - "protobuf", + "protobuf 2.28.0", ] [[package]] -name = "protobuf-codegen-pure" -version = "2.24.1" +name = "protobuf-codegen" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1afb68a6d768571da3db86ce55f0f62966e0fc25eaf96acd070ea548a91b0d23" +checksum = "e26b833f144769a30e04b1db0146b2aaa53fd2fd83acf10a6b5f996606c18144" dependencies = [ - "protobuf", - "protobuf-codegen", + "anyhow", + "once_cell", + "protobuf 3.7.1", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", ] [[package]] -name = "protoc" -version = "2.24.1" +name = "protobuf-parse" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c367feabb5f78ca3b2ec25e2c4a5f4f0826017d7fb634f52961afd1a6613d1fb" +checksum = "322330e133eab455718444b4e033ebfac7c6528972c784fcde28d2cc783c6257" dependencies = [ + "anyhow", + "indexmap 2.6.0", "log", - "which 4.1.0", + "protobuf 3.7.1", + "protobuf-support", + "tempfile", + "thiserror", + "which", ] [[package]] -name = "protoc-rust" -version = "2.24.1" +name = "protobuf-support" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bb2c1038f8014a2e42fdffec03ffc03f574a8bf66b0ac32f1b6941681eb1317" +checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ - "protobuf", - "protobuf-codegen", - "protoc", - "tempfile", + "thiserror", ] [[package]] -name = "quote" -version = "0.6.13" +name = "protoc" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0218039c514f9e14a5060742ecd50427f8ac4f85a6dc58f2ddb806e318c55ee" +dependencies = [ + "log", + "which", +] + +[[package]] +name = "protoc-rust" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +checksum = "22f8a182bb17c485f20bdc4274a8c39000a61024cfe461c799b50fec77267838" dependencies = [ - "proc-macro2 0.4.30", + "protobuf 2.28.0", + "protobuf-codegen 2.28.0", + "protoc", + "tempfile", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ - "proc-macro2 1.0.27", + "proc-macro2", ] [[package]] @@ -440,40 +550,58 @@ dependencies = [ ] [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ - "winapi", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "rustc-demangle" -version = "0.1.20" +name = "regex-automata" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] -name = "syn" -version = "0.15.44" +name = "regex-syntax" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", + "winapi", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "syn" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ - "proc-macro2 1.0.27", - "quote 1.0.9", - "unicode-xid 0.2.2", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] @@ -492,77 +620,79 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.25" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.25" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ - "proc-macro2 1.0.27", - "quote 1.0.9", - "syn 1.0.73", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "ttrpc" -version = "0.4.15" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cba1bb15a916136c7fbd9af517f873e250552d558c2b7d8ad8a1ba4361f88fb5" +checksum = "e376927d4422245ae3e0a0d7df0e805f99652536999b5c671144de9fe4120d8c" dependencies = [ "byteorder", + "crossbeam", "libc", "log", - "nix", - "protobuf", - "protobuf-codegen-pure", + "nix 0.26.4", + "protobuf 3.7.1", + "protobuf-codegen 3.7.1", "thiserror", + "windows-sys", ] [[package]] name = "ttrpc-codegen" -version = "0.1.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e8844d7a8351fa833bea811f826401bec020b233e60a7c0a8f313f764ce5a5" +checksum = "94d7f7631d7a9ebed715a47cd4cb6072cbc7ae1d4ec01598971bbec0024340c2" dependencies = [ - "protobuf", - "protobuf-codegen", - "protobuf-codegen-pure", + "protobuf 2.28.0", + "protobuf-codegen 3.7.1", + "protobuf-support", "ttrpc-compiler", ] [[package]] name = "ttrpc-compiler" -version = "0.3.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d290e64bdb994926d102f2983cc6550ece0778c8430253dc2de4e71cbf5285d9" +checksum = "04c4c51f20209ae3ec2579b947b54cf52685825238002bc2e5af8e1e075d4813" dependencies = [ "derive-new", "prost", "prost-build", "prost-types", - "protobuf", - "protobuf-codegen", + "protobuf 2.28.0", + "protobuf-codegen 2.28.0", "tempfile", ] [[package]] -name = "unicode-segmentation" -version = "1.7.1" +name = "unicode-ident" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "unicode-segmentation" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-xid" @@ -582,16 +712,6 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" -[[package]] -name = "which" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" -dependencies = [ - "failure", - "libc", -] - [[package]] name = "which" version = "4.1.0" @@ -623,3 +743,69 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/Cargo.toml b/Cargo.toml index 30fb4a5..5ce4110 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,20 +10,22 @@ license = "Mulan PSL v2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -protobuf = "2.8.0" +protobuf = "3.1.0" bytes = "0.4.11" libc = "0.2.71" byteorder = "1.3.2" log = "0.4.8" nix = "0.16.1" -ttrpc = "0.4.2" +ttrpc = "0.8.2" lazy_static = "1.4.0" [build-dependencies] -protoc-rust = "2.8.0" +protoc-rust = "2.28.0" +protobuf = "2.28.0" +protobuf-codegen = "3.2.0" cmd_lib = "0.7.8" -ttrpc-codegen = "0.1.2" +ttrpc-codegen = "0.4.2" [lib] name = "shim_v2" diff --git a/build.rs b/build.rs index dda0ccb..9f5cf4a 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,9 @@ use ttrpc_codegen::Codegen; +use ttrpc_codegen::ProtobufCustomize; fn main() { + let protobuf_customized = ProtobufCustomize::default().gen_mod_rs(false); + Codegen::new() .out_dir("src/protocols") .inputs(&[ @@ -14,6 +17,7 @@ fn main() { ]) .include("src/protocols/protos") .rust_protobuf() + .rust_protobuf_customize(protobuf_customized.clone()) .run() .expect("Codegen failed"); } diff --git a/src/client/client.rs b/src/client/client.rs index 2151e23..4967668 100644 --- a/src/client/client.rs +++ b/src/client/client.rs @@ -20,13 +20,13 @@ use std::os::unix::io::RawFd; use std::path::Path; use std::path::MAIN_SEPARATOR; use std::sync::Mutex; -use ttrpc::client::Client; +use ttrpc::Client; +use ttrpc::context; #[derive(Clone)] pub struct Store { conn: Client, container_id: String, - timeout: i64, } #[derive(Debug)] @@ -131,12 +131,12 @@ pub fn new_conn(container_id: &String, addr: &String) -> Result<()> { connect_to_unix_socket(!addr.starts_with("unix://"), &path.to_string_lossy())? }; + let client = ttrpc::Client::new(fd).map_err(|e| Error::Other(format!("failed to create ttrpc client: {:?}", e)))?; TTRPC_CLIENTS.lock().unwrap().insert( container_id.clone(), Store { - conn: Client::new(fd), + conn: client, container_id: container_id.clone(), - timeout: 0, }, ); @@ -186,15 +186,17 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::CreateTaskRequest::new(); - req.set_id(self.container_id.clone()); - req.set_bundle(bundle.clone()); - req.set_terminal(terminal); - req.set_stdin(stdin.clone()); - req.set_stdout(stdout.clone()); - req.set_stderr(stderr.clone()); + req.id = self.container_id.clone(); + req.bundle = bundle.clone(); + req.terminal = terminal; + req.stdin = stdin.clone(); + req.stdout = stdout.clone(); + req.stderr = stderr.clone(); + + let ctx = context::with_timeout(0); let resp = client - .create(&req, self.timeout) + .create(ctx, &req) .map_err(shim_error!(e, "ttrpc call create failed"))?; Ok(resp.pid as i32) @@ -205,11 +207,13 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::StartRequest::new(); - req.set_id(self.container_id.clone()); - req.set_exec_id(exec_id.clone()); + req.id = self.container_id.clone(); + req.exec_id = exec_id.clone(); + + let ctx = context::with_timeout(0); let resp = client - .start(&req, self.timeout) + .start(ctx, &req) .map_err(shim_error!(e, "ttrpc call start failed"))?; Ok(resp.pid as i32) @@ -225,12 +229,14 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::KillRequest::new(); - req.set_id(self.container_id.clone()); - req.set_signal(signal); - req.set_all(all); + req.id = self.container_id.clone(); + req.signal = signal; + req.all = all; + + let ctx = context::with_timeout(0); client - .kill(&req, self.timeout) + .kill(ctx, &req) .map_err(shim_error!(e, "ttrpc call kill failed"))?; Ok(()) @@ -241,11 +247,13 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::DeleteRequest::new(); - req.set_id(self.container_id.clone()); - req.set_exec_id(exec_id.clone()); + req.id = self.container_id.clone(); + req.exec_id = exec_id.clone(); + + let ctx = context::with_timeout(0); let resp = client - .delete(&req, self.timeout) + .delete(ctx, &req) .map_err(shim_error!(e, "ttrpc call delete failed"))?; Ok(DeleteResponse { @@ -259,10 +267,12 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::ShutdownRequest::new(); - req.set_id(self.container_id.clone()); + req.id = self.container_id.clone(); + + let ctx = context::with_timeout(0); client - .shutdown(&req, self.timeout) + .shutdown(ctx, &req) .map_err(shim_error!(e, "ttrpc call shutdown failed"))?; Ok(()) @@ -283,22 +293,24 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::ExecProcessRequest::new(); - req.set_id(self.container_id.clone()); - req.set_exec_id(exec_id.clone()); - req.set_terminal(terminal); - req.set_stdin(stdin.clone()); - req.set_stdout(stdout.clone()); - req.set_stderr(stderr.clone()); - let mut exec_spec: ::protobuf::well_known_types::Any = - ::protobuf::well_known_types::Any::new(); - exec_spec.set_value(std::vec::Vec::from(spec)); - exec_spec.set_type_url(String::from( + req.id = self.container_id.clone(); + req.exec_id = exec_id.clone(); + req.terminal = terminal; + req.stdin = stdin.clone(); + req.stdout = stdout.clone(); + req.stderr = stderr.clone(); + let mut exec_spec: ::protobuf::well_known_types::any::Any = + ::protobuf::well_known_types::any::Any::new(); + exec_spec.value = std::vec::Vec::from(spec); + exec_spec.type_url = String::from( "types.containerd.io/opencontainers/runtime-spec/1/Process", - )); - req.set_spec(exec_spec); + ); + req.spec = protobuf::MessageField::some(exec_spec); + + let ctx = context::with_timeout(0); client - .exec(&req, self.timeout) + .exec(ctx, &req) .map_err(shim_error!(e, "ttrpc call exec failed"))?; Ok(()) @@ -314,13 +326,15 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::ResizePtyRequest::new(); - req.set_id(self.container_id.clone()); - req.set_exec_id(exec_id.clone()); - req.set_height(height); - req.set_width(width); + req.id = self.container_id.clone(); + req.exec_id = exec_id.clone(); + req.height = height; + req.width = width; + + let ctx = context::with_timeout(0); client - .resize_pty(&req, self.timeout) + .resize_pty(ctx, &req) .map_err(shim_error!(e, "ttrpc call resize_pty failed"))?; Ok(()) @@ -331,10 +345,12 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::PauseRequest::new(); - req.set_id(self.container_id.clone()); + req.id = self.container_id.clone(); + + let ctx = context::with_timeout(0); client - .pause(&req, self.timeout) + .pause(ctx, &req) .map_err(shim_error!(e, "ttrpc call pause failed"))?; Ok(()) @@ -345,10 +361,12 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::ResumeRequest::new(); - req.set_id(self.container_id.clone()); + req.id = self.container_id.clone(); + + let ctx = context::with_timeout(0); client - .resume(&req, self.timeout) + .resume(ctx, &req) .map_err(shim_error!(e, "ttrpc call resume failed"))?; Ok(()) @@ -359,16 +377,18 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::StateRequest::new(); - req.set_id(self.container_id.clone()); + req.id = self.container_id.clone(); + + let ctx = context::with_timeout(0); let resp = client - .state(&req, self.timeout) + .state(ctx, &req) .map_err(shim_error!(e, "ttrpc call state failed"))?; Ok(State { id: self.container_id.clone(), pid: resp.pid, - status: match resp.status { + status: match resp.status.enum_value_or_default() { shim_v2_status::CREATED => Status::CreatedStatus, shim_v2_status::RUNNING => Status::RunningStatus, shim_v2_status::STOPPED => Status::StoppedStatus, @@ -390,12 +410,13 @@ impl Store { let mut req = protocols::shim::PidsRequest::new(); req.id = self.container_id.clone(); + let ctx = context::with_timeout(0); + let resp = c - .pids(&req, self.timeout) + .pids(ctx, &req) .map_err(shim_error!(e, "call pids failed"))?; - let process = &resp.get_processes()[0]; - - Ok(process.pid as i32) + + Ok(resp.processes[0].pid as i32) } pub fn wait(&self, exec_id: &String) -> Result { @@ -403,13 +424,15 @@ impl Store { let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone()); let mut req = protocols::shim::WaitRequest::new(); - req.set_id(self.container_id.clone()); - req.set_exec_id(exec_id.clone()); + req.id = self.container_id.clone(); + req.exec_id = exec_id.clone(); + + let ctx = context::with_timeout(0); let resp = client - .wait(&req, self.timeout) + .wait(ctx, &req) .map_err(shim_error!(e, "ttrpc call wait failed"))?; Ok(resp.exit_status as i32) } -} +} \ No newline at end of file -- 2.45.0