From a9ba061325b4345e0171d681cf6c8838d76fb77f Mon Sep 17 00:00:00 2001 From: Efremov Alexey Date: Fri, 10 Sep 2021 13:08:15 +0300 Subject: [PATCH] Add: subscription + query with warp --- rust/Cargo.lock | 1211 ++++++--------------- rust/graphql-server/cli/Cargo.toml | 13 +- rust/graphql-server/cli/src/main.rs | 23 +- rust/graphql-server/program/Cargo.toml | 9 +- rust/graphql-server/program/src/schema.rs | 66 +- rust/graphql-server/program/src/server.rs | 124 +-- 6 files changed, 459 insertions(+), 987 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index e7616c4..e2163c8 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -12,279 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "actix-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" -dependencies = [ - "bitflags", - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project 0.4.28", - "tokio 0.2.25", - "tokio-util 0.3.1", -] - -[[package]] -name = "actix-connect" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures-util", - "http", - "log", - "trust-dns-proto", - "trust-dns-resolver", -] - -[[package]] -name = "actix-cors" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e5c769e4d332bfad27f11b8139b5818c4bbddb02c385b8f16344d93ff1a8eb" -dependencies = [ - "actix-service", - "actix-web", - "derive_more", - "futures-util", -] - -[[package]] -name = "actix-http" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cb8958da437716f3f31b0e76f8daf36554128517d7df37ceba7df00f09622ee" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt", - "actix-service", - "actix-threadpool", - "actix-utils", - "base64 0.13.0", - "bitflags", - "brotli2", - "bytes 0.5.6", - "cookie", - "copyless", - "derive_more", - "either", - "encoding_rs", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2 0.2.7", - "http", - "httparse", - "indexmap", - "itoa", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding", - "pin-project 1.0.8", - "rand 0.7.3", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "sha-1 0.9.8", - "slab", - "time 0.2.27", -] - -[[package]] -name = "actix-macros" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" -dependencies = [ - "quote 1.0.9", - "syn 1.0.75", -] - -[[package]] -name = "actix-router" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" -dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", -] - -[[package]] -name = "actix-rt" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" -dependencies = [ - "actix-macros", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec", - "tokio 0.2.25", -] - -[[package]] -name = "actix-server" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "futures-channel", - "futures-util", - "log", - "mio 0.6.23", - "mio-uds", - "num_cpus", - "slab", - "socket2 0.3.19", -] - -[[package]] -name = "actix-service" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" -dependencies = [ - "futures-util", - "pin-project 0.4.28", -] - -[[package]] -name = "actix-testing" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" -dependencies = [ - "actix-macros", - "actix-rt", - "actix-server", - "actix-service", - "log", - "socket2 0.3.19", -] - -[[package]] -name = "actix-threadpool" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" -dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot 0.11.2", - "threadpool", -] - -[[package]] -name = "actix-tls" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "futures-util", -] - -[[package]] -name = "actix-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "bitflags", - "bytes 0.5.6", - "either", - "futures-channel", - "futures-sink", - "futures-util", - "log", - "pin-project 0.4.28", - "slab", -] - -[[package]] -name = "actix-web" -version = "3.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes 0.5.6", - "derive_more", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "log", - "mime", - "pin-project 1.0.8", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "socket2 0.3.19", - "time 0.2.27", - "tinyvec", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" -dependencies = [ - "proc-macro2 1.0.28", - "quote 1.0.9", - "syn 1.0.75", -] - [[package]] name = "addr2line" version = "0.16.0" @@ -472,7 +199,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -505,6 +232,27 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-stream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +dependencies = [ + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.75", +] + [[package]] name = "async-trait" version = "0.1.51" @@ -524,7 +272,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -533,30 +281,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "awc" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "base64 0.13.0", - "bytes 0.5.6", - "cfg-if 1.0.0", - "derive_more", - "futures-core", - "log", - "mime", - "percent-encoding", - "rand 0.7.3", - "serde", - "serde_json", - "serde_urlencoded", -] - [[package]] name = "backtrace" version = "0.3.61" @@ -573,12 +297,6 @@ dependencies = [ "serde", ] -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - [[package]] name = "base32" version = "0.4.0" @@ -715,26 +433,6 @@ dependencies = [ "syn 1.0.75", ] -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -dependencies = [ - "brotli-sys", - "libc", -] - [[package]] name = "bs58" version = "0.3.1" @@ -758,6 +456,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +dependencies = [ + "memchr", + "safemem", +] + [[package]] name = "bumpalo" version = "3.7.0" @@ -815,15 +523,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" -[[package]] -name = "bytestring" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" -dependencies = [ - "bytes 1.1.0", -] - [[package]] name = "bzip2" version = "0.3.3" @@ -876,8 +575,8 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.44", - "winapi 0.3.9", + "time", + "winapi", ] [[package]] @@ -939,7 +638,7 @@ dependencies = [ "terminal_size", "termios", "unicode-width", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -955,44 +654,15 @@ dependencies = [ "regex", "terminal_size", "unicode-width", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cookie" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" -dependencies = [ - "percent-encoding", - "time 0.2.27", - "version_check", -] - -[[package]] -name = "copyless" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" - [[package]] name = "core-foundation" version = "0.9.1" @@ -1185,19 +855,6 @@ dependencies = [ "syn 1.0.75", ] -[[package]] -name = "derive_more" -version = "0.99.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" -dependencies = [ - "convert_case", - "proc-macro2 1.0.28", - "quote 1.0.9", - "rustc_version 0.3.3", - "syn 1.0.75", -] - [[package]] name = "derive_utils" version = "0.11.2" @@ -1265,15 +922,9 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dtoa" version = "0.4.8" @@ -1351,18 +1002,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "enum-as-inner" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" -dependencies = [ - "heck", - "proc-macro2 1.0.28", - "quote 1.0.9", - "syn 1.0.75", -] - [[package]] name = "enum-ordinalize" version = "3.1.10" @@ -1389,6 +1028,19 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "failure" version = "0.1.8" @@ -1432,7 +1084,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.10", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1478,22 +1130,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "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.3.16" @@ -1592,22 +1228,13 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.12.4" @@ -1635,7 +1262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1693,26 +1320,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "h2" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio 0.2.25", - "tokio-util 0.3.1", - "tracing", - "tracing-futures", -] - [[package]] name = "h2" version = "0.3.4" @@ -1727,8 +1334,8 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.10.1", - "tokio-util 0.6.7", + "tokio", + "tokio-util", "tracing", ] @@ -1756,6 +1363,31 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +[[package]] +name = "headers" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" +dependencies = [ + "base64 0.13.0", + "bitflags", + "bytes 1.1.0", + "headers-core", + "http", + "mime", + "sha-1 0.9.8", + "time", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] + [[package]] name = "heck" version = "0.3.3" @@ -1832,17 +1464,6 @@ dependencies = [ "hmac 0.8.1", ] -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - [[package]] name = "http" version = "0.2.4" @@ -1862,7 +1483,7 @@ checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ "bytes 1.1.0", "http", - "pin-project-lite 0.2.7", + "pin-project-lite", ] [[package]] @@ -1893,15 +1514,15 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.4", + "h2", "http", "http-body", "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.7", + "pin-project-lite", "socket2 0.4.1", - "tokio 1.10.1", + "tokio", "tower-service", "tracing", "want", @@ -1917,7 +1538,7 @@ dependencies = [ "hyper", "log", "rustls", - "tokio 1.10.1", + "tokio", "tokio-rustls", "webpki", ] @@ -1965,6 +1586,15 @@ dependencies = [ "bytes 0.5.6", ] +[[package]] +name = "input_buffer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" +dependencies = [ + "bytes 1.1.0", +] + [[package]] name = "instant" version = "0.1.10" @@ -1983,18 +1613,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2 0.3.19", - "widestring", - "winapi 0.3.9", - "winreg 0.6.2", -] - [[package]] name = "ipnet" version = "2.3.1" @@ -2083,28 +1701,51 @@ dependencies = [ "syn 1.0.75", ] +[[package]] +name = "juniper_graphql_ws" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5526c2f2a9c40f08841dc559971641fdd71c008a265745d18bb0c8b7e105b3" +dependencies = [ + "juniper", + "juniper_subscriptions", + "serde", + "tokio", +] + +[[package]] +name = "juniper_subscriptions" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2983b26a1e12b691c17432aee3881d8bec4a94d6c64bc933c0eaf6d9e3429f13" +dependencies = [ + "futures", + "juniper", +] + +[[package]] +name = "juniper_warp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d167107f6634c92f90daae1a298133377373e935d455042f90efc480fae4a52" +dependencies = [ + "anyhow", + "futures", + "juniper", + "juniper_graphql_ws", + "serde", + "serde_json", + "thiserror", + "tokio", + "warp", +] + [[package]] name = "keccak" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" -[[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 = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -2127,7 +1768,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" dependencies = [ "cfg-if 1.0.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2211,21 +1852,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - [[package]] name = "matches" version = "0.1.9" @@ -2268,6 +1894,16 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "mime_guess" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.4.4" @@ -2278,25 +1914,6 @@ dependencies = [ "autocfg", ] -[[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 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.7.13" @@ -2305,32 +1922,9 @@ checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", "log", - "miow 0.3.7", + "miow", "ntapi", - "winapi 0.3.9", -] - -[[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", + "winapi", ] [[package]] @@ -2339,7 +1933,25 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi 0.3.9", + "winapi", +] + +[[package]] +name = "multipart" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" +dependencies = [ + "buf_redux", + "httparse", + "log", + "mime", + "mime_guess", + "quick-error", + "rand 0.7.3", + "safemem", + "tempfile", + "twoway", ] [[package]] @@ -2368,7 +1980,7 @@ checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ "cfg-if 0.1.10", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2399,7 +2011,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2646,7 +2258,7 @@ dependencies = [ "libc", "redox_syscall 0.1.57", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2660,7 +2272,7 @@ dependencies = [ "libc", "redox_syscall 0.2.10", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2696,33 +2308,13 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "pin-project" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f" -dependencies = [ - "pin-project-internal 0.4.28", -] - [[package]] name = "pin-project" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ - "pin-project-internal 1.0.8", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e" -dependencies = [ - "proc-macro2 1.0.28", - "quote 1.0.9", - "syn 1.0.75", + "pin-project-internal", ] [[package]] @@ -2736,12 +2328,6 @@ dependencies = [ "syn 1.0.75", ] -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.7" @@ -3055,7 +2641,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3079,29 +2665,19 @@ dependencies = [ "log", "mime", "percent-encoding", - "pin-project-lite 0.2.7", + "pin-project-lite", "rustls", "serde", "serde_json", "serde_urlencoded", - "tokio 1.10.1", + "tokio", "tokio-rustls", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "webpki-roots", - "winreg 0.7.0", -] - -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname", - "quick-error", + "winreg", ] [[package]] @@ -3116,7 +2692,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3126,7 +2702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99371657d3c8e4d816fb6221db98fa408242b0b53bac08f8676a41f8554fe99f" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3150,15 +2726,6 @@ dependencies = [ "semver 0.9.0", ] -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustls" version = "0.19.1" @@ -3184,6 +2751,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "same-file" version = "1.0.6" @@ -3200,9 +2773,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.9", + "winapi", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -3386,12 +2965,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "sha2" version = "0.9.6" @@ -3461,7 +3034,7 @@ checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if 1.0.0", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3471,7 +3044,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3507,12 +3080,12 @@ dependencies = [ "borsh", "borsh-derive", "futures", - "mio 0.7.13", + "mio", "solana-banks-interface", "solana-program", "solana-sdk", "tarpc", - "tokio 1.10.1", + "tokio", "tokio-serde", ] @@ -3522,7 +3095,7 @@ version = "1.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec2a702be6df37c117b2b9cadc90508eaad3ad03004873d4e5ef434fd6b9788a" dependencies = [ - "mio 0.7.13", + "mio", "serde", "solana-sdk", "tarpc", @@ -3537,13 +3110,13 @@ dependencies = [ "bincode", "futures", "log", - "mio 0.7.13", + "mio", "solana-banks-interface", "solana-metrics", "solana-runtime", "solana-sdk", "tarpc", - "tokio 1.10.1", + "tokio", "tokio-serde", "tokio-stream", ] @@ -3629,8 +3202,8 @@ dependencies = [ "solana-version", "solana-vote-program", "thiserror", - "tokio 1.10.1", - "tungstenite", + "tokio", + "tungstenite 0.10.1", "url", ] @@ -3670,7 +3243,7 @@ dependencies = [ "serde", "syn 0.15.44", "syn 1.0.75", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3693,7 +3266,7 @@ dependencies = [ "solana-version", "spl-memo", "thiserror", - "tokio 1.10.1", + "tokio", ] [[package]] @@ -3707,7 +3280,7 @@ dependencies = [ "generic-array 0.14.4", "log", "memmap2", - "rustc_version 0.2.3", + "rustc_version", "serde", "serde_derive", "sha2", @@ -3724,7 +3297,7 @@ checksum = "a876aa31298fdee6560c8ee0695ebed313bbdbb6fbbee439ac3b9df8aebfb87c" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "rustc_version 0.2.3", + "rustc_version", "syn 1.0.75", ] @@ -3734,7 +3307,7 @@ version = "1.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98a07290cc521e529bff0b0afd3aacd1d3904a41f35321ede6d1f3574efa3e94" dependencies = [ - "env_logger", + "env_logger 0.8.4", "lazy_static", "log", ] @@ -3756,7 +3329,7 @@ version = "1.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a49cfd9ec1637885f80d0ac33cf71c685fe13bad6de2bfd469e8aa7dc39967a3" dependencies = [ - "env_logger", + "env_logger 0.8.4", "gethostname", "lazy_static", "log", @@ -3782,7 +3355,7 @@ dependencies = [ "solana-logger", "solana-sdk", "solana-version", - "tokio 1.10.1", + "tokio", "url", ] @@ -3807,7 +3380,7 @@ dependencies = [ "num-derive", "num-traits", "rand 0.7.3", - "rustc_version 0.2.3", + "rustc_version", "rustversion", "serde", "serde_bytes", @@ -3833,7 +3406,7 @@ dependencies = [ "chrono", "chrono-humanize", "log", - "mio 0.7.13", + "mio", "serde", "serde_derive", "solana-banks-client", @@ -3844,7 +3417,7 @@ dependencies = [ "solana-sdk", "solana-vote-program", "thiserror", - "tokio 1.10.1", + "tokio", ] [[package]] @@ -3908,7 +3481,7 @@ dependencies = [ "rand 0.7.3", "rayon", "regex", - "rustc_version 0.2.3", + "rustc_version", "serde", "serde_derive", "solana-config-program", @@ -3960,7 +3533,7 @@ dependencies = [ "rand 0.7.3", "rand_chacha 0.2.2", "rand_core 0.6.3", - "rustc_version 0.2.3", + "rustc_version", "rustversion", "serde", "serde_bytes", @@ -4010,7 +3583,7 @@ dependencies = [ "log", "num-derive", "num-traits", - "rustc_version 0.2.3", + "rustc_version", "serde", "serde_derive", "solana-config-program", @@ -4053,7 +3626,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de8d410e68becf2a80a582caa46349dca6959ecf1319fe722a11a33e46af229b" dependencies = [ "log", - "rustc_version 0.2.3", + "rustc_version", "serde", "serde_derive", "solana-frozen-abi", @@ -4072,7 +3645,7 @@ dependencies = [ "log", "num-derive", "num-traits", - "rustc_version 0.2.3", + "rustc_version", "serde", "serde_derive", "solana-frozen-abi", @@ -4099,7 +3672,7 @@ dependencies = [ "rustc-demangle", "scroll", "thiserror", - "time 0.1.44", + "time", ] [[package]] @@ -4154,10 +3727,12 @@ dependencies = [ name = "spl-graphql-server" version = "0.1.0" dependencies = [ - "actix-cors", - "actix-web", - "env_logger", + "async-stream", + "env_logger 0.8.4", + "futures", "juniper", + "juniper_graphql_ws", + "juniper_warp", "serde", "serde_derive", "serde_json", @@ -4165,15 +3740,25 @@ dependencies = [ "solana-program", "spl-token-metadata", "spl-token-vault", + "warp", ] [[package]] name = "spl-graphql-server-cli" version = "0.1.0" dependencies = [ - "actix-web", - "env_logger", + "async-stream", + "env_logger 0.9.0", + "futures", + "juniper", + "juniper_graphql_ws", + "juniper_warp", + "log", + "serde", + "serde_json", "spl-graphql-server", + "tokio", + "warp", ] [[package]] @@ -4304,70 +3889,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2 1.0.28", - "quote 1.0.9", - "serde", - "serde_derive", - "syn 1.0.75", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2 1.0.28", - "quote 1.0.9", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn 1.0.75", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.8.0" @@ -4442,14 +3969,14 @@ dependencies = [ "futures", "humantime", "log", - "pin-project 1.0.8", + "pin-project", "rand 0.7.3", "serde", "static_assertions", "tarpc-plugins", - "tokio 1.10.1", + "tokio", "tokio-serde", - "tokio-util 0.6.7", + "tokio-util", ] [[package]] @@ -4474,7 +4001,7 @@ dependencies = [ "rand 0.8.4", "redox_syscall 0.2.10", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4493,7 +4020,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4534,15 +4061,6 @@ dependencies = [ "syn 1.0.75", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.1.44" @@ -4551,45 +4069,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2 1.0.28", - "quote 1.0.9", - "standback", - "syn 1.0.75", + "winapi", ] [[package]] @@ -4625,26 +4105,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio 0.6.23", - "mio-uds", - "pin-project-lite 0.1.12", - "signal-hook-registry", - "slab", - "winapi 0.3.9", -] - [[package]] name = "tokio" version = "1.10.1" @@ -4655,14 +4115,14 @@ dependencies = [ "bytes 1.1.0", "libc", "memchr", - "mio 0.7.13", + "mio", "num_cpus", "once_cell", "parking_lot 0.11.2", - "pin-project-lite 0.2.7", + "pin-project-lite", "signal-hook-registry", "tokio-macros", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4683,7 +4143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls", - "tokio 1.10.1", + "tokio", "webpki", ] @@ -4698,7 +4158,7 @@ dependencies = [ "educe", "futures-core", "futures-sink", - "pin-project 1.0.8", + "pin-project", "serde", "serde_json", ] @@ -4710,22 +4170,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ "futures-core", - "pin-project-lite 0.2.7", - "tokio 1.10.1", + "pin-project-lite", + "tokio", ] [[package]] -name = "tokio-util" -version = "0.3.1" +name = "tokio-tungstenite" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", + "futures-util", "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", + "pin-project", + "tokio", + "tungstenite 0.12.0", ] [[package]] @@ -4738,8 +4197,8 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.7", - "tokio 1.10.1", + "pin-project-lite", + "tokio", ] [[package]] @@ -4765,7 +4224,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.7", + "pin-project-lite", "tracing-core", ] @@ -4778,55 +4237,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project 1.0.8", - "tracing", -] - -[[package]] -name = "trust-dns-proto" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" -dependencies = [ - "async-trait", - "cfg-if 1.0.0", - "enum-as-inner", - "futures", - "idna", - "lazy_static", - "log", - "rand 0.7.3", - "smallvec", - "thiserror", - "tokio 0.2.25", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" -dependencies = [ - "cfg-if 0.1.10", - "futures", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec", - "thiserror", - "tokio 0.2.25", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -4844,7 +4254,7 @@ dependencies = [ "bytes 0.5.6", "http", "httparse", - "input_buffer", + "input_buffer 0.3.1", "log", "native-tls", "rand 0.7.3", @@ -4853,6 +4263,34 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" +dependencies = [ + "base64 0.13.0", + "byteorder", + "bytes 1.1.0", + "http", + "httparse", + "input_buffer 0.4.0", + "log", + "rand 0.8.4", + "sha-1 0.9.8", + "url", + "utf-8", +] + +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +dependencies = [ + "memchr", +] + [[package]] name = "typenum" version = "1.13.0" @@ -4865,6 +4303,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.6" @@ -4984,7 +4431,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -4998,6 +4445,35 @@ dependencies = [ "try-lock", ] +[[package]] +name = "warp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" +dependencies = [ + "bytes 1.1.0", + "futures", + "headers", + "http", + "hyper", + "log", + "mime", + "mime_guess", + "multipart", + "percent-encoding", + "pin-project", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tokio-util", + "tower-service", + "tracing", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -5107,18 +4583,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "widestring" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" - -[[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" @@ -5129,12 +4593,6 @@ 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" @@ -5147,7 +4605,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5156,32 +4614,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "winreg" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", -] - -[[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", + "winapi", ] [[package]] diff --git a/rust/graphql-server/cli/Cargo.toml b/rust/graphql-server/cli/Cargo.toml index db6166b..2867978 100644 --- a/rust/graphql-server/cli/Cargo.toml +++ b/rust/graphql-server/cli/Cargo.toml @@ -6,6 +6,15 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -actix-web = "3" -env_logger = "0.8" +env_logger = "0.9" +futures = "0.3.1" +log = "0.4.8" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } +warp = "0.3" +async-stream = "0.3" spl-graphql-server = { path = "../program" } +juniper = "0.15" +juniper_graphql_ws = "0.3.0" +juniper_warp = { version = "0.7.0", features = ["subscriptions"] } diff --git a/rust/graphql-server/cli/src/main.rs b/rust/graphql-server/cli/src/main.rs index 3e92ea3..8ff653a 100644 --- a/rust/graphql-server/cli/src/main.rs +++ b/rust/graphql-server/cli/src/main.rs @@ -1,29 +1,20 @@ -use std::io; -use std::sync::Arc; -use std::sync::RwLock; use std::thread; use spl_graphql_server::schema::{create_schema, Ctx}; use spl_graphql_server::server::AppServer; -#[actix_web::main] -async fn main() -> io::Result<()> { +#[tokio::main] +async fn main() { std::env::set_var("RUST_LOG", "actix_web=info"); env_logger::init(); - let context = std::sync::Arc::new(RwLock::new(Ctx::new())); + let context = Ctx::new(); + let mut ctx = Ctx::clone(&context); - let ctx = Arc::clone(&context); + let server = AppServer::new(create_schema, context); thread::spawn(move || { - match ctx.try_write() { - Ok(mut c) => { - c.preload(); - } - Err(_) => {} - }; + ctx.preload(); }); - let ctx = Arc::clone(&context); - let schema = std::sync::Arc::new(create_schema()); - let server = AppServer::new(schema, ctx); + server.run().await } diff --git a/rust/graphql-server/program/Cargo.toml b/rust/graphql-server/program/Cargo.toml index 18ab41d..9339c17 100644 --- a/rust/graphql-server/program/Cargo.toml +++ b/rust/graphql-server/program/Cargo.toml @@ -6,13 +6,18 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -actix-web = "3.3.2" -actix-cors = "0.4.0" +warp = "0.3" env_logger = "0.8" serde = "1.0.103" +futures = "0.3" serde_json = "1.0.44" serde_derive = "1.0.103" + juniper = "0.15" +juniper_graphql_ws = "0.3.0" +juniper_warp = { version = "0.7.0", features = ["subscriptions"] } +async-stream = "0.3" + solana-client = "1.7.8" solana-program = "1.7.8" spl-token-vault = { path = "../../token-vault/program", features = [ "no-entrypoint" ] } diff --git a/rust/graphql-server/program/src/schema.rs b/rust/graphql-server/program/src/schema.rs index 09db6d7..832aa75 100644 --- a/rust/graphql-server/program/src/schema.rs +++ b/rust/graphql-server/program/src/schema.rs @@ -1,30 +1,55 @@ use solana_program::pubkey::Pubkey; -use juniper::{FieldResult, FieldError, EmptySubscription, EmptyMutation, RootNode }; +use juniper::{FieldResult, FieldError, EmptyMutation, RootNode, graphql_subscription }; + use { crate::state::SharedState }; use juniper::{GraphQLEnum, GraphQLObject}; use std::str::FromStr; +use futures::Stream; +use std::sync::{RwLock, Arc}; +use std::pin::Pin; -pub struct Ctx(SharedState); +pub struct Ctx { + state: Arc> +} impl Ctx { pub fn new() -> Ctx { let state = SharedState::new(); - Ctx(state) + Ctx { + state: Arc::new(RwLock::new(state)) + } } - pub fn preload(&mut self) { - self.0.preload() - } - pub fn find_vault(&self, key: &str) -> Option<&spl_token_vault::state::Vault> { - match Pubkey::from_str(key) { - Ok(id) => self.0.vaults.get(&id), - Err(_) => Option::None + pub fn clone(ctx: &Ctx) -> Ctx { + let state = Arc::clone(&ctx.state); + Ctx { + state: state } } + + pub fn preload<'a>(&'a mut self) { + if let Ok(mut state) = self.state.try_write() { + state.preload() + } + } + pub fn find_vault(&self, key: &str) -> Option { + let res = self.state + .try_read() + .map(|st| { + match Pubkey::from_str(key) { + Ok(id) => st.vaults.get(&id).map(|v| Vault::from(v)), + Err(_) => None, + } + }); + res.unwrap_or(None) + } pub fn vaults(&self) -> Vec { - self.0.vaults.values().map(|v| Vault::from(v)).collect() + match self.state.try_read() { + Ok(state) => state.vaults.values().map(|v| Vault::from(v)).collect(), + Err(_) => Vec::new(), + } } } @@ -129,7 +154,7 @@ pub struct QueryRoot; impl QueryRoot { /// get vault by id fn vault(context: &Ctx, id: String) -> FieldResult { - let result = context.find_vault(&id).map(|v| Vault::from(v)); + let result = context.find_vault(&id); if let Some(v) = result { Ok(v) } else { @@ -143,8 +168,21 @@ impl QueryRoot { } } -pub type Schema = RootNode<'static, QueryRoot, EmptyMutation, EmptySubscription>; +type StringStream = Pin> + Send>>; +pub struct Subscription; +#[graphql_subscription(context = Ctx)] +impl Subscription { + async fn hello_world() -> StringStream { + let stream = futures::stream::iter(vec![ + Ok(String::from("Hello")), + Ok(String::from("World!")) + ]); + Box::pin(stream) + } +} + +pub type Schema = RootNode<'static, QueryRoot, EmptyMutation, Subscription>; pub fn create_schema() -> Schema { - Schema::new(QueryRoot {}, EmptyMutation::new(), EmptySubscription::new()) + Schema::new(QueryRoot {}, EmptyMutation::new(), Subscription {}) } diff --git a/rust/graphql-server/program/src/server.rs b/rust/graphql-server/program/src/server.rs index 7e1c57c..30edf90 100644 --- a/rust/graphql-server/program/src/server.rs +++ b/rust/graphql-server/program/src/server.rs @@ -1,79 +1,69 @@ - - -use actix_cors::Cors; -use actix_web::{middleware, web, App, HttpResponse, HttpServer}; -use juniper::http::graphiql::graphiql_source; -use juniper::http::GraphQLRequest; +use std::{ collections::HashMap, convert::Infallible }; +use juniper_warp::subscriptions::serve_graphql_ws; +use juniper_graphql_ws::ConnectionConfig; +use juniper_warp::{playground_filter}; +use futures::FutureExt; +use warp::Filter; +use juniper::InputValue; use std::sync::Arc; -use std::sync::RwLock; -use std::io; use crate::schema::{Schema, Ctx}; pub struct AppServer { - schema: Arc, - context: Arc> -} - - -async fn graphiql() -> HttpResponse { - let html = graphiql_source("http://127.0.0.1:8080/graphql", None); - HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body(html) -} - -async fn graphql( - st: web::Data>, - ctx: web::Data>>, - data: web::Json, -) -> Result { - let user = web::block(move || { - match ctx.get_ref().try_read() { - Ok(context) => { - let res = data.execute_sync(&st, &context); - let json = serde_json::to_string(&res)?; - return Ok::<_, serde_json::error::Error>(json); - } - Err(e) => { - let json_str = format!("{{\"error\":\"{}\"}}", e.to_string()); - let json = serde_json::to_string(&json_str)?; - return Ok::<_, serde_json::error::Error>(json); - } - } - }).await?; - Ok(HttpResponse::Ok() - .content_type("application/json") - .body(user)) + create_schema: Box Schema>, + context: Ctx } impl AppServer { - pub fn new(schema: Arc, context: Arc>) -> Self { + pub fn new(create_schema: fn() -> Schema, context: Ctx) -> Self { AppServer { - schema: schema, - context: context + create_schema: Box::new(create_schema), + context: context } } - pub async fn run(self) -> io::Result<()> { - let schema = self.schema; - let context = self.context; - // Start http server - HttpServer::new(move || { - App::new() - .data(schema.clone()) - .data(context.clone()) - .wrap(middleware::Logger::default()) - .wrap( - Cors::new() - .allowed_methods(vec!["POST", "GET"]) - .supports_credentials() - .max_age(3600) - .finish(), - ) - .service(web::resource("/graphql").route(web::post().to(graphql))) - .service(web::resource("/graphiql").route(web::get().to(graphiql))) + pub async fn run(self) { + let qm_schema = (*self.create_schema)(); + let base_context = Arc::new(self.context); + + let context = Arc::clone(&base_context); + let qm_state = warp::any().map(move || { + return Ctx::clone(&context); + }); + let qm_graphql_filter = juniper_warp::make_graphql_filter(qm_schema, qm_state.boxed()); + let root_node = Arc::new((*self.create_schema)()); + let log = warp::log("warp_subscriptions"); + let context = Arc::clone(&base_context); + let routes = (warp::path("subscriptions") + .and(warp::ws()) + .map(move |ws: warp::ws::Ws| { + let root_node = Arc::clone(&root_node); + let context = Arc::clone(&context); + + let ctx = Ctx::clone(&context); + ws.on_upgrade(move |websocket| async move { + let connection_config = move |_: HashMap| async move { + Ok(ConnectionConfig::new(ctx)) as Result<_, Infallible> + }; + + serve_graphql_ws(websocket, root_node, connection_config) + .map(|r| { + if let Err(e) = r { + println!("Websocket error: {}", e); + } + }) + .await + }) + })) + .map(|reply| { + // TODO#584: remove this workaround + warp::reply::with_header(reply, "Sec-WebSocket-Protocol", "graphql-ws") }) - .bind("127.0.0.1:8080")? - .run() - .await - } + .or(warp::post() + .and(warp::path("graphql")) + .and(qm_graphql_filter)) + .or(warp::get() + .and(warp::path("playground")) + .and(playground_filter("/graphql", Some("/subscriptions")))) + .with(log); + warp::serve(routes).run(([127, 0, 0, 1], 8080)).await; + } }