Merge pull request #39 from influxdata/grpc

feature: gRPC
pull/24376/head
Carol (Nichols || Goulding) 2020-02-19 08:35:36 -05:00 committed by GitHub
commit 96ae7f53f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 423 additions and 34 deletions

314
Cargo.lock generated
View File

@ -48,6 +48,35 @@ dependencies = [
"predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "async-stream"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"async-stream-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "async-stream-impl"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "async-trait"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -88,6 +117,14 @@ dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "base64"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "base64"
version = "0.11.0"
@ -321,7 +358,6 @@ dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"prost 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-build 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rocksdb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -329,6 +365,8 @@ dependencies = [
"serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tonic 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tonic-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -962,6 +1000,11 @@ name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -1146,6 +1189,7 @@ dependencies = [
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1173,6 +1217,14 @@ dependencies = [
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_pcg"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.56"
@ -1524,11 +1576,246 @@ dependencies = [
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tonic"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"async-stream 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"prost 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-derive 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-balance 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-load 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-make 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing-futures 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tonic-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-build 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-buffer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-discover 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-limit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-load-shed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-retry 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-timeout 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-balance"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-discover 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-load 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-make 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-ready-cache 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-buffer"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-discover"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-layer"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "tower-limit"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-load"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-discover 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-load-shed"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-make"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-ready-cache"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-retry"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-service"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "tower-timeout"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tower-util"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tracing"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tracing-attributes"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tracing-core"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tracing-futures"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "treeline"
version = "0.1.0"
@ -1803,11 +2090,15 @@ dependencies = [
"checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
"checksum assert_cmd 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6283bac8dd7226470d491bc4737816fea4ca1fba7a2847f2e9097fd6bfb4624c"
"checksum async-stream 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5"
"checksum async-stream-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670"
"checksum async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "750b1c38a1dfadd108da0f01c08f4cdc7ff1bb39b325f9c82cc972361780a6e1"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536"
"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
"checksum bindgen 0.49.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4c07087f3d5731bf3fb375a81841b99597e25dc11bd3bc72d16d43adf6624a6e"
"checksum bindgen 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57"
@ -1904,6 +2195,7 @@ dependencies = [
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
"checksum openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)" = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
"checksum petgraph 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29c127eea4a29ec6c85d153c59dc1213f33ec74cead30fe4730aecc88cc1fd92"
"checksum pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c"
@ -1930,6 +2222,7 @@ dependencies = [
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8"
@ -1967,7 +2260,26 @@ dependencies = [
"checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c"
"checksum tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828"
"checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930"
"checksum tonic 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48"
"checksum tonic-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0436413ba71545bcc6c2b9a0f9d78d72deb0123c6a75ccdfe7c056f9930f5e52"
"checksum tower 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62"
"checksum tower-balance 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c"
"checksum tower-buffer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a"
"checksum tower-discover 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a"
"checksum tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a35d656f2638b288b33495d1053ea74c40dc05ec0b92084dd71ca5566c4ed1dc"
"checksum tower-limit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a4030a1dc1ab99ec6fc9475fc18c62f6cc4da035d370fcbd22fe342f9dd16cd"
"checksum tower-load 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b"
"checksum tower-load-shed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e"
"checksum tower-make 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965"
"checksum tower-ready-cache 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2183d0a00b68a41c0af9e281cf51f40c7de2e1d4af4a43f92a5c35bbe7728d7"
"checksum tower-retry 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952"
"checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
"checksum tower-timeout 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e"
"checksum tower-util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5702d7890e35b2aae6ee420e8a762547505dbed30c075fbc84ec069a0aa18314"
"checksum tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e213bd24252abeb86a0b7060e02df677d367ce6cb772cef17e9214b8390a8d3"
"checksum tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04cfd395def5a60236e187e1ff905cb55668a59f29928dec05e6e1b1fd2ac1f3"
"checksum tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "13a46f11e372b8bd4b4398ea54353412fdd7fd42a8370c7e543e218cf7661978"
"checksum tracing-futures 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "33848db47a7c848ab48b66aab3293cb9c61ea879a3586ecfcd17302fcea0baf1"
"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"

View File

@ -28,8 +28,7 @@ byteorder = "1.3.4"
num_cpus = "1.11.1"
# waiting for tonic to bump up to use newest tokio
#tonic = "0.1.0-alpha.6"
tonic = "0.1.1"
prost = "0.6.1"
# using croaring here because we needed Treemap support for u64
@ -40,8 +39,7 @@ http = "0.2.0"
serde_urlencoded = "0.6.1"
[build-dependencies]
#tonic-build = "0.1.0-alpha.6"
prost-build = "0.6.1"
tonic-build = "0.1.1"
[dev-dependencies]
reqwest = { version = "0.10.1", features = ["blocking"] }

View File

@ -1,7 +1,7 @@
//use tonic_build;
use prost_build;
type Error = Box<dyn std::error::Error>;
type Result<T, E = Error> = std::result::Result<T, E>;
fn main() {
// tonic_build::compile_protos("proto/delorean/delorean.proto")?;
prost_build::compile_protos(&["proto/delorean/delorean.proto"], &["proto/delorean/"]).unwrap();
fn main() -> Result<()> {
tonic_build::compile_protos("proto/delorean/delorean.proto")?;
Ok(())
}

View File

@ -4,6 +4,11 @@
extern crate log;
use delorean::delorean::Bucket;
use delorean::delorean::{
delorean_server::{Delorean, DeloreanServer},
CreateBucketRequest, CreateBucketResponse, DeleteBucketRequest, DeleteBucketResponse,
GetBucketsResponse, Organization,
};
use delorean::line_parser;
use delorean::line_parser::index_pairs;
use delorean::storage::database::Database;
@ -21,9 +26,37 @@ use csv::Writer;
use failure::_core::time::Duration;
use futures::{self, StreamExt};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use hyper::{Body, Method, Server, StatusCode};
use serde::Deserialize;
use serde_json;
use tonic::Status;
#[derive(Debug, Default)]
pub struct GrpcServer {}
#[tonic::async_trait]
impl Delorean for GrpcServer {
async fn create_bucket(
&self,
_req: tonic::Request<CreateBucketRequest>,
) -> Result<tonic::Response<CreateBucketResponse>, Status> {
Ok(tonic::Response::new(CreateBucketResponse {}))
}
async fn delete_bucket(
&self,
_req: tonic::Request<DeleteBucketRequest>,
) -> Result<tonic::Response<DeleteBucketResponse>, Status> {
Ok(tonic::Response::new(DeleteBucketResponse {}))
}
async fn get_buckets(
&self,
_req: tonic::Request<Organization>,
) -> Result<tonic::Response<GetBucketsResponse>, Status> {
Ok(tonic::Response::new(GetBucketsResponse { buckets: vec![] }))
}
}
struct App {
db: Database,
@ -37,7 +70,7 @@ struct WriteInfo {
bucket_name: String,
}
async fn write(req: Request<Body>, app: Arc<App>) -> Result<Body, ApplicationError> {
async fn write(req: hyper::Request<Body>, app: Arc<App>) -> Result<Body, ApplicationError> {
let query = req.uri().query().ok_or(StatusCode::BAD_REQUEST)?;
let write_info: WriteInfo =
serde_urlencoded::from_str(query).map_err(|_| StatusCode::BAD_REQUEST)?;
@ -122,7 +155,7 @@ fn duration_to_nanos_or_default(
}
// TODO: figure out how to stream read results out rather than rendering the whole thing in mem
async fn read(req: Request<Body>, app: Arc<App>) -> Result<Body, ApplicationError> {
async fn read(req: hyper::Request<Body>, app: Arc<App>) -> Result<Body, ApplicationError> {
let query = req
.uri()
.query()
@ -240,7 +273,7 @@ async fn read(req: Request<Body>, app: Arc<App>) -> Result<Body, ApplicationErro
Ok(response_body.into())
}
async fn service(req: Request<Body>, app: Arc<App>) -> http::Result<Response<Body>> {
async fn service(req: hyper::Request<Body>, app: Arc<App>) -> http::Result<hyper::Response<Body>> {
let response = match (req.method(), req.uri().path()) {
(&Method::POST, "/api/v2/write") => write(req, app).await,
(&Method::GET, "/api/v2/read") => read(req, app).await,
@ -251,12 +284,12 @@ async fn service(req: Request<Body>, app: Arc<App>) -> http::Result<Response<Bod
};
match response {
Ok(body) => Ok(Response::builder()
Ok(body) => Ok(hyper::Response::builder()
.body(body.into())
.expect("Should have been able to construct a response")),
Err(e) => {
let json = serde_json::json!({"error": e.to_string()}).to_string();
Ok(Response::builder()
Ok(hyper::Response::builder()
.status(e.status_code())
.body(json.into())
.expect("Should have been able to construct a response"))
@ -333,6 +366,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
panic!("DELOREAN_BIND_ADDR environment variable not a valid unicode string")
}
};
let grpc_bind_addr: SocketAddr = match std::env::var("DELOREAN_GRPC_BIND_ADDR") {
Ok(addr) => addr
.parse()
.expect("DELOREAN_GRPC_BIND_ADDR environment variable not a valid SocketAddr"),
Err(VarError::NotPresent) => "127.0.0.1:8081".parse().unwrap(),
Err(VarError::NotUnicode(_)) => {
panic!("DELOREAN_GRPC_BIND_ADDR environment variable not a valid unicode string")
}
};
let make_svc = make_service_fn(move |_conn| {
let state = state.clone();
@ -344,11 +386,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
}
});
let grpc_server = tonic::transport::Server::builder()
.add_service(DeloreanServer::new(GrpcServer::default()))
.serve(grpc_bind_addr);
let server = Server::bind(&bind_addr).serve(make_svc);
info!("gRPC server listening on http://{}", grpc_bind_addr);
info!("Listening on http://{}", bind_addr);
server.await?;
let (grpc_server, server) = futures::future::join(grpc_server, server).await;
grpc_server?;
server?;
Ok(())
}

View File

@ -23,11 +23,19 @@ use std::thread::sleep;
use std::time::{Duration, SystemTime};
const URL_BASE: &str = "http://localhost:8080/api/v2";
const GRPC_URL_BASE: &str = "http://localhost:8081/";
fn read_data(
client: &reqwest::blocking::Client,
mod grpc {
tonic::include_proto!("delorean");
}
use grpc::delorean_client::DeloreanClient;
use grpc::Organization;
async fn read_data(
client: &reqwest::Client,
path: &str,
org_id: &str,
org_id: u32,
bucket_name: &str,
predicate: &str,
seconds_ago: u64,
@ -36,29 +44,35 @@ fn read_data(
Ok(client
.get(&url)
.query(&[
("org_id", org_id),
("bucket_name", bucket_name),
("org_id", &org_id.to_string()),
("predicate", predicate),
("start", &format!("-{}s", seconds_ago)),
])
.send()?
.send()
.await?
.error_for_status()?
.text()?)
.text()
.await?)
}
fn write_data(
client: &reqwest::blocking::Client,
async fn write_data(
client: &reqwest::Client,
path: &str,
org_id: &str,
org_id: u32,
bucket_name: &str,
body: String,
) -> Result<(), Box<dyn std::error::Error>> {
let url = format!("{}{}", URL_BASE, path);
client
.post(&url)
.query(&[("org_id", org_id), ("bucket_name", bucket_name)])
.query(&[
("bucket_name", bucket_name),
("org_id", &org_id.to_string()),
])
.body(body)
.send()?
.send()
.await?
.error_for_status()?;
Ok(())
}
@ -75,8 +89,8 @@ fn get_test_storage_path() -> String {
.expect("Should have been able to turn temp dir into String")
}
#[test]
fn read_and_write_data() -> Result<(), Box<dyn std::error::Error>> {
#[tokio::test]
async fn read_and_write_data() -> Result<(), Box<dyn std::error::Error>> {
let mut server_thread = Command::cargo_bin("delorean")?
.stdout(Stdio::null())
.env("DELOREAN_DB_DIR", get_test_storage_path())
@ -85,9 +99,23 @@ fn read_and_write_data() -> Result<(), Box<dyn std::error::Error>> {
// TODO: poll the server to see if it's ready instead of sleeping
sleep(Duration::from_secs(3));
let org_id = "7878";
let org_id = 7878;
let bucket_name = "all";
let client = reqwest::blocking::Client::new();
let client = reqwest::Client::new();
let mut grpc_client = DeloreanClient::connect(GRPC_URL_BASE).await?;
let get_buckets_request = tonic::Request::new(Organization {
id: org_id,
name: "test".into(),
buckets: vec![],
});
let get_buckets_response = grpc_client.get_buckets(get_buckets_request).await?;
let get_buckets_response = get_buckets_response.into_inner();
let org_buckets = get_buckets_response.buckets;
// This checks that gRPC is functioning and that we're starting from an org without buckets.
assert!(org_buckets.is_empty());
let start_time = SystemTime::now();
let ns_since_epoch = start_time
@ -113,7 +141,8 @@ cpu_load_short,host=server01,region=us-west value=0.000003 {}",
ns_since_epoch + 2,
ns_since_epoch + 3
),
)?;
)
.await?;
let end_time = SystemTime::now();
let duration = end_time
@ -128,7 +157,8 @@ cpu_load_short,host=server01,region=us-west value=0.000003 {}",
bucket_name,
"host=\"server01\"",
seconds_ago,
)?;
)
.await?;
// TODO: make a more sustainable way to manage expected data for tests, such as using the
// insta crate to manage snapshots.