From f1e3f12af6574a03018d34961ceb76a593df1786 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Fri, 12 Apr 2019 22:50:40 -0700 Subject: [PATCH] Replace grpc-rs with tower-grpc. This commit replaces the grpc-rs dependency with tower-grpc. As a result, this also replaces the rust-protobuf dependency with prost. Prost generates far less code that has the benefit of being simple structs and enums. Because tower-grpc is entirely Rust native, we no longer need to depend on a CMake or C++ compiler to be installed to build Azure Functions for Rust. Fixes #243. Fixes #220. --- .gitmodules | 2 +- Cargo.lock | 809 +- README.md | 56 - azure-functions-codegen/src/func/invoker.rs | 37 +- .../src/func/output_bindings.rs | 53 +- azure-functions-shared/Cargo.toml | 9 +- azure-functions-shared/build.rs | 23 +- .../cache/ClaimsIdentityRpc.rs | 550 -- azure-functions-shared/cache/FunctionRpc.rs | 8205 ----------------- .../cache/FunctionRpc_grpc.rs | 63 - .../cache/azure_functions_rpc_messages.rs | 515 ++ azure-functions-shared/protobuf | 2 +- .../src/codegen/function.rs | 4 +- azure-functions-shared/src/lib.rs | 13 +- azure-functions/Cargo.toml | 9 +- azure-functions/src/bindings/blob.rs | 198 +- azure-functions/src/bindings/blob_trigger.rs | 96 +- .../src/bindings/cosmos_db_document.rs | 45 +- .../src/bindings/cosmos_db_trigger.rs | 14 +- .../src/bindings/event_grid_event.rs | 20 +- .../src/bindings/event_hub_message.rs | 252 +- .../src/bindings/event_hub_trigger.rs | 114 +- azure-functions/src/bindings/http_request.rs | 144 +- azure-functions/src/bindings/http_response.rs | 54 +- azure-functions/src/bindings/queue_message.rs | 252 +- azure-functions/src/bindings/queue_trigger.rs | 90 +- .../src/bindings/service_bus_message.rs | 250 +- .../src/bindings/service_bus_trigger.rs | 184 +- .../src/bindings/signalr_connection_info.rs | 22 +- .../src/bindings/signalr_group_action.rs | 41 +- .../src/bindings/signalr_message.rs | 38 +- azure-functions/src/bindings/table.rs | 71 +- azure-functions/src/bindings/timer_info.rs | 20 +- azure-functions/src/cli.rs | 41 +- azure-functions/src/commands.rs | 3 + azure-functions/src/commands/run.rs | 392 + azure-functions/src/http/body.rs | 109 +- azure-functions/src/http/response_builder.rs | 8 +- azure-functions/src/lib.rs | 60 +- azure-functions/src/logger.rs | 35 +- azure-functions/src/rpc.rs | 4 - azure-functions/src/rpc/client.rs | 383 - azure-functions/src/util.rs | 98 +- docker/build-image/Dockerfile | 2 +- examples/service-bus/Dockerfile | 2 +- 45 files changed, 2782 insertions(+), 10610 deletions(-) delete mode 100644 azure-functions-shared/cache/ClaimsIdentityRpc.rs delete mode 100644 azure-functions-shared/cache/FunctionRpc.rs delete mode 100644 azure-functions-shared/cache/FunctionRpc_grpc.rs create mode 100644 azure-functions-shared/cache/azure_functions_rpc_messages.rs create mode 100644 azure-functions/src/commands.rs create mode 100644 azure-functions/src/commands/run.rs delete mode 100644 azure-functions/src/rpc.rs delete mode 100644 azure-functions/src/rpc/client.rs diff --git a/.gitmodules b/.gitmodules index 241b693..34a73b6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "azure-functions-shared/protobuf"] path = azure-functions-shared/protobuf - url = https://github.com/Azure/azure-functions-language-worker-protobuf + url = https://github.com/peterhuene/azure-functions-language-worker-protobuf diff --git a/Cargo.lock b/Cargo.lock index 9dcad99..0ad4590 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,11 +53,9 @@ dependencies = [ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grpcio 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -65,7 +63,12 @@ dependencies = [ "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-grpc 0.1.0 (git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f)", + "tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2?rev=a3c958a243ef3d837933b31bf186ba0e6b0e60c9)", + "tower-request-modifier 0.1.0 (git+https://github.com/tower-rs/tower-http?rev=e7ef6ef623411342ee89c0a83ef924db6206143a)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-util 0.1.0 (git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c)", "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -99,17 +102,18 @@ name = "azure-functions-shared" version = "0.7.0" dependencies = [ "azure-functions-shared-codegen 0.7.0", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grpcio 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protoc-grpcio 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-grpc 0.1.0 (git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f)", + "tower-grpc-build 0.1.0 (git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f)", ] [[package]] @@ -143,6 +147,14 @@ dependencies = [ "libc 0.2.48 (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.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" @@ -181,6 +193,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -228,11 +241,11 @@ dependencies = [ ] [[package]] -name = "cmake" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "codegen" +version = "0.1.1" +source = "git+https://github.com/carllerche/codegen#87e270f74a9b686e8f8a2daf6b4b4112a2807f90" dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -252,15 +265,6 @@ dependencies = [ "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-channel" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-deque" version = "0.7.1" @@ -309,16 +313,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "derive-new" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "digest" version = "0.7.6" @@ -354,18 +348,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -378,6 +360,11 @@ name = "fixedbitset" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fs_extra" version = "1.1.0" @@ -388,6 +375,20 @@ name = "fuchsia-cprng" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "futures" version = "0.1.26" @@ -402,40 +403,20 @@ dependencies = [ ] [[package]] -name = "grpcio" -version = "0.4.4" +name = "h2" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grpcio-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "grpcio-compiler" -version = "0.5.0-alpha" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf-codegen 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "grpcio-sys" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -462,6 +443,27 @@ dependencies = [ "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "http-body" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-http#e7ef6ef623411342ee89c0a83ef924db6206143a" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-buf 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "http-example" version = "0.1.0" @@ -472,6 +474,11 @@ dependencies = [ "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "iovec" version = "0.1.2" @@ -494,16 +501,39 @@ name = "itoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lock_api" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.4.6" @@ -532,11 +562,60 @@ name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "multimap" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nix" version = "0.11.0" @@ -575,6 +654,40 @@ dependencies = [ "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "owning_ref" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (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 = "pest" version = "2.1.0" @@ -622,11 +735,6 @@ dependencies = [ "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "pkg-config" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "proc-macro2" version = "0.4.27" @@ -683,40 +791,6 @@ dependencies = [ "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "protobuf" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "protobuf-codegen" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "protoc" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "protoc-grpcio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grpcio-compiler 0.5.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf-codegen 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protoc 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "queue-example" version = "0.1.0" @@ -1006,6 +1080,16 @@ name = "smallvec" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "string" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "strsim" version = "0.8.0" @@ -1021,17 +1105,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "synstructure" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "table-example" version = "0.1.0" @@ -1107,6 +1180,68 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-buf" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-connect" +version = "0.1.0" +source = "git+https://github.com/carllerche/tokio-connect#f7ad1ca437973d6e24037ac6f7d5ef1013833c0b" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-executor" version = "0.1.7" @@ -1116,6 +1251,66 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-fs" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-sync" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-threadpool" version = "0.1.13" @@ -1132,6 +1327,291 @@ dependencies = [ "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-timer" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-trace-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-buffer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-discover 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-limit 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-load-shed 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-reconnect 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-retry 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-timeout 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-util 0.1.0 (git+https://github.com/tower-rs/tower)", +] + +[[package]] +name = "tower-buffer" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-discover" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-grpc" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f#55d004e49f6c6097a9f556752bceb8b32c8c700f" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2)", + "tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-util 0.1.0 (git+https://github.com/tower-rs/tower)", +] + +[[package]] +name = "tower-grpc-build" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f#55d004e49f6c6097a9f556752bceb8b32c8c700f" +dependencies = [ + "codegen 0.1.1 (git+https://github.com/carllerche/codegen)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-h2" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-h2#a3c958a243ef3d837933b31bf186ba0e6b0e60c9" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-connect 0.1.0 (git+https://github.com/carllerche/tokio-connect)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tower 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-h2" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-h2?rev=a3c958a243ef3d837933b31bf186ba0e6b0e60c9#a3c958a243ef3d837933b31bf186ba0e6b0e60c9" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-connect 0.1.0 (git+https://github.com/carllerche/tokio-connect)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tower 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-http" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-http#e7ef6ef623411342ee89c0a83ef924db6206143a" +dependencies = [ + "http-body 0.1.0 (git+https://github.com/tower-rs/tower-http)", + "tower-http-util 0.1.0 (git+https://github.com/tower-rs/tower-http)", +] + +[[package]] +name = "tower-http-util" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-http#e7ef6ef623411342ee89c0a83ef924db6206143a" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.1.0 (git+https://github.com/tower-rs/tower-http)", + "tokio-buf 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-layer" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-layer" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-limit" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-load-shed" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-reconnect" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-util 0.1.0 (git+https://github.com/tower-rs/tower)", +] + +[[package]] +name = "tower-request-modifier" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower-http?rev=e7ef6ef623411342ee89c0a83ef924db6206143a#e7ef6ef623411342ee89c0a83ef924db6206143a" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-retry" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-service" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-timeout" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-util" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-util" +version = "0.1.0" +source = "git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c#979c1399127bdb269c751b99c12b3adfad55463c" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.1.0 (git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c)", + "tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" version = "1.10.0" @@ -1210,6 +1690,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1228,6 +1713,15 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "xml-rs" version = "0.8.0" @@ -1242,6 +1736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" @@ -1252,61 +1747,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "6ec65ee4f9c9d16f335091d23693457ed4928657ba4982289d7fafee03bc614a" +"checksum codegen 0.1.1 (git+https://github.com/carllerche/codegen)" = "" "checksum colored 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e9a455e156a4271e12fd0246238c380b1e223e3736663c7a18ed8b6362028a9" -"checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" "checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" "checksum ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "630391922b1b893692c6334369ff528dcc3a9d8061ccf4c803aa8f83cb13db5e" -"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" "checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" -"checksum grpcio 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c02fb3c9c44615973814c838f75d7898695d4d4b97a3e8cf52e9ccca30664b6f" -"checksum grpcio-compiler 0.5.0-alpha (registry+https://github.com/rust-lang/crates.io-index)" = "9a135632fa82163b355fd629acfc07e4521166a87ad4b0716e148203735fa450" -"checksum grpcio-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d8d3b6d1a70b9dcb2545d1aff5b2c74652cb635f6ab6426be8fd201e9566b7e" +"checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" "checksum handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" +"checksum http-body 0.1.0 (git+https://github.com/tower-rs/tower-http)" = "" +"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" +"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" +"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54f0c72a98d8ab3c99560bfd16df8059cc10e1f9a8e83e6e3b97718dd766e9c3" "checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" "checksum pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646" "checksum pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5a3492a4ed208ffc247adcdcc7ba2a95be3104f58877d0d02f0df39bf3efb5e" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96d14b1c185652833d24aaad41c5832b0be5616a590227c1fbff57c616754b23" "checksum prost-build 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb788126ea840817128183f8f603dce02cb7aea25c2a0b764359d8e20010702e" "checksum prost-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e7dc378b94ac374644181a2247cebf59a6ec1c88b49ac77f3a94b86b79d0e11" "checksum prost-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1de482a366941c8d56d19b650fac09ca08508f2a696119ee7513ad590c8bac6f" -"checksum protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82d117bc7565ce6be0150159251c9b1eeec7b129f5a2aa86e10acb5970de1cb" -"checksum protobuf-codegen 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f25bf531a031dd128d4e7285401caed1038d4f732b56bb1d99f02bdad4ad125" -"checksum protoc 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6762f5a05f41eb6252606fc6553262a025e72c51a0227717990998fd9c2ac81" -"checksum protoc-grpcio 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "da4389258ed4b768438edec1e1e813cc7fa29e70c1b1cb4eb2f8fc341dc562dd" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" @@ -1339,17 +1841,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b4cfac95805274c6afdb12d8f770fa2d27c045953e7b630a81801953699a9a" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "65641e515a437b308ab131a82ce3042ff9795bef5d6c5a9be4eb24195c417fd9" +"checksum tokio-buf 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "473a45a40e558d6d80e9f60e3d934c32488045def2745488a257e472941e9bce" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-connect 0.1.0 (git+https://github.com/carllerche/tokio-connect)" = "" +"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" "checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" +"checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" +"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" +"checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" +"checksum tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fda385df506bf7546e70872767f71e81640f1f251bdf2fd8eb81a0eaec5fe022" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" "checksum tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ec5759cf26cf9659555f36c431b515e3d05f66831741c85b4b5d5dfb9cf1323c" +"checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350c9edade9830dc185ae48ba45667a445ab59f6167ef6d0254ec9d2430d9dd3" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tower 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-buffer 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-discover 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-grpc 0.1.0 (git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f)" = "" +"checksum tower-grpc-build 0.1.0 (git+https://github.com/tower-rs/tower-grpc?rev=55d004e49f6c6097a9f556752bceb8b32c8c700f)" = "" +"checksum tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2)" = "" +"checksum tower-h2 0.1.0 (git+https://github.com/tower-rs/tower-h2?rev=a3c958a243ef3d837933b31bf186ba0e6b0e60c9)" = "" +"checksum tower-http 0.1.0 (git+https://github.com/tower-rs/tower-http)" = "" +"checksum tower-http-util 0.1.0 (git+https://github.com/tower-rs/tower-http)" = "" +"checksum tower-layer 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-layer 0.1.0 (git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c)" = "" +"checksum tower-limit 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-load-shed 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-reconnect 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-request-modifier 0.1.0 (git+https://github.com/tower-rs/tower-http?rev=e7ef6ef623411342ee89c0a83ef924db6206143a)" = "" +"checksum tower-retry 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-service 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc0c98637d23732f8de6dfd16494c9f1559c3b9e20b4a46462c8f9b9e827bfa" +"checksum tower-timeout 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-util 0.1.0 (git+https://github.com/tower-rs/tower)" = "" +"checksum tower-util 0.1.0 (git+https://github.com/tower-rs/tower?rev=979c1399127bdb269c751b99c12b3adfad55463c)" = "" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71a9c5b1fe77426cf144cc30e49e955270f5086e31a6441dfa8b32efc09b9d77" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" @@ -1363,7 +1900,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5" diff --git a/README.md b/README.md index 06ebfde..3bb6401 100644 --- a/README.md +++ b/README.md @@ -44,62 +44,6 @@ Documentation for the [latest published version](https://docs.rs/azure-functions # Getting Started -## Install CMake - -The `azure-functions` crate has a dependency on the `grpcio` crate that uses [CMake](https://cmake.org) to build and link against the gRPC native library. - -CMake must be installed and on the `PATH` to be able to use Azure Functions for Rust. - -### Windows - -Install CMake from the [Windows installer](https://cmake.org/download/). - -### macOS - -The easiest way to install CMake on macOS is with [Homebrew](https://brew.sh/): - -``` -$ brew install cmake -``` - -### Linux - -Use your distro's package manager to install a `cmake` (or similar) package. - -For example on Debian/Ubuntu: - -``` -$ apt-get install cmake -``` - -## Install a C++ Compiler - -The `grpcio` crate builds a native library that implements the gRPC runtime. - -Therefore, a C++ compiler must be on your PATH. - -### Windows - -Install [Visual Studio 2015 or later](https://visualstudio.microsoft.com/). - -### macOS - -Ensure the XCode command line utilities are installed, as this will install `clang`: - -``` -$ xcode-select --install -``` - -### Linux - -Use your distro's package manager to install `g++` (or similar) package: - -For example on Debian/Ubuntu: - -``` -$ apt-get install g++ -``` - ## Install a .NET Core SDK A .NET Core SDK is required to synchronize Azure Functions Host binding extensions. diff --git a/azure-functions-codegen/src/func/invoker.rs b/azure-functions-codegen/src/func/invoker.rs index 8a948b4..363cc94 100644 --- a/azure-functions-codegen/src/func/invoker.rs +++ b/azure-functions-codegen/src/func/invoker.rs @@ -42,11 +42,19 @@ impl<'a> Invoker<'a> { if let Type::Path(tp) = Invoker::deref_arg_type(arg_type) { if get_generic_argument_type(last_segment_in_path(&tp.path), "Vec").is_some() { - return Some(quote!(__param.take_data().into_vec())); + return Some(quote!(__param + .data + .take() + .expect("expected parameter binding data") + .into_vec())); } } - Some(quote!(__param.take_data().into())) + Some(quote!(__param + .data + .take() + .expect("expected parameter binding data") + .into())) }) .collect() } @@ -138,8 +146,8 @@ impl ToTokens for Invoker<'_> { quote!(#[allow(dead_code)] fn #invoker( __name: &str, - __req: &mut ::azure_functions::rpc::protocol::InvocationRequest, - ) -> ::azure_functions::rpc::protocol::InvocationResponse { + __req: &mut ::azure_functions::rpc::InvocationRequest, + ) -> ::azure_functions::rpc::InvocationResponse { use azure_functions::{IntoVec, FromVec}; let mut #trigger_arg: Option<#trigger_type> = None; @@ -147,7 +155,12 @@ impl ToTokens for Invoker<'_> { for __param in __req.input_data.iter_mut() { match __param.name.as_str() { - #trigger_name => #trigger_arg = Some(#trigger_type::new(__param.take_data(), &mut __req.trigger_metadata)), + #trigger_name => #trigger_arg = Some( + #trigger_type::new( + __param.data.take().expect("expected parameter binding data"), + &mut __req.trigger_metadata + ) + ), #(#arg_names => #args_for_match = Some(#arg_assignments),)* _ => panic!(format!("unexpected parameter binding '{}'", __param.name)), }; @@ -156,13 +169,19 @@ impl ToTokens for Invoker<'_> { let __ctx = ::azure_functions::Context::new(&__req.invocation_id, &__req.function_id, __name); let __ret = #target(#(#args_for_call,)*); - let mut __res = ::azure_functions::rpc::protocol::InvocationResponse::new(); - __res.set_invocation_id(__req.invocation_id.clone()); + let mut __res = ::azure_functions::rpc::InvocationResponse { + invocation_id: __req.invocation_id.clone(), + result: Some(::azure_functions::rpc::StatusResult { + status: ::azure_functions::rpc::status_result::Status::Success as i32, + ..Default::default() + }), + ..Default::default() + }; + #output_bindings - __res.mut_result().status = - ::azure_functions::rpc::protocol::StatusResult_Status::Success; __res + }).to_tokens(tokens); } } diff --git a/azure-functions-codegen/src/func/output_bindings.rs b/azure-functions-codegen/src/func/output_bindings.rs index 15c0362..e5aae93 100644 --- a/azure-functions-codegen/src/func/output_bindings.rs +++ b/azure-functions-codegen/src/func/output_bindings.rs @@ -12,10 +12,10 @@ impl<'a> OutputBindings<'a> { .map(|(name, _)| { let name_str = to_camel_case(&name.to_string()); quote!( - let mut __output_binding = ::azure_functions::rpc::protocol::ParameterBinding::new(); - __output_binding.set_name(#name_str.to_string()); - __output_binding.set_data(#name.unwrap().into()); - __output_data.push(__output_binding); + __output_data.push(::azure_functions::rpc::ParameterBinding{ + name: #name_str.to_string(), + data: Some(#name.unwrap().into()), + }); ) }) .collect() @@ -33,20 +33,20 @@ impl<'a> OutputBindings<'a> { let conversion = OutputBindings::get_binding_conversion(inner, None); Some(quote!( if let Some(__ret) = __ret.#index { - let mut __output_binding = ::azure_functions::rpc::protocol::ParameterBinding::new(); - __output_binding.set_name(#name.to_string()); - __output_binding.set_data(#conversion); - __output_data.push(__output_binding); + __res.output_data.push(::azure_functions::rpc::ParameterBinding{ + name: #name.to_string(), + data: Some(#conversion) + }); } )) } None => { let conversion = OutputBindings::get_binding_conversion(ty, Some(index)); Some(quote!( - let mut __output_binding = ::azure_functions::rpc::protocol::ParameterBinding::new(); - __output_binding.set_name(#name.to_string()); - __output_binding.set_data(#conversion); - __output_data.push(__output_binding); + __res.output_data.push(::azure_functions::rpc::ParameterBinding{ + name: #name.to_string(), + data: Some(#conversion) + }); )) } } @@ -55,10 +55,8 @@ impl<'a> OutputBindings<'a> { fn get_binding_conversion(ty: &Type, index: Option) -> TokenStream { match OutputBindings::get_generic_argument_type(ty, "Vec") { Some(_) => match index { - Some(index) => { - quote!(::azure_functions::rpc::protocol::TypedData::from_vec(__ret.#index)) - } - None => quote!(::azure_functions::rpc::protocol::TypedData::from_vec(__ret)), + Some(index) => quote!(::azure_functions::rpc::TypedData::from_vec(__ret.#index)), + None => quote!(::azure_functions::rpc::TypedData::from_vec(__ret)), }, None => match index { Some(index) => quote!(__ret.#index.into()), @@ -132,13 +130,13 @@ impl<'a> OutputBindings<'a> { let conversion = OutputBindings::get_binding_conversion(inner, None); Some(quote!( if let Some(__ret) = __ret.0 { - __res.set_return_value(#conversion); + __res.return_value = Some(#conversion); } )) } None => { let conversion = OutputBindings::get_binding_conversion(ty, Some(0.into())); - Some(quote!(__res.set_return_value(#conversion);)) + Some(quote!(__res.return_value = Some(#conversion);)) } } } else { @@ -154,13 +152,13 @@ impl<'a> OutputBindings<'a> { let conversion = OutputBindings::get_binding_conversion(inner, None); Some(quote!( if let Some(__ret) = __ret { - __res.set_return_value(#conversion); + __res.return_value = Some(#conversion); } )) } None => { let conversion = OutputBindings::get_binding_conversion(ty, None); - Some(quote!(__res.set_return_value(#conversion);)) + Some(quote!(__res.return_value = Some(#conversion);)) } } } @@ -169,17 +167,12 @@ impl<'a> OutputBindings<'a> { impl ToTokens for OutputBindings<'_> { fn to_tokens(&self, tokens: &mut TokenStream) { - let mut output_bindings = self.get_output_argument_bindings(); - output_bindings.append(&mut self.iter_output_return_bindings()); + for binding in self.get_output_argument_bindings() { + binding.to_tokens(tokens); + } - if !output_bindings.is_empty() { - quote!( - { - let mut __output_data = __res.mut_output_data(); - #(#output_bindings;)* - } - ) - .to_tokens(tokens); + for binding in self.iter_output_return_bindings() { + binding.to_tokens(tokens); } match &self.0.decl.output { diff --git a/azure-functions-shared/Cargo.toml b/azure-functions-shared/Cargo.toml index f97b001..eb240c6 100644 --- a/azure-functions-shared/Cargo.toml +++ b/azure-functions-shared/Cargo.toml @@ -10,9 +10,10 @@ edition = "2018" [dependencies] azure-functions-shared-codegen = { version = "0.7.0", path = "../azure-functions-shared-codegen" } -protobuf = "2.3.0" -grpcio = { version = "0.4.4", default-features = false, features = ["protobuf-codec"] } -futures = "0.1.26" +tower-grpc = { git = "https://github.com/tower-rs/tower-grpc", rev = "55d004e49f6c6097a9f556752bceb8b32c8c700f"} +prost = "0.5" +prost-types = "0.5" +bytes = "0.4" serde = "1.0.90" serde_json = "1.0.39" serde_derive = "1.0.90" @@ -22,7 +23,7 @@ proc-macro2 = { version = "0.4.27" } lazy_static = "1.3.0" [build-dependencies] -protoc-grpcio = "1.0.2" +tower-grpc-build = { git = "https://github.com/tower-rs/tower-grpc", rev = "55d004e49f6c6097a9f556752bceb8b32c8c700f"} [features] default = [] diff --git a/azure-functions-shared/build.rs b/azure-functions-shared/build.rs index a05c67b..9329baa 100644 --- a/azure-functions-shared/build.rs +++ b/azure-functions-shared/build.rs @@ -4,21 +4,14 @@ use std::path::PathBuf; const OUT_DIR_VAR: &str = "OUT_DIR"; const CACHE_DIR_NAME: &str = "cache"; -const PROTOBUF_INPUT_FILES: &[&str] = &["FunctionRpc.proto", "identity/ClaimsIdentityRpc.proto"]; -const OUTPUT_FILES: &[&str] = &[ - "FunctionRpc.rs", - "FunctionRpc_grpc.rs", - "ClaimsIdentityRpc.rs", -]; +const PROTOBUF_INPUT_FILES: &[&str] = &["FunctionRpc.proto"]; +const OUTPUT_FILES: &[&str] = &["azure_functions_rpc_messages.rs"]; fn compile_protobufs(out_dir: &PathBuf, cache_dir: &PathBuf) { - protoc_grpcio::compile_grpc_protos( - PROTOBUF_INPUT_FILES, - &["protobuf/src/proto"], - &out_dir, - None, - ) - .expect("Failed to compile gRPC definitions."); + tower_grpc_build::Config::new() + .enable_client(true) + .build(PROTOBUF_INPUT_FILES, &["protobuf/src/proto"]) + .unwrap_or_else(|e| panic!("protobuf compilation failed: {}", e)); for file in OUTPUT_FILES.iter() { fs::copy(out_dir.join(file), cache_dir.join(file)) @@ -36,7 +29,9 @@ fn use_cached_files(out_dir: &PathBuf, cache_dir: &PathBuf) { } fn main() { - println!("cargo:rerun-if-changed=protobuf/src/proto/FunctionRpc.proto"); + for file in PROTOBUF_INPUT_FILES { + println!("cargo:rerun-if-changed=protobuf/src/proto/{}", file); + } let out_dir = PathBuf::from(env::var(OUT_DIR_VAR).unwrap()); diff --git a/azure-functions-shared/cache/ClaimsIdentityRpc.rs b/azure-functions-shared/cache/ClaimsIdentityRpc.rs deleted file mode 100644 index 882430d..0000000 --- a/azure-functions-shared/cache/ClaimsIdentityRpc.rs +++ /dev/null @@ -1,550 +0,0 @@ -// This file is generated by rust-protobuf 2.3.0. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct RpcClaimsIdentity { - // message fields - pub authentication_type: ::std::string::String, - pub name_claim_type: ::std::string::String, - pub role_claim_type: ::std::string::String, - pub claims: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcClaimsIdentity { - pub fn new() -> RpcClaimsIdentity { - ::std::default::Default::default() - } - - // string authentication_type = 1; - - pub fn clear_authentication_type(&mut self) { - self.authentication_type.clear(); - } - - // Param is passed by value, moved - pub fn set_authentication_type(&mut self, v: ::std::string::String) { - self.authentication_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_authentication_type(&mut self) -> &mut ::std::string::String { - &mut self.authentication_type - } - - // Take field - pub fn take_authentication_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.authentication_type, ::std::string::String::new()) - } - - pub fn get_authentication_type(&self) -> &str { - &self.authentication_type - } - - // string name_claim_type = 2; - - pub fn clear_name_claim_type(&mut self) { - self.name_claim_type.clear(); - } - - // Param is passed by value, moved - pub fn set_name_claim_type(&mut self, v: ::std::string::String) { - self.name_claim_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name_claim_type(&mut self) -> &mut ::std::string::String { - &mut self.name_claim_type - } - - // Take field - pub fn take_name_claim_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name_claim_type, ::std::string::String::new()) - } - - pub fn get_name_claim_type(&self) -> &str { - &self.name_claim_type - } - - // string role_claim_type = 3; - - pub fn clear_role_claim_type(&mut self) { - self.role_claim_type.clear(); - } - - // Param is passed by value, moved - pub fn set_role_claim_type(&mut self, v: ::std::string::String) { - self.role_claim_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_role_claim_type(&mut self) -> &mut ::std::string::String { - &mut self.role_claim_type - } - - // Take field - pub fn take_role_claim_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.role_claim_type, ::std::string::String::new()) - } - - pub fn get_role_claim_type(&self) -> &str { - &self.role_claim_type - } - - // repeated .RpcClaim claims = 4; - - pub fn clear_claims(&mut self) { - self.claims.clear(); - } - - // Param is passed by value, moved - pub fn set_claims(&mut self, v: ::protobuf::RepeatedField) { - self.claims = v; - } - - // Mutable pointer to the field. - pub fn mut_claims(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.claims - } - - // Take field - pub fn take_claims(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.claims, ::protobuf::RepeatedField::new()) - } - - pub fn get_claims(&self) -> &[RpcClaim] { - &self.claims - } -} - -impl ::protobuf::Message for RpcClaimsIdentity { - fn is_initialized(&self) -> bool { - for v in &self.claims { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.authentication_type)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name_claim_type)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.role_claim_type)?; - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.claims)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.authentication_type.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.authentication_type); - } - if !self.name_claim_type.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.name_claim_type); - } - if !self.role_claim_type.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.role_claim_type); - } - for value in &self.claims { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.authentication_type.is_empty() { - os.write_string(1, &self.authentication_type)?; - } - if !self.name_claim_type.is_empty() { - os.write_string(2, &self.name_claim_type)?; - } - if !self.role_claim_type.is_empty() { - os.write_string(3, &self.role_claim_type)?; - } - for v in &self.claims { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcClaimsIdentity { - RpcClaimsIdentity::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "authentication_type", - |m: &RpcClaimsIdentity| { &m.authentication_type }, - |m: &mut RpcClaimsIdentity| { &mut m.authentication_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name_claim_type", - |m: &RpcClaimsIdentity| { &m.name_claim_type }, - |m: &mut RpcClaimsIdentity| { &mut m.name_claim_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "role_claim_type", - |m: &RpcClaimsIdentity| { &m.role_claim_type }, - |m: &mut RpcClaimsIdentity| { &mut m.role_claim_type }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "claims", - |m: &RpcClaimsIdentity| { &m.claims }, - |m: &mut RpcClaimsIdentity| { &mut m.claims }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcClaimsIdentity", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcClaimsIdentity { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcClaimsIdentity, - }; - unsafe { - instance.get(RpcClaimsIdentity::new) - } - } -} - -impl ::protobuf::Clear for RpcClaimsIdentity { - fn clear(&mut self) { - self.clear_authentication_type(); - self.clear_name_claim_type(); - self.clear_role_claim_type(); - self.clear_claims(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcClaimsIdentity { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcClaimsIdentity { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RpcClaim { - // message fields - pub value: ::std::string::String, - pub field_type: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcClaim { - pub fn new() -> RpcClaim { - ::std::default::Default::default() - } - - // string value = 1; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::string::String) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::string::String { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.value, ::std::string::String::new()) - } - - pub fn get_value(&self) -> &str { - &self.value - } - - // string type = 2; - - pub fn clear_field_type(&mut self) { - self.field_type.clear(); - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: ::std::string::String) { - self.field_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_type(&mut self) -> &mut ::std::string::String { - &mut self.field_type - } - - // Take field - pub fn take_field_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) - } - - pub fn get_field_type(&self) -> &str { - &self.field_type - } -} - -impl ::protobuf::Message for RpcClaim { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.value)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.value.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.value); - } - if !self.field_type.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.field_type); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.value.is_empty() { - os.write_string(1, &self.value)?; - } - if !self.field_type.is_empty() { - os.write_string(2, &self.field_type)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcClaim { - RpcClaim::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "value", - |m: &RpcClaim| { &m.value }, - |m: &mut RpcClaim| { &mut m.value }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "type", - |m: &RpcClaim| { &m.field_type }, - |m: &mut RpcClaim| { &mut m.field_type }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcClaim", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcClaim { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcClaim, - }; - unsafe { - instance.get(RpcClaim::new) - } - } -} - -impl ::protobuf::Clear for RpcClaim { - fn clear(&mut self) { - self.clear_value(); - self.clear_field_type(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcClaim { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcClaim { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x20identity/ClaimsIdentityRpc.proto\"\xb7\x01\n\x11RpcClaimsIdentity\ - \x12/\n\x13authentication_type\x18\x01\x20\x01(\tR\x12authenticationType\ - \x12&\n\x0fname_claim_type\x18\x02\x20\x01(\tR\rnameClaimType\x12&\n\x0f\ - role_claim_type\x18\x03\x20\x01(\tR\rroleClaimType\x12!\n\x06claims\x18\ - \x04\x20\x03(\x0b2\t.RpcClaimR\x06claims\"4\n\x08RpcClaim\x12\x14\n\x05v\ - alue\x18\x01\x20\x01(\tR\x05value\x12\x12\n\x04type\x18\x02\x20\x01(\tR\ - \x04typeb\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/azure-functions-shared/cache/FunctionRpc.rs b/azure-functions-shared/cache/FunctionRpc.rs deleted file mode 100644 index c1bb356..0000000 --- a/azure-functions-shared/cache/FunctionRpc.rs +++ /dev/null @@ -1,8205 +0,0 @@ -// This file is generated by rust-protobuf 2.3.0. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct StreamingMessage { - // message fields - pub request_id: ::std::string::String, - // message oneof groups - pub content: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -#[derive(Clone,PartialEq)] -pub enum StreamingMessage_oneof_content { - start_stream(StartStream), - worker_init_request(WorkerInitRequest), - worker_init_response(WorkerInitResponse), - worker_heartbeat(WorkerHeartbeat), - worker_terminate(WorkerTerminate), - worker_status_request(WorkerStatusRequest), - worker_status_response(WorkerStatusResponse), - file_change_event_request(FileChangeEventRequest), - worker_action_response(WorkerActionResponse), - function_load_request(FunctionLoadRequest), - function_load_response(FunctionLoadResponse), - invocation_request(InvocationRequest), - invocation_response(InvocationResponse), - invocation_cancel(InvocationCancel), - rpc_log(RpcLog), - function_environment_reload_request(FunctionEnvironmentReloadRequest), - function_environment_reload_response(FunctionEnvironmentReloadResponse), -} - -impl StreamingMessage { - pub fn new() -> StreamingMessage { - ::std::default::Default::default() - } - - // string request_id = 1; - - pub fn clear_request_id(&mut self) { - self.request_id.clear(); - } - - // Param is passed by value, moved - pub fn set_request_id(&mut self, v: ::std::string::String) { - self.request_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_request_id(&mut self) -> &mut ::std::string::String { - &mut self.request_id - } - - // Take field - pub fn take_request_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.request_id, ::std::string::String::new()) - } - - pub fn get_request_id(&self) -> &str { - &self.request_id - } - - // .AzureFunctionsRpcMessages.StartStream start_stream = 20; - - pub fn clear_start_stream(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_start_stream(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_start_stream(&mut self, v: StartStream) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(v)) - } - - // Mutable pointer to the field. - pub fn mut_start_stream(&mut self) -> &mut StartStream { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(StartStream::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_start_stream(&mut self) -> StartStream { - if self.has_start_stream() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(v)) => v, - _ => panic!(), - } - } else { - StartStream::new() - } - } - - pub fn get_start_stream(&self) -> &StartStream { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(ref v)) => v, - _ => StartStream::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerInitRequest worker_init_request = 17; - - pub fn clear_worker_init_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_init_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_init_request(&mut self, v: WorkerInitRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_init_request(&mut self) -> &mut WorkerInitRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(WorkerInitRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_init_request(&mut self) -> WorkerInitRequest { - if self.has_worker_init_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(v)) => v, - _ => panic!(), - } - } else { - WorkerInitRequest::new() - } - } - - pub fn get_worker_init_request(&self) -> &WorkerInitRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(ref v)) => v, - _ => WorkerInitRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerInitResponse worker_init_response = 16; - - pub fn clear_worker_init_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_init_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_init_response(&mut self, v: WorkerInitResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_init_response(&mut self) -> &mut WorkerInitResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(WorkerInitResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_init_response(&mut self) -> WorkerInitResponse { - if self.has_worker_init_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(v)) => v, - _ => panic!(), - } - } else { - WorkerInitResponse::new() - } - } - - pub fn get_worker_init_response(&self) -> &WorkerInitResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(ref v)) => v, - _ => WorkerInitResponse::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerHeartbeat worker_heartbeat = 15; - - pub fn clear_worker_heartbeat(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_heartbeat(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_heartbeat(&mut self, v: WorkerHeartbeat) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_heartbeat(&mut self) -> &mut WorkerHeartbeat { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(WorkerHeartbeat::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_heartbeat(&mut self) -> WorkerHeartbeat { - if self.has_worker_heartbeat() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(v)) => v, - _ => panic!(), - } - } else { - WorkerHeartbeat::new() - } - } - - pub fn get_worker_heartbeat(&self) -> &WorkerHeartbeat { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(ref v)) => v, - _ => WorkerHeartbeat::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerTerminate worker_terminate = 14; - - pub fn clear_worker_terminate(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_terminate(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_terminate(&mut self, v: WorkerTerminate) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_terminate(&mut self) -> &mut WorkerTerminate { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(WorkerTerminate::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_terminate(&mut self) -> WorkerTerminate { - if self.has_worker_terminate() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(v)) => v, - _ => panic!(), - } - } else { - WorkerTerminate::new() - } - } - - pub fn get_worker_terminate(&self) -> &WorkerTerminate { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(ref v)) => v, - _ => WorkerTerminate::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerStatusRequest worker_status_request = 12; - - pub fn clear_worker_status_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_status_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_status_request(&mut self, v: WorkerStatusRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_status_request(&mut self) -> &mut WorkerStatusRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(WorkerStatusRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_status_request(&mut self) -> WorkerStatusRequest { - if self.has_worker_status_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(v)) => v, - _ => panic!(), - } - } else { - WorkerStatusRequest::new() - } - } - - pub fn get_worker_status_request(&self) -> &WorkerStatusRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(ref v)) => v, - _ => WorkerStatusRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerStatusResponse worker_status_response = 13; - - pub fn clear_worker_status_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_status_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_status_response(&mut self, v: WorkerStatusResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_status_response(&mut self) -> &mut WorkerStatusResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(WorkerStatusResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_status_response(&mut self) -> WorkerStatusResponse { - if self.has_worker_status_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(v)) => v, - _ => panic!(), - } - } else { - WorkerStatusResponse::new() - } - } - - pub fn get_worker_status_response(&self) -> &WorkerStatusResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(ref v)) => v, - _ => WorkerStatusResponse::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.FileChangeEventRequest file_change_event_request = 6; - - pub fn clear_file_change_event_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_file_change_event_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_file_change_event_request(&mut self, v: FileChangeEventRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_file_change_event_request(&mut self) -> &mut FileChangeEventRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(FileChangeEventRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_file_change_event_request(&mut self) -> FileChangeEventRequest { - if self.has_file_change_event_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(v)) => v, - _ => panic!(), - } - } else { - FileChangeEventRequest::new() - } - } - - pub fn get_file_change_event_request(&self) -> &FileChangeEventRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(ref v)) => v, - _ => FileChangeEventRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.WorkerActionResponse worker_action_response = 7; - - pub fn clear_worker_action_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_worker_action_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_worker_action_response(&mut self, v: WorkerActionResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_worker_action_response(&mut self) -> &mut WorkerActionResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(WorkerActionResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_worker_action_response(&mut self) -> WorkerActionResponse { - if self.has_worker_action_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(v)) => v, - _ => panic!(), - } - } else { - WorkerActionResponse::new() - } - } - - pub fn get_worker_action_response(&self) -> &WorkerActionResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(ref v)) => v, - _ => WorkerActionResponse::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.FunctionLoadRequest function_load_request = 8; - - pub fn clear_function_load_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_function_load_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_function_load_request(&mut self, v: FunctionLoadRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_function_load_request(&mut self) -> &mut FunctionLoadRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(FunctionLoadRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_function_load_request(&mut self) -> FunctionLoadRequest { - if self.has_function_load_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(v)) => v, - _ => panic!(), - } - } else { - FunctionLoadRequest::new() - } - } - - pub fn get_function_load_request(&self) -> &FunctionLoadRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(ref v)) => v, - _ => FunctionLoadRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.FunctionLoadResponse function_load_response = 9; - - pub fn clear_function_load_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_function_load_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_function_load_response(&mut self, v: FunctionLoadResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_function_load_response(&mut self) -> &mut FunctionLoadResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(FunctionLoadResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_function_load_response(&mut self) -> FunctionLoadResponse { - if self.has_function_load_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(v)) => v, - _ => panic!(), - } - } else { - FunctionLoadResponse::new() - } - } - - pub fn get_function_load_response(&self) -> &FunctionLoadResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(ref v)) => v, - _ => FunctionLoadResponse::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.InvocationRequest invocation_request = 4; - - pub fn clear_invocation_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_invocation_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_invocation_request(&mut self, v: InvocationRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_invocation_request(&mut self) -> &mut InvocationRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(InvocationRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_invocation_request(&mut self) -> InvocationRequest { - if self.has_invocation_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(v)) => v, - _ => panic!(), - } - } else { - InvocationRequest::new() - } - } - - pub fn get_invocation_request(&self) -> &InvocationRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(ref v)) => v, - _ => InvocationRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.InvocationResponse invocation_response = 5; - - pub fn clear_invocation_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_invocation_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_invocation_response(&mut self, v: InvocationResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_invocation_response(&mut self) -> &mut InvocationResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(InvocationResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_invocation_response(&mut self) -> InvocationResponse { - if self.has_invocation_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(v)) => v, - _ => panic!(), - } - } else { - InvocationResponse::new() - } - } - - pub fn get_invocation_response(&self) -> &InvocationResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(ref v)) => v, - _ => InvocationResponse::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.InvocationCancel invocation_cancel = 21; - - pub fn clear_invocation_cancel(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_invocation_cancel(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_invocation_cancel(&mut self, v: InvocationCancel) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(v)) - } - - // Mutable pointer to the field. - pub fn mut_invocation_cancel(&mut self) -> &mut InvocationCancel { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(InvocationCancel::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_invocation_cancel(&mut self) -> InvocationCancel { - if self.has_invocation_cancel() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(v)) => v, - _ => panic!(), - } - } else { - InvocationCancel::new() - } - } - - pub fn get_invocation_cancel(&self) -> &InvocationCancel { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(ref v)) => v, - _ => InvocationCancel::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.RpcLog rpc_log = 2; - - pub fn clear_rpc_log(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_rpc_log(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_rpc_log(&mut self, v: RpcLog) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(v)) - } - - // Mutable pointer to the field. - pub fn mut_rpc_log(&mut self) -> &mut RpcLog { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(RpcLog::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_rpc_log(&mut self) -> RpcLog { - if self.has_rpc_log() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(v)) => v, - _ => panic!(), - } - } else { - RpcLog::new() - } - } - - pub fn get_rpc_log(&self) -> &RpcLog { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(ref v)) => v, - _ => RpcLog::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.FunctionEnvironmentReloadRequest function_environment_reload_request = 25; - - pub fn clear_function_environment_reload_request(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_function_environment_reload_request(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_function_environment_reload_request(&mut self, v: FunctionEnvironmentReloadRequest) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(v)) - } - - // Mutable pointer to the field. - pub fn mut_function_environment_reload_request(&mut self) -> &mut FunctionEnvironmentReloadRequest { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(FunctionEnvironmentReloadRequest::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_function_environment_reload_request(&mut self) -> FunctionEnvironmentReloadRequest { - if self.has_function_environment_reload_request() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(v)) => v, - _ => panic!(), - } - } else { - FunctionEnvironmentReloadRequest::new() - } - } - - pub fn get_function_environment_reload_request(&self) -> &FunctionEnvironmentReloadRequest { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(ref v)) => v, - _ => FunctionEnvironmentReloadRequest::default_instance(), - } - } - - // .AzureFunctionsRpcMessages.FunctionEnvironmentReloadResponse function_environment_reload_response = 26; - - pub fn clear_function_environment_reload_response(&mut self) { - self.content = ::std::option::Option::None; - } - - pub fn has_function_environment_reload_response(&self) -> bool { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_function_environment_reload_response(&mut self, v: FunctionEnvironmentReloadResponse) { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(v)) - } - - // Mutable pointer to the field. - pub fn mut_function_environment_reload_response(&mut self) -> &mut FunctionEnvironmentReloadResponse { - if let ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(_)) = self.content { - } else { - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(FunctionEnvironmentReloadResponse::new())); - } - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_function_environment_reload_response(&mut self) -> FunctionEnvironmentReloadResponse { - if self.has_function_environment_reload_response() { - match self.content.take() { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(v)) => v, - _ => panic!(), - } - } else { - FunctionEnvironmentReloadResponse::new() - } - } - - pub fn get_function_environment_reload_response(&self) -> &FunctionEnvironmentReloadResponse { - match self.content { - ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(ref v)) => v, - _ => FunctionEnvironmentReloadResponse::default_instance(), - } - } -} - -impl ::protobuf::Message for StreamingMessage { - fn is_initialized(&self) -> bool { - if let Some(StreamingMessage_oneof_content::start_stream(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_init_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_init_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_heartbeat(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_terminate(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_status_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_status_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::file_change_event_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::worker_action_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::function_load_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::function_load_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::invocation_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::invocation_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::invocation_cancel(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::rpc_log(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::function_environment_reload_request(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - if let Some(StreamingMessage_oneof_content::function_environment_reload_response(ref v)) = self.content { - if !v.is_initialized() { - return false; - } - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.request_id)?; - }, - 20 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::start_stream(is.read_message()?)); - }, - 17 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_request(is.read_message()?)); - }, - 16 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_init_response(is.read_message()?)); - }, - 15 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_heartbeat(is.read_message()?)); - }, - 14 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_terminate(is.read_message()?)); - }, - 12 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_request(is.read_message()?)); - }, - 13 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_status_response(is.read_message()?)); - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::file_change_event_request(is.read_message()?)); - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::worker_action_response(is.read_message()?)); - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_request(is.read_message()?)); - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_load_response(is.read_message()?)); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_request(is.read_message()?)); - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_response(is.read_message()?)); - }, - 21 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::invocation_cancel(is.read_message()?)); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::rpc_log(is.read_message()?)); - }, - 25 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_request(is.read_message()?)); - }, - 26 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.content = ::std::option::Option::Some(StreamingMessage_oneof_content::function_environment_reload_response(is.read_message()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.request_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.request_id); - } - if let ::std::option::Option::Some(ref v) = self.content { - match v { - &StreamingMessage_oneof_content::start_stream(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_init_request(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_init_response(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_heartbeat(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_terminate(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_status_request(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_status_response(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::file_change_event_request(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::worker_action_response(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::function_load_request(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::function_load_response(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::invocation_request(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::invocation_response(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::invocation_cancel(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::rpc_log(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::function_environment_reload_request(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &StreamingMessage_oneof_content::function_environment_reload_response(ref v) => { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.request_id.is_empty() { - os.write_string(1, &self.request_id)?; - } - if let ::std::option::Option::Some(ref v) = self.content { - match v { - &StreamingMessage_oneof_content::start_stream(ref v) => { - os.write_tag(20, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_init_request(ref v) => { - os.write_tag(17, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_init_response(ref v) => { - os.write_tag(16, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_heartbeat(ref v) => { - os.write_tag(15, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_terminate(ref v) => { - os.write_tag(14, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_status_request(ref v) => { - os.write_tag(12, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_status_response(ref v) => { - os.write_tag(13, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::file_change_event_request(ref v) => { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::worker_action_response(ref v) => { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::function_load_request(ref v) => { - os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::function_load_response(ref v) => { - os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::invocation_request(ref v) => { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::invocation_response(ref v) => { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::invocation_cancel(ref v) => { - os.write_tag(21, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::rpc_log(ref v) => { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::function_environment_reload_request(ref v) => { - os.write_tag(25, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &StreamingMessage_oneof_content::function_environment_reload_response(ref v) => { - os.write_tag(26, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> StreamingMessage { - StreamingMessage::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "request_id", - |m: &StreamingMessage| { &m.request_id }, - |m: &mut StreamingMessage| { &mut m.request_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, StartStream>( - "start_stream", - StreamingMessage::has_start_stream, - StreamingMessage::get_start_stream, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerInitRequest>( - "worker_init_request", - StreamingMessage::has_worker_init_request, - StreamingMessage::get_worker_init_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerInitResponse>( - "worker_init_response", - StreamingMessage::has_worker_init_response, - StreamingMessage::get_worker_init_response, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerHeartbeat>( - "worker_heartbeat", - StreamingMessage::has_worker_heartbeat, - StreamingMessage::get_worker_heartbeat, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerTerminate>( - "worker_terminate", - StreamingMessage::has_worker_terminate, - StreamingMessage::get_worker_terminate, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerStatusRequest>( - "worker_status_request", - StreamingMessage::has_worker_status_request, - StreamingMessage::get_worker_status_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerStatusResponse>( - "worker_status_response", - StreamingMessage::has_worker_status_response, - StreamingMessage::get_worker_status_response, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, FileChangeEventRequest>( - "file_change_event_request", - StreamingMessage::has_file_change_event_request, - StreamingMessage::get_file_change_event_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, WorkerActionResponse>( - "worker_action_response", - StreamingMessage::has_worker_action_response, - StreamingMessage::get_worker_action_response, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, FunctionLoadRequest>( - "function_load_request", - StreamingMessage::has_function_load_request, - StreamingMessage::get_function_load_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, FunctionLoadResponse>( - "function_load_response", - StreamingMessage::has_function_load_response, - StreamingMessage::get_function_load_response, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, InvocationRequest>( - "invocation_request", - StreamingMessage::has_invocation_request, - StreamingMessage::get_invocation_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, InvocationResponse>( - "invocation_response", - StreamingMessage::has_invocation_response, - StreamingMessage::get_invocation_response, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, InvocationCancel>( - "invocation_cancel", - StreamingMessage::has_invocation_cancel, - StreamingMessage::get_invocation_cancel, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, RpcLog>( - "rpc_log", - StreamingMessage::has_rpc_log, - StreamingMessage::get_rpc_log, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, FunctionEnvironmentReloadRequest>( - "function_environment_reload_request", - StreamingMessage::has_function_environment_reload_request, - StreamingMessage::get_function_environment_reload_request, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, FunctionEnvironmentReloadResponse>( - "function_environment_reload_response", - StreamingMessage::has_function_environment_reload_response, - StreamingMessage::get_function_environment_reload_response, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StreamingMessage", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static StreamingMessage { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StreamingMessage, - }; - unsafe { - instance.get(StreamingMessage::new) - } - } -} - -impl ::protobuf::Clear for StreamingMessage { - fn clear(&mut self) { - self.clear_request_id(); - self.clear_start_stream(); - self.clear_worker_init_request(); - self.clear_worker_init_response(); - self.clear_worker_heartbeat(); - self.clear_worker_terminate(); - self.clear_worker_status_request(); - self.clear_worker_status_response(); - self.clear_file_change_event_request(); - self.clear_worker_action_response(); - self.clear_function_load_request(); - self.clear_function_load_response(); - self.clear_invocation_request(); - self.clear_invocation_response(); - self.clear_invocation_cancel(); - self.clear_rpc_log(); - self.clear_function_environment_reload_request(); - self.clear_function_environment_reload_response(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StreamingMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StreamingMessage { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StartStream { - // message fields - pub worker_id: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl StartStream { - pub fn new() -> StartStream { - ::std::default::Default::default() - } - - // string worker_id = 2; - - pub fn clear_worker_id(&mut self) { - self.worker_id.clear(); - } - - // Param is passed by value, moved - pub fn set_worker_id(&mut self, v: ::std::string::String) { - self.worker_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_worker_id(&mut self) -> &mut ::std::string::String { - &mut self.worker_id - } - - // Take field - pub fn take_worker_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.worker_id, ::std::string::String::new()) - } - - pub fn get_worker_id(&self) -> &str { - &self.worker_id - } -} - -impl ::protobuf::Message for StartStream { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.worker_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.worker_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.worker_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.worker_id.is_empty() { - os.write_string(2, &self.worker_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> StartStream { - StartStream::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "worker_id", - |m: &StartStream| { &m.worker_id }, - |m: &mut StartStream| { &mut m.worker_id }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StartStream", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static StartStream { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StartStream, - }; - unsafe { - instance.get(StartStream::new) - } - } -} - -impl ::protobuf::Clear for StartStream { - fn clear(&mut self) { - self.clear_worker_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StartStream { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StartStream { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerInitRequest { - // message fields - pub host_version: ::std::string::String, - pub capabilities: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - pub log_categories: ::std::collections::HashMap<::std::string::String, RpcLog_Level>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerInitRequest { - pub fn new() -> WorkerInitRequest { - ::std::default::Default::default() - } - - // string host_version = 1; - - pub fn clear_host_version(&mut self) { - self.host_version.clear(); - } - - // Param is passed by value, moved - pub fn set_host_version(&mut self, v: ::std::string::String) { - self.host_version = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_host_version(&mut self) -> &mut ::std::string::String { - &mut self.host_version - } - - // Take field - pub fn take_host_version(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.host_version, ::std::string::String::new()) - } - - pub fn get_host_version(&self) -> &str { - &self.host_version - } - - // repeated .AzureFunctionsRpcMessages.WorkerInitRequest.CapabilitiesEntry capabilities = 2; - - pub fn clear_capabilities(&mut self) { - self.capabilities.clear(); - } - - // Param is passed by value, moved - pub fn set_capabilities(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.capabilities = v; - } - - // Mutable pointer to the field. - pub fn mut_capabilities(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.capabilities - } - - // Take field - pub fn take_capabilities(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.capabilities, ::std::collections::HashMap::new()) - } - - pub fn get_capabilities(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.capabilities - } - - // repeated .AzureFunctionsRpcMessages.WorkerInitRequest.LogCategoriesEntry log_categories = 3; - - pub fn clear_log_categories(&mut self) { - self.log_categories.clear(); - } - - // Param is passed by value, moved - pub fn set_log_categories(&mut self, v: ::std::collections::HashMap<::std::string::String, RpcLog_Level>) { - self.log_categories = v; - } - - // Mutable pointer to the field. - pub fn mut_log_categories(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, RpcLog_Level> { - &mut self.log_categories - } - - // Take field - pub fn take_log_categories(&mut self) -> ::std::collections::HashMap<::std::string::String, RpcLog_Level> { - ::std::mem::replace(&mut self.log_categories, ::std::collections::HashMap::new()) - } - - pub fn get_log_categories(&self) -> &::std::collections::HashMap<::std::string::String, RpcLog_Level> { - &self.log_categories - } -} - -impl ::protobuf::Message for WorkerInitRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.host_version)?; - }, - 2 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.capabilities)?; - }, - 3 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeEnum>(wire_type, is, &mut self.log_categories)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.host_version.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.host_version); - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(2, &self.capabilities); - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeEnum>(3, &self.log_categories); - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.host_version.is_empty() { - os.write_string(1, &self.host_version)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(2, &self.capabilities, os)?; - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeEnum>(3, &self.log_categories, os)?; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerInitRequest { - WorkerInitRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "host_version", - |m: &WorkerInitRequest| { &m.host_version }, - |m: &mut WorkerInitRequest| { &mut m.host_version }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "capabilities", - |m: &WorkerInitRequest| { &m.capabilities }, - |m: &mut WorkerInitRequest| { &mut m.capabilities }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeEnum>( - "log_categories", - |m: &WorkerInitRequest| { &m.log_categories }, - |m: &mut WorkerInitRequest| { &mut m.log_categories }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerInitRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerInitRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerInitRequest, - }; - unsafe { - instance.get(WorkerInitRequest::new) - } - } -} - -impl ::protobuf::Clear for WorkerInitRequest { - fn clear(&mut self) { - self.clear_host_version(); - self.clear_capabilities(); - self.clear_log_categories(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerInitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerInitRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerInitResponse { - // message fields - pub worker_version: ::std::string::String, - pub capabilities: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - pub result: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerInitResponse { - pub fn new() -> WorkerInitResponse { - ::std::default::Default::default() - } - - // string worker_version = 1; - - pub fn clear_worker_version(&mut self) { - self.worker_version.clear(); - } - - // Param is passed by value, moved - pub fn set_worker_version(&mut self, v: ::std::string::String) { - self.worker_version = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_worker_version(&mut self) -> &mut ::std::string::String { - &mut self.worker_version - } - - // Take field - pub fn take_worker_version(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.worker_version, ::std::string::String::new()) - } - - pub fn get_worker_version(&self) -> &str { - &self.worker_version - } - - // repeated .AzureFunctionsRpcMessages.WorkerInitResponse.CapabilitiesEntry capabilities = 2; - - pub fn clear_capabilities(&mut self) { - self.capabilities.clear(); - } - - // Param is passed by value, moved - pub fn set_capabilities(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.capabilities = v; - } - - // Mutable pointer to the field. - pub fn mut_capabilities(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.capabilities - } - - // Take field - pub fn take_capabilities(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.capabilities, ::std::collections::HashMap::new()) - } - - pub fn get_capabilities(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.capabilities - } - - // .AzureFunctionsRpcMessages.StatusResult result = 3; - - pub fn clear_result(&mut self) { - self.result.clear(); - } - - pub fn has_result(&self) -> bool { - self.result.is_some() - } - - // Param is passed by value, moved - pub fn set_result(&mut self, v: StatusResult) { - self.result = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_result(&mut self) -> &mut StatusResult { - if self.result.is_none() { - self.result.set_default(); - } - self.result.as_mut().unwrap() - } - - // Take field - pub fn take_result(&mut self) -> StatusResult { - self.result.take().unwrap_or_else(|| StatusResult::new()) - } - - pub fn get_result(&self) -> &StatusResult { - self.result.as_ref().unwrap_or_else(|| StatusResult::default_instance()) - } -} - -impl ::protobuf::Message for WorkerInitResponse { - fn is_initialized(&self) -> bool { - for v in &self.result { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.worker_version)?; - }, - 2 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.capabilities)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.result)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.worker_version.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.worker_version); - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(2, &self.capabilities); - if let Some(ref v) = self.result.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.worker_version.is_empty() { - os.write_string(1, &self.worker_version)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(2, &self.capabilities, os)?; - if let Some(ref v) = self.result.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerInitResponse { - WorkerInitResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "worker_version", - |m: &WorkerInitResponse| { &m.worker_version }, - |m: &mut WorkerInitResponse| { &mut m.worker_version }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "capabilities", - |m: &WorkerInitResponse| { &m.capabilities }, - |m: &mut WorkerInitResponse| { &mut m.capabilities }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "result", - |m: &WorkerInitResponse| { &m.result }, - |m: &mut WorkerInitResponse| { &mut m.result }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerInitResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerInitResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerInitResponse, - }; - unsafe { - instance.get(WorkerInitResponse::new) - } - } -} - -impl ::protobuf::Clear for WorkerInitResponse { - fn clear(&mut self) { - self.clear_worker_version(); - self.clear_capabilities(); - self.clear_result(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerInitResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerInitResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StatusResult { - // message fields - pub status: StatusResult_Status, - pub result: ::std::string::String, - pub exception: ::protobuf::SingularPtrField, - pub logs: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl StatusResult { - pub fn new() -> StatusResult { - ::std::default::Default::default() - } - - // .AzureFunctionsRpcMessages.StatusResult.Status status = 4; - - pub fn clear_status(&mut self) { - self.status = StatusResult_Status::Failure; - } - - // Param is passed by value, moved - pub fn set_status(&mut self, v: StatusResult_Status) { - self.status = v; - } - - pub fn get_status(&self) -> StatusResult_Status { - self.status - } - - // string result = 1; - - pub fn clear_result(&mut self) { - self.result.clear(); - } - - // Param is passed by value, moved - pub fn set_result(&mut self, v: ::std::string::String) { - self.result = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_result(&mut self) -> &mut ::std::string::String { - &mut self.result - } - - // Take field - pub fn take_result(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.result, ::std::string::String::new()) - } - - pub fn get_result(&self) -> &str { - &self.result - } - - // .AzureFunctionsRpcMessages.RpcException exception = 2; - - pub fn clear_exception(&mut self) { - self.exception.clear(); - } - - pub fn has_exception(&self) -> bool { - self.exception.is_some() - } - - // Param is passed by value, moved - pub fn set_exception(&mut self, v: RpcException) { - self.exception = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_exception(&mut self) -> &mut RpcException { - if self.exception.is_none() { - self.exception.set_default(); - } - self.exception.as_mut().unwrap() - } - - // Take field - pub fn take_exception(&mut self) -> RpcException { - self.exception.take().unwrap_or_else(|| RpcException::new()) - } - - pub fn get_exception(&self) -> &RpcException { - self.exception.as_ref().unwrap_or_else(|| RpcException::default_instance()) - } - - // repeated .AzureFunctionsRpcMessages.RpcLog logs = 3; - - pub fn clear_logs(&mut self) { - self.logs.clear(); - } - - // Param is passed by value, moved - pub fn set_logs(&mut self, v: ::protobuf::RepeatedField) { - self.logs = v; - } - - // Mutable pointer to the field. - pub fn mut_logs(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.logs - } - - // Take field - pub fn take_logs(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.logs, ::protobuf::RepeatedField::new()) - } - - pub fn get_logs(&self) -> &[RpcLog] { - &self.logs - } -} - -impl ::protobuf::Message for StatusResult { - fn is_initialized(&self) -> bool { - for v in &self.exception { - if !v.is_initialized() { - return false; - } - }; - for v in &self.logs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 4 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.status, 4, &mut self.unknown_fields)? - }, - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.result)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.exception)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.logs)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.status != StatusResult_Status::Failure { - my_size += ::protobuf::rt::enum_size(4, self.status); - } - if !self.result.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.result); - } - if let Some(ref v) = self.exception.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.logs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.status != StatusResult_Status::Failure { - os.write_enum(4, self.status.value())?; - } - if !self.result.is_empty() { - os.write_string(1, &self.result)?; - } - if let Some(ref v) = self.exception.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.logs { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> StatusResult { - StatusResult::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "status", - |m: &StatusResult| { &m.status }, - |m: &mut StatusResult| { &mut m.status }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "result", - |m: &StatusResult| { &m.result }, - |m: &mut StatusResult| { &mut m.result }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "exception", - |m: &StatusResult| { &m.exception }, - |m: &mut StatusResult| { &mut m.exception }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "logs", - |m: &StatusResult| { &m.logs }, - |m: &mut StatusResult| { &mut m.logs }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StatusResult", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static StatusResult { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StatusResult, - }; - unsafe { - instance.get(StatusResult::new) - } - } -} - -impl ::protobuf::Clear for StatusResult { - fn clear(&mut self) { - self.clear_status(); - self.clear_result(); - self.clear_exception(); - self.clear_logs(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StatusResult { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StatusResult { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum StatusResult_Status { - Failure = 0, - Success = 1, - Cancelled = 2, -} - -impl ::protobuf::ProtobufEnum for StatusResult_Status { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StatusResult_Status::Failure), - 1 => ::std::option::Option::Some(StatusResult_Status::Success), - 2 => ::std::option::Option::Some(StatusResult_Status::Cancelled), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [StatusResult_Status] = &[ - StatusResult_Status::Failure, - StatusResult_Status::Success, - StatusResult_Status::Cancelled, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("StatusResult_Status", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for StatusResult_Status { -} - -impl ::std::default::Default for StatusResult_Status { - fn default() -> Self { - StatusResult_Status::Failure - } -} - -impl ::protobuf::reflect::ProtobufValue for StatusResult_Status { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerHeartbeat { - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerHeartbeat { - pub fn new() -> WorkerHeartbeat { - ::std::default::Default::default() - } -} - -impl ::protobuf::Message for WorkerHeartbeat { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerHeartbeat { - WorkerHeartbeat::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerHeartbeat", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerHeartbeat { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerHeartbeat, - }; - unsafe { - instance.get(WorkerHeartbeat::new) - } - } -} - -impl ::protobuf::Clear for WorkerHeartbeat { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerHeartbeat { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerHeartbeat { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerTerminate { - // message fields - pub grace_period: ::protobuf::SingularPtrField<::protobuf::well_known_types::Duration>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerTerminate { - pub fn new() -> WorkerTerminate { - ::std::default::Default::default() - } - - // .google.protobuf.Duration grace_period = 1; - - pub fn clear_grace_period(&mut self) { - self.grace_period.clear(); - } - - pub fn has_grace_period(&self) -> bool { - self.grace_period.is_some() - } - - // Param is passed by value, moved - pub fn set_grace_period(&mut self, v: ::protobuf::well_known_types::Duration) { - self.grace_period = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grace_period(&mut self) -> &mut ::protobuf::well_known_types::Duration { - if self.grace_period.is_none() { - self.grace_period.set_default(); - } - self.grace_period.as_mut().unwrap() - } - - // Take field - pub fn take_grace_period(&mut self) -> ::protobuf::well_known_types::Duration { - self.grace_period.take().unwrap_or_else(|| ::protobuf::well_known_types::Duration::new()) - } - - pub fn get_grace_period(&self) -> &::protobuf::well_known_types::Duration { - self.grace_period.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::Duration::default_instance()) - } -} - -impl ::protobuf::Message for WorkerTerminate { - fn is_initialized(&self) -> bool { - for v in &self.grace_period { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grace_period)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.grace_period.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.grace_period.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerTerminate { - WorkerTerminate::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Duration>>( - "grace_period", - |m: &WorkerTerminate| { &m.grace_period }, - |m: &mut WorkerTerminate| { &mut m.grace_period }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerTerminate", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerTerminate { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerTerminate, - }; - unsafe { - instance.get(WorkerTerminate::new) - } - } -} - -impl ::protobuf::Clear for WorkerTerminate { - fn clear(&mut self) { - self.clear_grace_period(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerTerminate { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerTerminate { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FileChangeEventRequest { - // message fields - pub field_type: FileChangeEventRequest_Type, - pub full_path: ::std::string::String, - pub name: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl FileChangeEventRequest { - pub fn new() -> FileChangeEventRequest { - ::std::default::Default::default() - } - - // .AzureFunctionsRpcMessages.FileChangeEventRequest.Type type = 1; - - pub fn clear_field_type(&mut self) { - self.field_type = FileChangeEventRequest_Type::Unknown; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: FileChangeEventRequest_Type) { - self.field_type = v; - } - - pub fn get_field_type(&self) -> FileChangeEventRequest_Type { - self.field_type - } - - // string full_path = 2; - - pub fn clear_full_path(&mut self) { - self.full_path.clear(); - } - - // Param is passed by value, moved - pub fn set_full_path(&mut self, v: ::std::string::String) { - self.full_path = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_full_path(&mut self) -> &mut ::std::string::String { - &mut self.full_path - } - - // Take field - pub fn take_full_path(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.full_path, ::std::string::String::new()) - } - - pub fn get_full_path(&self) -> &str { - &self.full_path - } - - // string name = 3; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - &self.name - } -} - -impl ::protobuf::Message for FileChangeEventRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)? - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.full_path)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.field_type != FileChangeEventRequest_Type::Unknown { - my_size += ::protobuf::rt::enum_size(1, self.field_type); - } - if !self.full_path.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.full_path); - } - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.name); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.field_type != FileChangeEventRequest_Type::Unknown { - os.write_enum(1, self.field_type.value())?; - } - if !self.full_path.is_empty() { - os.write_string(2, &self.full_path)?; - } - if !self.name.is_empty() { - os.write_string(3, &self.name)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FileChangeEventRequest { - FileChangeEventRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "type", - |m: &FileChangeEventRequest| { &m.field_type }, - |m: &mut FileChangeEventRequest| { &mut m.field_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "full_path", - |m: &FileChangeEventRequest| { &m.full_path }, - |m: &mut FileChangeEventRequest| { &mut m.full_path }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - |m: &FileChangeEventRequest| { &m.name }, - |m: &mut FileChangeEventRequest| { &mut m.name }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "FileChangeEventRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static FileChangeEventRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const FileChangeEventRequest, - }; - unsafe { - instance.get(FileChangeEventRequest::new) - } - } -} - -impl ::protobuf::Clear for FileChangeEventRequest { - fn clear(&mut self) { - self.clear_field_type(); - self.clear_full_path(); - self.clear_name(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FileChangeEventRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FileChangeEventRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum FileChangeEventRequest_Type { - Unknown = 0, - Created = 1, - Deleted = 2, - Changed = 4, - Renamed = 8, - All = 15, -} - -impl ::protobuf::ProtobufEnum for FileChangeEventRequest_Type { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(FileChangeEventRequest_Type::Unknown), - 1 => ::std::option::Option::Some(FileChangeEventRequest_Type::Created), - 2 => ::std::option::Option::Some(FileChangeEventRequest_Type::Deleted), - 4 => ::std::option::Option::Some(FileChangeEventRequest_Type::Changed), - 8 => ::std::option::Option::Some(FileChangeEventRequest_Type::Renamed), - 15 => ::std::option::Option::Some(FileChangeEventRequest_Type::All), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [FileChangeEventRequest_Type] = &[ - FileChangeEventRequest_Type::Unknown, - FileChangeEventRequest_Type::Created, - FileChangeEventRequest_Type::Deleted, - FileChangeEventRequest_Type::Changed, - FileChangeEventRequest_Type::Renamed, - FileChangeEventRequest_Type::All, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("FileChangeEventRequest_Type", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for FileChangeEventRequest_Type { -} - -impl ::std::default::Default for FileChangeEventRequest_Type { - fn default() -> Self { - FileChangeEventRequest_Type::Unknown - } -} - -impl ::protobuf::reflect::ProtobufValue for FileChangeEventRequest_Type { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerActionResponse { - // message fields - pub action: WorkerActionResponse_Action, - pub reason: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerActionResponse { - pub fn new() -> WorkerActionResponse { - ::std::default::Default::default() - } - - // .AzureFunctionsRpcMessages.WorkerActionResponse.Action action = 1; - - pub fn clear_action(&mut self) { - self.action = WorkerActionResponse_Action::Restart; - } - - // Param is passed by value, moved - pub fn set_action(&mut self, v: WorkerActionResponse_Action) { - self.action = v; - } - - pub fn get_action(&self) -> WorkerActionResponse_Action { - self.action - } - - // string reason = 2; - - pub fn clear_reason(&mut self) { - self.reason.clear(); - } - - // Param is passed by value, moved - pub fn set_reason(&mut self, v: ::std::string::String) { - self.reason = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_reason(&mut self) -> &mut ::std::string::String { - &mut self.reason - } - - // Take field - pub fn take_reason(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.reason, ::std::string::String::new()) - } - - pub fn get_reason(&self) -> &str { - &self.reason - } -} - -impl ::protobuf::Message for WorkerActionResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.action, 1, &mut self.unknown_fields)? - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.reason)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.action != WorkerActionResponse_Action::Restart { - my_size += ::protobuf::rt::enum_size(1, self.action); - } - if !self.reason.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.reason); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.action != WorkerActionResponse_Action::Restart { - os.write_enum(1, self.action.value())?; - } - if !self.reason.is_empty() { - os.write_string(2, &self.reason)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerActionResponse { - WorkerActionResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "action", - |m: &WorkerActionResponse| { &m.action }, - |m: &mut WorkerActionResponse| { &mut m.action }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "reason", - |m: &WorkerActionResponse| { &m.reason }, - |m: &mut WorkerActionResponse| { &mut m.reason }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerActionResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerActionResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerActionResponse, - }; - unsafe { - instance.get(WorkerActionResponse::new) - } - } -} - -impl ::protobuf::Clear for WorkerActionResponse { - fn clear(&mut self) { - self.clear_action(); - self.clear_reason(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerActionResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerActionResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum WorkerActionResponse_Action { - Restart = 0, - Reload = 1, -} - -impl ::protobuf::ProtobufEnum for WorkerActionResponse_Action { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(WorkerActionResponse_Action::Restart), - 1 => ::std::option::Option::Some(WorkerActionResponse_Action::Reload), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [WorkerActionResponse_Action] = &[ - WorkerActionResponse_Action::Restart, - WorkerActionResponse_Action::Reload, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("WorkerActionResponse_Action", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for WorkerActionResponse_Action { -} - -impl ::std::default::Default for WorkerActionResponse_Action { - fn default() -> Self { - WorkerActionResponse_Action::Restart - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerActionResponse_Action { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerStatusRequest { - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerStatusRequest { - pub fn new() -> WorkerStatusRequest { - ::std::default::Default::default() - } -} - -impl ::protobuf::Message for WorkerStatusRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerStatusRequest { - WorkerStatusRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerStatusRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerStatusRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerStatusRequest, - }; - unsafe { - instance.get(WorkerStatusRequest::new) - } - } -} - -impl ::protobuf::Clear for WorkerStatusRequest { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerStatusRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerStatusRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WorkerStatusResponse { - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl WorkerStatusResponse { - pub fn new() -> WorkerStatusResponse { - ::std::default::Default::default() - } -} - -impl ::protobuf::Message for WorkerStatusResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> WorkerStatusResponse { - WorkerStatusResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "WorkerStatusResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static WorkerStatusResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WorkerStatusResponse, - }; - unsafe { - instance.get(WorkerStatusResponse::new) - } - } -} - -impl ::protobuf::Clear for WorkerStatusResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WorkerStatusResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WorkerStatusResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FunctionEnvironmentReloadRequest { - // message fields - pub environment_variables: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl FunctionEnvironmentReloadRequest { - pub fn new() -> FunctionEnvironmentReloadRequest { - ::std::default::Default::default() - } - - // repeated .AzureFunctionsRpcMessages.FunctionEnvironmentReloadRequest.EnvironmentVariablesEntry environment_variables = 1; - - pub fn clear_environment_variables(&mut self) { - self.environment_variables.clear(); - } - - // Param is passed by value, moved - pub fn set_environment_variables(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.environment_variables = v; - } - - // Mutable pointer to the field. - pub fn mut_environment_variables(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.environment_variables - } - - // Take field - pub fn take_environment_variables(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.environment_variables, ::std::collections::HashMap::new()) - } - - pub fn get_environment_variables(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.environment_variables - } -} - -impl ::protobuf::Message for FunctionEnvironmentReloadRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.environment_variables)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(1, &self.environment_variables); - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(1, &self.environment_variables, os)?; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FunctionEnvironmentReloadRequest { - FunctionEnvironmentReloadRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "environment_variables", - |m: &FunctionEnvironmentReloadRequest| { &m.environment_variables }, - |m: &mut FunctionEnvironmentReloadRequest| { &mut m.environment_variables }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "FunctionEnvironmentReloadRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static FunctionEnvironmentReloadRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const FunctionEnvironmentReloadRequest, - }; - unsafe { - instance.get(FunctionEnvironmentReloadRequest::new) - } - } -} - -impl ::protobuf::Clear for FunctionEnvironmentReloadRequest { - fn clear(&mut self) { - self.clear_environment_variables(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FunctionEnvironmentReloadRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FunctionEnvironmentReloadRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FunctionEnvironmentReloadResponse { - // message fields - pub result: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl FunctionEnvironmentReloadResponse { - pub fn new() -> FunctionEnvironmentReloadResponse { - ::std::default::Default::default() - } - - // .AzureFunctionsRpcMessages.StatusResult result = 3; - - pub fn clear_result(&mut self) { - self.result.clear(); - } - - pub fn has_result(&self) -> bool { - self.result.is_some() - } - - // Param is passed by value, moved - pub fn set_result(&mut self, v: StatusResult) { - self.result = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_result(&mut self) -> &mut StatusResult { - if self.result.is_none() { - self.result.set_default(); - } - self.result.as_mut().unwrap() - } - - // Take field - pub fn take_result(&mut self) -> StatusResult { - self.result.take().unwrap_or_else(|| StatusResult::new()) - } - - pub fn get_result(&self) -> &StatusResult { - self.result.as_ref().unwrap_or_else(|| StatusResult::default_instance()) - } -} - -impl ::protobuf::Message for FunctionEnvironmentReloadResponse { - fn is_initialized(&self) -> bool { - for v in &self.result { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.result)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.result.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.result.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FunctionEnvironmentReloadResponse { - FunctionEnvironmentReloadResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "result", - |m: &FunctionEnvironmentReloadResponse| { &m.result }, - |m: &mut FunctionEnvironmentReloadResponse| { &mut m.result }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "FunctionEnvironmentReloadResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static FunctionEnvironmentReloadResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const FunctionEnvironmentReloadResponse, - }; - unsafe { - instance.get(FunctionEnvironmentReloadResponse::new) - } - } -} - -impl ::protobuf::Clear for FunctionEnvironmentReloadResponse { - fn clear(&mut self) { - self.clear_result(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FunctionEnvironmentReloadResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FunctionEnvironmentReloadResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FunctionLoadRequest { - // message fields - pub function_id: ::std::string::String, - pub metadata: ::protobuf::SingularPtrField, - pub managed_dependency_enabled: bool, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl FunctionLoadRequest { - pub fn new() -> FunctionLoadRequest { - ::std::default::Default::default() - } - - // string function_id = 1; - - pub fn clear_function_id(&mut self) { - self.function_id.clear(); - } - - // Param is passed by value, moved - pub fn set_function_id(&mut self, v: ::std::string::String) { - self.function_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_function_id(&mut self) -> &mut ::std::string::String { - &mut self.function_id - } - - // Take field - pub fn take_function_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.function_id, ::std::string::String::new()) - } - - pub fn get_function_id(&self) -> &str { - &self.function_id - } - - // .AzureFunctionsRpcMessages.RpcFunctionMetadata metadata = 2; - - pub fn clear_metadata(&mut self) { - self.metadata.clear(); - } - - pub fn has_metadata(&self) -> bool { - self.metadata.is_some() - } - - // Param is passed by value, moved - pub fn set_metadata(&mut self, v: RpcFunctionMetadata) { - self.metadata = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_metadata(&mut self) -> &mut RpcFunctionMetadata { - if self.metadata.is_none() { - self.metadata.set_default(); - } - self.metadata.as_mut().unwrap() - } - - // Take field - pub fn take_metadata(&mut self) -> RpcFunctionMetadata { - self.metadata.take().unwrap_or_else(|| RpcFunctionMetadata::new()) - } - - pub fn get_metadata(&self) -> &RpcFunctionMetadata { - self.metadata.as_ref().unwrap_or_else(|| RpcFunctionMetadata::default_instance()) - } - - // bool managed_dependency_enabled = 3; - - pub fn clear_managed_dependency_enabled(&mut self) { - self.managed_dependency_enabled = false; - } - - // Param is passed by value, moved - pub fn set_managed_dependency_enabled(&mut self, v: bool) { - self.managed_dependency_enabled = v; - } - - pub fn get_managed_dependency_enabled(&self) -> bool { - self.managed_dependency_enabled - } -} - -impl ::protobuf::Message for FunctionLoadRequest { - fn is_initialized(&self) -> bool { - for v in &self.metadata { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.function_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.metadata)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.managed_dependency_enabled = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.function_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.function_id); - } - if let Some(ref v) = self.metadata.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.managed_dependency_enabled != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.function_id.is_empty() { - os.write_string(1, &self.function_id)?; - } - if let Some(ref v) = self.metadata.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.managed_dependency_enabled != false { - os.write_bool(3, self.managed_dependency_enabled)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FunctionLoadRequest { - FunctionLoadRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "function_id", - |m: &FunctionLoadRequest| { &m.function_id }, - |m: &mut FunctionLoadRequest| { &mut m.function_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "metadata", - |m: &FunctionLoadRequest| { &m.metadata }, - |m: &mut FunctionLoadRequest| { &mut m.metadata }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "managed_dependency_enabled", - |m: &FunctionLoadRequest| { &m.managed_dependency_enabled }, - |m: &mut FunctionLoadRequest| { &mut m.managed_dependency_enabled }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "FunctionLoadRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static FunctionLoadRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const FunctionLoadRequest, - }; - unsafe { - instance.get(FunctionLoadRequest::new) - } - } -} - -impl ::protobuf::Clear for FunctionLoadRequest { - fn clear(&mut self) { - self.clear_function_id(); - self.clear_metadata(); - self.clear_managed_dependency_enabled(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FunctionLoadRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FunctionLoadRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct FunctionLoadResponse { - // message fields - pub function_id: ::std::string::String, - pub result: ::protobuf::SingularPtrField, - pub is_dependency_downloaded: bool, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl FunctionLoadResponse { - pub fn new() -> FunctionLoadResponse { - ::std::default::Default::default() - } - - // string function_id = 1; - - pub fn clear_function_id(&mut self) { - self.function_id.clear(); - } - - // Param is passed by value, moved - pub fn set_function_id(&mut self, v: ::std::string::String) { - self.function_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_function_id(&mut self) -> &mut ::std::string::String { - &mut self.function_id - } - - // Take field - pub fn take_function_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.function_id, ::std::string::String::new()) - } - - pub fn get_function_id(&self) -> &str { - &self.function_id - } - - // .AzureFunctionsRpcMessages.StatusResult result = 2; - - pub fn clear_result(&mut self) { - self.result.clear(); - } - - pub fn has_result(&self) -> bool { - self.result.is_some() - } - - // Param is passed by value, moved - pub fn set_result(&mut self, v: StatusResult) { - self.result = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_result(&mut self) -> &mut StatusResult { - if self.result.is_none() { - self.result.set_default(); - } - self.result.as_mut().unwrap() - } - - // Take field - pub fn take_result(&mut self) -> StatusResult { - self.result.take().unwrap_or_else(|| StatusResult::new()) - } - - pub fn get_result(&self) -> &StatusResult { - self.result.as_ref().unwrap_or_else(|| StatusResult::default_instance()) - } - - // bool is_dependency_downloaded = 3; - - pub fn clear_is_dependency_downloaded(&mut self) { - self.is_dependency_downloaded = false; - } - - // Param is passed by value, moved - pub fn set_is_dependency_downloaded(&mut self, v: bool) { - self.is_dependency_downloaded = v; - } - - pub fn get_is_dependency_downloaded(&self) -> bool { - self.is_dependency_downloaded - } -} - -impl ::protobuf::Message for FunctionLoadResponse { - fn is_initialized(&self) -> bool { - for v in &self.result { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.function_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.result)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.is_dependency_downloaded = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.function_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.function_id); - } - if let Some(ref v) = self.result.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.is_dependency_downloaded != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.function_id.is_empty() { - os.write_string(1, &self.function_id)?; - } - if let Some(ref v) = self.result.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.is_dependency_downloaded != false { - os.write_bool(3, self.is_dependency_downloaded)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> FunctionLoadResponse { - FunctionLoadResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "function_id", - |m: &FunctionLoadResponse| { &m.function_id }, - |m: &mut FunctionLoadResponse| { &mut m.function_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "result", - |m: &FunctionLoadResponse| { &m.result }, - |m: &mut FunctionLoadResponse| { &mut m.result }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "is_dependency_downloaded", - |m: &FunctionLoadResponse| { &m.is_dependency_downloaded }, - |m: &mut FunctionLoadResponse| { &mut m.is_dependency_downloaded }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "FunctionLoadResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static FunctionLoadResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const FunctionLoadResponse, - }; - unsafe { - instance.get(FunctionLoadResponse::new) - } - } -} - -impl ::protobuf::Clear for FunctionLoadResponse { - fn clear(&mut self) { - self.clear_function_id(); - self.clear_result(); - self.clear_is_dependency_downloaded(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for FunctionLoadResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FunctionLoadResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RpcFunctionMetadata { - // message fields - pub name: ::std::string::String, - pub directory: ::std::string::String, - pub script_file: ::std::string::String, - pub entry_point: ::std::string::String, - pub bindings: ::std::collections::HashMap<::std::string::String, BindingInfo>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcFunctionMetadata { - pub fn new() -> RpcFunctionMetadata { - ::std::default::Default::default() - } - - // string name = 4; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - &self.name - } - - // string directory = 1; - - pub fn clear_directory(&mut self) { - self.directory.clear(); - } - - // Param is passed by value, moved - pub fn set_directory(&mut self, v: ::std::string::String) { - self.directory = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_directory(&mut self) -> &mut ::std::string::String { - &mut self.directory - } - - // Take field - pub fn take_directory(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.directory, ::std::string::String::new()) - } - - pub fn get_directory(&self) -> &str { - &self.directory - } - - // string script_file = 2; - - pub fn clear_script_file(&mut self) { - self.script_file.clear(); - } - - // Param is passed by value, moved - pub fn set_script_file(&mut self, v: ::std::string::String) { - self.script_file = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_script_file(&mut self) -> &mut ::std::string::String { - &mut self.script_file - } - - // Take field - pub fn take_script_file(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.script_file, ::std::string::String::new()) - } - - pub fn get_script_file(&self) -> &str { - &self.script_file - } - - // string entry_point = 3; - - pub fn clear_entry_point(&mut self) { - self.entry_point.clear(); - } - - // Param is passed by value, moved - pub fn set_entry_point(&mut self, v: ::std::string::String) { - self.entry_point = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_entry_point(&mut self) -> &mut ::std::string::String { - &mut self.entry_point - } - - // Take field - pub fn take_entry_point(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.entry_point, ::std::string::String::new()) - } - - pub fn get_entry_point(&self) -> &str { - &self.entry_point - } - - // repeated .AzureFunctionsRpcMessages.RpcFunctionMetadata.BindingsEntry bindings = 6; - - pub fn clear_bindings(&mut self) { - self.bindings.clear(); - } - - // Param is passed by value, moved - pub fn set_bindings(&mut self, v: ::std::collections::HashMap<::std::string::String, BindingInfo>) { - self.bindings = v; - } - - // Mutable pointer to the field. - pub fn mut_bindings(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, BindingInfo> { - &mut self.bindings - } - - // Take field - pub fn take_bindings(&mut self) -> ::std::collections::HashMap<::std::string::String, BindingInfo> { - ::std::mem::replace(&mut self.bindings, ::std::collections::HashMap::new()) - } - - pub fn get_bindings(&self) -> &::std::collections::HashMap<::std::string::String, BindingInfo> { - &self.bindings - } -} - -impl ::protobuf::Message for RpcFunctionMetadata { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 4 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.directory)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.script_file)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.entry_point)?; - }, - 6 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.bindings)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.name); - } - if !self.directory.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.directory); - } - if !self.script_file.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.script_file); - } - if !self.entry_point.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.entry_point); - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(6, &self.bindings); - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.name.is_empty() { - os.write_string(4, &self.name)?; - } - if !self.directory.is_empty() { - os.write_string(1, &self.directory)?; - } - if !self.script_file.is_empty() { - os.write_string(2, &self.script_file)?; - } - if !self.entry_point.is_empty() { - os.write_string(3, &self.entry_point)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(6, &self.bindings, os)?; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcFunctionMetadata { - RpcFunctionMetadata::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - |m: &RpcFunctionMetadata| { &m.name }, - |m: &mut RpcFunctionMetadata| { &mut m.name }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "directory", - |m: &RpcFunctionMetadata| { &m.directory }, - |m: &mut RpcFunctionMetadata| { &mut m.directory }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "script_file", - |m: &RpcFunctionMetadata| { &m.script_file }, - |m: &mut RpcFunctionMetadata| { &mut m.script_file }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "entry_point", - |m: &RpcFunctionMetadata| { &m.entry_point }, - |m: &mut RpcFunctionMetadata| { &mut m.entry_point }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( - "bindings", - |m: &RpcFunctionMetadata| { &m.bindings }, - |m: &mut RpcFunctionMetadata| { &mut m.bindings }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcFunctionMetadata", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcFunctionMetadata { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcFunctionMetadata, - }; - unsafe { - instance.get(RpcFunctionMetadata::new) - } - } -} - -impl ::protobuf::Clear for RpcFunctionMetadata { - fn clear(&mut self) { - self.clear_name(); - self.clear_directory(); - self.clear_script_file(); - self.clear_entry_point(); - self.clear_bindings(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcFunctionMetadata { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcFunctionMetadata { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct InvocationRequest { - // message fields - pub invocation_id: ::std::string::String, - pub function_id: ::std::string::String, - pub input_data: ::protobuf::RepeatedField, - pub trigger_metadata: ::std::collections::HashMap<::std::string::String, TypedData>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl InvocationRequest { - pub fn new() -> InvocationRequest { - ::std::default::Default::default() - } - - // string invocation_id = 1; - - pub fn clear_invocation_id(&mut self) { - self.invocation_id.clear(); - } - - // Param is passed by value, moved - pub fn set_invocation_id(&mut self, v: ::std::string::String) { - self.invocation_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_invocation_id(&mut self) -> &mut ::std::string::String { - &mut self.invocation_id - } - - // Take field - pub fn take_invocation_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.invocation_id, ::std::string::String::new()) - } - - pub fn get_invocation_id(&self) -> &str { - &self.invocation_id - } - - // string function_id = 2; - - pub fn clear_function_id(&mut self) { - self.function_id.clear(); - } - - // Param is passed by value, moved - pub fn set_function_id(&mut self, v: ::std::string::String) { - self.function_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_function_id(&mut self) -> &mut ::std::string::String { - &mut self.function_id - } - - // Take field - pub fn take_function_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.function_id, ::std::string::String::new()) - } - - pub fn get_function_id(&self) -> &str { - &self.function_id - } - - // repeated .AzureFunctionsRpcMessages.ParameterBinding input_data = 3; - - pub fn clear_input_data(&mut self) { - self.input_data.clear(); - } - - // Param is passed by value, moved - pub fn set_input_data(&mut self, v: ::protobuf::RepeatedField) { - self.input_data = v; - } - - // Mutable pointer to the field. - pub fn mut_input_data(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.input_data - } - - // Take field - pub fn take_input_data(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.input_data, ::protobuf::RepeatedField::new()) - } - - pub fn get_input_data(&self) -> &[ParameterBinding] { - &self.input_data - } - - // repeated .AzureFunctionsRpcMessages.InvocationRequest.TriggerMetadataEntry trigger_metadata = 4; - - pub fn clear_trigger_metadata(&mut self) { - self.trigger_metadata.clear(); - } - - // Param is passed by value, moved - pub fn set_trigger_metadata(&mut self, v: ::std::collections::HashMap<::std::string::String, TypedData>) { - self.trigger_metadata = v; - } - - // Mutable pointer to the field. - pub fn mut_trigger_metadata(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, TypedData> { - &mut self.trigger_metadata - } - - // Take field - pub fn take_trigger_metadata(&mut self) -> ::std::collections::HashMap<::std::string::String, TypedData> { - ::std::mem::replace(&mut self.trigger_metadata, ::std::collections::HashMap::new()) - } - - pub fn get_trigger_metadata(&self) -> &::std::collections::HashMap<::std::string::String, TypedData> { - &self.trigger_metadata - } -} - -impl ::protobuf::Message for InvocationRequest { - fn is_initialized(&self) -> bool { - for v in &self.input_data { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.invocation_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.function_id)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.input_data)?; - }, - 4 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.trigger_metadata)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.invocation_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.invocation_id); - } - if !self.function_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.function_id); - } - for value in &self.input_data { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.trigger_metadata); - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.invocation_id.is_empty() { - os.write_string(1, &self.invocation_id)?; - } - if !self.function_id.is_empty() { - os.write_string(2, &self.function_id)?; - } - for v in &self.input_data { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.trigger_metadata, os)?; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> InvocationRequest { - InvocationRequest::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "invocation_id", - |m: &InvocationRequest| { &m.invocation_id }, - |m: &mut InvocationRequest| { &mut m.invocation_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "function_id", - |m: &InvocationRequest| { &m.function_id }, - |m: &mut InvocationRequest| { &mut m.function_id }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "input_data", - |m: &InvocationRequest| { &m.input_data }, - |m: &mut InvocationRequest| { &mut m.input_data }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( - "trigger_metadata", - |m: &InvocationRequest| { &m.trigger_metadata }, - |m: &mut InvocationRequest| { &mut m.trigger_metadata }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "InvocationRequest", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static InvocationRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const InvocationRequest, - }; - unsafe { - instance.get(InvocationRequest::new) - } - } -} - -impl ::protobuf::Clear for InvocationRequest { - fn clear(&mut self) { - self.clear_invocation_id(); - self.clear_function_id(); - self.clear_input_data(); - self.clear_trigger_metadata(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for InvocationRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for InvocationRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct InvocationCancel { - // message fields - pub invocation_id: ::std::string::String, - pub grace_period: ::protobuf::SingularPtrField<::protobuf::well_known_types::Duration>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl InvocationCancel { - pub fn new() -> InvocationCancel { - ::std::default::Default::default() - } - - // string invocation_id = 2; - - pub fn clear_invocation_id(&mut self) { - self.invocation_id.clear(); - } - - // Param is passed by value, moved - pub fn set_invocation_id(&mut self, v: ::std::string::String) { - self.invocation_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_invocation_id(&mut self) -> &mut ::std::string::String { - &mut self.invocation_id - } - - // Take field - pub fn take_invocation_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.invocation_id, ::std::string::String::new()) - } - - pub fn get_invocation_id(&self) -> &str { - &self.invocation_id - } - - // .google.protobuf.Duration grace_period = 1; - - pub fn clear_grace_period(&mut self) { - self.grace_period.clear(); - } - - pub fn has_grace_period(&self) -> bool { - self.grace_period.is_some() - } - - // Param is passed by value, moved - pub fn set_grace_period(&mut self, v: ::protobuf::well_known_types::Duration) { - self.grace_period = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_grace_period(&mut self) -> &mut ::protobuf::well_known_types::Duration { - if self.grace_period.is_none() { - self.grace_period.set_default(); - } - self.grace_period.as_mut().unwrap() - } - - // Take field - pub fn take_grace_period(&mut self) -> ::protobuf::well_known_types::Duration { - self.grace_period.take().unwrap_or_else(|| ::protobuf::well_known_types::Duration::new()) - } - - pub fn get_grace_period(&self) -> &::protobuf::well_known_types::Duration { - self.grace_period.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::Duration::default_instance()) - } -} - -impl ::protobuf::Message for InvocationCancel { - fn is_initialized(&self) -> bool { - for v in &self.grace_period { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.invocation_id)?; - }, - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grace_period)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.invocation_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.invocation_id); - } - if let Some(ref v) = self.grace_period.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.invocation_id.is_empty() { - os.write_string(2, &self.invocation_id)?; - } - if let Some(ref v) = self.grace_period.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> InvocationCancel { - InvocationCancel::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "invocation_id", - |m: &InvocationCancel| { &m.invocation_id }, - |m: &mut InvocationCancel| { &mut m.invocation_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Duration>>( - "grace_period", - |m: &InvocationCancel| { &m.grace_period }, - |m: &mut InvocationCancel| { &mut m.grace_period }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "InvocationCancel", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static InvocationCancel { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const InvocationCancel, - }; - unsafe { - instance.get(InvocationCancel::new) - } - } -} - -impl ::protobuf::Clear for InvocationCancel { - fn clear(&mut self) { - self.clear_invocation_id(); - self.clear_grace_period(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for InvocationCancel { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for InvocationCancel { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct InvocationResponse { - // message fields - pub invocation_id: ::std::string::String, - pub output_data: ::protobuf::RepeatedField, - pub return_value: ::protobuf::SingularPtrField, - pub result: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl InvocationResponse { - pub fn new() -> InvocationResponse { - ::std::default::Default::default() - } - - // string invocation_id = 1; - - pub fn clear_invocation_id(&mut self) { - self.invocation_id.clear(); - } - - // Param is passed by value, moved - pub fn set_invocation_id(&mut self, v: ::std::string::String) { - self.invocation_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_invocation_id(&mut self) -> &mut ::std::string::String { - &mut self.invocation_id - } - - // Take field - pub fn take_invocation_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.invocation_id, ::std::string::String::new()) - } - - pub fn get_invocation_id(&self) -> &str { - &self.invocation_id - } - - // repeated .AzureFunctionsRpcMessages.ParameterBinding output_data = 2; - - pub fn clear_output_data(&mut self) { - self.output_data.clear(); - } - - // Param is passed by value, moved - pub fn set_output_data(&mut self, v: ::protobuf::RepeatedField) { - self.output_data = v; - } - - // Mutable pointer to the field. - pub fn mut_output_data(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.output_data - } - - // Take field - pub fn take_output_data(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.output_data, ::protobuf::RepeatedField::new()) - } - - pub fn get_output_data(&self) -> &[ParameterBinding] { - &self.output_data - } - - // .AzureFunctionsRpcMessages.TypedData return_value = 4; - - pub fn clear_return_value(&mut self) { - self.return_value.clear(); - } - - pub fn has_return_value(&self) -> bool { - self.return_value.is_some() - } - - // Param is passed by value, moved - pub fn set_return_value(&mut self, v: TypedData) { - self.return_value = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_return_value(&mut self) -> &mut TypedData { - if self.return_value.is_none() { - self.return_value.set_default(); - } - self.return_value.as_mut().unwrap() - } - - // Take field - pub fn take_return_value(&mut self) -> TypedData { - self.return_value.take().unwrap_or_else(|| TypedData::new()) - } - - pub fn get_return_value(&self) -> &TypedData { - self.return_value.as_ref().unwrap_or_else(|| TypedData::default_instance()) - } - - // .AzureFunctionsRpcMessages.StatusResult result = 3; - - pub fn clear_result(&mut self) { - self.result.clear(); - } - - pub fn has_result(&self) -> bool { - self.result.is_some() - } - - // Param is passed by value, moved - pub fn set_result(&mut self, v: StatusResult) { - self.result = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_result(&mut self) -> &mut StatusResult { - if self.result.is_none() { - self.result.set_default(); - } - self.result.as_mut().unwrap() - } - - // Take field - pub fn take_result(&mut self) -> StatusResult { - self.result.take().unwrap_or_else(|| StatusResult::new()) - } - - pub fn get_result(&self) -> &StatusResult { - self.result.as_ref().unwrap_or_else(|| StatusResult::default_instance()) - } -} - -impl ::protobuf::Message for InvocationResponse { - fn is_initialized(&self) -> bool { - for v in &self.output_data { - if !v.is_initialized() { - return false; - } - }; - for v in &self.return_value { - if !v.is_initialized() { - return false; - } - }; - for v in &self.result { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.invocation_id)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.output_data)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.return_value)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.result)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.invocation_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.invocation_id); - } - for value in &self.output_data { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.return_value.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.result.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.invocation_id.is_empty() { - os.write_string(1, &self.invocation_id)?; - } - for v in &self.output_data { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.return_value.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.result.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> InvocationResponse { - InvocationResponse::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "invocation_id", - |m: &InvocationResponse| { &m.invocation_id }, - |m: &mut InvocationResponse| { &mut m.invocation_id }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "output_data", - |m: &InvocationResponse| { &m.output_data }, - |m: &mut InvocationResponse| { &mut m.output_data }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "return_value", - |m: &InvocationResponse| { &m.return_value }, - |m: &mut InvocationResponse| { &mut m.return_value }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "result", - |m: &InvocationResponse| { &m.result }, - |m: &mut InvocationResponse| { &mut m.result }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "InvocationResponse", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static InvocationResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const InvocationResponse, - }; - unsafe { - instance.get(InvocationResponse::new) - } - } -} - -impl ::protobuf::Clear for InvocationResponse { - fn clear(&mut self) { - self.clear_invocation_id(); - self.clear_output_data(); - self.clear_return_value(); - self.clear_result(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for InvocationResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for InvocationResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TypedData { - // message oneof groups - pub data: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -#[derive(Clone,PartialEq)] -pub enum TypedData_oneof_data { - string(::std::string::String), - json(::std::string::String), - bytes(::std::vec::Vec), - stream(::std::vec::Vec), - http(RpcHttp), - int(i64), - double(f64), -} - -impl TypedData { - pub fn new() -> TypedData { - ::std::default::Default::default() - } - - // string string = 1; - - pub fn clear_string(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_string(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::string(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_string(&mut self, v: ::std::string::String) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::string(v)) - } - - // Mutable pointer to the field. - pub fn mut_string(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(TypedData_oneof_data::string(_)) = self.data { - } else { - self.data = ::std::option::Option::Some(TypedData_oneof_data::string(::std::string::String::new())); - } - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::string(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_string(&mut self) -> ::std::string::String { - if self.has_string() { - match self.data.take() { - ::std::option::Option::Some(TypedData_oneof_data::string(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - pub fn get_string(&self) -> &str { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::string(ref v)) => v, - _ => "", - } - } - - // string json = 2; - - pub fn clear_json(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_json(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::json(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_json(&mut self, v: ::std::string::String) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::json(v)) - } - - // Mutable pointer to the field. - pub fn mut_json(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(TypedData_oneof_data::json(_)) = self.data { - } else { - self.data = ::std::option::Option::Some(TypedData_oneof_data::json(::std::string::String::new())); - } - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::json(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_json(&mut self) -> ::std::string::String { - if self.has_json() { - match self.data.take() { - ::std::option::Option::Some(TypedData_oneof_data::json(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - pub fn get_json(&self) -> &str { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::json(ref v)) => v, - _ => "", - } - } - - // bytes bytes = 3; - - pub fn clear_bytes(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_bytes(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::bytes(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_bytes(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::bytes(v)) - } - - // Mutable pointer to the field. - pub fn mut_bytes(&mut self) -> &mut ::std::vec::Vec { - if let ::std::option::Option::Some(TypedData_oneof_data::bytes(_)) = self.data { - } else { - self.data = ::std::option::Option::Some(TypedData_oneof_data::bytes(::std::vec::Vec::new())); - } - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::bytes(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_bytes(&mut self) -> ::std::vec::Vec { - if self.has_bytes() { - match self.data.take() { - ::std::option::Option::Some(TypedData_oneof_data::bytes(v)) => v, - _ => panic!(), - } - } else { - ::std::vec::Vec::new() - } - } - - pub fn get_bytes(&self) -> &[u8] { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::bytes(ref v)) => v, - _ => &[], - } - } - - // bytes stream = 4; - - pub fn clear_stream(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_stream(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::stream(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_stream(&mut self, v: ::std::vec::Vec) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::stream(v)) - } - - // Mutable pointer to the field. - pub fn mut_stream(&mut self) -> &mut ::std::vec::Vec { - if let ::std::option::Option::Some(TypedData_oneof_data::stream(_)) = self.data { - } else { - self.data = ::std::option::Option::Some(TypedData_oneof_data::stream(::std::vec::Vec::new())); - } - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::stream(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_stream(&mut self) -> ::std::vec::Vec { - if self.has_stream() { - match self.data.take() { - ::std::option::Option::Some(TypedData_oneof_data::stream(v)) => v, - _ => panic!(), - } - } else { - ::std::vec::Vec::new() - } - } - - pub fn get_stream(&self) -> &[u8] { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::stream(ref v)) => v, - _ => &[], - } - } - - // .AzureFunctionsRpcMessages.RpcHttp http = 5; - - pub fn clear_http(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_http(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::http(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_http(&mut self, v: RpcHttp) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::http(v)) - } - - // Mutable pointer to the field. - pub fn mut_http(&mut self) -> &mut RpcHttp { - if let ::std::option::Option::Some(TypedData_oneof_data::http(_)) = self.data { - } else { - self.data = ::std::option::Option::Some(TypedData_oneof_data::http(RpcHttp::new())); - } - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::http(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_http(&mut self) -> RpcHttp { - if self.has_http() { - match self.data.take() { - ::std::option::Option::Some(TypedData_oneof_data::http(v)) => v, - _ => panic!(), - } - } else { - RpcHttp::new() - } - } - - pub fn get_http(&self) -> &RpcHttp { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::http(ref v)) => v, - _ => RpcHttp::default_instance(), - } - } - - // sint64 int = 6; - - pub fn clear_int(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_int(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::int(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_int(&mut self, v: i64) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::int(v)) - } - - pub fn get_int(&self) -> i64 { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::int(v)) => v, - _ => 0, - } - } - - // double double = 7; - - pub fn clear_double(&mut self) { - self.data = ::std::option::Option::None; - } - - pub fn has_double(&self) -> bool { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::double(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_double(&mut self, v: f64) { - self.data = ::std::option::Option::Some(TypedData_oneof_data::double(v)) - } - - pub fn get_double(&self) -> f64 { - match self.data { - ::std::option::Option::Some(TypedData_oneof_data::double(v)) => v, - _ => 0., - } - } -} - -impl ::protobuf::Message for TypedData { - fn is_initialized(&self) -> bool { - if let Some(TypedData_oneof_data::http(ref v)) = self.data { - if !v.is_initialized() { - return false; - } - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::string(is.read_string()?)); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::json(is.read_string()?)); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::bytes(is.read_bytes()?)); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::stream(is.read_bytes()?)); - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::http(is.read_message()?)); - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::int(is.read_sint64()?)); - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.data = ::std::option::Option::Some(TypedData_oneof_data::double(is.read_double()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let ::std::option::Option::Some(ref v) = self.data { - match v { - &TypedData_oneof_data::string(ref v) => { - my_size += ::protobuf::rt::string_size(1, &v); - }, - &TypedData_oneof_data::json(ref v) => { - my_size += ::protobuf::rt::string_size(2, &v); - }, - &TypedData_oneof_data::bytes(ref v) => { - my_size += ::protobuf::rt::bytes_size(3, &v); - }, - &TypedData_oneof_data::stream(ref v) => { - my_size += ::protobuf::rt::bytes_size(4, &v); - }, - &TypedData_oneof_data::http(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }, - &TypedData_oneof_data::int(v) => { - my_size += ::protobuf::rt::value_varint_zigzag_size(6, v); - }, - &TypedData_oneof_data::double(v) => { - my_size += 9; - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let ::std::option::Option::Some(ref v) = self.data { - match v { - &TypedData_oneof_data::string(ref v) => { - os.write_string(1, v)?; - }, - &TypedData_oneof_data::json(ref v) => { - os.write_string(2, v)?; - }, - &TypedData_oneof_data::bytes(ref v) => { - os.write_bytes(3, v)?; - }, - &TypedData_oneof_data::stream(ref v) => { - os.write_bytes(4, v)?; - }, - &TypedData_oneof_data::http(ref v) => { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }, - &TypedData_oneof_data::int(v) => { - os.write_sint64(6, v)?; - }, - &TypedData_oneof_data::double(v) => { - os.write_double(7, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> TypedData { - TypedData::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "string", - TypedData::has_string, - TypedData::get_string, - )); - fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( - "json", - TypedData::has_json, - TypedData::get_json, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( - "bytes", - TypedData::has_bytes, - TypedData::get_bytes, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( - "stream", - TypedData::has_stream, - TypedData::get_stream, - )); - fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, RpcHttp>( - "http", - TypedData::has_http, - TypedData::get_http, - )); - fields.push(::protobuf::reflect::accessor::make_singular_i64_accessor::<_>( - "int", - TypedData::has_int, - TypedData::get_int, - )); - fields.push(::protobuf::reflect::accessor::make_singular_f64_accessor::<_>( - "double", - TypedData::has_double, - TypedData::get_double, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TypedData", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static TypedData { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TypedData, - }; - unsafe { - instance.get(TypedData::new) - } - } -} - -impl ::protobuf::Clear for TypedData { - fn clear(&mut self) { - self.clear_string(); - self.clear_json(); - self.clear_bytes(); - self.clear_stream(); - self.clear_http(); - self.clear_int(); - self.clear_double(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TypedData { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TypedData { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ParameterBinding { - // message fields - pub name: ::std::string::String, - pub data: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl ParameterBinding { - pub fn new() -> ParameterBinding { - ::std::default::Default::default() - } - - // string name = 1; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - &self.name - } - - // .AzureFunctionsRpcMessages.TypedData data = 2; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: TypedData) { - self.data = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut TypedData { - if self.data.is_none() { - self.data.set_default(); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> TypedData { - self.data.take().unwrap_or_else(|| TypedData::new()) - } - - pub fn get_data(&self) -> &TypedData { - self.data.as_ref().unwrap_or_else(|| TypedData::default_instance()) - } -} - -impl ::protobuf::Message for ParameterBinding { - fn is_initialized(&self) -> bool { - for v in &self.data { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.name); - } - if let Some(ref v) = self.data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.name.is_empty() { - os.write_string(1, &self.name)?; - } - if let Some(ref v) = self.data.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ParameterBinding { - ParameterBinding::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - |m: &ParameterBinding| { &m.name }, - |m: &mut ParameterBinding| { &mut m.name }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "data", - |m: &ParameterBinding| { &m.data }, - |m: &mut ParameterBinding| { &mut m.data }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ParameterBinding", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static ParameterBinding { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ParameterBinding, - }; - unsafe { - instance.get(ParameterBinding::new) - } - } -} - -impl ::protobuf::Clear for ParameterBinding { - fn clear(&mut self) { - self.clear_name(); - self.clear_data(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ParameterBinding { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ParameterBinding { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BindingInfo { - // message fields - pub field_type: ::std::string::String, - pub direction: BindingInfo_Direction, - pub data_type: BindingInfo_DataType, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl BindingInfo { - pub fn new() -> BindingInfo { - ::std::default::Default::default() - } - - // string type = 2; - - pub fn clear_field_type(&mut self) { - self.field_type.clear(); - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: ::std::string::String) { - self.field_type = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_field_type(&mut self) -> &mut ::std::string::String { - &mut self.field_type - } - - // Take field - pub fn take_field_type(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) - } - - pub fn get_field_type(&self) -> &str { - &self.field_type - } - - // .AzureFunctionsRpcMessages.BindingInfo.Direction direction = 3; - - pub fn clear_direction(&mut self) { - self.direction = BindingInfo_Direction::value_in; - } - - // Param is passed by value, moved - pub fn set_direction(&mut self, v: BindingInfo_Direction) { - self.direction = v; - } - - pub fn get_direction(&self) -> BindingInfo_Direction { - self.direction - } - - // .AzureFunctionsRpcMessages.BindingInfo.DataType data_type = 4; - - pub fn clear_data_type(&mut self) { - self.data_type = BindingInfo_DataType::undefined; - } - - // Param is passed by value, moved - pub fn set_data_type(&mut self, v: BindingInfo_DataType) { - self.data_type = v; - } - - pub fn get_data_type(&self) -> BindingInfo_DataType { - self.data_type - } -} - -impl ::protobuf::Message for BindingInfo { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; - }, - 3 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.direction, 3, &mut self.unknown_fields)? - }, - 4 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.data_type, 4, &mut self.unknown_fields)? - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.field_type.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.field_type); - } - if self.direction != BindingInfo_Direction::value_in { - my_size += ::protobuf::rt::enum_size(3, self.direction); - } - if self.data_type != BindingInfo_DataType::undefined { - my_size += ::protobuf::rt::enum_size(4, self.data_type); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.field_type.is_empty() { - os.write_string(2, &self.field_type)?; - } - if self.direction != BindingInfo_Direction::value_in { - os.write_enum(3, self.direction.value())?; - } - if self.data_type != BindingInfo_DataType::undefined { - os.write_enum(4, self.data_type.value())?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> BindingInfo { - BindingInfo::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "type", - |m: &BindingInfo| { &m.field_type }, - |m: &mut BindingInfo| { &mut m.field_type }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "direction", - |m: &BindingInfo| { &m.direction }, - |m: &mut BindingInfo| { &mut m.direction }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "data_type", - |m: &BindingInfo| { &m.data_type }, - |m: &mut BindingInfo| { &mut m.data_type }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BindingInfo", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static BindingInfo { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BindingInfo, - }; - unsafe { - instance.get(BindingInfo::new) - } - } -} - -impl ::protobuf::Clear for BindingInfo { - fn clear(&mut self) { - self.clear_field_type(); - self.clear_direction(); - self.clear_data_type(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BindingInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BindingInfo { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum BindingInfo_Direction { - value_in = 0, - out = 1, - inout = 2, -} - -impl ::protobuf::ProtobufEnum for BindingInfo_Direction { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BindingInfo_Direction::value_in), - 1 => ::std::option::Option::Some(BindingInfo_Direction::out), - 2 => ::std::option::Option::Some(BindingInfo_Direction::inout), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [BindingInfo_Direction] = &[ - BindingInfo_Direction::value_in, - BindingInfo_Direction::out, - BindingInfo_Direction::inout, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("BindingInfo_Direction", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for BindingInfo_Direction { -} - -impl ::std::default::Default for BindingInfo_Direction { - fn default() -> Self { - BindingInfo_Direction::value_in - } -} - -impl ::protobuf::reflect::ProtobufValue for BindingInfo_Direction { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum BindingInfo_DataType { - undefined = 0, - string = 1, - binary = 2, - stream = 3, -} - -impl ::protobuf::ProtobufEnum for BindingInfo_DataType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(BindingInfo_DataType::undefined), - 1 => ::std::option::Option::Some(BindingInfo_DataType::string), - 2 => ::std::option::Option::Some(BindingInfo_DataType::binary), - 3 => ::std::option::Option::Some(BindingInfo_DataType::stream), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [BindingInfo_DataType] = &[ - BindingInfo_DataType::undefined, - BindingInfo_DataType::string, - BindingInfo_DataType::binary, - BindingInfo_DataType::stream, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("BindingInfo_DataType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for BindingInfo_DataType { -} - -impl ::std::default::Default for BindingInfo_DataType { - fn default() -> Self { - BindingInfo_DataType::undefined - } -} - -impl ::protobuf::reflect::ProtobufValue for BindingInfo_DataType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RpcLog { - // message fields - pub invocation_id: ::std::string::String, - pub category: ::std::string::String, - pub level: RpcLog_Level, - pub message: ::std::string::String, - pub event_id: ::std::string::String, - pub exception: ::protobuf::SingularPtrField, - pub properties: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcLog { - pub fn new() -> RpcLog { - ::std::default::Default::default() - } - - // string invocation_id = 1; - - pub fn clear_invocation_id(&mut self) { - self.invocation_id.clear(); - } - - // Param is passed by value, moved - pub fn set_invocation_id(&mut self, v: ::std::string::String) { - self.invocation_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_invocation_id(&mut self) -> &mut ::std::string::String { - &mut self.invocation_id - } - - // Take field - pub fn take_invocation_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.invocation_id, ::std::string::String::new()) - } - - pub fn get_invocation_id(&self) -> &str { - &self.invocation_id - } - - // string category = 2; - - pub fn clear_category(&mut self) { - self.category.clear(); - } - - // Param is passed by value, moved - pub fn set_category(&mut self, v: ::std::string::String) { - self.category = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_category(&mut self) -> &mut ::std::string::String { - &mut self.category - } - - // Take field - pub fn take_category(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.category, ::std::string::String::new()) - } - - pub fn get_category(&self) -> &str { - &self.category - } - - // .AzureFunctionsRpcMessages.RpcLog.Level level = 3; - - pub fn clear_level(&mut self) { - self.level = RpcLog_Level::Trace; - } - - // Param is passed by value, moved - pub fn set_level(&mut self, v: RpcLog_Level) { - self.level = v; - } - - pub fn get_level(&self) -> RpcLog_Level { - self.level - } - - // string message = 4; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - &mut self.message - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.message, ::std::string::String::new()) - } - - pub fn get_message(&self) -> &str { - &self.message - } - - // string event_id = 5; - - pub fn clear_event_id(&mut self) { - self.event_id.clear(); - } - - // Param is passed by value, moved - pub fn set_event_id(&mut self, v: ::std::string::String) { - self.event_id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_event_id(&mut self) -> &mut ::std::string::String { - &mut self.event_id - } - - // Take field - pub fn take_event_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.event_id, ::std::string::String::new()) - } - - pub fn get_event_id(&self) -> &str { - &self.event_id - } - - // .AzureFunctionsRpcMessages.RpcException exception = 6; - - pub fn clear_exception(&mut self) { - self.exception.clear(); - } - - pub fn has_exception(&self) -> bool { - self.exception.is_some() - } - - // Param is passed by value, moved - pub fn set_exception(&mut self, v: RpcException) { - self.exception = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_exception(&mut self) -> &mut RpcException { - if self.exception.is_none() { - self.exception.set_default(); - } - self.exception.as_mut().unwrap() - } - - // Take field - pub fn take_exception(&mut self) -> RpcException { - self.exception.take().unwrap_or_else(|| RpcException::new()) - } - - pub fn get_exception(&self) -> &RpcException { - self.exception.as_ref().unwrap_or_else(|| RpcException::default_instance()) - } - - // string properties = 7; - - pub fn clear_properties(&mut self) { - self.properties.clear(); - } - - // Param is passed by value, moved - pub fn set_properties(&mut self, v: ::std::string::String) { - self.properties = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_properties(&mut self) -> &mut ::std::string::String { - &mut self.properties - } - - // Take field - pub fn take_properties(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.properties, ::std::string::String::new()) - } - - pub fn get_properties(&self) -> &str { - &self.properties - } -} - -impl ::protobuf::Message for RpcLog { - fn is_initialized(&self) -> bool { - for v in &self.exception { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.invocation_id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.category)?; - }, - 3 => { - ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.level, 3, &mut self.unknown_fields)? - }, - 4 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.message)?; - }, - 5 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.event_id)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.exception)?; - }, - 7 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.properties)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.invocation_id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.invocation_id); - } - if !self.category.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.category); - } - if self.level != RpcLog_Level::Trace { - my_size += ::protobuf::rt::enum_size(3, self.level); - } - if !self.message.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.message); - } - if !self.event_id.is_empty() { - my_size += ::protobuf::rt::string_size(5, &self.event_id); - } - if let Some(ref v) = self.exception.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.properties.is_empty() { - my_size += ::protobuf::rt::string_size(7, &self.properties); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.invocation_id.is_empty() { - os.write_string(1, &self.invocation_id)?; - } - if !self.category.is_empty() { - os.write_string(2, &self.category)?; - } - if self.level != RpcLog_Level::Trace { - os.write_enum(3, self.level.value())?; - } - if !self.message.is_empty() { - os.write_string(4, &self.message)?; - } - if !self.event_id.is_empty() { - os.write_string(5, &self.event_id)?; - } - if let Some(ref v) = self.exception.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.properties.is_empty() { - os.write_string(7, &self.properties)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcLog { - RpcLog::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "invocation_id", - |m: &RpcLog| { &m.invocation_id }, - |m: &mut RpcLog| { &mut m.invocation_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "category", - |m: &RpcLog| { &m.category }, - |m: &mut RpcLog| { &mut m.category }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "level", - |m: &RpcLog| { &m.level }, - |m: &mut RpcLog| { &mut m.level }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "message", - |m: &RpcLog| { &m.message }, - |m: &mut RpcLog| { &mut m.message }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "event_id", - |m: &RpcLog| { &m.event_id }, - |m: &mut RpcLog| { &mut m.event_id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "exception", - |m: &RpcLog| { &m.exception }, - |m: &mut RpcLog| { &mut m.exception }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "properties", - |m: &RpcLog| { &m.properties }, - |m: &mut RpcLog| { &mut m.properties }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcLog", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcLog { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcLog, - }; - unsafe { - instance.get(RpcLog::new) - } - } -} - -impl ::protobuf::Clear for RpcLog { - fn clear(&mut self) { - self.clear_invocation_id(); - self.clear_category(); - self.clear_level(); - self.clear_message(); - self.clear_event_id(); - self.clear_exception(); - self.clear_properties(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcLog { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcLog { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum RpcLog_Level { - Trace = 0, - Debug = 1, - Information = 2, - Warning = 3, - Error = 4, - Critical = 5, - None = 6, -} - -impl ::protobuf::ProtobufEnum for RpcLog_Level { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(RpcLog_Level::Trace), - 1 => ::std::option::Option::Some(RpcLog_Level::Debug), - 2 => ::std::option::Option::Some(RpcLog_Level::Information), - 3 => ::std::option::Option::Some(RpcLog_Level::Warning), - 4 => ::std::option::Option::Some(RpcLog_Level::Error), - 5 => ::std::option::Option::Some(RpcLog_Level::Critical), - 6 => ::std::option::Option::Some(RpcLog_Level::None), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [RpcLog_Level] = &[ - RpcLog_Level::Trace, - RpcLog_Level::Debug, - RpcLog_Level::Information, - RpcLog_Level::Warning, - RpcLog_Level::Error, - RpcLog_Level::Critical, - RpcLog_Level::None, - ]; - values - } - - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("RpcLog_Level", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for RpcLog_Level { -} - -impl ::std::default::Default for RpcLog_Level { - fn default() -> Self { - RpcLog_Level::Trace - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcLog_Level { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RpcException { - // message fields - pub source: ::std::string::String, - pub stack_trace: ::std::string::String, - pub message: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcException { - pub fn new() -> RpcException { - ::std::default::Default::default() - } - - // string source = 3; - - pub fn clear_source(&mut self) { - self.source.clear(); - } - - // Param is passed by value, moved - pub fn set_source(&mut self, v: ::std::string::String) { - self.source = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_source(&mut self) -> &mut ::std::string::String { - &mut self.source - } - - // Take field - pub fn take_source(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.source, ::std::string::String::new()) - } - - pub fn get_source(&self) -> &str { - &self.source - } - - // string stack_trace = 1; - - pub fn clear_stack_trace(&mut self) { - self.stack_trace.clear(); - } - - // Param is passed by value, moved - pub fn set_stack_trace(&mut self, v: ::std::string::String) { - self.stack_trace = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stack_trace(&mut self) -> &mut ::std::string::String { - &mut self.stack_trace - } - - // Take field - pub fn take_stack_trace(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.stack_trace, ::std::string::String::new()) - } - - pub fn get_stack_trace(&self) -> &str { - &self.stack_trace - } - - // string message = 2; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - &mut self.message - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.message, ::std::string::String::new()) - } - - pub fn get_message(&self) -> &str { - &self.message - } -} - -impl ::protobuf::Message for RpcException { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; - }, - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.stack_trace)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.message)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.source.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.source); - } - if !self.stack_trace.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.stack_trace); - } - if !self.message.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.message); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.source.is_empty() { - os.write_string(3, &self.source)?; - } - if !self.stack_trace.is_empty() { - os.write_string(1, &self.stack_trace)?; - } - if !self.message.is_empty() { - os.write_string(2, &self.message)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcException { - RpcException::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "source", - |m: &RpcException| { &m.source }, - |m: &mut RpcException| { &mut m.source }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "stack_trace", - |m: &RpcException| { &m.stack_trace }, - |m: &mut RpcException| { &mut m.stack_trace }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "message", - |m: &RpcException| { &m.message }, - |m: &mut RpcException| { &mut m.message }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcException", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcException { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcException, - }; - unsafe { - instance.get(RpcException::new) - } - } -} - -impl ::protobuf::Clear for RpcException { - fn clear(&mut self) { - self.clear_source(); - self.clear_stack_trace(); - self.clear_message(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcException { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcException { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RpcHttp { - // message fields - pub method: ::std::string::String, - pub url: ::std::string::String, - pub headers: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - pub body: ::protobuf::SingularPtrField, - pub params: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - pub status_code: ::std::string::String, - pub query: ::std::collections::HashMap<::std::string::String, ::std::string::String>, - pub enable_content_negotiation: bool, - pub rawBody: ::protobuf::SingularPtrField, - pub identities: ::protobuf::RepeatedField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl RpcHttp { - pub fn new() -> RpcHttp { - ::std::default::Default::default() - } - - // string method = 1; - - pub fn clear_method(&mut self) { - self.method.clear(); - } - - // Param is passed by value, moved - pub fn set_method(&mut self, v: ::std::string::String) { - self.method = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_method(&mut self) -> &mut ::std::string::String { - &mut self.method - } - - // Take field - pub fn take_method(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.method, ::std::string::String::new()) - } - - pub fn get_method(&self) -> &str { - &self.method - } - - // string url = 2; - - pub fn clear_url(&mut self) { - self.url.clear(); - } - - // Param is passed by value, moved - pub fn set_url(&mut self, v: ::std::string::String) { - self.url = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_url(&mut self) -> &mut ::std::string::String { - &mut self.url - } - - // Take field - pub fn take_url(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.url, ::std::string::String::new()) - } - - pub fn get_url(&self) -> &str { - &self.url - } - - // repeated .AzureFunctionsRpcMessages.RpcHttp.HeadersEntry headers = 3; - - pub fn clear_headers(&mut self) { - self.headers.clear(); - } - - // Param is passed by value, moved - pub fn set_headers(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.headers = v; - } - - // Mutable pointer to the field. - pub fn mut_headers(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.headers - } - - // Take field - pub fn take_headers(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.headers, ::std::collections::HashMap::new()) - } - - pub fn get_headers(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.headers - } - - // .AzureFunctionsRpcMessages.TypedData body = 4; - - pub fn clear_body(&mut self) { - self.body.clear(); - } - - pub fn has_body(&self) -> bool { - self.body.is_some() - } - - // Param is passed by value, moved - pub fn set_body(&mut self, v: TypedData) { - self.body = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_body(&mut self) -> &mut TypedData { - if self.body.is_none() { - self.body.set_default(); - } - self.body.as_mut().unwrap() - } - - // Take field - pub fn take_body(&mut self) -> TypedData { - self.body.take().unwrap_or_else(|| TypedData::new()) - } - - pub fn get_body(&self) -> &TypedData { - self.body.as_ref().unwrap_or_else(|| TypedData::default_instance()) - } - - // repeated .AzureFunctionsRpcMessages.RpcHttp.ParamsEntry params = 10; - - pub fn clear_params(&mut self) { - self.params.clear(); - } - - // Param is passed by value, moved - pub fn set_params(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.params = v; - } - - // Mutable pointer to the field. - pub fn mut_params(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.params - } - - // Take field - pub fn take_params(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.params, ::std::collections::HashMap::new()) - } - - pub fn get_params(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.params - } - - // string status_code = 12; - - pub fn clear_status_code(&mut self) { - self.status_code.clear(); - } - - // Param is passed by value, moved - pub fn set_status_code(&mut self, v: ::std::string::String) { - self.status_code = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_status_code(&mut self) -> &mut ::std::string::String { - &mut self.status_code - } - - // Take field - pub fn take_status_code(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.status_code, ::std::string::String::new()) - } - - pub fn get_status_code(&self) -> &str { - &self.status_code - } - - // repeated .AzureFunctionsRpcMessages.RpcHttp.QueryEntry query = 15; - - pub fn clear_query(&mut self) { - self.query.clear(); - } - - // Param is passed by value, moved - pub fn set_query(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { - self.query = v; - } - - // Mutable pointer to the field. - pub fn mut_query(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { - &mut self.query - } - - // Take field - pub fn take_query(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { - ::std::mem::replace(&mut self.query, ::std::collections::HashMap::new()) - } - - pub fn get_query(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { - &self.query - } - - // bool enable_content_negotiation = 16; - - pub fn clear_enable_content_negotiation(&mut self) { - self.enable_content_negotiation = false; - } - - // Param is passed by value, moved - pub fn set_enable_content_negotiation(&mut self, v: bool) { - self.enable_content_negotiation = v; - } - - pub fn get_enable_content_negotiation(&self) -> bool { - self.enable_content_negotiation - } - - // .AzureFunctionsRpcMessages.TypedData rawBody = 17; - - pub fn clear_rawBody(&mut self) { - self.rawBody.clear(); - } - - pub fn has_rawBody(&self) -> bool { - self.rawBody.is_some() - } - - // Param is passed by value, moved - pub fn set_rawBody(&mut self, v: TypedData) { - self.rawBody = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_rawBody(&mut self) -> &mut TypedData { - if self.rawBody.is_none() { - self.rawBody.set_default(); - } - self.rawBody.as_mut().unwrap() - } - - // Take field - pub fn take_rawBody(&mut self) -> TypedData { - self.rawBody.take().unwrap_or_else(|| TypedData::new()) - } - - pub fn get_rawBody(&self) -> &TypedData { - self.rawBody.as_ref().unwrap_or_else(|| TypedData::default_instance()) - } - - // repeated .RpcClaimsIdentity identities = 18; - - pub fn clear_identities(&mut self) { - self.identities.clear(); - } - - // Param is passed by value, moved - pub fn set_identities(&mut self, v: ::protobuf::RepeatedField) { - self.identities = v; - } - - // Mutable pointer to the field. - pub fn mut_identities(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.identities - } - - // Take field - pub fn take_identities(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.identities, ::protobuf::RepeatedField::new()) - } - - pub fn get_identities(&self) -> &[super::ClaimsIdentityRpc::RpcClaimsIdentity] { - &self.identities - } -} - -impl ::protobuf::Message for RpcHttp { - fn is_initialized(&self) -> bool { - for v in &self.body { - if !v.is_initialized() { - return false; - } - }; - for v in &self.rawBody { - if !v.is_initialized() { - return false; - } - }; - for v in &self.identities { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.method)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.url)?; - }, - 3 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.headers)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.body)?; - }, - 10 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.params)?; - }, - 12 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.status_code)?; - }, - 15 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.query)?; - }, - 16 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.enable_content_negotiation = tmp; - }, - 17 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.rawBody)?; - }, - 18 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.identities)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.method.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.method); - } - if !self.url.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.url); - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(3, &self.headers); - if let Some(ref v) = self.body.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(10, &self.params); - if !self.status_code.is_empty() { - my_size += ::protobuf::rt::string_size(12, &self.status_code); - } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(15, &self.query); - if self.enable_content_negotiation != false { - my_size += 3; - } - if let Some(ref v) = self.rawBody.as_ref() { - let len = v.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.identities { - let len = value.compute_size(); - my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.method.is_empty() { - os.write_string(1, &self.method)?; - } - if !self.url.is_empty() { - os.write_string(2, &self.url)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(3, &self.headers, os)?; - if let Some(ref v) = self.body.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(10, &self.params, os)?; - if !self.status_code.is_empty() { - os.write_string(12, &self.status_code)?; - } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(15, &self.query, os)?; - if self.enable_content_negotiation != false { - os.write_bool(16, self.enable_content_negotiation)?; - } - if let Some(ref v) = self.rawBody.as_ref() { - os.write_tag(17, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.identities { - os.write_tag(18, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RpcHttp { - RpcHttp::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "method", - |m: &RpcHttp| { &m.method }, - |m: &mut RpcHttp| { &mut m.method }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "url", - |m: &RpcHttp| { &m.url }, - |m: &mut RpcHttp| { &mut m.url }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "headers", - |m: &RpcHttp| { &m.headers }, - |m: &mut RpcHttp| { &mut m.headers }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "body", - |m: &RpcHttp| { &m.body }, - |m: &mut RpcHttp| { &mut m.body }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "params", - |m: &RpcHttp| { &m.params }, - |m: &mut RpcHttp| { &mut m.params }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "status_code", - |m: &RpcHttp| { &m.status_code }, - |m: &mut RpcHttp| { &mut m.status_code }, - )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( - "query", - |m: &RpcHttp| { &m.query }, - |m: &mut RpcHttp| { &mut m.query }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "enable_content_negotiation", - |m: &RpcHttp| { &m.enable_content_negotiation }, - |m: &mut RpcHttp| { &mut m.enable_content_negotiation }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "rawBody", - |m: &RpcHttp| { &m.rawBody }, - |m: &mut RpcHttp| { &mut m.rawBody }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "identities", - |m: &RpcHttp| { &m.identities }, - |m: &mut RpcHttp| { &mut m.identities }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RpcHttp", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static RpcHttp { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RpcHttp, - }; - unsafe { - instance.get(RpcHttp::new) - } - } -} - -impl ::protobuf::Clear for RpcHttp { - fn clear(&mut self) { - self.clear_method(); - self.clear_url(); - self.clear_headers(); - self.clear_body(); - self.clear_params(); - self.clear_status_code(); - self.clear_query(); - self.clear_enable_content_negotiation(); - self.clear_rawBody(); - self.clear_identities(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RpcHttp { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RpcHttp { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x11FunctionRpc.proto\x12\x19AzureFunctionsRpcMessages\x1a\x1egoogle/p\ - rotobuf/duration.proto\x1a\x20identity/ClaimsIdentityRpc.proto\"\xf1\r\n\ - \x10StreamingMessage\x12\x1d\n\nrequest_id\x18\x01\x20\x01(\tR\trequestI\ - d\x12K\n\x0cstart_stream\x18\x14\x20\x01(\x0b2&.AzureFunctionsRpcMessage\ - s.StartStreamH\0R\x0bstartStream\x12^\n\x13worker_init_request\x18\x11\ - \x20\x01(\x0b2,.AzureFunctionsRpcMessages.WorkerInitRequestH\0R\x11worke\ - rInitRequest\x12a\n\x14worker_init_response\x18\x10\x20\x01(\x0b2-.Azure\ - FunctionsRpcMessages.WorkerInitResponseH\0R\x12workerInitResponse\x12W\n\ - \x10worker_heartbeat\x18\x0f\x20\x01(\x0b2*.AzureFunctionsRpcMessages.Wo\ - rkerHeartbeatH\0R\x0fworkerHeartbeat\x12W\n\x10worker_terminate\x18\x0e\ - \x20\x01(\x0b2*.AzureFunctionsRpcMessages.WorkerTerminateH\0R\x0fworkerT\ - erminate\x12d\n\x15worker_status_request\x18\x0c\x20\x01(\x0b2..AzureFun\ - ctionsRpcMessages.WorkerStatusRequestH\0R\x13workerStatusRequest\x12g\n\ - \x16worker_status_response\x18\r\x20\x01(\x0b2/.AzureFunctionsRpcMessage\ - s.WorkerStatusResponseH\0R\x14workerStatusResponse\x12n\n\x19file_change\ - _event_request\x18\x06\x20\x01(\x0b21.AzureFunctionsRpcMessages.FileChan\ - geEventRequestH\0R\x16fileChangeEventRequest\x12g\n\x16worker_action_res\ - ponse\x18\x07\x20\x01(\x0b2/.AzureFunctionsRpcMessages.WorkerActionRespo\ - nseH\0R\x14workerActionResponse\x12d\n\x15function_load_request\x18\x08\ - \x20\x01(\x0b2..AzureFunctionsRpcMessages.FunctionLoadRequestH\0R\x13fun\ - ctionLoadRequest\x12g\n\x16function_load_response\x18\t\x20\x01(\x0b2/.A\ - zureFunctionsRpcMessages.FunctionLoadResponseH\0R\x14functionLoadRespons\ - e\x12]\n\x12invocation_request\x18\x04\x20\x01(\x0b2,.AzureFunctionsRpcM\ - essages.InvocationRequestH\0R\x11invocationRequest\x12`\n\x13invocation_\ - response\x18\x05\x20\x01(\x0b2-.AzureFunctionsRpcMessages.InvocationResp\ - onseH\0R\x12invocationResponse\x12Z\n\x11invocation_cancel\x18\x15\x20\ - \x01(\x0b2+.AzureFunctionsRpcMessages.InvocationCancelH\0R\x10invocation\ - Cancel\x12<\n\x07rpc_log\x18\x02\x20\x01(\x0b2!.AzureFunctionsRpcMessage\ - s.RpcLogH\0R\x06rpcLog\x12\x8c\x01\n#function_environment_reload_request\ - \x18\x19\x20\x01(\x0b2;.AzureFunctionsRpcMessages.FunctionEnvironmentRel\ - oadRequestH\0R\x20functionEnvironmentReloadRequest\x12\x8f\x01\n$functio\ - n_environment_reload_response\x18\x1a\x20\x01(\x0b2<.AzureFunctionsRpcMe\ - ssages.FunctionEnvironmentReloadResponseH\0R!functionEnvironmentReloadRe\ - sponseB\t\n\x07content\"*\n\x0bStartStream\x12\x1b\n\tworker_id\x18\x02\ - \x20\x01(\tR\x08workerId\"\xae\x03\n\x11WorkerInitRequest\x12!\n\x0chost\ - _version\x18\x01\x20\x01(\tR\x0bhostVersion\x12b\n\x0ccapabilities\x18\ - \x02\x20\x03(\x0b2>.AzureFunctionsRpcMessages.WorkerInitRequest.Capabili\ - tiesEntryR\x0ccapabilities\x12f\n\x0elog_categories\x18\x03\x20\x03(\x0b\ - 2?.AzureFunctionsRpcMessages.WorkerInitRequest.LogCategoriesEntryR\rlogC\ - ategories\x1a?\n\x11CapabilitiesEntry\x12\x10\n\x03key\x18\x01\x20\x01(\ - \tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\x028\x01\x1a\ - i\n\x12LogCategoriesEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\ - \x12=\n\x05value\x18\x02\x20\x01(\x0e2'.AzureFunctionsRpcMessages.RpcLog\ - .LevelR\x05value:\x028\x01\"\xa2\x02\n\x12WorkerInitResponse\x12%\n\x0ew\ - orker_version\x18\x01\x20\x01(\tR\rworkerVersion\x12c\n\x0ccapabilities\ - \x18\x02\x20\x03(\x0b2?.AzureFunctionsRpcMessages.WorkerInitResponse.Cap\ - abilitiesEntryR\x0ccapabilities\x12?\n\x06result\x18\x03\x20\x01(\x0b2'.\ - AzureFunctionsRpcMessages.StatusResultR\x06result\x1a?\n\x11Capabilities\ - Entry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\ - \x02\x20\x01(\tR\x05value:\x028\x01\"\x9f\x02\n\x0cStatusResult\x12F\n\ - \x06status\x18\x04\x20\x01(\x0e2..AzureFunctionsRpcMessages.StatusResult\ - .StatusR\x06status\x12\x16\n\x06result\x18\x01\x20\x01(\tR\x06result\x12\ - E\n\texception\x18\x02\x20\x01(\x0b2'.AzureFunctionsRpcMessages.RpcExcep\ - tionR\texception\x125\n\x04logs\x18\x03\x20\x03(\x0b2!.AzureFunctionsRpc\ - Messages.RpcLogR\x04logs\"1\n\x06Status\x12\x0b\n\x07Failure\x10\0\x12\ - \x0b\n\x07Success\x10\x01\x12\r\n\tCancelled\x10\x02\"\x11\n\x0fWorkerHe\ - artbeat\"O\n\x0fWorkerTerminate\x12<\n\x0cgrace_period\x18\x01\x20\x01(\ - \x0b2\x19.google.protobuf.DurationR\x0bgracePeriod\"\xe7\x01\n\x16FileCh\ - angeEventRequest\x12J\n\x04type\x18\x01\x20\x01(\x0e26.AzureFunctionsRpc\ - Messages.FileChangeEventRequest.TypeR\x04type\x12\x1b\n\tfull_path\x18\ - \x02\x20\x01(\tR\x08fullPath\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04na\ - me\"P\n\x04Type\x12\x0b\n\x07Unknown\x10\0\x12\x0b\n\x07Created\x10\x01\ - \x12\x0b\n\x07Deleted\x10\x02\x12\x0b\n\x07Changed\x10\x04\x12\x0b\n\x07\ - Renamed\x10\x08\x12\x07\n\x03All\x10\x0f\"\xa1\x01\n\x14WorkerActionResp\ - onse\x12N\n\x06action\x18\x01\x20\x01(\x0e26.AzureFunctionsRpcMessages.W\ - orkerActionResponse.ActionR\x06action\x12\x16\n\x06reason\x18\x02\x20\ - \x01(\tR\x06reason\"!\n\x06Action\x12\x0b\n\x07Restart\x10\0\x12\n\n\x06\ - Reload\x10\x01\"\x15\n\x13WorkerStatusRequest\"\x16\n\x14WorkerStatusRes\ - ponse\"\xf8\x01\n\x20FunctionEnvironmentReloadRequest\x12\x8a\x01\n\x15e\ - nvironment_variables\x18\x01\x20\x03(\x0b2U.AzureFunctionsRpcMessages.Fu\ - nctionEnvironmentReloadRequest.EnvironmentVariablesEntryR\x14environment\ - Variables\x1aG\n\x19EnvironmentVariablesEntry\x12\x10\n\x03key\x18\x01\ - \x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\x02\ - 8\x01\"d\n!FunctionEnvironmentReloadResponse\x12?\n\x06result\x18\x03\ - \x20\x01(\x0b2'.AzureFunctionsRpcMessages.StatusResultR\x06result\"\xc0\ - \x01\n\x13FunctionLoadRequest\x12\x1f\n\x0bfunction_id\x18\x01\x20\x01(\ - \tR\nfunctionId\x12J\n\x08metadata\x18\x02\x20\x01(\x0b2..AzureFunctions\ - RpcMessages.RpcFunctionMetadataR\x08metadata\x12<\n\x1amanaged_dependenc\ - y_enabled\x18\x03\x20\x01(\x08R\x18managedDependencyEnabled\"\xb2\x01\n\ - \x14FunctionLoadResponse\x12\x1f\n\x0bfunction_id\x18\x01\x20\x01(\tR\nf\ - unctionId\x12?\n\x06result\x18\x02\x20\x01(\x0b2'.AzureFunctionsRpcMessa\ - ges.StatusResultR\x06result\x128\n\x18is_dependency_downloaded\x18\x03\ - \x20\x01(\x08R\x16isDependencyDownloaded\"\xc8\x02\n\x13RpcFunctionMetad\ - ata\x12\x12\n\x04name\x18\x04\x20\x01(\tR\x04name\x12\x1c\n\tdirectory\ - \x18\x01\x20\x01(\tR\tdirectory\x12\x1f\n\x0bscript_file\x18\x02\x20\x01\ - (\tR\nscriptFile\x12\x1f\n\x0bentry_point\x18\x03\x20\x01(\tR\nentryPoin\ - t\x12X\n\x08bindings\x18\x06\x20\x03(\x0b2<.AzureFunctionsRpcMessages.Rp\ - cFunctionMetadata.BindingsEntryR\x08bindings\x1ac\n\rBindingsEntry\x12\ - \x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12<\n\x05value\x18\x02\x20\x01\ - (\x0b2&.AzureFunctionsRpcMessages.BindingInfoR\x05value:\x028\x01\"\xfd\ - \x02\n\x11InvocationRequest\x12#\n\rinvocation_id\x18\x01\x20\x01(\tR\ - \x0cinvocationId\x12\x1f\n\x0bfunction_id\x18\x02\x20\x01(\tR\nfunctionI\ - d\x12J\n\ninput_data\x18\x03\x20\x03(\x0b2+.AzureFunctionsRpcMessages.Pa\ - rameterBindingR\tinputData\x12l\n\x10trigger_metadata\x18\x04\x20\x03(\ - \x0b2A.AzureFunctionsRpcMessages.InvocationRequest.TriggerMetadataEntryR\ - \x0ftriggerMetadata\x1ah\n\x14TriggerMetadataEntry\x12\x10\n\x03key\x18\ - \x01\x20\x01(\tR\x03key\x12:\n\x05value\x18\x02\x20\x01(\x0b2$.AzureFunc\ - tionsRpcMessages.TypedDataR\x05value:\x028\x01\"u\n\x10InvocationCancel\ - \x12#\n\rinvocation_id\x18\x02\x20\x01(\tR\x0cinvocationId\x12<\n\x0cgra\ - ce_period\x18\x01\x20\x01(\x0b2\x19.google.protobuf.DurationR\x0bgracePe\ - riod\"\x91\x02\n\x12InvocationResponse\x12#\n\rinvocation_id\x18\x01\x20\ - \x01(\tR\x0cinvocationId\x12L\n\x0boutput_data\x18\x02\x20\x03(\x0b2+.Az\ - ureFunctionsRpcMessages.ParameterBindingR\noutputData\x12G\n\x0creturn_v\ - alue\x18\x04\x20\x01(\x0b2$.AzureFunctionsRpcMessages.TypedDataR\x0bretu\ - rnValue\x12?\n\x06result\x18\x03\x20\x01(\x0b2'.AzureFunctionsRpcMessage\ - s.StatusResultR\x06result\"\xdd\x01\n\tTypedData\x12\x18\n\x06string\x18\ - \x01\x20\x01(\tH\0R\x06string\x12\x14\n\x04json\x18\x02\x20\x01(\tH\0R\ - \x04json\x12\x16\n\x05bytes\x18\x03\x20\x01(\x0cH\0R\x05bytes\x12\x18\n\ - \x06stream\x18\x04\x20\x01(\x0cH\0R\x06stream\x128\n\x04http\x18\x05\x20\ - \x01(\x0b2\".AzureFunctionsRpcMessages.RpcHttpH\0R\x04http\x12\x12\n\x03\ - int\x18\x06\x20\x01(\x12H\0R\x03int\x12\x18\n\x06double\x18\x07\x20\x01(\ - \x01H\0R\x06doubleB\x06\n\x04data\"`\n\x10ParameterBinding\x12\x12\n\x04\ - name\x18\x01\x20\x01(\tR\x04name\x128\n\x04data\x18\x02\x20\x01(\x0b2$.A\ - zureFunctionsRpcMessages.TypedDataR\x04data\"\xa7\x02\n\x0bBindingInfo\ - \x12\x12\n\x04type\x18\x02\x20\x01(\tR\x04type\x12N\n\tdirection\x18\x03\ - \x20\x01(\x0e20.AzureFunctionsRpcMessages.BindingInfo.DirectionR\tdirect\ - ion\x12L\n\tdata_type\x18\x04\x20\x01(\x0e2/.AzureFunctionsRpcMessages.B\ - indingInfo.DataTypeR\x08dataType\"'\n\tDirection\x12\x06\n\x02in\x10\0\ - \x12\x07\n\x03out\x10\x01\x12\t\n\x05inout\x10\x02\"=\n\x08DataType\x12\ - \r\n\tundefined\x10\0\x12\n\n\x06string\x10\x01\x12\n\n\x06binary\x10\ - \x02\x12\n\n\x06stream\x10\x03\"\x84\x03\n\x06RpcLog\x12#\n\rinvocation_\ - id\x18\x01\x20\x01(\tR\x0cinvocationId\x12\x1a\n\x08category\x18\x02\x20\ - \x01(\tR\x08category\x12=\n\x05level\x18\x03\x20\x01(\x0e2'.AzureFunctio\ - nsRpcMessages.RpcLog.LevelR\x05level\x12\x18\n\x07message\x18\x04\x20\ - \x01(\tR\x07message\x12\x19\n\x08event_id\x18\x05\x20\x01(\tR\x07eventId\ - \x12E\n\texception\x18\x06\x20\x01(\x0b2'.AzureFunctionsRpcMessages.RpcE\ - xceptionR\texception\x12\x1e\n\nproperties\x18\x07\x20\x01(\tR\nproperti\ - es\"^\n\x05Level\x12\t\n\x05Trace\x10\0\x12\t\n\x05Debug\x10\x01\x12\x0f\ - \n\x0bInformation\x10\x02\x12\x0b\n\x07Warning\x10\x03\x12\t\n\x05Error\ - \x10\x04\x12\x0c\n\x08Critical\x10\x05\x12\x08\n\x04None\x10\x06\"a\n\ - \x0cRpcException\x12\x16\n\x06source\x18\x03\x20\x01(\tR\x06source\x12\ - \x1f\n\x0bstack_trace\x18\x01\x20\x01(\tR\nstackTrace\x12\x18\n\x07messa\ - ge\x18\x02\x20\x01(\tR\x07message\"\xc9\x05\n\x07RpcHttp\x12\x16\n\x06me\ - thod\x18\x01\x20\x01(\tR\x06method\x12\x10\n\x03url\x18\x02\x20\x01(\tR\ - \x03url\x12I\n\x07headers\x18\x03\x20\x03(\x0b2/.AzureFunctionsRpcMessag\ - es.RpcHttp.HeadersEntryR\x07headers\x128\n\x04body\x18\x04\x20\x01(\x0b2\ - $.AzureFunctionsRpcMessages.TypedDataR\x04body\x12F\n\x06params\x18\n\ - \x20\x03(\x0b2..AzureFunctionsRpcMessages.RpcHttp.ParamsEntryR\x06params\ - \x12\x1f\n\x0bstatus_code\x18\x0c\x20\x01(\tR\nstatusCode\x12C\n\x05quer\ - y\x18\x0f\x20\x03(\x0b2-.AzureFunctionsRpcMessages.RpcHttp.QueryEntryR\ - \x05query\x12<\n\x1aenable_content_negotiation\x18\x10\x20\x01(\x08R\x18\ - enableContentNegotiation\x12>\n\x07rawBody\x18\x11\x20\x01(\x0b2$.AzureF\ - unctionsRpcMessages.TypedDataR\x07rawBody\x122\n\nidentities\x18\x12\x20\ - \x03(\x0b2\x12.RpcClaimsIdentityR\nidentities\x1a:\n\x0cHeadersEntry\x12\ - \x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\ - \x01(\tR\x05value:\x028\x01\x1a9\n\x0bParamsEntry\x12\x10\n\x03key\x18\ - \x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\ - \x028\x01\x1a8\n\nQueryEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\ - \x12\x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\x028\x012|\n\x0bFuncti\ - onRpc\x12m\n\x0bEventStream\x12+.AzureFunctionsRpcMessages.StreamingMess\ - age\x1a+.AzureFunctionsRpcMessages.StreamingMessage\"\0(\x010\x01B\xa5\ - \x01\n*com.microsoft.azure.functions.rpc.messagesB\rFunctionProtoP\x01Z7\ - github.com/Azure/azure-functions-go-worker/internal/rpc\xaa\x02,Microsof\ - t.Azure.WebJobs.Script.Grpc.Messagesb\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/azure-functions-shared/cache/FunctionRpc_grpc.rs b/azure-functions-shared/cache/FunctionRpc_grpc.rs deleted file mode 100644 index dfc8500..0000000 --- a/azure-functions-shared/cache/FunctionRpc_grpc.rs +++ /dev/null @@ -1,63 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -const METHOD_FUNCTION_RPC_EVENT_STREAM: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Duplex, - name: "/AzureFunctionsRpcMessages.FunctionRpc/EventStream", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -#[derive(Clone)] -pub struct FunctionRpcClient { - client: ::grpcio::Client, -} - -impl FunctionRpcClient { - pub fn new(channel: ::grpcio::Channel) -> Self { - FunctionRpcClient { - client: ::grpcio::Client::new(channel), - } - } - - pub fn event_stream_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { - self.client.duplex_streaming(&METHOD_FUNCTION_RPC_EVENT_STREAM, opt) - } - - pub fn event_stream(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { - self.event_stream_opt(::grpcio::CallOption::default()) - } - pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { - self.client.spawn(f) - } -} - -pub trait FunctionRpc { - fn event_stream(&mut self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink); -} - -pub fn create_function_rpc(s: S) -> ::grpcio::Service { - let mut builder = ::grpcio::ServiceBuilder::new(); - let mut instance = s.clone(); - builder = builder.add_duplex_streaming_handler(&METHOD_FUNCTION_RPC_EVENT_STREAM, move |ctx, req, resp| { - instance.event_stream(ctx, req, resp) - }); - builder.build() -} diff --git a/azure-functions-shared/cache/azure_functions_rpc_messages.rs b/azure-functions-shared/cache/azure_functions_rpc_messages.rs new file mode 100644 index 0000000..0289a6a --- /dev/null +++ b/azure-functions-shared/cache/azure_functions_rpc_messages.rs @@ -0,0 +1,515 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NullableString { + #[prost(oneof="nullable_string::String", tags="1")] + pub string: ::std::option::Option, +} +pub mod nullable_string { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum String { + #[prost(string, tag="1")] + Value(std::string::String), + } +} +/// Light-weight representation of a .NET System.Security.Claims.ClaimsIdentity object. +/// This is the same serialization as found in EasyAuth, and needs to be kept in sync with +/// its ClaimsIdentitySlim definition, as seen in the WebJobs extension: +/// https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.Http/ClaimsIdentitySlim.cs +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcClaimsIdentity { + #[prost(message, optional, tag="1")] + pub authentication_type: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub name_claim_type: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub role_claim_type: ::std::option::Option, + #[prost(message, repeated, tag="4")] + pub claims: ::std::vec::Vec, +} +/// Light-weight representation of a .NET System.Security.Claims.Claim object. +/// This is the same serialization as found in EasyAuth, and needs to be kept in sync with +/// its ClaimSlim definition, as seen in the WebJobs extension: +/// https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.Http/ClaimSlim.cs +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcClaim { + #[prost(string, tag="1")] + pub value: std::string::String, + #[prost(string, tag="2")] + pub r#type: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamingMessage { + /// Used to identify message between host and worker + #[prost(string, tag="1")] + pub request_id: std::string::String, + /// Payload of the message + #[prost(oneof="streaming_message::Content", tags="20, 17, 16, 15, 14, 12, 13, 6, 7, 8, 9, 4, 5, 21, 2, 25, 26")] + pub content: ::std::option::Option, +} +pub mod streaming_message { + /// Payload of the message + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Content { + /// Worker initiates stream + #[prost(message, tag="20")] + StartStream(super::StartStream), + /// Host sends capabilities/init data to worker + #[prost(message, tag="17")] + WorkerInitRequest(super::WorkerInitRequest), + /// Worker responds after initializing with its capabilities & status + #[prost(message, tag="16")] + WorkerInitResponse(super::WorkerInitResponse), + /// Worker periodically sends empty heartbeat message to host + #[prost(message, tag="15")] + WorkerHeartbeat(super::WorkerHeartbeat), + /// Host sends terminate message to worker. + /// Worker terminates if it can, otherwise host terminates after a grace period + #[prost(message, tag="14")] + WorkerTerminate(super::WorkerTerminate), + /// Add any worker relevant status to response + #[prost(message, tag="12")] + WorkerStatusRequest(super::WorkerStatusRequest), + #[prost(message, tag="13")] + WorkerStatusResponse(super::WorkerStatusResponse), + /// On file change event, host sends notification to worker + #[prost(message, tag="6")] + FileChangeEventRequest(super::FileChangeEventRequest), + /// Worker requests a desired action (restart worker, reload function) + #[prost(message, tag="7")] + WorkerActionResponse(super::WorkerActionResponse), + /// Host sends required metadata to worker to load function + #[prost(message, tag="8")] + FunctionLoadRequest(super::FunctionLoadRequest), + /// Worker responds after loading with the load result + #[prost(message, tag="9")] + FunctionLoadResponse(super::FunctionLoadResponse), + /// Host requests a given invocation + #[prost(message, tag="4")] + InvocationRequest(super::InvocationRequest), + /// Worker responds to a given invocation + #[prost(message, tag="5")] + InvocationResponse(super::InvocationResponse), + /// Host sends cancel message to attempt to cancel an invocation. + /// If an invocation is cancelled, host will receive an invocation response with status cancelled. + #[prost(message, tag="21")] + InvocationCancel(super::InvocationCancel), + /// Worker logs a message back to the host + #[prost(message, tag="2")] + RpcLog(super::RpcLog), + #[prost(message, tag="25")] + FunctionEnvironmentReloadRequest(super::FunctionEnvironmentReloadRequest), + #[prost(message, tag="26")] + FunctionEnvironmentReloadResponse(super::FunctionEnvironmentReloadResponse), + } +} +// Process.Start required info +// connection details +// protocol type +// protocol version + +/// Worker sends the host information identifying itself +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartStream { + /// id of the worker + #[prost(string, tag="2")] + pub worker_id: std::string::String, +} +/// Host requests the worker to initialize itself +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerInitRequest { + /// version of the host sending init request + #[prost(string, tag="1")] + pub host_version: std::string::String, + /// A map of host supported features/capabilities + #[prost(map="string, string", tag="2")] + pub capabilities: ::std::collections::HashMap, + /// inform worker of supported categories and their levels + /// i.e. Worker = Verbose, Function.MyFunc = None + #[prost(map="string, enumeration(rpc_log::Level)", tag="3")] + pub log_categories: ::std::collections::HashMap, +} +/// Worker responds with the result of initializing itself +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerInitResponse { + /// Version of worker + #[prost(string, tag="1")] + pub worker_version: std::string::String, + /// A map of worker supported features/capabilities + #[prost(map="string, string", tag="2")] + pub capabilities: ::std::collections::HashMap, + /// Status of the response + #[prost(message, optional, tag="3")] + pub result: ::std::option::Option, +} +/// Used by the host to determine success/failure/cancellation +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResult { + /// Status for the given result + #[prost(enumeration="status_result::Status", tag="4")] + pub status: i32, + /// Specific message about the result + #[prost(string, tag="1")] + pub result: std::string::String, + /// Exception message (if exists) for the status + #[prost(message, optional, tag="2")] + pub exception: ::std::option::Option, + /// Captured logs or relevant details can use the logs property + #[prost(message, repeated, tag="3")] + pub logs: ::std::vec::Vec, +} +pub mod status_result { + /// Indicates Failure/Success/Cancelled + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Status { + Failure = 0, + Success = 1, + Cancelled = 2, + } +} +// TODO: investigate grpc heartbeat - don't limit to grpc implemention + +/// Message is empty by design - Will add more fields in future if needed +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerHeartbeat { +} +/// Warning before killing the process after grace_period +/// Worker self terminates ..no response on this +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerTerminate { + #[prost(message, optional, tag="1")] + pub grace_period: ::std::option::Option<::prost_types::Duration>, +} +/// Host notifies worker of file content change +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FileChangeEventRequest { + /// type for this event + #[prost(enumeration="file_change_event_request::Type", tag="1")] + pub r#type: i32, + /// full file path for the file change notification + #[prost(string, tag="2")] + pub full_path: std::string::String, + /// Name of the function affected + #[prost(string, tag="3")] + pub name: std::string::String, +} +pub mod file_change_event_request { + /// Types of File change operations (See link for more info: https://msdn.microsoft.com/en-us/library/t6xf43e0(v=vs.110).aspx) + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Type { + Unknown = 0, + Created = 1, + Deleted = 2, + Changed = 4, + Renamed = 8, + All = 15, + } +} +/// Indicates whether worker reloaded successfully or needs a restart +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerActionResponse { + /// action for this response + #[prost(enumeration="worker_action_response::Action", tag="1")] + pub action: i32, + /// text reason for the response + #[prost(string, tag="2")] + pub reason: std::string::String, +} +pub mod worker_action_response { + /// indicates whether a restart is needed, or reload succesfully + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Action { + Restart = 0, + Reload = 1, + } +} +/// NOT USED +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerStatusRequest { +} +/// NOT USED +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WorkerStatusResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionEnvironmentReloadRequest { + /// Environment variables from the current process + #[prost(map="string, string", tag="1")] + pub environment_variables: ::std::collections::HashMap, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionEnvironmentReloadResponse { + /// Status of the response + #[prost(message, optional, tag="3")] + pub result: ::std::option::Option, +} +/// Host tells the worker to load a Function +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionLoadRequest { + /// unique function identifier (avoid name collisions, facilitate reload case) + #[prost(string, tag="1")] + pub function_id: std::string::String, + /// Metadata for the request + #[prost(message, optional, tag="2")] + pub metadata: ::std::option::Option, + /// A flag indicating if managed dependency is enabled or not + #[prost(bool, tag="3")] + pub managed_dependency_enabled: bool, +} +/// Worker tells host result of reload +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionLoadResponse { + /// unique function identifier + #[prost(string, tag="1")] + pub function_id: std::string::String, + /// Result of load operation + /// + /// TODO: return type expected? + #[prost(message, optional, tag="2")] + pub result: ::std::option::Option, + /// Result of load operation + #[prost(bool, tag="3")] + pub is_dependency_downloaded: bool, +} +/// Information on how a Function should be loaded and its bindings +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcFunctionMetadata { + /// TODO: do we want the host's name - the language worker might do a better job of assignment than the host + #[prost(string, tag="4")] + pub name: std::string::String, + /// base directory for the Function + #[prost(string, tag="1")] + pub directory: std::string::String, + /// Script file specified + #[prost(string, tag="2")] + pub script_file: std::string::String, + /// Entry point specified + #[prost(string, tag="3")] + pub entry_point: std::string::String, + /// Bindings info + #[prost(map="string, message", tag="6")] + pub bindings: ::std::collections::HashMap, +} +/// Host requests worker to invoke a Function +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InvocationRequest { + /// Unique id for each invocation + #[prost(string, tag="1")] + pub invocation_id: std::string::String, + /// Unique id for each Function + #[prost(string, tag="2")] + pub function_id: std::string::String, + /// Input bindings (include trigger) + #[prost(message, repeated, tag="3")] + pub input_data: ::std::vec::Vec, + /// binding metadata from trigger + #[prost(map="string, message", tag="4")] + pub trigger_metadata: ::std::collections::HashMap, +} +/// Host requests worker to cancel invocation +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InvocationCancel { + /// Unique id for invocation + #[prost(string, tag="2")] + pub invocation_id: std::string::String, + /// Time period before force shutdown + /// + /// could also use absolute time + #[prost(message, optional, tag="1")] + pub grace_period: ::std::option::Option<::prost_types::Duration>, +} +/// Worker responds with status of Invocation +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InvocationResponse { + /// Unique id for invocation + #[prost(string, tag="1")] + pub invocation_id: std::string::String, + /// Output binding data + #[prost(message, repeated, tag="2")] + pub output_data: ::std::vec::Vec, + /// data returned from Function (for $return and triggers with return support) + #[prost(message, optional, tag="4")] + pub return_value: ::std::option::Option, + /// Status of the invocation (success/failure/canceled) + #[prost(message, optional, tag="3")] + pub result: ::std::option::Option, +} +/// Used to encapsulate data which could be a variety of types +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypedData { + #[prost(oneof="typed_data::Data", tags="1, 2, 3, 4, 5, 6, 7")] + pub data: ::std::option::Option, +} +pub mod typed_data { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Data { + #[prost(string, tag="1")] + String(std::string::String), + #[prost(string, tag="2")] + Json(std::string::String), + #[prost(bytes, tag="3")] + Bytes(std::vec::Vec), + #[prost(bytes, tag="4")] + Stream(std::vec::Vec), + #[prost(message, tag="5")] + Http(Box), + #[prost(sint64, tag="6")] + Int(i64), + #[prost(double, tag="7")] + Double(f64), + } +} +/// Used to describe a given binding on invocation +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ParameterBinding { + /// Name for the binding + #[prost(string, tag="1")] + pub name: std::string::String, + /// Data for the binding + #[prost(message, optional, tag="2")] + pub data: ::std::option::Option, +} +/// Used to describe a given binding on load +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BindingInfo { + /// Type of binding (e.g. HttpTrigger) + #[prost(string, tag="2")] + pub r#type: std::string::String, + /// Direction of the given binding + #[prost(enumeration="binding_info::Direction", tag="3")] + pub direction: i32, + #[prost(enumeration="binding_info::DataType", tag="4")] + pub data_type: i32, +} +pub mod binding_info { + /// Indicates whether it is an input or output binding (or a fancy inout binding) + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Direction { + In = 0, + Out = 1, + Inout = 2, + } + /// Indicates the type of the data for the binding + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum DataType { + Undefined = 0, + String = 1, + Binary = 2, + Stream = 3, + } +} +/// Used to send logs back to the Host +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcLog { + /// Unique id for invocation (if exists) + #[prost(string, tag="1")] + pub invocation_id: std::string::String, + /// TOD: This should be an enum + /// Category for the log (startup, load, invocation, etc.) + #[prost(string, tag="2")] + pub category: std::string::String, + /// Level for the given log message + #[prost(enumeration="rpc_log::Level", tag="3")] + pub level: i32, + /// Message for the given log + #[prost(string, tag="4")] + pub message: std::string::String, + /// Id for the even associated with this log (if exists) + #[prost(string, tag="5")] + pub event_id: std::string::String, + /// Exception (if exists) + #[prost(message, optional, tag="6")] + pub exception: ::std::option::Option, + /// json serialized property bag, or could use a type scheme like map + #[prost(string, tag="7")] + pub properties: std::string::String, +} +pub mod rpc_log { + /// Matching ILogger semantics + /// https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs + /// Level for the Log + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Level { + Trace = 0, + Debug = 1, + Information = 2, + Warning = 3, + Error = 4, + Critical = 5, + None = 6, + } +} +/// Encapsulates an Exception +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcException { + /// Source of the exception + #[prost(string, tag="3")] + pub source: std::string::String, + /// Stack trace for the exception + #[prost(string, tag="1")] + pub stack_trace: std::string::String, + /// Textual message describing hte exception + #[prost(string, tag="2")] + pub message: std::string::String, +} +/// TODO - solidify this or remove it +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RpcHttp { + #[prost(string, tag="1")] + pub method: std::string::String, + #[prost(string, tag="2")] + pub url: std::string::String, + #[prost(map="string, string", tag="3")] + pub headers: ::std::collections::HashMap, + #[prost(message, optional, boxed, tag="4")] + pub body: ::std::option::Option<::std::boxed::Box>, + #[prost(map="string, string", tag="10")] + pub params: ::std::collections::HashMap, + #[prost(string, tag="12")] + pub status_code: std::string::String, + #[prost(map="string, string", tag="15")] + pub query: ::std::collections::HashMap, + #[prost(bool, tag="16")] + pub enable_content_negotiation: bool, + #[prost(message, optional, boxed, tag="17")] + pub raw_body: ::std::option::Option<::std::boxed::Box>, + #[prost(message, repeated, tag="18")] + pub identities: ::std::vec::Vec, +} +pub mod client { + use ::tower_grpc::codegen::client::*; + use super::StreamingMessage; + + /// Interface exported by the server. + #[derive(Debug, Clone)] + pub struct FunctionRpc { + inner: grpc::Grpc, + } + + impl FunctionRpc { + pub fn new(inner: T) -> Self { + let inner = grpc::Grpc::new(inner); + Self { inner } + } + + pub fn poll_ready(&mut self) -> futures::Poll<(), grpc::Status> + where T: grpc::GrpcService, + { + self.inner.poll_ready() + } + + /// Interface exported by the server. + pub fn event_stream(&mut self, request: grpc::Request) -> grpc::streaming::ResponseFuture + where T: grpc::GrpcService, + B: futures::Stream, + B: grpc::Encodable, + { + let path = http::PathAndQuery::from_static("/AzureFunctionsRpcMessages.FunctionRpc/EventStream"); + self.inner.streaming(request, path) + } + } +} diff --git a/azure-functions-shared/protobuf b/azure-functions-shared/protobuf index 8450073..2601636 160000 --- a/azure-functions-shared/protobuf +++ b/azure-functions-shared/protobuf @@ -1 +1 @@ -Subproject commit 8450073938d10bae8e73901cfcc52fac4a3745fa +Subproject commit 2601636fcb9f36a9d0baf8c90602f108c61b6834 diff --git a/azure-functions-shared/src/codegen/function.rs b/azure-functions-shared/src/codegen/function.rs index c80facf..8386905 100644 --- a/azure-functions-shared/src/codegen/function.rs +++ b/azure-functions-shared/src/codegen/function.rs @@ -3,7 +3,7 @@ use crate::codegen::{ get_boolean_value, get_string_value, iter_attribute_args, macro_panic, quotable::{QuotableBorrowedStr, QuotableOption}, }; -use crate::rpc::protocol; +use crate::rpc; use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens}; use serde::{ser::SerializeMap, Serialize, Serializer}; @@ -17,7 +17,7 @@ pub struct Function { pub disabled: bool, pub bindings: Cow<'static, [Binding]>, pub invoker_name: Option>, - pub invoker: Option protocol::InvocationResponse>, + pub invoker: Option rpc::InvocationResponse>, pub manifest_dir: Option>, pub file: Option>, } diff --git a/azure-functions-shared/src/lib.rs b/azure-functions-shared/src/lib.rs index 765ee7a..f02632f 100644 --- a/azure-functions-shared/src/lib.rs +++ b/azure-functions-shared/src/lib.rs @@ -5,6 +5,7 @@ #![cfg_attr(feature = "unstable", feature(proc_macro_diagnostic))] #![deny(missing_docs)] #![deny(unused_extern_crates)] +#![allow(clippy::large_enum_variant)] #[doc(hidden)] pub mod codegen; @@ -15,17 +16,11 @@ pub mod util; #[doc(hidden)] #[allow(renamed_and_removed_lints)] pub mod rpc { - pub mod protocol { - use azure_functions_shared_codegen::generated_mod; + use azure_functions_shared_codegen::generated_mod; - generated_mod!(FunctionRpc); - generated_mod!(FunctionRpc_grpc); - generated_mod!(ClaimsIdentityRpc); + generated_mod!(azure_functions_rpc_messages); - pub use self::ClaimsIdentityRpc::*; - pub use self::FunctionRpc::*; - pub use self::FunctionRpc_grpc::*; - } + pub use self::azure_functions_rpc_messages::*; } pub use self::context::*; diff --git a/azure-functions/Cargo.toml b/azure-functions/Cargo.toml index 5888e2d..1e57633 100644 --- a/azure-functions/Cargo.toml +++ b/azure-functions/Cargo.toml @@ -11,11 +11,15 @@ edition = "2018" [dependencies] azure-functions-shared = { version = "0.7.0", path = "../azure-functions-shared" } azure-functions-codegen = { version = "0.7.0", path = "../azure-functions-codegen" } +tower-h2 = { git = "https://github.com/tower-rs/tower-h2", rev = "a3c958a243ef3d837933b31bf186ba0e6b0e60c9"} +tower-request-modifier = { git = "https://github.com/tower-rs/tower-http", rev = "e7ef6ef623411342ee89c0a83ef924db6206143a" } +tower-grpc = { git = "https://github.com/tower-rs/tower-grpc", rev = "55d004e49f6c6097a9f556752bceb8b32c8c700f"} +tower-service = "0.2.0" +tower-util = { git = "https://github.com/tower-rs/tower", rev = "979c1399127bdb269c751b99c12b3adfad55463c" } log = { version = "0.4.6", features = ["std"] } -grpcio = { version = "0.4.4", default-features = false, features = ["protobuf-codec"] } futures = "0.1.26" clap = "2.33.0" -tokio-threadpool = "0.1.13" +tokio = "0.1.18" serde = "1.0.90" serde_json = "1.0.39" serde_derive = "1.0.90" @@ -25,7 +29,6 @@ lazy_static = "1.3.0" tempfile = "3.0.7" ctrlc = "3.1.1" backtrace = "0.3.15" -crossbeam-channel = "0.3.8" fs_extra = "1.1.0" [features] diff --git a/azure-functions/src/bindings/blob.rs b/azure-functions/src/bindings/blob.rs index e249093..05675cc 100644 --- a/azure-functions/src/bindings/blob.rs +++ b/azure-functions/src/bindings/blob.rs @@ -1,5 +1,7 @@ -use crate::http::Body; -use crate::rpc::protocol; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, +}; use serde::de::Error; use serde::Deserialize; use serde_json::{from_str, Result, Value}; @@ -59,44 +61,31 @@ use std::str::from_utf8; /// } /// ``` #[derive(Debug, Clone)] -pub struct Blob(protocol::TypedData); +pub struct Blob(TypedData); impl Blob { /// Gets the content of the blob as a string. /// /// Returns None if there is no valid string representation of the blob. pub fn as_str(&self) -> Option<&str> { - if self.0.has_string() { - return Some(self.0.get_string()); + match &self.0.data { + Some(Data::String(s)) => Some(s), + Some(Data::Json(s)) => Some(s), + Some(Data::Bytes(b)) => from_utf8(b).ok(), + Some(Data::Stream(s)) => from_utf8(s).ok(), + _ => None, } - if self.0.has_json() { - return Some(self.0.get_json()); - } - if self.0.has_bytes() { - return from_utf8(self.0.get_bytes()).map(|s| s).ok(); - } - if self.0.has_stream() { - return from_utf8(self.0.get_stream()).map(|s| s).ok(); - } - None } /// Gets the content of the blob as a slice of bytes. pub fn as_bytes(&self) -> &[u8] { - if self.0.has_string() { - return self.0.get_string().as_bytes(); + match &self.0.data { + Some(Data::String(s)) => s.as_bytes(), + Some(Data::Json(s)) => s.as_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for blob content"), } - if self.0.has_json() { - return self.0.get_json().as_bytes(); - } - if self.0.has_bytes() { - return self.0.get_bytes(); - } - if self.0.has_stream() { - return self.0.get_stream(); - } - - panic!("unexpected data for blob content"); } /// Deserializes the blob as JSON to the requested type. @@ -119,76 +108,72 @@ impl fmt::Display for Blob { impl<'a> From<&'a str> for Blob { fn from(content: &'a str) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content.to_owned()); - Blob(data) + Blob(TypedData { + data: Some(Data::String(content.to_owned())), + }) } } impl From for Blob { fn from(content: String) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content); - Blob(data) + Blob(TypedData { + data: Some(Data::String(content)), + }) } } impl From<&Value> for Blob { fn from(content: &Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - Blob(data) + Blob(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl From for Blob { fn from(content: Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - Blob(data) + Blob(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl<'a> From<&'a [u8]> for Blob { fn from(content: &'a [u8]) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content.to_owned()); - Blob(data) + Blob(TypedData { + data: Some(Data::Bytes(content.to_owned())), + }) } } impl From> for Blob { fn from(content: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content); - Blob(data) + Blob(TypedData { + data: Some(Data::Bytes(content)), + }) } } #[doc(hidden)] -impl From for Blob { - fn from(data: protocol::TypedData) -> Self { +impl From for Blob { + fn from(data: TypedData) -> Self { Blob(data) } } impl Into for Blob { - fn into(mut self) -> String { - if self.0.has_string() { - return self.0.take_string(); + fn into(self) -> String { + match self.0.data { + Some(Data::String(s)) => s, + Some(Data::Json(s)) => s, + Some(Data::Bytes(b)) => { + String::from_utf8(b).expect("blob does not contain valid UTF-8 bytes") + } + Some(Data::Stream(s)) => { + String::from_utf8(s).expect("blob does not contain valid UTF-8 bytes") + } + _ => panic!("unexpected data for blob content"), } - if self.0.has_json() { - return self.0.take_json(); - } - if self.0.has_bytes() { - return String::from_utf8(self.0.take_bytes()) - .expect("blob does not contain valid UTF-8 bytes"); - } - if self.0.has_stream() { - return String::from_utf8(self.0.take_stream()) - .expect("blob does not contain valid UTF-8 bytes"); - } - panic!("unexpected data for blob content"); } } @@ -203,46 +188,32 @@ impl Into for Blob { } impl Into> for Blob { - fn into(mut self) -> Vec { - if self.0.has_string() { - return self.0.take_string().into_bytes(); + fn into(self) -> Vec { + match self.0.data { + Some(Data::String(s)) => s.into_bytes(), + Some(Data::Json(s)) => s.into_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for blob content"), } - if self.0.has_json() { - return self.0.take_json().into_bytes(); - } - if self.0.has_bytes() { - return self.0.take_bytes(); - } - if self.0.has_stream() { - return self.0.take_stream(); - } - - panic!("unexpected data for blob content"); } } impl<'a> Into> for Blob { - fn into(mut self) -> Body<'a> { - if self.0.has_string() { - return self.0.take_string().into(); + fn into(self) -> Body<'a> { + match self.0.data { + Some(Data::String(s)) => s.into(), + Some(Data::Json(s)) => Body::Json(Cow::from(s)), + Some(Data::Bytes(b)) => b.into(), + Some(Data::Stream(s)) => s.into(), + _ => panic!("unexpected data for blob content"), } - if self.0.has_json() { - return Body::Json(Cow::from(self.0.take_json())); - } - if self.0.has_bytes() { - return self.0.take_bytes().into(); - } - if self.0.has_stream() { - return self.0.take_stream().into(); - } - - panic!("unexpected data for blob content"); } } #[doc(hidden)] -impl Into for Blob { - fn into(self) -> protocol::TypedData { +impl Into for Blob { + fn into(self) -> TypedData { self.0 } } @@ -262,28 +233,31 @@ mod tests { let blob: Blob = BLOB.into(); assert_eq!(blob.as_str().unwrap(), BLOB); - let data: protocol::TypedData = blob.into(); - assert_eq!(data.get_string(), BLOB); + let data: TypedData = blob.into(); + assert_eq!(data.data, Some(Data::String(BLOB.to_string()))); } #[test] fn it_has_json_content() { #[derive(Serialize, Deserialize)] - struct Data { + struct SerializedData { message: String, }; const MESSAGE: &'static str = "test"; - let data = Data { + let data = SerializedData { message: MESSAGE.to_string(), }; let blob: Blob = ::serde_json::to_value(data).unwrap().into(); - assert_eq!(blob.as_json::().unwrap().message, MESSAGE); + assert_eq!(blob.as_json::().unwrap().message, MESSAGE); - let data: protocol::TypedData = blob.into(); - assert_eq!(data.get_json(), r#"{"message":"test"}"#); + let data: TypedData = blob.into(); + assert_eq!( + data.data, + Some(Data::Json(r#"{"message":"test"}"#.to_string())) + ); } #[test] @@ -293,8 +267,8 @@ mod tests { let blob: Blob = BLOB.into(); assert_eq!(blob.as_bytes(), BLOB); - let data: protocol::TypedData = blob.into(); - assert_eq!(data.get_bytes(), BLOB); + let data: TypedData = blob.into(); + assert_eq!(data.data, Some(Data::Bytes(BLOB.to_owned()))); } #[test] @@ -343,8 +317,9 @@ mod tests { fn it_converts_from_typed_data() { const BLOB: &'static str = "hello world!"; - let mut data = protocol::TypedData::new(); - data.set_string(BLOB.to_string()); + let data = TypedData { + data: Some(Data::String(BLOB.to_string())), + }; let blob: Blob = data.into(); assert_eq!(blob.as_str().unwrap(), BLOB); @@ -389,18 +364,15 @@ mod tests { #[test] fn it_converts_to_typed_data() { let blob: Blob = "test".into(); - let data: protocol::TypedData = blob.into(); - assert!(data.has_string()); - assert_eq!(data.get_string(), "test"); + let data: TypedData = blob.into(); + assert_eq!(data.data, Some(Data::String("test".to_string()))); let blob: Blob = to_value("test").unwrap().into(); - let data: protocol::TypedData = blob.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#""test""#); + let data: TypedData = blob.into(); + assert_eq!(data.data, Some(Data::Json(r#""test""#.to_string()))); let blob: Blob = vec![1, 2, 3].into(); - let data: protocol::TypedData = blob.into(); - assert!(data.has_bytes()); - assert_eq!(data.get_bytes(), [1, 2, 3]); + let data: TypedData = blob.into(); + assert_eq!(data.data, Some(Data::Bytes(vec![1, 2, 3]))); } } diff --git a/azure-functions/src/bindings/blob_trigger.rs b/azure-functions/src/bindings/blob_trigger.rs index 73ecde7..d9bfead 100644 --- a/azure-functions/src/bindings/blob_trigger.rs +++ b/azure-functions/src/bindings/blob_trigger.rs @@ -1,7 +1,9 @@ -use crate::bindings::Blob; -use crate::blob::Properties; -use crate::rpc::protocol; -use crate::util::convert_from; +use crate::{ + bindings::Blob, + blob::Properties, + rpc::{typed_data::Data, TypedData}, + util::convert_from, +}; use serde_json::from_str; use std::collections::HashMap; @@ -51,27 +53,35 @@ pub struct BlobTrigger { impl BlobTrigger { #[doc(hidden)] - pub fn new( - data: protocol::TypedData, - metadata: &mut HashMap, - ) -> Self { + pub fn new(data: TypedData, metadata: &mut HashMap) -> Self { BlobTrigger { blob: data.into(), path: metadata - .get_mut(PATH_KEY) - .map_or(String::new(), protocol::TypedData::take_string), - uri: metadata.get(URI_KEY).map_or(String::new(), |x| { - convert_from(x) - .unwrap_or_else(|| panic!("failed to read '{}' from metadata", URI_KEY)) + .remove(PATH_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for 'path' metadata key"), + }) + .expect("expected a blob path"), + uri: metadata.get(URI_KEY).map_or(String::new(), |data| { + convert_from(data).unwrap_or_else(|| panic!("failed to convert uri")) }), properties: metadata - .get(PROPERTIES_KEY) - .map_or(Default::default(), |x| { - from_str(x.get_json()).expect("failed to deserialize blob properties") + .remove(PROPERTIES_KEY) + .map_or(Properties::default(), |data| match data.data { + Some(Data::Json(s)) => { + from_str(&s).expect("failed to deserialize blob properties") + } + _ => panic!("expected a string for properties"), + }), + metadata: metadata + .remove(METADATA_KEY) + .map_or(HashMap::new(), |data| match data.data { + Some(Data::Json(s)) => { + from_str(&s).expect("failed to deserialize blob metadata") + } + _ => panic!("expected a string for metadata"), }), - metadata: metadata.get(METADATA_KEY).map_or(Default::default(), |x| { - from_str(x.get_json()).expect("failed to deserialize blob metadata") - }), } } } @@ -130,31 +140,41 @@ mod tests { "BlobTierLastModifiedTime": null }); - let mut data = protocol::TypedData::new(); - data.set_string(BLOB.to_string()); + let data = TypedData { + data: Some(Data::String(BLOB.to_string())), + }; - let mut metadata = HashMap::new(); - - let mut value = protocol::TypedData::new(); - value.set_string(PATH.to_string()); - metadata.insert(PATH_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_json("\"".to_string() + URI + "\""); - metadata.insert(URI_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_json(properties.to_string()); - metadata.insert(PROPERTIES_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); let mut user_metadata = HashMap::new(); user_metadata.insert( USER_METADAT_KEY.to_string(), USER_METADATA_VALUE.to_string(), ); - value.set_json(to_string(&user_metadata).unwrap()); - metadata.insert(METADATA_KEY.to_string(), value); + + let mut metadata = HashMap::new(); + metadata.insert( + PATH_KEY.to_string(), + TypedData { + data: Some(Data::String(PATH.to_string())), + }, + ); + metadata.insert( + URI_KEY.to_string(), + TypedData { + data: Some(Data::Json("\"".to_string() + URI + "\"")), + }, + ); + metadata.insert( + PROPERTIES_KEY.to_string(), + TypedData { + data: Some(Data::Json(properties.to_string())), + }, + ); + metadata.insert( + METADATA_KEY.to_string(), + TypedData { + data: Some(Data::Json(to_string(&user_metadata).unwrap())), + }, + ); let trigger = BlobTrigger::new(data, &mut metadata); assert_eq!(trigger.path, PATH); diff --git a/azure-functions/src/bindings/cosmos_db_document.rs b/azure-functions/src/bindings/cosmos_db_document.rs index fc64564..fe1ce45 100644 --- a/azure-functions/src/bindings/cosmos_db_document.rs +++ b/azure-functions/src/bindings/cosmos_db_document.rs @@ -1,4 +1,9 @@ -use crate::{http::Body, rpc::protocol, util::convert_from, FromVec, IntoVec}; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, + util::convert_from, + FromVec, IntoVec, +}; use serde_json::{from_str, Map, Value}; use std::borrow::Cow; use std::fmt; @@ -152,7 +157,7 @@ impl From for CosmosDbDocument { } #[doc(hidden)] -impl IntoVec for protocol::TypedData { +impl IntoVec for TypedData { fn into_vec(self) -> Vec { if self.data.is_none() { return vec![]; @@ -168,17 +173,19 @@ impl IntoVec for protocol::TypedData { } #[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(Value::Array(vec.into_iter().map(|d| d.0).collect()).to_string()); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(|d| d.0).collect()).to_string(), + )), + } } } #[doc(hidden)] -impl From for CosmosDbDocument { - fn from(data: protocol::TypedData) -> Self { +impl From for CosmosDbDocument { + fn from(data: TypedData) -> Self { if data.data.is_none() { return CosmosDbDocument(Value::Null); } @@ -227,11 +234,11 @@ impl<'a> Into> for Vec { } #[doc(hidden)] -impl Into for CosmosDbDocument { - fn into(self) -> protocol::TypedData { - let mut data = protocol::TypedData::new(); - data.set_json(self.0.to_string()); - data +impl Into for CosmosDbDocument { + fn into(self) -> TypedData { + TypedData { + data: Some(Data::Json(self.0.to_string())), + } } } @@ -312,10 +319,11 @@ mod tests { #[test] fn it_converts_from_typed_data() { - let mut data = protocol::TypedData::new(); - data.set_json(r#"{ "foo": "bar" }"#.to_string()); + let document: CosmosDbDocument = TypedData { + data: Some(Data::Json(r#"{ "foo": "bar" }"#.to_string())), + } + .into(); - let document: CosmosDbDocument = data.into(); let data = document.as_object().unwrap(); assert_eq!(data["foo"].as_str().unwrap(), "bar"); } @@ -326,8 +334,7 @@ mod tests { let data = document.as_object().unwrap(); assert_eq!(data["foo"].as_str().unwrap(), "bar"); - let data: protocol::TypedData = document.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#"{"foo":"bar"}"#); + let data: TypedData = document.into(); + assert_eq!(data.data, Some(Data::Json(r#"{"foo":"bar"}"#.to_string()))); } } diff --git a/azure-functions/src/bindings/cosmos_db_trigger.rs b/azure-functions/src/bindings/cosmos_db_trigger.rs index 0a6d722..a6eabfc 100644 --- a/azure-functions/src/bindings/cosmos_db_trigger.rs +++ b/azure-functions/src/bindings/cosmos_db_trigger.rs @@ -1,5 +1,4 @@ -use crate::rpc::protocol; -use crate::util::convert_from; +use crate::{rpc::TypedData, util::convert_from}; use serde_json::Value; use std::collections::HashMap; @@ -58,10 +57,7 @@ pub struct CosmosDbTrigger { impl CosmosDbTrigger { #[doc(hidden)] - pub fn new( - data: protocol::TypedData, - _metadata: &mut HashMap, - ) -> Self { + pub fn new(data: TypedData, _metadata: &mut HashMap) -> Self { let value = convert_from(&data).expect("expected JSON document data"); match value { Value::Array(array) => CosmosDbTrigger { documents: array }, @@ -73,6 +69,7 @@ impl CosmosDbTrigger { #[cfg(test)] mod tests { use super::*; + use crate::rpc::typed_data::Data; #[test] fn it_constructs() { @@ -103,8 +100,9 @@ mod tests { } ]"#; - let mut data = protocol::TypedData::new(); - data.set_json(DOCUMENTS.to_string()); + let data = TypedData { + data: Some(Data::Json(DOCUMENTS.to_string())), + }; let mut metadata = HashMap::new(); let trigger = CosmosDbTrigger::new(data, &mut metadata); diff --git a/azure-functions/src/bindings/event_grid_event.rs b/azure-functions/src/bindings/event_grid_event.rs index 1795841..0c5eca3 100644 --- a/azure-functions/src/bindings/event_grid_event.rs +++ b/azure-functions/src/bindings/event_grid_event.rs @@ -1,5 +1,7 @@ -use crate::rpc::protocol; -use crate::util::deserialize_datetime; +use crate::{ + rpc::{typed_data::Data, TypedData}, + util::deserialize_datetime, +}; use chrono::{DateTime, Utc}; use serde_derive::Deserialize; use serde_json::from_str; @@ -51,12 +53,11 @@ pub struct EventGridEvent { impl EventGridEvent { #[doc(hidden)] - pub fn new(data: protocol::TypedData, _: &mut HashMap) -> Self { - if !data.has_json() { - panic!("expected JSON data for Event Grid trigger binding"); + pub fn new(data: TypedData, _: &mut HashMap) -> Self { + match data.data { + Some(Data::Json(s)) => from_str(&s).expect("failed to parse Event Grid JSON"), + _ => panic!("expected JSON data for Event Grid trigger binding"), } - - from_str(data.get_json()).expect("failed to parse Event Grid JSON") } } @@ -68,8 +69,9 @@ mod tests { fn it_constructs() { const EVENT: &'static str = r#"{"topic":"/subscriptions/{subscription-id}/resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/xstoretestaccount","subject":"/blobServices/default/containers/oc2d2817345i200097container/blobs/oc2d2817345i20002296blob","eventType":"Microsoft.Storage.BlobCreated","eventTime":"2017-06-26T18:41:00.9584103Z","id":"831e1650-001e-001b-66ab-eeb76e069631","data":{"api":"PutBlockList","clientRequestId":"6d79dbfb-0e37-4fc4-981f-442c9ca65760","requestId":"831e1650-001e-001b-66ab-eeb76e000000","eTag":"0x8D4BCC2E4835CD0","contentType":"application/octet-stream","contentLength":524288,"blobType":"BlockBlob","url":"https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob","sequencer":"00000000000004420000000000028963","storageDiagnostics":{"batchId":"b68529f3-68cd-4744-baa4-3c0498ec19f0"}},"dataVersion":"1","metadataVersion":"1"}"#; - let mut data = protocol::TypedData::new(); - data.set_json(EVENT.to_string()); + let data = TypedData { + data: Some(Data::Json(EVENT.to_string())), + }; let mut metadata = HashMap::new(); diff --git a/azure-functions/src/bindings/event_hub_message.rs b/azure-functions/src/bindings/event_hub_message.rs index 0fa5564..476d55c 100644 --- a/azure-functions/src/bindings/event_hub_message.rs +++ b/azure-functions/src/bindings/event_hub_message.rs @@ -1,4 +1,8 @@ -use crate::{http::Body, rpc::protocol, FromVec}; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, + FromVec, +}; use serde::de::Error; use serde::Deserialize; use serde_json::{from_str, Result, Value}; @@ -58,44 +62,31 @@ use std::str::from_utf8; /// } /// ``` #[derive(Debug, Clone)] -pub struct EventHubMessage(protocol::TypedData); +pub struct EventHubMessage(TypedData); impl EventHubMessage { /// Gets the content of the message as a string. /// /// Returns None if there is no valid string representation of the message. pub fn as_str(&self) -> Option<&str> { - if self.0.has_string() { - return Some(self.0.get_string()); + match &self.0.data { + Some(Data::String(s)) => Some(s), + Some(Data::Json(s)) => Some(s), + Some(Data::Bytes(b)) => from_utf8(b).ok(), + Some(Data::Stream(s)) => from_utf8(s).ok(), + _ => None, } - if self.0.has_json() { - return Some(self.0.get_json()); - } - if self.0.has_bytes() { - return from_utf8(self.0.get_bytes()).map(|s| s).ok(); - } - if self.0.has_stream() { - return from_utf8(self.0.get_stream()).map(|s| s).ok(); - } - None } /// Gets the content of the message as a slice of bytes. pub fn as_bytes(&self) -> &[u8] { - if self.0.has_string() { - return self.0.get_string().as_bytes(); + match &self.0.data { + Some(Data::String(s)) => s.as_bytes(), + Some(Data::Json(s)) => s.as_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for Event Hub message contents"), } - if self.0.has_json() { - return self.0.get_json().as_bytes(); - } - if self.0.has_bytes() { - return self.0.get_bytes(); - } - if self.0.has_stream() { - return self.0.get_stream(); - } - - panic!("unexpected data for Event Hub message contents"); } /// Deserializes the message as JSON to the requested type. @@ -119,162 +110,136 @@ impl fmt::Display for EventHubMessage { impl<'a> From<&'a str> for EventHubMessage { fn from(content: &'a str) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content.to_owned()); - EventHubMessage(data) + EventHubMessage(TypedData { + data: Some(Data::String(content.to_owned())), + }) } } impl From for EventHubMessage { fn from(content: String) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content); - EventHubMessage(data) + EventHubMessage(TypedData { + data: Some(Data::String(content)), + }) } } impl From<&Value> for EventHubMessage { fn from(content: &Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - EventHubMessage(data) + EventHubMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl From for EventHubMessage { fn from(content: Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - EventHubMessage(data) + EventHubMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl<'a> From<&'a [u8]> for EventHubMessage { fn from(content: &'a [u8]) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content.to_owned()); - EventHubMessage(data) + EventHubMessage(TypedData { + data: Some(Data::Bytes(content.to_owned())), + }) } } impl From> for EventHubMessage { fn from(content: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content); + EventHubMessage(TypedData { + data: Some(Data::Bytes(content)), + }) + } +} + +#[doc(hidden)] +impl From for EventHubMessage { + fn from(data: TypedData) -> Self { EventHubMessage(data) } } #[doc(hidden)] -impl From for EventHubMessage { - fn from(data: protocol::TypedData) -> Self { - EventHubMessage(data) - } -} - -#[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(Value::Array(vec.into_iter().map(Into::into).collect()).to_string()); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(Into::into).collect()).to_string(), + )), + } } } impl Into for EventHubMessage { - fn into(mut self) -> String { - if self.0.has_string() { - return self.0.take_string(); + fn into(self) -> String { + match self.0.data { + Some(Data::String(s)) => s, + Some(Data::Json(s)) => s, + Some(Data::Bytes(b)) => { + String::from_utf8(b).expect("Event Hub message does not contain valid UTF-8 bytes") + } + Some(Data::Stream(s)) => { + String::from_utf8(s).expect("Event Hub message does not contain valid UTF-8 bytes") + } + _ => panic!("unexpected data for Event Hub message content"), } - if self.0.has_json() { - return self.0.take_json(); - } - if self.0.has_bytes() { - return String::from_utf8(self.0.take_bytes()) - .expect("Event Hub message does not contain valid UTF-8 bytes"); - } - if self.0.has_stream() { - return String::from_utf8(self.0.take_stream()) - .expect("Event Hub message does not contain valid UTF-8 bytes"); - } - panic!("unexpected data for Event Hub message content"); } } impl Into for EventHubMessage { - fn into(mut self) -> Value { - if self.0.has_string() { - return Value::String(self.0.take_string()); - } - if self.0.has_json() { - return from_str(self.0.get_json()) - .expect("queue message does not contain valid JSON data"); - } - // TODO: this is not an efficient encoding - if self.0.has_bytes() { - return Value::Array( - self.0 - .get_bytes() - .iter() + fn into(self) -> Value { + // TODO: this is not an efficient encoding for bytes/stream + match self.0.data { + Some(Data::String(s)) => Value::String(s), + Some(Data::Json(s)) => { + from_str(&s).expect("Event Hub message does not contain valid JSON data") + } + Some(Data::Bytes(b)) => Value::Array( + b.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); - } - // TODO: this is not an efficient encoding - if self.0.has_stream() { - return Value::Array( - self.0 - .get_stream() - .iter() + ), + Some(Data::Stream(s)) => Value::Array( + s.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); + ), + _ => panic!("unexpected data for Event Hub message content"), } - panic!("unexpected data for Event Hub message content"); } } impl Into> for EventHubMessage { - fn into(mut self) -> Vec { - if self.0.has_string() { - return self.0.take_string().into_bytes(); + fn into(self) -> Vec { + match self.0.data { + Some(Data::String(s)) => s.into_bytes(), + Some(Data::Json(s)) => s.into_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for Event Hub message content"), } - if self.0.has_json() { - return self.0.take_json().into_bytes(); - } - if self.0.has_bytes() { - return self.0.take_bytes(); - } - if self.0.has_stream() { - return self.0.take_stream(); - } - - panic!("unexpected data for Event Hub message content"); } } impl<'a> Into> for EventHubMessage { - fn into(mut self) -> Body<'a> { - if self.0.has_string() { - return self.0.take_string().into(); + fn into(self) -> Body<'a> { + match self.0.data { + Some(Data::String(s)) => s.into(), + Some(Data::Json(s)) => Body::Json(Cow::from(s)), + Some(Data::Bytes(b)) => b.into(), + Some(Data::Stream(s)) => s.into(), + _ => panic!("unexpected data for Event Hub message content"), } - if self.0.has_json() { - return Body::Json(Cow::from(self.0.take_json())); - } - if self.0.has_bytes() { - return self.0.take_bytes().into(); - } - if self.0.has_stream() { - return self.0.take_stream().into(); - } - - panic!("unexpected data for blob content"); } } #[doc(hidden)] -impl Into for EventHubMessage { - fn into(self) -> protocol::TypedData { +impl Into for EventHubMessage { + fn into(self) -> TypedData { self.0 } } @@ -293,28 +258,34 @@ mod tests { let message: EventHubMessage = MESSAGE.into(); assert_eq!(message.as_str().unwrap(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_string(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String(MESSAGE.to_string()))); } #[test] fn it_has_json_content() { #[derive(Serialize, Deserialize)] - struct Data { + struct SerializedData { message: String, }; const MESSAGE: &'static str = "test"; - let data = Data { + let data = SerializedData { message: MESSAGE.to_string(), }; let message: EventHubMessage = ::serde_json::to_value(data).unwrap().into(); - assert_eq!(message.as_json::().unwrap().message, MESSAGE); + assert_eq!( + message.as_json::().unwrap().message, + MESSAGE + ); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_json(), r#"{"message":"test"}"#); + let data: TypedData = message.into(); + assert_eq!( + data.data, + Some(Data::Json(r#"{"message":"test"}"#.to_string())) + ); } #[test] @@ -324,8 +295,8 @@ mod tests { let message: EventHubMessage = MESSAGE.into(); assert_eq!(message.as_bytes(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_bytes(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes(MESSAGE.to_owned()))); } #[test] @@ -409,18 +380,15 @@ mod tests { #[test] fn it_converts_to_typed_data() { let message: EventHubMessage = "test".into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_string()); - assert_eq!(data.get_string(), "test"); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String("test".to_string()))); let message: EventHubMessage = to_value("test").unwrap().into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#""test""#); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Json(r#""test""#.to_string()))); let message: EventHubMessage = vec![1, 2, 3].into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_bytes()); - assert_eq!(data.get_bytes(), [1, 2, 3]); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes([1, 2, 3].to_vec()))); } } diff --git a/azure-functions/src/bindings/event_hub_trigger.rs b/azure-functions/src/bindings/event_hub_trigger.rs index ea64c53..7482f9a 100644 --- a/azure-functions/src/bindings/event_hub_trigger.rs +++ b/azure-functions/src/bindings/event_hub_trigger.rs @@ -1,7 +1,9 @@ -use crate::bindings::EventHubMessage; -use crate::event_hub::{PartitionContext, SystemProperties}; -use crate::rpc::protocol; -use crate::util::convert_from; +use crate::{ + bindings::EventHubMessage, + event_hub::{PartitionContext, SystemProperties}, + rpc::{typed_data::Data, TypedData}, + util::convert_from, +}; use chrono::{DateTime, Utc}; use serde_json::{from_str, Value}; use std::collections::HashMap; @@ -59,17 +61,18 @@ pub struct EventHubTrigger { impl EventHubTrigger { #[doc(hidden)] - pub fn new( - data: protocol::TypedData, - metadata: &mut HashMap, - ) -> Self { + pub fn new(data: TypedData, metadata: &mut HashMap) -> Self { EventHubTrigger { message: data.into(), partition_context: from_str( - metadata + match &metadata .get(PARTITION_CONTEXT_KEY) .expect("expected partition context") - .get_json(), + .data + { + Some(Data::Json(s)) => s, + _ => panic!("expected JSON data for partition context"), + }, ) .expect("failed to deserialize partition context"), enqueued_time: convert_from( @@ -79,14 +82,21 @@ impl EventHubTrigger { ) .expect("failed to convert enqueued time"), offset: metadata - .get_mut(OFFSET_KEY) - .expect("expected offset") - .take_string(), + .remove(OFFSET_KEY) + .map(|offset| match offset.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for offset"), + }) + .expect("expected offset"), properties: from_str( - metadata + match &metadata .get(PROPERTIES_KEY) .expect("expected properties") - .get_json(), + .data + { + Some(Data::Json(s)) => s, + _ => panic!("expected JSON data for properties"), + }, ) .expect("failed to deserialize properties"), sequence_number: convert_from( @@ -96,10 +106,14 @@ impl EventHubTrigger { ) .expect("failed to convert sequence number"), system_properties: from_str( - metadata + match &metadata .get(SYSTEM_PROPERTIES_KEY) .expect("expected system properties") - .get_json(), + .data + { + Some(Data::Json(s)) => s, + _ => panic!("expected JSON data for system properties"), + }, ) .expect("failed to deserialize system properties"), } @@ -128,8 +142,9 @@ mod tests { const USER_PROPERTY_VALUE: &str = "property value"; const PARTITION_KEY: &str = "partition key"; - let mut data = protocol::TypedData::new(); - data.set_string(MESSAGE.to_string()); + let data = TypedData { + data: Some(Data::String(MESSAGE.to_string())), + }; let mut metadata = HashMap::new(); @@ -156,29 +171,44 @@ mod tests { enqueued_time: DateTime::::from_str(ENQUEUED_TIME).unwrap(), }; - let mut value = protocol::TypedData::new(); - value.set_json(serde_json::to_string(&context).unwrap()); - metadata.insert(PARTITION_CONTEXT_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_string(ENQUEUED_TIME.to_string()); - metadata.insert(ENQUEUED_TIME_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_string(OFFSET.to_string()); - metadata.insert(OFFSET_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_json(properties.to_string()); - metadata.insert(PROPERTIES_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_int(SEQUENCE_NUMBER); - metadata.insert(SEQUENCE_NUMBER_KEY.to_string(), value); - - let mut value = protocol::TypedData::new(); - value.set_json(serde_json::to_string(&system_properties).unwrap()); - metadata.insert(SYSTEM_PROPERTIES_KEY.to_string(), value); + metadata.insert( + PARTITION_CONTEXT_KEY.to_string(), + TypedData { + data: Some(Data::Json(serde_json::to_string(&context).unwrap())), + }, + ); + metadata.insert( + ENQUEUED_TIME_KEY.to_string(), + TypedData { + data: Some(Data::String(ENQUEUED_TIME.to_string())), + }, + ); + metadata.insert( + OFFSET_KEY.to_string(), + TypedData { + data: Some(Data::String(OFFSET.to_string())), + }, + ); + metadata.insert( + PROPERTIES_KEY.to_string(), + TypedData { + data: Some(Data::Json(properties.to_string())), + }, + ); + metadata.insert( + SEQUENCE_NUMBER_KEY.to_string(), + TypedData { + data: Some(Data::Int(SEQUENCE_NUMBER)), + }, + ); + metadata.insert( + SYSTEM_PROPERTIES_KEY.to_string(), + TypedData { + data: Some(Data::Json( + serde_json::to_string(&system_properties).unwrap(), + )), + }, + ); let trigger = EventHubTrigger::new(data, &mut metadata); diff --git a/azure-functions/src/bindings/http_request.rs b/azure-functions/src/bindings/http_request.rs index 527333c..c96a551 100644 --- a/azure-functions/src/bindings/http_request.rs +++ b/azure-functions/src/bindings/http_request.rs @@ -1,5 +1,7 @@ -use crate::http::Body; -use crate::rpc::protocol; +use crate::{ + http::Body, + rpc::{typed_data::Data, RpcHttp, TypedData}, +}; use std::collections::HashMap; /// Represents a HTTP trigger binding. @@ -32,7 +34,7 @@ use std::collections::HashMap; /// } /// ``` #[derive(Debug)] -pub struct HttpRequest(protocol::RpcHttp); +pub struct HttpRequest(RpcHttp); impl HttpRequest { /// Gets the HTTP method (e.g. "GET") for the request. @@ -104,24 +106,21 @@ impl HttpRequest { /// Gets the body of the request. pub fn body(&self) -> Body { - if self.0.has_body() { - Body::from(self.0.get_body()) - } else { - Body::Empty - } + self.0 + .body + .as_ref() + .map(|b| Body::from(&**b)) + .unwrap_or(Body::Empty) } } impl HttpRequest { #[doc(hidden)] - pub fn new( - mut data: protocol::TypedData, - _: &mut HashMap, - ) -> Self { - if !data.has_http() { - panic!("unexpected type data for HTTP request."); + pub fn new(data: TypedData, _: &mut HashMap) -> Self { + match data.data { + Some(Data::Http(http)) => HttpRequest(*http), + _ => panic!("unexpected type data for HTTP request."), } - HttpRequest(data.take_http()) } } @@ -135,10 +134,12 @@ mod tests { fn it_has_the_method() { const METHOD: &'static str = "GET"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - http.set_method(METHOD.to_string()); - data.set_http(http); + let mut http = RpcHttp::default(); + http.method = METHOD.to_string(); + + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -150,10 +151,12 @@ mod tests { fn it_has_the_url() { const URL: &'static str = "http://example.com"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - http.set_url(URL.to_string()); - data.set_http(http); + let mut http = RpcHttp::default(); + http.url = URL.to_string(); + + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -166,12 +169,12 @@ mod tests { const KEY: &'static str = "Accept"; const VALUE: &'static str = "application/json"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut headers = HashMap::new(); - headers.insert(KEY.to_string(), VALUE.to_string()); - http.set_headers(headers); - data.set_http(http); + let mut http = RpcHttp::default(); + http.headers.insert(KEY.to_string(), VALUE.to_string()); + + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -184,12 +187,12 @@ mod tests { const KEY: &'static str = "id"; const VALUE: &'static str = "12345"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut params = HashMap::new(); - params.insert(KEY.to_string(), VALUE.to_string()); - http.set_params(params); - data.set_http(http); + let mut http = RpcHttp::default(); + http.params.insert(KEY.to_string(), VALUE.to_string()); + + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -202,12 +205,12 @@ mod tests { const KEY: &'static str = "name"; const VALUE: &'static str = "Peter"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut params = HashMap::new(); - params.insert(KEY.to_string(), VALUE.to_string()); - http.set_query(params); - data.set_http(http); + let mut http = RpcHttp::default(); + http.query.insert(KEY.to_string(), VALUE.to_string()); + + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -217,10 +220,9 @@ mod tests { #[test] fn it_has_an_empty_body() { - let mut data = protocol::TypedData::new(); - let http = protocol::RpcHttp::new(); - - data.set_http(http); + let data = TypedData { + data: Some(Data::Http(Box::new(RpcHttp::default()))), + }; let mut metadata = HashMap::new(); @@ -232,13 +234,14 @@ mod tests { fn it_has_a_string_body() { const BODY: &'static str = "TEXT BODY"; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut body = protocol::TypedData::new(); + let mut http = RpcHttp::default(); + http.body = Some(Box::new(TypedData { + data: Some(Data::String(BODY.to_string())), + })); - body.set_string(BODY.to_string()); - http.set_body(body); - data.set_http(http); + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -250,13 +253,14 @@ mod tests { fn it_has_a_json_body() { const BODY: &'static str = r#"{ "json": "body" }"#; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut body = protocol::TypedData::new(); + let mut http = RpcHttp::default(); + http.body = Some(Box::new(TypedData { + data: Some(Data::Json(BODY.to_string())), + })); - body.set_json(BODY.to_string()); - http.set_body(body); - data.set_http(http); + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -268,13 +272,14 @@ mod tests { fn it_has_a_bytes_body() { const BODY: &'static [u8] = &[0, 1, 2]; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut body = protocol::TypedData::new(); + let mut http = RpcHttp::default(); + http.body = Some(Box::new(TypedData { + data: Some(Data::Bytes(BODY.to_vec())), + })); - body.set_bytes(BODY.to_owned()); - http.set_body(body); - data.set_http(http); + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); @@ -286,13 +291,14 @@ mod tests { fn it_has_a_stream_body() { const BODY: &'static [u8] = &[0, 1, 2]; - let mut data = protocol::TypedData::new(); - let mut http = protocol::RpcHttp::new(); - let mut body = protocol::TypedData::new(); + let mut http = RpcHttp::default(); + http.body = Some(Box::new(TypedData { + data: Some(Data::Stream(BODY.to_vec())), + })); - body.set_stream(BODY.to_owned()); - http.set_body(body); - data.set_http(http); + let data = TypedData { + data: Some(Data::Http(Box::new(http))), + }; let mut metadata = HashMap::new(); diff --git a/azure-functions/src/bindings/http_response.rs b/azure-functions/src/bindings/http_response.rs index 57b065e..f33c317 100644 --- a/azure-functions/src/bindings/http_response.rs +++ b/azure-functions/src/bindings/http_response.rs @@ -1,5 +1,7 @@ -use crate::http::{Body, ResponseBuilder, Status}; -use crate::rpc::protocol; +use crate::{ + http::{Body, ResponseBuilder, Status}, + rpc::{typed_data::Data, RpcHttp, TypedData}, +}; use std::collections::HashMap; /// Represents a HTTP output binding. @@ -69,14 +71,14 @@ use std::collections::HashMap; /// ``` #[derive(Default, Debug)] pub struct HttpResponse { - pub(crate) data: protocol::RpcHttp, + pub(crate) data: RpcHttp, pub(crate) status: Status, } impl HttpResponse { pub(crate) fn new() -> Self { HttpResponse { - data: protocol::RpcHttp::new(), + data: RpcHttp::default(), status: Status::Ok, } } @@ -122,11 +124,11 @@ impl HttpResponse { /// assert_eq!(response.body().as_str().unwrap(), "example"); /// ``` pub fn body(&self) -> Body { - if self.data.has_body() { - Body::from(self.data.get_body()) - } else { - Body::Empty - } + self.data + .body + .as_ref() + .map(|b| Body::from(&**b)) + .unwrap_or(Body::Empty) } /// Gets the headers of the response. @@ -160,13 +162,13 @@ impl From for HttpResponse { } #[doc(hidden)] -impl Into for HttpResponse { - fn into(mut self) -> protocol::TypedData { - self.data.set_status_code(self.status.to_string()); +impl Into for HttpResponse { + fn into(mut self) -> TypedData { + self.data.status_code = self.status.to_string(); - let mut data = protocol::TypedData::new(); - data.set_http(self.data); - data + TypedData { + data: Some(Data::Http(Box::new(self.data))), + } } } @@ -270,13 +272,19 @@ mod tests { .body("body") .into(); - let data: protocol::TypedData = response.into(); - assert!(data.has_http()); - - let http = data.get_http(); - assert_eq!(http.get_status_code(), "400"); - assert_eq!(http.get_headers().get("header").unwrap(), "value"); - assert!(http.get_body().has_string()); - assert_eq!(http.get_body().get_string(), "body"); + let data: TypedData = response.into(); + match data.data { + Some(Data::Http(http)) => { + assert_eq!(http.status_code, "400"); + assert_eq!(http.headers.get("header").unwrap(), "value"); + assert_eq!( + http.body, + Some(Box::new(TypedData { + data: Some(Data::String("body".to_string())) + })) + ); + } + _ => assert!(false), + } } } diff --git a/azure-functions/src/bindings/queue_message.rs b/azure-functions/src/bindings/queue_message.rs index 414303b..fe38fa4 100644 --- a/azure-functions/src/bindings/queue_message.rs +++ b/azure-functions/src/bindings/queue_message.rs @@ -1,4 +1,8 @@ -use crate::{http::Body, rpc::protocol, FromVec}; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, + FromVec, +}; use serde::de::Error; use serde::Deserialize; use serde_json::{from_str, Result, Value}; @@ -59,44 +63,31 @@ use std::str::from_utf8; /// } /// ``` #[derive(Debug, Clone)] -pub struct QueueMessage(protocol::TypedData); +pub struct QueueMessage(TypedData); impl QueueMessage { /// Gets the content of the message as a string. /// /// Returns None if there is no valid string representation of the message. pub fn as_str(&self) -> Option<&str> { - if self.0.has_string() { - return Some(self.0.get_string()); + match &self.0.data { + Some(Data::String(s)) => Some(s), + Some(Data::Json(s)) => Some(s), + Some(Data::Bytes(b)) => from_utf8(b).ok(), + Some(Data::Stream(s)) => from_utf8(s).ok(), + _ => None, } - if self.0.has_json() { - return Some(self.0.get_json()); - } - if self.0.has_bytes() { - return from_utf8(self.0.get_bytes()).map(|s| s).ok(); - } - if self.0.has_stream() { - return from_utf8(self.0.get_stream()).map(|s| s).ok(); - } - None } /// Gets the content of the message as a slice of bytes. pub fn as_bytes(&self) -> &[u8] { - if self.0.has_string() { - return self.0.get_string().as_bytes(); + match &self.0.data { + Some(Data::String(s)) => s.as_bytes(), + Some(Data::Json(s)) => s.as_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for queue message content"), } - if self.0.has_json() { - return self.0.get_json().as_bytes(); - } - if self.0.has_bytes() { - return self.0.get_bytes(); - } - if self.0.has_stream() { - return self.0.get_stream(); - } - - panic!("unexpected data for queue message content"); } /// Deserializes the message as JSON to the requested type. @@ -119,162 +110,136 @@ impl fmt::Display for QueueMessage { impl<'a> From<&'a str> for QueueMessage { fn from(content: &'a str) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content.to_owned()); - QueueMessage(data) + QueueMessage(TypedData { + data: Some(Data::String(content.to_owned())), + }) } } impl From for QueueMessage { fn from(content: String) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content); - QueueMessage(data) + QueueMessage(TypedData { + data: Some(Data::String(content)), + }) } } impl From<&Value> for QueueMessage { fn from(content: &Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - QueueMessage(data) + QueueMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl From for QueueMessage { fn from(content: Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - QueueMessage(data) + QueueMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl<'a> From<&'a [u8]> for QueueMessage { fn from(content: &'a [u8]) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content.to_owned()); - QueueMessage(data) + QueueMessage(TypedData { + data: Some(Data::Bytes(content.to_owned())), + }) } } impl From> for QueueMessage { fn from(content: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content); + QueueMessage(TypedData { + data: Some(Data::Bytes(content)), + }) + } +} + +#[doc(hidden)] +impl From for QueueMessage { + fn from(data: TypedData) -> Self { QueueMessage(data) } } #[doc(hidden)] -impl From for QueueMessage { - fn from(data: protocol::TypedData) -> Self { - QueueMessage(data) - } -} - -#[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(Value::Array(vec.into_iter().map(Into::into).collect()).to_string()); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(Into::into).collect()).to_string(), + )), + } } } impl Into for QueueMessage { - fn into(mut self) -> String { - if self.0.has_string() { - return self.0.take_string(); + fn into(self) -> String { + match self.0.data { + Some(Data::String(s)) => s, + Some(Data::Json(s)) => s, + Some(Data::Bytes(b)) => { + String::from_utf8(b).expect("queue message does not contain valid UTF-8 bytes") + } + Some(Data::Stream(s)) => { + String::from_utf8(s).expect("queue message does not contain valid UTF-8 bytes") + } + _ => panic!("unexpected data for queue message content"), } - if self.0.has_json() { - return self.0.take_json(); - } - if self.0.has_bytes() { - return String::from_utf8(self.0.take_bytes()) - .expect("queue message does not contain valid UTF-8 bytes"); - } - if self.0.has_stream() { - return String::from_utf8(self.0.take_stream()) - .expect("queue message does not contain valid UTF-8 bytes"); - } - panic!("unexpected data for queue message content"); } } impl Into for QueueMessage { - fn into(mut self) -> Value { - if self.0.has_string() { - return Value::String(self.0.take_string()); - } - if self.0.has_json() { - return from_str(self.0.get_json()) - .expect("queue message does not contain valid JSON data"); - } - // TODO: this is not an efficient encoding - if self.0.has_bytes() { - return Value::Array( - self.0 - .get_bytes() - .iter() + fn into(self) -> Value { + // TODO: this is not an efficient encoding for bytes/stream + match self.0.data { + Some(Data::String(s)) => Value::String(s), + Some(Data::Json(s)) => { + from_str(&s).expect("queue message does not contain valid JSON data") + } + Some(Data::Bytes(b)) => Value::Array( + b.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); - } - // TODO: this is not an efficient encoding - if self.0.has_stream() { - return Value::Array( - self.0 - .get_stream() - .iter() + ), + Some(Data::Stream(s)) => Value::Array( + s.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); + ), + _ => panic!("unexpected data for queue message content"), } - panic!("unexpected data for queue message content"); } } impl Into> for QueueMessage { - fn into(mut self) -> Vec { - if self.0.has_string() { - return self.0.take_string().into_bytes(); + fn into(self) -> Vec { + match self.0.data { + Some(Data::String(s)) => s.into_bytes(), + Some(Data::Json(s)) => s.into_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for queue message content"), } - if self.0.has_json() { - return self.0.take_json().into_bytes(); - } - if self.0.has_bytes() { - return self.0.take_bytes(); - } - if self.0.has_stream() { - return self.0.take_stream(); - } - - panic!("unexpected data for queue message content"); } } impl<'a> Into> for QueueMessage { - fn into(mut self) -> Body<'a> { - if self.0.has_string() { - return self.0.take_string().into(); + fn into(self) -> Body<'a> { + match self.0.data { + Some(Data::String(s)) => s.into(), + Some(Data::Json(s)) => Body::Json(Cow::from(s)), + Some(Data::Bytes(b)) => b.into(), + Some(Data::Stream(s)) => s.into(), + _ => panic!("unexpected data for queue message content"), } - if self.0.has_json() { - return Body::Json(Cow::from(self.0.take_json())); - } - if self.0.has_bytes() { - return self.0.take_bytes().into(); - } - if self.0.has_stream() { - return self.0.take_stream().into(); - } - - panic!("unexpected data for queue message content"); } } #[doc(hidden)] -impl Into for QueueMessage { - fn into(self) -> protocol::TypedData { +impl Into for QueueMessage { + fn into(self) -> TypedData { self.0 } } @@ -293,28 +258,34 @@ mod tests { let message: QueueMessage = MESSAGE.into(); assert_eq!(message.as_str().unwrap(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_string(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String(MESSAGE.to_string()))); } #[test] fn it_has_json_content() { #[derive(Serialize, Deserialize)] - struct Data { + struct SerializedData { message: String, }; const MESSAGE: &'static str = "test"; - let data = Data { + let data = SerializedData { message: MESSAGE.to_string(), }; let message: QueueMessage = ::serde_json::to_value(data).unwrap().into(); - assert_eq!(message.as_json::().unwrap().message, MESSAGE); + assert_eq!( + message.as_json::().unwrap().message, + MESSAGE + ); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_json(), r#"{"message":"test"}"#); + let data: TypedData = message.into(); + assert_eq!( + data.data, + Some(Data::Json(r#"{"message":"test"}"#.to_string())) + ); } #[test] @@ -324,8 +295,8 @@ mod tests { let message: QueueMessage = MESSAGE.into(); assert_eq!(message.as_bytes(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_bytes(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes([1, 2, 3].to_vec()))); } #[test] @@ -409,18 +380,15 @@ mod tests { #[test] fn it_converts_to_typed_data() { let message: QueueMessage = "test".into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_string()); - assert_eq!(data.get_string(), "test"); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String("test".to_string()))); let message: QueueMessage = to_value("test").unwrap().into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#""test""#); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Json(r#""test""#.to_string()))); let message: QueueMessage = vec![1, 2, 3].into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_bytes()); - assert_eq!(data.get_bytes(), [1, 2, 3]); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes([1, 2, 3].to_vec()))); } } diff --git a/azure-functions/src/bindings/queue_trigger.rs b/azure-functions/src/bindings/queue_trigger.rs index 52a1992..abed775 100644 --- a/azure-functions/src/bindings/queue_trigger.rs +++ b/azure-functions/src/bindings/queue_trigger.rs @@ -1,6 +1,8 @@ -use crate::bindings::QueueMessage; -use crate::rpc::protocol; -use crate::util::convert_from; +use crate::{ + bindings::QueueMessage, + rpc::{typed_data::Data, TypedData}, + util::convert_from, +}; use chrono::{DateTime, Utc}; use std::collections::HashMap; @@ -56,16 +58,16 @@ pub struct QueueTrigger { impl QueueTrigger { #[doc(hidden)] - pub fn new( - data: protocol::TypedData, - metadata: &mut HashMap, - ) -> Self { + pub fn new(data: TypedData, metadata: &mut HashMap) -> Self { QueueTrigger { message: data.into(), id: metadata - .get_mut(ID_KEY) - .expect("expected a message id") - .take_string(), + .remove(ID_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for message id"), + }) + .expect("expected a message id"), dequeue_count: convert_from( metadata .get(DEQUEUE_COUNT_KEY) @@ -91,9 +93,12 @@ impl QueueTrigger { ) .expect("failed to convert next visible time"), pop_receipt: metadata - .get_mut(POP_RECEIPT_KEY) - .expect("expected a pop receipt") - .take_string(), + .remove(POP_RECEIPT_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for pop receipt"), + }) + .expect("expected a pop receipt"), } } } @@ -110,34 +115,53 @@ mod tests { const MESSAGE: &'static str = "\"hello world\""; let now = Utc::now(); - let mut data = protocol::TypedData::new(); - data.set_json(MESSAGE.to_string()); + let data = TypedData { + data: Some(Data::Json(MESSAGE.to_string())), + }; let mut metadata = HashMap::new(); - let mut value = protocol::TypedData::new(); - value.set_string(ID.to_string()); - metadata.insert(ID_KEY.to_string(), value); + metadata.insert( + ID_KEY.to_string(), + TypedData { + data: Some(Data::String(ID.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_json(DEQUEUE_COUNT.to_string()); - metadata.insert(DEQUEUE_COUNT_KEY.to_string(), value); + metadata.insert( + DEQUEUE_COUNT_KEY.to_string(), + TypedData { + data: Some(Data::Json(DEQUEUE_COUNT.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(now.to_rfc3339()); - metadata.insert(EXPIRATION_TIME_KEY.to_string(), value); + metadata.insert( + EXPIRATION_TIME_KEY.to_string(), + TypedData { + data: Some(Data::String(now.to_rfc3339())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(now.to_rfc3339()); - metadata.insert(INSERTION_TIME_KEY.to_string(), value); + metadata.insert( + INSERTION_TIME_KEY.to_string(), + TypedData { + data: Some(Data::String(now.to_rfc3339())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_json("\"".to_string() + &now.to_rfc3339() + "\""); - metadata.insert(NEXT_VISIBLE_TIME_KEY.to_string(), value); + metadata.insert( + NEXT_VISIBLE_TIME_KEY.to_string(), + TypedData { + data: Some(Data::Json("\"".to_string() + &now.to_rfc3339() + "\"")), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(POP_RECEIPT.to_string()); - metadata.insert(POP_RECEIPT_KEY.to_string(), value); + metadata.insert( + POP_RECEIPT_KEY.to_string(), + TypedData { + data: Some(Data::String(POP_RECEIPT.to_string())), + }, + ); let trigger = QueueTrigger::new(data, &mut metadata); assert_eq!(trigger.id, ID); diff --git a/azure-functions/src/bindings/service_bus_message.rs b/azure-functions/src/bindings/service_bus_message.rs index 3cb2ea1..c98668b 100644 --- a/azure-functions/src/bindings/service_bus_message.rs +++ b/azure-functions/src/bindings/service_bus_message.rs @@ -1,4 +1,8 @@ -use crate::{http::Body, rpc::protocol, FromVec}; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, + FromVec, +}; use serde::de::Error; use serde::Deserialize; use serde_json::{from_str, Result, Value}; @@ -63,44 +67,31 @@ use std::str::from_utf8; /// } /// ``` #[derive(Debug, Clone)] -pub struct ServiceBusMessage(protocol::TypedData); +pub struct ServiceBusMessage(TypedData); impl ServiceBusMessage { /// Gets the content of the message as a string. /// /// Returns None if there is no valid string representation of the message. pub fn as_str(&self) -> Option<&str> { - if self.0.has_string() { - return Some(self.0.get_string()); + match &self.0.data { + Some(Data::String(s)) => Some(s), + Some(Data::Json(s)) => Some(s), + Some(Data::Bytes(b)) => from_utf8(b).ok(), + Some(Data::Stream(s)) => from_utf8(s).ok(), + _ => None, } - if self.0.has_json() { - return Some(self.0.get_json()); - } - if self.0.has_bytes() { - return from_utf8(self.0.get_bytes()).map(|s| s).ok(); - } - if self.0.has_stream() { - return from_utf8(self.0.get_stream()).map(|s| s).ok(); - } - None } /// Gets the content of the message as a slice of bytes. pub fn as_bytes(&self) -> &[u8] { - if self.0.has_string() { - return self.0.get_string().as_bytes(); + match &self.0.data { + Some(Data::String(s)) => s.as_bytes(), + Some(Data::Json(s)) => s.as_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for service bus message content"), } - if self.0.has_json() { - return self.0.get_json().as_bytes(); - } - if self.0.has_bytes() { - return self.0.get_bytes(); - } - if self.0.has_stream() { - return self.0.get_stream(); - } - - panic!("unexpected data for service bus message content"); } /// Deserializes the message as JSON to the requested type. @@ -124,162 +115,134 @@ impl fmt::Display for ServiceBusMessage { impl<'a> From<&'a str> for ServiceBusMessage { fn from(content: &'a str) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content.to_owned()); - ServiceBusMessage(data) + ServiceBusMessage(TypedData { + data: Some(Data::String(content.to_owned())), + }) } } impl From for ServiceBusMessage { fn from(content: String) -> Self { - let mut data = protocol::TypedData::new(); - data.set_string(content); - ServiceBusMessage(data) + ServiceBusMessage(TypedData { + data: Some(Data::String(content)), + }) } } impl From<&Value> for ServiceBusMessage { fn from(content: &Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - ServiceBusMessage(data) + ServiceBusMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl From for ServiceBusMessage { fn from(content: Value) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(content.to_string()); - ServiceBusMessage(data) + ServiceBusMessage(TypedData { + data: Some(Data::Json(content.to_string())), + }) } } impl<'a> From<&'a [u8]> for ServiceBusMessage { fn from(content: &'a [u8]) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content.to_owned()); - ServiceBusMessage(data) + ServiceBusMessage(TypedData { + data: Some(Data::Bytes(content.to_owned())), + }) } } impl From> for ServiceBusMessage { fn from(content: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_bytes(content); + ServiceBusMessage(TypedData { + data: Some(Data::Bytes(content)), + }) + } +} + +#[doc(hidden)] +impl From for ServiceBusMessage { + fn from(data: TypedData) -> Self { ServiceBusMessage(data) } } #[doc(hidden)] -impl From for ServiceBusMessage { - fn from(data: protocol::TypedData) -> Self { - ServiceBusMessage(data) - } -} - -#[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json(Value::Array(vec.into_iter().map(Into::into).collect()).to_string()); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(Into::into).collect()).to_string(), + )), + } } } impl Into for ServiceBusMessage { - fn into(mut self) -> String { - if self.0.has_string() { - return self.0.take_string(); + fn into(self) -> String { + match self.0.data { + Some(Data::String(s)) => s, + Some(Data::Json(s)) => s, + Some(Data::Bytes(b)) => String::from_utf8(b) + .expect("service bus message does not contain valid UTF-8 bytes"), + Some(Data::Stream(s)) => String::from_utf8(s) + .expect("service bus message does not contain valid UTF-8 bytes"), + _ => panic!("unexpected data for service bus message content"), } - if self.0.has_json() { - return self.0.take_json(); - } - if self.0.has_bytes() { - return String::from_utf8(self.0.take_bytes()) - .expect("service bus message does not contain valid UTF-8 bytes"); - } - if self.0.has_stream() { - return String::from_utf8(self.0.take_stream()) - .expect("service bus message does not contain valid UTF-8 bytes"); - } - panic!("unexpected data for service bus message content"); } } impl Into for ServiceBusMessage { - fn into(mut self) -> Value { - if self.0.has_string() { - return Value::String(self.0.take_string()); - } - if self.0.has_json() { - return from_str(self.0.get_json()) - .expect("service bus message does not contain valid JSON data"); - } - // TODO: this is not an efficient encoding - if self.0.has_bytes() { - return Value::Array( - self.0 - .get_bytes() - .iter() + fn into(self) -> Value { + // TODO: this is not an efficient encoding for bytes/stream + match self.0.data { + Some(Data::String(s)) => Value::String(s), + Some(Data::Json(s)) => { + from_str(&s).expect("service bus message does not contain valid JSON data") + } + Some(Data::Bytes(b)) => Value::Array( + b.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); - } - // TODO: this is not an efficient encoding - if self.0.has_stream() { - return Value::Array( - self.0 - .get_stream() - .iter() + ), + Some(Data::Stream(s)) => Value::Array( + s.iter() .map(|n| Value::Number(u64::from(*n).into())) .collect(), - ); + ), + _ => panic!("unexpected data for service bus message content"), } - panic!("unexpected data for service bus message content"); } } impl Into> for ServiceBusMessage { - fn into(mut self) -> Vec { - if self.0.has_string() { - return self.0.take_string().into_bytes(); + fn into(self) -> Vec { + match self.0.data { + Some(Data::String(s)) => s.into_bytes(), + Some(Data::Json(s)) => s.into_bytes(), + Some(Data::Bytes(b)) => b, + Some(Data::Stream(s)) => s, + _ => panic!("unexpected data for service bus message content"), } - if self.0.has_json() { - return self.0.take_json().into_bytes(); - } - if self.0.has_bytes() { - return self.0.take_bytes(); - } - if self.0.has_stream() { - return self.0.take_stream(); - } - - panic!("unexpected data for service bus message content"); } } impl<'a> Into> for ServiceBusMessage { - fn into(mut self) -> Body<'a> { - if self.0.has_string() { - return self.0.take_string().into(); + fn into(self) -> Body<'a> { + match self.0.data { + Some(Data::String(s)) => s.into(), + Some(Data::Json(s)) => Body::Json(Cow::from(s)), + Some(Data::Bytes(b)) => b.into(), + Some(Data::Stream(s)) => s.into(), + _ => panic!("unexpected data for service bus message content"), } - if self.0.has_json() { - return Body::Json(Cow::from(self.0.take_json())); - } - if self.0.has_bytes() { - return self.0.take_bytes().into(); - } - if self.0.has_stream() { - return self.0.take_stream().into(); - } - - panic!("unexpected data for service bus message content"); } } #[doc(hidden)] -impl Into for ServiceBusMessage { - fn into(self) -> protocol::TypedData { +impl Into for ServiceBusMessage { + fn into(self) -> TypedData { self.0 } } @@ -298,28 +261,34 @@ mod tests { let message: ServiceBusMessage = MESSAGE.into(); assert_eq!(message.as_str().unwrap(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_string(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String(MESSAGE.to_string()))); } #[test] fn it_has_json_content() { #[derive(Serialize, Deserialize)] - struct Data { + struct SerializedData { message: String, }; const MESSAGE: &'static str = "test"; - let data = Data { + let data = SerializedData { message: MESSAGE.to_string(), }; let message: ServiceBusMessage = ::serde_json::to_value(data).unwrap().into(); - assert_eq!(message.as_json::().unwrap().message, MESSAGE); + assert_eq!( + message.as_json::().unwrap().message, + MESSAGE + ); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_json(), r#"{"message":"test"}"#); + let data: TypedData = message.into(); + assert_eq!( + data.data, + Some(Data::Json(r#"{"message":"test"}"#.to_string())) + ); } #[test] @@ -329,8 +298,8 @@ mod tests { let message: ServiceBusMessage = MESSAGE.into(); assert_eq!(message.as_bytes(), MESSAGE); - let data: protocol::TypedData = message.into(); - assert_eq!(data.get_bytes(), MESSAGE); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes(MESSAGE.to_vec()))); } #[test] @@ -414,18 +383,15 @@ mod tests { #[test] fn it_converts_to_typed_data() { let message: ServiceBusMessage = "test".into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_string()); - assert_eq!(data.get_string(), "test"); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::String("test".to_string()))); let message: ServiceBusMessage = to_value("test").unwrap().into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#""test""#); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Json(r#""test""#.to_string()))); let message: ServiceBusMessage = vec![1, 2, 3].into(); - let data: protocol::TypedData = message.into(); - assert!(data.has_bytes()); - assert_eq!(data.get_bytes(), [1, 2, 3]); + let data: TypedData = message.into(); + assert_eq!(data.data, Some(Data::Bytes([1, 2, 3].to_vec()))); } } diff --git a/azure-functions/src/bindings/service_bus_trigger.rs b/azure-functions/src/bindings/service_bus_trigger.rs index 5a324d6..ae0ad85 100644 --- a/azure-functions/src/bindings/service_bus_trigger.rs +++ b/azure-functions/src/bindings/service_bus_trigger.rs @@ -1,6 +1,8 @@ -use crate::bindings::ServiceBusMessage; -use crate::rpc::protocol; -use crate::util::convert_from; +use crate::{ + bindings::ServiceBusMessage, + rpc::{typed_data::Data, TypedData}, + util::convert_from, +}; use chrono::{DateTime, Utc}; use serde_json::{from_str, Map, Value}; use std::collections::HashMap; @@ -95,10 +97,7 @@ pub struct ServiceBusTrigger { impl ServiceBusTrigger { #[doc(hidden)] - pub fn new( - data: protocol::TypedData, - metadata: &mut HashMap, - ) -> Self { + pub fn new(data: TypedData, metadata: &mut HashMap) -> Self { ServiceBusTrigger { message: data.into(), delivery_count: convert_from( @@ -107,9 +106,12 @@ impl ServiceBusTrigger { .expect("expected a delivery count"), ) .expect("failed to convert delivery count"), - dead_letter_source: metadata - .get_mut(DEAD_LETTER_SOURCE_KEY) - .map(protocol::TypedData::take_string), + dead_letter_source: metadata.remove(DEAD_LETTER_SOURCE_KEY).map(|data| { + match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for dead letter source"), + } + }), expiration_time: convert_from( metadata .get(EXPIRATION_TIME_KEY) @@ -123,34 +125,49 @@ impl ServiceBusTrigger { ) .expect("failed to convert enqueued time"), message_id: metadata - .get_mut(MESSAGE_ID_KEY) - .expect("expected a message id") - .take_string(), + .remove(MESSAGE_ID_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for message id"), + }) + .expect("expected a message id"), content_type: metadata - .get_mut(CONTENT_TYPE_KEY) - .map(protocol::TypedData::take_string), - reply_to: metadata - .get_mut(REPLY_TO_KEY) - .map(protocol::TypedData::take_string), + .remove(CONTENT_TYPE_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for content type"), + }), + reply_to: metadata.remove(REPLY_TO_KEY).map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for reply to"), + }), sequence_number: convert_from( metadata .get(SEQUENCE_NUMBER_KEY) .expect("expected a sequence number"), ) .expect("failed to convert sequence number"), - to: metadata - .get_mut(TO_KEY) - .map(protocol::TypedData::take_string), - label: metadata - .get_mut(LABEL_KEY) - .map(protocol::TypedData::take_string), + to: metadata.remove(TO_KEY).map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for to"), + }), + label: metadata.remove(LABEL_KEY).map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for label"), + }), correlation_id: metadata - .get_mut(CORRELATION_ID_KEY) - .map(protocol::TypedData::take_string), + .remove(CORRELATION_ID_KEY) + .map(|data| match data.data { + Some(Data::String(s)) => s, + _ => panic!("expected a string for correlation id"), + }), user_properties: from_str( metadata .get(USER_PROPERTIES_KEY) - .map(protocol::TypedData::get_json) + .map(|data| match &data.data { + Some(Data::Json(s)) => s.as_str(), + _ => panic!("expected JSON data for user properties"), + }) .unwrap_or("{}"), ) .expect("failed to convert user properties"), @@ -177,58 +194,95 @@ mod tests { const MESSAGE: &'static str = "\"hello world\""; let now = Utc::now(); - let mut data = protocol::TypedData::new(); - data.set_json(MESSAGE.to_string()); + let data = TypedData { + data: Some(Data::Json(MESSAGE.to_string())), + }; let mut metadata = HashMap::new(); - let mut value = protocol::TypedData::new(); - value.set_int(DELIVERY_COUNT.into()); - metadata.insert(DELIVERY_COUNT_KEY.to_string(), value); + metadata.insert( + DELIVERY_COUNT_KEY.to_string(), + TypedData { + data: Some(Data::Int(DELIVERY_COUNT as i64)), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(DEAD_LETTER_SOURCE.to_string()); - metadata.insert(DEAD_LETTER_SOURCE_KEY.to_string(), value); + metadata.insert( + DEAD_LETTER_SOURCE_KEY.to_string(), + TypedData { + data: Some(Data::String(DEAD_LETTER_SOURCE.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(now.to_rfc3339()); - metadata.insert(EXPIRATION_TIME_KEY.to_string(), value); + metadata.insert( + EXPIRATION_TIME_KEY.to_string(), + TypedData { + data: Some(Data::String(now.to_rfc3339())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(now.to_rfc3339()); - metadata.insert(ENQUEUED_TIME_KEY.to_string(), value); + metadata.insert( + ENQUEUED_TIME_KEY.to_string(), + TypedData { + data: Some(Data::String(now.to_rfc3339())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(MESSAGE_ID.to_string()); - metadata.insert(MESSAGE_ID_KEY.to_string(), value); + metadata.insert( + MESSAGE_ID_KEY.to_string(), + TypedData { + data: Some(Data::String(MESSAGE_ID.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(CONTENT_TYPE.to_string()); - metadata.insert(CONTENT_TYPE_KEY.to_string(), value); + metadata.insert( + CONTENT_TYPE_KEY.to_string(), + TypedData { + data: Some(Data::String(CONTENT_TYPE.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(REPLY_TO.to_string()); - metadata.insert(REPLY_TO_KEY.to_string(), value); + metadata.insert( + REPLY_TO_KEY.to_string(), + TypedData { + data: Some(Data::String(REPLY_TO.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_int(SEQUENCE_NUMBER); - metadata.insert(SEQUENCE_NUMBER_KEY.to_string(), value); + metadata.insert( + SEQUENCE_NUMBER_KEY.to_string(), + TypedData { + data: Some(Data::Int(SEQUENCE_NUMBER)), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(TO.to_string()); - metadata.insert(TO_KEY.to_string(), value); + metadata.insert( + TO_KEY.to_string(), + TypedData { + data: Some(Data::String(TO.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(LABEL.to_string()); - metadata.insert(LABEL_KEY.to_string(), value); + metadata.insert( + LABEL_KEY.to_string(), + TypedData { + data: Some(Data::String(LABEL.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_string(CORRELATION_ID.to_string()); - metadata.insert(CORRELATION_ID_KEY.to_string(), value); + metadata.insert( + CORRELATION_ID_KEY.to_string(), + TypedData { + data: Some(Data::String(CORRELATION_ID.to_string())), + }, + ); - let mut value = protocol::TypedData::new(); - value.set_json(USER_PROPERTIES.to_string()); - metadata.insert(USER_PROPERTIES_KEY.to_string(), value); + metadata.insert( + USER_PROPERTIES_KEY.to_string(), + TypedData { + data: Some(Data::Json(USER_PROPERTIES.to_string())), + }, + ); let trigger = ServiceBusTrigger::new(data, &mut metadata); diff --git a/azure-functions/src/bindings/signalr_connection_info.rs b/azure-functions/src/bindings/signalr_connection_info.rs index 13bb84a..b06951c 100644 --- a/azure-functions/src/bindings/signalr_connection_info.rs +++ b/azure-functions/src/bindings/signalr_connection_info.rs @@ -1,5 +1,7 @@ -use crate::http::Body; -use crate::rpc::protocol; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, +}; use serde_derive::{Deserialize, Serialize}; use serde_json::{from_str, to_string}; use std::borrow::Cow; @@ -47,9 +49,12 @@ pub struct SignalRConnectionInfo { } #[doc(hidden)] -impl From for SignalRConnectionInfo { - fn from(data: protocol::TypedData) -> Self { - from_str(data.get_json()).expect("failed to parse SignalR connection info") +impl From for SignalRConnectionInfo { + fn from(data: TypedData) -> Self { + match &data.data { + Some(Data::Json(s)) => from_str(s).expect("failed to parse SignalR connection info"), + _ => panic!("expected JSON data for SignalR connection info"), + } } } @@ -78,8 +83,11 @@ mod tests { #[test] fn it_converts_from_typed_data() { - let mut data = protocol::TypedData::new(); - data.set_json(r#"{ "url": "foo", "accessToken": "bar"}"#.to_owned()); + let data = TypedData { + data: Some(Data::Json( + r#"{ "url": "foo", "accessToken": "bar"}"#.to_owned(), + )), + }; let info: SignalRConnectionInfo = data.into(); assert_eq!(info.url, "foo"); diff --git a/azure-functions/src/bindings/signalr_group_action.rs b/azure-functions/src/bindings/signalr_group_action.rs index 66a355e..795eeb3 100644 --- a/azure-functions/src/bindings/signalr_group_action.rs +++ b/azure-functions/src/bindings/signalr_group_action.rs @@ -1,4 +1,8 @@ -use crate::{rpc::protocol, signalr::GroupAction, FromVec}; +use crate::{ + rpc::{typed_data::Data, TypedData}, + signalr::GroupAction, + FromVec, +}; use serde_derive::{Deserialize, Serialize}; use serde_json::{to_string, to_value, Value}; @@ -46,25 +50,24 @@ pub struct SignalRGroupAction { } #[doc(hidden)] -impl Into for SignalRGroupAction { - fn into(self) -> protocol::TypedData { - let mut data = protocol::TypedData::new(); - data.set_json( - to_string(&self).expect("failed to convert SignalR group action to JSON string"), - ); - - data +impl Into for SignalRGroupAction { + fn into(self) -> TypedData { + TypedData { + data: Some(Data::Json( + to_string(&self).expect("failed to convert SignalR group action to JSON string"), + )), + } } } #[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json( - Value::Array(vec.into_iter().map(|a| to_value(a).unwrap()).collect()).to_string(), - ); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(|a| to_value(a).unwrap()).collect()).to_string(), + )), + } } } @@ -92,10 +95,12 @@ mod tests { action: GroupAction::Remove, }; - let data: protocol::TypedData = action.into(); + let data: TypedData = action.into(); assert_eq!( - data.get_json(), - r#"{"groupName":"foo","userId":"bar","action":"remove"}"# + data.data, + Some(Data::Json( + r#"{"groupName":"foo","userId":"bar","action":"remove"}"#.to_string() + )) ); } } diff --git a/azure-functions/src/bindings/signalr_message.rs b/azure-functions/src/bindings/signalr_message.rs index 91558ad..a5bf252 100644 --- a/azure-functions/src/bindings/signalr_message.rs +++ b/azure-functions/src/bindings/signalr_message.rs @@ -1,4 +1,7 @@ -use crate::{rpc::protocol, FromVec}; +use crate::{ + rpc::{typed_data::Data, TypedData}, + FromVec, +}; use serde_derive::{Deserialize, Serialize}; use serde_json::{to_string, to_value, Value}; @@ -49,22 +52,24 @@ pub struct SignalRMessage { } #[doc(hidden)] -impl Into for SignalRMessage { - fn into(self) -> protocol::TypedData { - let mut data = protocol::TypedData::new(); - data.set_json(to_string(&self).expect("failed to convert SignalR message to JSON string")); - data +impl Into for SignalRMessage { + fn into(self) -> TypedData { + TypedData { + data: Some(Data::Json( + to_string(&self).expect("failed to convert SignalR message to JSON string"), + )), + } } } #[doc(hidden)] -impl FromVec for protocol::TypedData { +impl FromVec for TypedData { fn from_vec(vec: Vec) -> Self { - let mut data = protocol::TypedData::new(); - data.set_json( - Value::Array(vec.into_iter().map(|m| to_value(m).unwrap()).collect()).to_string(), - ); - data + TypedData { + data: Some(Data::Json( + Value::Array(vec.into_iter().map(|m| to_value(m).unwrap()).collect()).to_string(), + )), + } } } @@ -106,10 +111,13 @@ mod tests { ], }; - let data: protocol::TypedData = message.into(); + let data: TypedData = message.into(); assert_eq!( - data.get_json(), - r#"{"userId":"foo","groupName":"bar","target":"baz","arguments":[1,"foo",false]}"# + data.data, + Some(Data::Json( + r#"{"userId":"foo","groupName":"bar","target":"baz","arguments":[1,"foo",false]}"# + .to_string() + )) ); } } diff --git a/azure-functions/src/bindings/table.rs b/azure-functions/src/bindings/table.rs index 4111c39..675a579 100644 --- a/azure-functions/src/bindings/table.rs +++ b/azure-functions/src/bindings/table.rs @@ -1,5 +1,7 @@ -use crate::http::Body; -use crate::rpc::protocol; +use crate::{ + http::Body, + rpc::{typed_data::Data, TypedData}, +}; use serde_json::{from_str, json, Map, Value}; use std::fmt; @@ -117,23 +119,24 @@ impl fmt::Display for Table { } #[doc(hidden)] -impl From for Table { - fn from(data: protocol::TypedData) -> Self { - if data.has_json() { - let mut rows: Value = - from_str(data.get_json()).expect("expected valid JSON data for table binding"); +impl From for Table { + fn from(data: TypedData) -> Self { + match &data.data { + Some(Data::Json(s)) => { + let mut rows: Value = + from_str(s).expect("expected valid JSON data for table binding"); - if rows.is_object() { - rows = Value::Array(vec![rows]); + if rows.is_object() { + rows = Value::Array(vec![rows]); + } + + if !rows.is_array() { + panic!("expected an object or array for table binding data"); + } + + Table(rows) } - - if !rows.is_array() { - panic!("expected an object or array for table binding data"); - } - - Table(rows) - } else { - Table::new() + _ => Table::new(), } } } @@ -151,11 +154,11 @@ impl<'a> Into> for Table { } #[doc(hidden)] -impl Into for Table { - fn into(self) -> protocol::TypedData { - let mut data = protocol::TypedData::new(); - data.set_json(self.0.to_string()); - data +impl Into for Table { + fn into(self) -> TypedData { + TypedData { + data: Some(Data::Json(self.0.to_string())), + } } } @@ -258,15 +261,17 @@ mod tests { const TABLE: &'static str = r#"[{"PartitionKey":"partition1","RowKey":"row1","data":"value"}]"#; - let mut data = protocol::TypedData::new(); - data.set_json(TABLE.to_string()); + let data = TypedData { + data: Some(Data::Json(TABLE.to_string())), + }; let table: Table = data.into(); assert_eq!(table.len(), 1); assert_eq!(table.to_string(), TABLE); - let mut data = protocol::TypedData::new(); - data.set_string("".to_string()); + let data = TypedData { + data: Some(Data::String("".to_string())), + }; let table: Table = data.into(); assert_eq!(table.len(), 0); @@ -291,8 +296,9 @@ mod tests { const TABLE: &'static str = r#"[{"PartitionKey":"partition1","RowKey":"row1","data":"value"}]"#; - let mut data = protocol::TypedData::new(); - data.set_json(TABLE.to_string()); + let data = TypedData { + data: Some(Data::Json(TABLE.to_string())), + }; let table: Table = data.into(); let body: Body = table.into(); @@ -309,11 +315,12 @@ mod tests { let row = table.add_row("partition1", "row1"); row.insert("data".to_string(), Value::String("value".to_string())); } - let data: protocol::TypedData = table.into(); - assert!(data.has_json()); + let data: TypedData = table.into(); assert_eq!( - data.get_json(), - r#"[{"PartitionKey":"partition1","RowKey":"row1","data":"value"}]"# + data.data, + Some(Data::Json( + r#"[{"PartitionKey":"partition1","RowKey":"row1","data":"value"}]"#.to_string() + )) ); } } diff --git a/azure-functions/src/bindings/timer_info.rs b/azure-functions/src/bindings/timer_info.rs index 898e277..b826b97 100644 --- a/azure-functions/src/bindings/timer_info.rs +++ b/azure-functions/src/bindings/timer_info.rs @@ -1,5 +1,7 @@ -use crate::rpc::protocol; -use crate::timer::ScheduleStatus; +use crate::{ + rpc::{typed_data::Data, TypedData}, + timer::ScheduleStatus, +}; use serde_derive::Deserialize; use serde_json::from_str; use std::collections::HashMap; @@ -43,12 +45,11 @@ pub struct TimerInfo { impl TimerInfo { #[doc(hidden)] - pub fn new(data: protocol::TypedData, _: &mut HashMap) -> Self { - if !data.has_json() { - panic!("expected JSON data for timer trigger binding"); + pub fn new(data: TypedData, _: &mut HashMap) -> Self { + match &data.data { + Some(Data::Json(s)) => from_str(s).expect("failed to parse timer JSON data"), + _ => panic!("expected JSON data for timer trigger binding"), } - - from_str(data.get_json()).expect("failed to parse timer JSON data") } } @@ -60,8 +61,9 @@ mod tests { fn it_has_json_data() { const JSON: &'static str = r#"{"ScheduleStatus":{"Last":"0001-01-01T00:00:00","Next":"2018-07-24T23:24:00-07:00","LastUpdated":"0001-01-01T00:00:00"},"IsPastDue":true}"#; - let mut data = protocol::TypedData::new(); - data.set_json(JSON.to_string()); + let data = TypedData { + data: Some(Data::Json(JSON.to_string())), + }; let mut metadata = HashMap::new(); diff --git a/azure-functions/src/cli.rs b/azure-functions/src/cli.rs index 06aed21..d9451eb 100644 --- a/azure-functions/src/cli.rs +++ b/azure-functions/src/cli.rs @@ -1,3 +1,4 @@ +use crate::commands::Run; use clap::{App, AppSettings, Arg, SubCommand}; use std::path::Path; @@ -65,43 +66,5 @@ pub fn create_app<'a, 'b>() -> App<'a, 'b> { .help("Use verbose output.") ) ) - .subcommand( - SubCommand::with_name("run") - .about("Runs the Rust language worker.") - .arg( - Arg::with_name("host") - .long("host") - .value_name("HOST") - .help("The hostname of the Azure Functions Host.") - .required(true), - ) - .arg( - Arg::with_name("port") - .long("port") - .value_name("PORT") - .help("The port of the Azure Functions Host.") - .required(true), - ) - .arg( - Arg::with_name("worker_id") - .long("workerId") - .value_name("WORKER_ID") - .help("The worker ID to use when registering with the Azure Functions Host.") - .required(true), - ) - .arg( - Arg::with_name("request_id") - .long("requestId") - .value_name("REQUEST_ID") - .help("The request ID to use when communicating with the Azure Functions Host.") - .hidden(true) - .required(true), - ) - .arg( - Arg::with_name("max_message_length") - .long("grpcMaxMessageLength") - .value_name("MAXIMUM") - .help("The maximum message length to use for gRPC messages.") - ) - ) + .subcommand(Run::create_subcommand()) } diff --git a/azure-functions/src/commands.rs b/azure-functions/src/commands.rs new file mode 100644 index 0000000..0003825 --- /dev/null +++ b/azure-functions/src/commands.rs @@ -0,0 +1,3 @@ +mod run; + +pub use self::run::*; diff --git a/azure-functions/src/commands/run.rs b/azure-functions/src/commands/run.rs new file mode 100644 index 0000000..d6bf093 --- /dev/null +++ b/azure-functions/src/commands/run.rs @@ -0,0 +1,392 @@ +use crate::{ + backtrace::Backtrace, + codegen::Function, + logger, + registry::Registry, + rpc::{ + client::FunctionRpc, status_result::Status, streaming_message::Content, + FunctionLoadRequest, FunctionLoadResponse, InvocationRequest, InvocationResponse, + StartStream, StatusResult, StreamingMessage, WorkerInitResponse, WorkerStatusRequest, + WorkerStatusResponse, + }, +}; +use clap::{App, Arg, ArgMatches, SubCommand}; +use futures::{future::lazy, sync::mpsc::unbounded, Future, Poll, Stream}; +use log::error; +use std::cell::RefCell; +use std::net::{IpAddr, SocketAddr}; +use std::panic::{catch_unwind, set_hook, AssertUnwindSafe, PanicInfo}; +use tokio::{ + executor::DefaultExecutor, + net::tcp::{ConnectFuture, TcpStream}, +}; +use tower_grpc::Request; +use tower_h2::client::Connect; +use tower_service::Service; +use tower_util::MakeService; + +const UNKNOWN: &str = ""; + +thread_local!(static FUNCTION_NAME: RefCell<&'static str> = RefCell::new(UNKNOWN)); + +type Sender = futures::sync::mpsc::UnboundedSender; + +struct HttpService(IpAddr, u16); + +impl Service<()> for HttpService { + type Response = TcpStream; + type Error = ::std::io::Error; + type Future = ConnectFuture; + + fn poll_ready(&mut self) -> Poll<(), Self::Error> { + Ok(().into()) + } + + fn call(&mut self, _: ()) -> Self::Future { + TcpStream::connect(&SocketAddr::new(self.0, self.1)) + } +} + +pub struct Run<'a> { + host: &'a str, + port: u16, + worker_id: &'a str, +} + +impl<'a> Run<'a> { + pub fn create_subcommand<'b>() -> App<'a, 'b> { + SubCommand::with_name("run") + .about("Runs the Rust language worker.") + .arg( + Arg::with_name("host") + .long("host") + .value_name("HOST") + .help("The hostname of the Azure Functions Host.") + .required(true), + ) + .arg( + Arg::with_name("port") + .long("port") + .value_name("PORT") + .help("The port of the Azure Functions Host.") + .required(true), + ) + .arg( + Arg::with_name("worker_id") + .long("workerId") + .value_name("WORKER_ID") + .help("The worker ID to use when registering with the Azure Functions Host.") + .required(true), + ) + .arg( + Arg::with_name("request_id") + .long("requestId") + .value_name("REQUEST_ID") + .help("The request ID to use when communicating with the Azure Functions Host.") + .hidden(true) + .required(true), + ) + .arg( + Arg::with_name("max_message_length") + .long("grpcMaxMessageLength") + .value_name("MAXIMUM") + .help("The maximum message length to use for gRPC messages."), + ) + } + + pub fn execute(&self, mut registry: Registry<'static>) -> Result<(), String> { + ctrlc::set_handler(|| {}).expect("failed setting SIGINT handler"); + + let uri = format!("http://{0}:{1}", self.host, self.port); + let (sender, receiver) = unbounded::(); + + // Start by sending a start stream message to the channel + // This will be sent to the host upon connection + sender + .unbounded_send(StreamingMessage { + content: Some(Content::StartStream(StartStream { + worker_id: self.worker_id.to_owned(), + })), + ..Default::default() + }) + .unwrap(); + + println!("Connecting to Azure Functions host at {}", uri); + + let run = Connect::new( + HttpService(self.host.parse().unwrap(), self.port), + Default::default(), + DefaultExecutor::current(), + ) + .make_service(()) + .map(move |conn| { + FunctionRpc::new( + tower_request_modifier::Builder::new() + .set_origin(uri) + .build(conn) + .unwrap(), + ) + }) + .map_err(|e| panic!("failed to connect to host: {}", e)) + .and_then(|mut client| { + client + .event_stream(Request::new( + receiver.map_err(|_| panic!("failed to receive from channel")), + )) + .map_err(|e| panic!("failed to start event stream: {}", e)) + }) + .and_then(move |stream| { + stream + .into_inner() + .into_future() + .map_err(|(e, _)| panic!("failed to read worker init request: {}", e)) + .and_then(move |(init_req, stream)| { + Run::handle_worker_init_request( + sender.clone(), + init_req.expect("expected a worker init request"), + ); + + stream + .for_each(move |req| { + Run::handle_request(&mut registry, sender.clone(), req); + Ok(()) + }) + .map_err(|e| panic!("fail to read request: {}", e)) + }) + }); + + tokio::run(run); + + Ok(()) + } + + fn handle_worker_init_request(sender: Sender, req: StreamingMessage) { + match req.content { + Some(Content::WorkerInitRequest(req)) => { + println!( + "Connected to Azure Functions host version {}.", + req.host_version + ); + + // TODO: use the level requested by the Azure functions host + log::set_boxed_logger(Box::new(logger::Logger::new( + log::Level::Info, + sender.clone(), + ))) + .expect("failed to set the global logger instance"); + + set_hook(Box::new(Run::handle_panic)); + + log::set_max_level(log::LevelFilter::Trace); + + sender + .unbounded_send(StreamingMessage { + content: Some(Content::WorkerInitResponse(WorkerInitResponse { + worker_version: env!("CARGO_PKG_VERSION").to_owned(), + result: Some(StatusResult { + status: Status::Success as i32, + ..Default::default() + }), + ..Default::default() + })), + ..Default::default() + }) + .unwrap(); + } + _ => panic!("expected a worker init request message from the host"), + }; + } + + fn handle_request(registry: &mut Registry<'static>, sender: Sender, req: StreamingMessage) { + match req.content { + Some(Content::FunctionLoadRequest(req)) => { + Run::handle_function_load_request(registry, sender, req) + } + Some(Content::InvocationRequest(req)) => { + Run::handle_invocation_request(registry, sender, req) + } + Some(Content::WorkerStatusRequest(req)) => { + Run::handle_worker_status_request(sender, req) + } + Some(Content::FileChangeEventRequest(_)) => {} + Some(Content::InvocationCancel(_)) => {} + Some(Content::FunctionEnvironmentReloadRequest(_)) => {} + _ => panic!("unexpected message from host: {:?}.", req), + }; + } + + fn handle_function_load_request( + registry: &mut Registry<'static>, + sender: Sender, + req: FunctionLoadRequest, + ) { + let mut result = StatusResult::default(); + + match req.metadata.as_ref() { + Some(metadata) => { + if registry.register(&req.function_id, &metadata.name) { + result.status = Status::Success as i32; + } else { + result.status = Status::Failure as i32; + result.result = format!("Function '{}' does not exist.", metadata.name); + } + } + None => { + result.status = Status::Failure as i32; + result.result = "Function load request metadata is missing.".to_string(); + } + }; + + sender + .unbounded_send(StreamingMessage { + content: Some(Content::FunctionLoadResponse(FunctionLoadResponse { + function_id: req.function_id, + result: Some(result), + ..Default::default() + })), + ..Default::default() + }) + .expect("failed to send function load response"); + } + + fn handle_invocation_request( + registry: &Registry<'static>, + sender: Sender, + req: InvocationRequest, + ) { + if let Some(func) = registry.get(&req.function_id) { + tokio::spawn(lazy(move || { + Run::invoke_function(func, sender, req); + Ok(()) + })); + return; + } + + let error = format!("Function with id '{}' does not exist.", req.function_id); + + sender + .unbounded_send(StreamingMessage { + content: Some(Content::InvocationResponse(InvocationResponse { + invocation_id: req.invocation_id, + result: Some(StatusResult { + status: Status::Failure as i32, + result: error, + ..Default::default() + }), + ..Default::default() + })), + ..Default::default() + }) + .expect("failed to send invocation response"); + } + + fn handle_worker_status_request(sender: Sender, _: WorkerStatusRequest) { + sender + .unbounded_send(StreamingMessage { + content: Some(Content::WorkerStatusResponse(WorkerStatusResponse {})), + ..Default::default() + }) + .expect("failed to send worker status response"); + } + + fn invoke_function(func: &'static Function, sender: Sender, mut req: InvocationRequest) { + // Set the function name in TLS + FUNCTION_NAME.with(|n| { + *n.borrow_mut() = &func.name; + }); + + // Set the invocation ID in TLS + logger::INVOCATION_ID.with(|id| { + id.borrow_mut().replace_range(.., &req.invocation_id); + }); + + let response = match catch_unwind(AssertUnwindSafe(|| { + (func + .invoker + .as_ref() + .expect("function must have an invoker"))(&func.name, &mut req) + })) { + Ok(res) => res, + Err(_) => InvocationResponse { + invocation_id: req.invocation_id, + result: Some(StatusResult { + status: Status::Failure as i32, + result: "Azure Function panicked: see log for more information.".to_string(), + ..Default::default() + }), + ..Default::default() + }, + }; + + // Clear the function name from TLS + FUNCTION_NAME.with(|n| { + *n.borrow_mut() = UNKNOWN; + }); + + // Clear the invocation ID from TLS + logger::INVOCATION_ID.with(|id| { + id.borrow_mut().clear(); + }); + + sender + .unbounded_send(StreamingMessage { + content: Some(Content::InvocationResponse(response)), + ..Default::default() + }) + .expect("failed to send invocation response"); + } + + fn handle_panic(info: &PanicInfo) { + let backtrace = Backtrace::new(); + match info.location() { + Some(location) => { + error!( + "Azure Function '{}' panicked with '{}', {}:{}:{}{}", + FUNCTION_NAME.with(|f| *f.borrow()), + info.payload() + .downcast_ref::<&str>() + .cloned() + .unwrap_or_else(|| info + .payload() + .downcast_ref::() + .map(String::as_str) + .unwrap_or(UNKNOWN)), + location.file(), + location.line(), + location.column(), + backtrace + ); + } + None => { + error!( + "Azure Function '{}' panicked with '{}'{}", + FUNCTION_NAME.with(|f| *f.borrow()), + info.payload() + .downcast_ref::<&str>() + .cloned() + .unwrap_or_else(|| info + .payload() + .downcast_ref::() + .map(String::as_str) + .unwrap_or(UNKNOWN)), + backtrace + ); + } + }; + } +} + +impl<'a> From<&'a ArgMatches<'a>> for Run<'a> { + fn from(args: &'a ArgMatches<'a>) -> Self { + Run { + host: args.value_of("host").expect("A host is required."), + port: args + .value_of("port") + .map(|port| port.parse::().expect("Invalid port number")) + .expect("A port number is required."), + worker_id: args + .value_of("worker_id") + .expect("A worker id is required."), + } + } +} diff --git a/azure-functions/src/http/body.rs b/azure-functions/src/http/body.rs index 95e8039..a887a09 100644 --- a/azure-functions/src/http/body.rs +++ b/azure-functions/src/http/body.rs @@ -1,6 +1,5 @@ -use crate::rpc::protocol; -use serde::de::Error; -use serde::Deserialize; +use crate::rpc::{typed_data::Data, TypedData}; +use serde::{de::Error, Deserialize}; use serde_json::{from_str, Result, Value}; use std::borrow::Cow; use std::fmt; @@ -127,22 +126,15 @@ impl fmt::Display for Body<'_> { } #[doc(hidden)] -impl<'a> From<&'a protocol::TypedData> for Body<'a> { - fn from(data: &'a protocol::TypedData) -> Self { - if data.has_string() { - return Body::String(Cow::Borrowed(data.get_string())); +impl<'a> From<&'a TypedData> for Body<'a> { + fn from(data: &'a TypedData) -> Self { + match &data.data { + Some(Data::String(s)) => Body::String(Cow::from(s)), + Some(Data::Json(s)) => Body::Json(Cow::from(s)), + Some(Data::Bytes(b)) => Body::Bytes(Cow::from(b)), + Some(Data::Stream(s)) => Body::Bytes(Cow::from(s)), + _ => Body::Empty, } - if data.has_json() { - return Body::Json(Cow::Borrowed(data.get_json())); - } - if data.has_bytes() { - return Body::Bytes(Cow::Borrowed(data.get_bytes())); - } - if data.has_stream() { - return Body::Bytes(Cow::Borrowed(data.get_stream())); - } - - Body::Empty } } @@ -183,18 +175,16 @@ impl From> for Body<'_> { } #[doc(hidden)] -impl Into for Body<'_> { - fn into(self) -> protocol::TypedData { - let mut data = protocol::TypedData::new(); - - match self { - Body::Empty => {} - Body::String(s) => data.set_string(s.into_owned()), - Body::Json(s) => data.set_json(s.into_owned()), - Body::Bytes(b) => data.set_bytes(b.into_owned()), - }; - - data +impl Into for Body<'_> { + fn into(self) -> TypedData { + TypedData { + data: match self { + Body::Empty => None, + Body::String(s) => Some(Data::String(s.into_owned())), + Body::Json(s) => Some(Data::Json(s.into_owned())), + Body::Bytes(b) => Some(Data::Bytes(b.into_owned())), + }, + } } } @@ -228,28 +218,31 @@ mod tests { let body: Body = BODY.into(); assert_eq!(body.as_str().unwrap(), BODY); - let data: protocol::TypedData = body.into(); - assert_eq!(data.get_string(), BODY); + let data: TypedData = body.into(); + assert_eq!(data.data, Some(Data::String(BODY.to_string()))); } #[test] fn it_has_a_json_body() { #[derive(Serialize, Deserialize)] - struct Data { + struct SerializedData { message: String, }; const MESSAGE: &'static str = "test"; - let data = Data { + let data = SerializedData { message: MESSAGE.to_string(), }; let body: Body = ::serde_json::to_value(data).unwrap().into(); - assert_eq!(body.as_json::().unwrap().message, MESSAGE); + assert_eq!(body.as_json::().unwrap().message, MESSAGE); - let data: protocol::TypedData = body.into(); - assert_eq!(data.get_json(), r#"{"message":"test"}"#); + let data: TypedData = body.into(); + assert_eq!( + data.data, + Some(Data::Json(r#"{"message":"test"}"#.to_string())) + ); } #[test] @@ -259,8 +252,8 @@ mod tests { let body: Body = BODY.into(); assert_eq!(body.as_bytes(), BODY); - let data: protocol::TypedData = body.into(); - assert_eq!(data.get_bytes(), BODY); + let data: TypedData = body.into(); + assert_eq!(data.data, Some(Data::Bytes(BODY.to_vec()))); } #[test] @@ -277,26 +270,31 @@ mod tests { #[test] fn it_converts_from_typed_data() { - let mut data = protocol::TypedData::new(); - data.set_string("test".to_string()); + let data = TypedData { + data: Some(Data::String("test".to_string())), + }; + let body: Body = (&data).into(); assert!(matches!(body, Body::String(_))); assert_eq!(body.as_str().unwrap(), "test"); - let mut data = protocol::TypedData::new(); - data.set_json("test".to_string()); + let data = TypedData { + data: Some(Data::Json("test".to_string())), + }; let body: Body = (&data).into(); assert!(matches!(body, Body::Json(_))); assert_eq!(body.as_str().unwrap(), "test"); - let mut data = protocol::TypedData::new(); - data.set_bytes(vec![0, 1, 2]); + let data = TypedData { + data: Some(Data::Bytes([0, 1, 2].to_vec())), + }; let body: Body = (&data).into(); assert!(matches!(body, Body::Bytes(_))); assert_eq!(body.as_bytes(), [0, 1, 2]); - let mut data = protocol::TypedData::new(); - data.set_stream(vec![0, 1, 2]); + let data = TypedData { + data: Some(Data::Stream([0, 1, 2].to_vec())), + }; let body: Body = (&data).into(); assert!(matches!(body, Body::Bytes(_))); assert_eq!(body.as_bytes(), [0, 1, 2]); @@ -340,22 +338,19 @@ mod tests { #[test] fn it_converts_to_typed_data() { let body = Body::Empty; - let data: protocol::TypedData = body.into(); + let data: TypedData = body.into(); assert!(data.data.is_none()); let body: Body = "test".into(); - let data: protocol::TypedData = body.into(); - assert!(data.has_string()); - assert_eq!(data.get_string(), "test"); + let data: TypedData = body.into(); + assert_eq!(data.data, Some(Data::String("test".to_string()))); let body: Body = to_value("test").unwrap().into(); - let data: protocol::TypedData = body.into(); - assert!(data.has_json()); - assert_eq!(data.get_json(), r#""test""#); + let data: TypedData = body.into(); + assert_eq!(data.data, Some(Data::Json(r#""test""#.to_string()))); let body: Body = vec![1, 2, 3].into(); - let data: protocol::TypedData = body.into(); - assert!(data.has_bytes()); - assert_eq!(data.get_bytes(), [1, 2, 3]); + let data: TypedData = body.into(); + assert_eq!(data.data, Some(Data::Bytes([1, 2, 3].to_vec()))); } } diff --git a/azure-functions/src/http/response_builder.rs b/azure-functions/src/http/response_builder.rs index 8d968ad..ad846e8 100644 --- a/azure-functions/src/http/response_builder.rs +++ b/azure-functions/src/http/response_builder.rs @@ -52,7 +52,7 @@ impl ResponseBuilder { /// ); /// ``` pub fn header, U: Into>(mut self, name: T, value: U) -> Self { - self.0.data.mut_headers().insert(name.into(), value.into()); + self.0.data.headers.insert(name.into(), value.into()); self } @@ -85,17 +85,17 @@ impl ResponseBuilder { { let body = body.into(); if let Body::Empty = &body { - self.0.data.clear_body(); + self.0.data.body = None; return self; } if !self.0.headers().contains_key("Content-Type") { - self.0.data.mut_headers().insert( + self.0.data.headers.insert( "Content-Type".to_string(), body.default_content_type().to_string(), ); } - self.0.data.set_body(body.into()); + self.0.data.body = Some(Box::new(body.into())); self } } diff --git a/azure-functions/src/lib.rs b/azure-functions/src/lib.rs index 91ba4dc..6775aaf 100644 --- a/azure-functions/src/lib.rs +++ b/azure-functions/src/lib.rs @@ -91,6 +91,7 @@ pub use azure_functions_shared::codegen; mod backtrace; mod cli; +mod commands; mod logger; mod registry; mod util; @@ -99,17 +100,14 @@ pub mod bindings; pub mod blob; pub mod event_hub; pub mod http; -#[doc(hidden)] -pub mod rpc; pub mod signalr; pub mod timer; #[doc(no_inline)] pub use azure_functions_codegen::export; -pub use azure_functions_shared::Context; +pub use azure_functions_shared::{rpc, Context}; use crate::registry::Registry; use clap::ArgMatches; -use futures::Future; use serde::Serialize; use serde_json::{json, to_string_pretty, Serializer}; use std::env::{current_dir, current_exe, var}; @@ -707,33 +705,6 @@ fn sync_extensions(script_root: &str, verbose: bool, registry: Registry<'static> } } -fn run_worker( - worker_id: &str, - host: &str, - port: u32, - max_message_length: Option, - registry: Registry<'static>, -) { - ctrlc::set_handler(|| {}).expect("failed setting SIGINT handler"); - - let client = rpc::Client::new(worker_id.to_string(), max_message_length); - - println!("Connecting to Azure Functions host at {}:{}.", host, port); - - client - .connect(host, port) - .and_then(move |client| { - println!( - "Connected to Azure Functions host version {}.", - client.host_version().unwrap() - ); - - client.process_all_messages(registry) - }) - .wait() - .unwrap(); -} - fn get_local_settings_path(matches: &ArgMatches) -> Option { if let Some(local_settings) = matches.value_of("local_settings") { return Some(local_settings.into()); @@ -793,23 +764,14 @@ pub fn worker_main(args: impl Iterator, functions: &[&'static cod return; } - if let Some(matches) = matches.subcommand_matches("run") { - run_worker( - matches - .value_of("worker_id") - .expect("A worker id is required."), - matches.value_of("host").expect("A host is required."), - matches - .value_of("port") - .map(|port| port.parse::().expect("Invalid port number")) - .expect("A port number is required."), - matches - .value_of("max_message_length") - .map(|len| len.parse::().expect("Invalid maximum message length")), - registry, - ); - return; + if let Err(e) = match matches + //.get_or_insert_with(|| create_app().get_matches_from(env::args().skip(1))) + .subcommand() + { + ("run", Some(args)) => commands::Run::from(args).execute(registry), + _ => panic!("expected a subcommand."), + } { + eprintln!("error: {}", e); + std::process::exit(1); } - - panic!("expected a subcommand."); } diff --git a/azure-functions/src/logger.rs b/azure-functions/src/logger.rs index ee95ad6..cd209ea 100644 --- a/azure-functions/src/logger.rs +++ b/azure-functions/src/logger.rs @@ -1,9 +1,11 @@ -use crate::rpc::{protocol, Sender}; +use crate::rpc::{rpc_log, streaming_message::Content, RpcLog, StreamingMessage}; use log::{Level, Log, Metadata, Record}; use std::cell::RefCell; thread_local!(pub static INVOCATION_ID: RefCell = RefCell::new(String::new())); +type Sender = futures::sync::mpsc::UnboundedSender; + pub struct Logger { level: Level, sender: Sender, @@ -25,26 +27,31 @@ impl Log for Logger { return; } - let mut event = protocol::RpcLog::new(); - event.set_level(match record.level() { - Level::Trace => protocol::RpcLog_Level::Trace, - Level::Debug => protocol::RpcLog_Level::Debug, - Level::Info => protocol::RpcLog_Level::Information, - Level::Warn => protocol::RpcLog_Level::Warning, - Level::Error => protocol::RpcLog_Level::Error, - }); - event.set_message(record.args().to_string()); + let mut event = RpcLog { + level: match record.level() { + Level::Trace => rpc_log::Level::Trace, + Level::Debug => rpc_log::Level::Debug, + Level::Info => rpc_log::Level::Information, + Level::Warn => rpc_log::Level::Warning, + Level::Error => rpc_log::Level::Error, + } as i32, + message: record.args().to_string(), + ..Default::default() + }; INVOCATION_ID.with(|id| { let id = id.borrow(); if !id.is_empty() { - event.set_invocation_id(id.clone()); + event.invocation_id = id.clone(); } }); - let mut message = protocol::StreamingMessage::new(); - message.set_rpc_log(event); - self.sender.try_send(message).unwrap(); + self.sender + .unbounded_send(StreamingMessage { + content: Some(Content::RpcLog(event)), + ..Default::default() + }) + .unwrap_or(()); } fn flush(&self) {} diff --git a/azure-functions/src/rpc.rs b/azure-functions/src/rpc.rs deleted file mode 100644 index a2bd6bb..0000000 --- a/azure-functions/src/rpc.rs +++ /dev/null @@ -1,4 +0,0 @@ -mod client; -pub use self::client::*; - -pub use azure_functions_shared::rpc::protocol; diff --git a/azure-functions/src/rpc/client.rs b/azure-functions/src/rpc/client.rs deleted file mode 100644 index ec5bd96..0000000 --- a/azure-functions/src/rpc/client.rs +++ /dev/null @@ -1,383 +0,0 @@ -use crate::backtrace::Backtrace; -use crate::codegen::Function; -use crate::logger; -use crate::registry::Registry; -use azure_functions_shared::rpc::protocol; -use crossbeam_channel::unbounded; -use futures::{ - future::{lazy, ok}, - Future, Sink, Stream, -}; -use grpcio::{ChannelBuilder, ClientDuplexReceiver, EnvBuilder, WriteFlags}; -use log::{self, error}; -use std::cell::RefCell; -use std::panic::{self, AssertUnwindSafe, PanicInfo}; -use std::sync::Arc; -use std::thread; -use tokio_threadpool::ThreadPool; - -pub type Sender = crossbeam_channel::Sender; -type Receiver = ClientDuplexReceiver; - -const UNKNOWN: &str = ""; - -thread_local!(static FUNCTION_NAME: RefCell<&'static str> = RefCell::new(UNKNOWN)); - -pub struct Client { - worker_id: String, - max_message_len: Option, - client: Option, // We must store the client to ensure the underlying channel isn't dropped - sender: Option, - receiver: Option, - host_version: Option, -} - -impl Client { - pub fn new(worker_id: String, max_message_len: Option) -> Client { - Client { - worker_id, - max_message_len, - client: None, - sender: None, - receiver: None, - host_version: None, - } - } - - pub fn host_version(&self) -> Option<&str> { - self.host_version.as_ref().map(String::as_str) - } - - pub fn sender(&self) -> Option { - self.sender.clone() - } - - pub fn connect(mut self, host: &str, port: u32) -> impl Future { - let mut channel = ChannelBuilder::new(Arc::new(EnvBuilder::new().build())); - - if let Some(len) = self.max_message_len { - if len > 0 { - channel = channel - .max_receive_message_len(len) - .max_send_message_len(len); - } - } - - let (mut rpc_sender, rpc_receiver) = self - .client - .get_or_insert(protocol::FunctionRpcClient::new( - channel.connect(&format!("{}:{}", host, port)), - )) - .event_stream() - .unwrap(); - - let (sender, receiver) = unbounded(); - - self.sender = Some(sender); - self.receiver = Some(rpc_receiver); - - thread::spawn(move || { - while let Ok(msg) = receiver.recv() { - rpc_sender = rpc_sender - .send((msg, WriteFlags::default())) - .wait() - .expect("failed to send message to host"); - } - }); - - let mut message = protocol::StreamingMessage::new(); - message.mut_start_stream().worker_id = self.worker_id.to_owned(); - - self.sender - .as_ref() - .unwrap() - .send(message) - .expect("failed to send start stream message"); - - self.read().and_then(|(mut c, msg)| { - let msg = msg.expect("host disconnected during worker initialization"); - - if !msg.has_worker_init_request() { - panic!("expected a worker init request, but received: {:?}.", msg); - } - - c.host_version = Some(msg.get_worker_init_request().host_version.clone()); - - let mut msg = protocol::StreamingMessage::new(); - { - let worker_init_res = msg.mut_worker_init_response(); - worker_init_res.worker_version = env!("CARGO_PKG_VERSION").to_owned(); - let result = worker_init_res.mut_result(); - result.status = protocol::StatusResult_Status::Success; - } - - c.sender - .as_ref() - .unwrap() - .send(msg) - .expect("failed to send init response message"); - - ok(c) - }) - } - - pub fn process_all_messages( - mut self, - mut registry: Registry<'static>, - ) -> impl Future { - let pool = tokio_threadpool::ThreadPool::new(); - - // TODO: use the level requested by the Azure functions host - log::set_boxed_logger(Box::new(logger::Logger::new( - log::Level::Trace, - self.sender.clone().unwrap(), - ))) - .expect("Failed to set the global logger instance"); - - panic::set_hook(Box::new(Client::handle_panic)); - - log::set_max_level(log::LevelFilter::Trace); - - loop { - let (c, msg) = self.read().wait().expect("Failed to read message"); - self = c; - - if msg.is_none() { - break; - } - - let msg = msg.unwrap(); - if msg.has_worker_terminate() { - break; - } - - Client::handle_request(&mut registry, self.sender().unwrap(), msg, &pool); - } - - pool.shutdown_on_idle().and_then(|_| ok(self)) - } - - fn read( - mut self, - ) -> impl Future), Error = ()> { - self.receiver - .take() - .unwrap() - .into_future() - .map_err(|(err, _)| panic!("failed to receive message: {:?}.", err)) - .and_then(move |(msg, r)| { - self.receiver = Some(r); - ok((self, msg)) - }) - } - - fn handle_function_load_request( - registry: &mut Registry<'static>, - sender: Sender, - req: protocol::FunctionLoadRequest, - ) { - let mut message = protocol::StreamingMessage::new(); - { - let response = message.mut_function_load_response(); - response.function_id = req.function_id.clone(); - - response.set_result(match req.metadata.as_ref() { - Some(metadata) => { - let mut result = protocol::StatusResult::new(); - if registry.register(&req.function_id, &metadata.name) { - result.status = protocol::StatusResult_Status::Success; - } else { - result.status = protocol::StatusResult_Status::Failure; - result.result = format!("Function '{}' does not exist.", metadata.name); - } - result - } - None => { - let mut result = protocol::StatusResult::new(); - result.status = protocol::StatusResult_Status::Failure; - result.result = "Function load request metadata is missing.".to_string(); - result - } - }); - } - - sender - .send(message) - .expect("Failed to send message to response thread"); - } - - fn invoke_function( - func: &'static Function, - sender: Sender, - mut req: protocol::InvocationRequest, - ) { - // Set the function name in TLS - FUNCTION_NAME.with(|n| { - *n.borrow_mut() = &func.name; - }); - - // Set the invocation ID in TLS - logger::INVOCATION_ID.with(|id| { - id.borrow_mut().replace_range(.., &req.invocation_id); - }); - - let res = match panic::catch_unwind(AssertUnwindSafe(|| { - (func - .invoker - .as_ref() - .expect("function must have an invoker"))(&func.name, &mut req) - })) { - Ok(res) => res, - Err(_) => { - let mut res = protocol::InvocationResponse::new(); - res.set_invocation_id(req.invocation_id.clone()); - let mut result = protocol::StatusResult::new(); - result.status = protocol::StatusResult_Status::Failure; - result.result = - "Azure Function panicked: see log for more information.".to_string(); - res.set_result(result); - res - } - }; - - // Clear the function name from TLS - FUNCTION_NAME.with(|n| { - *n.borrow_mut() = UNKNOWN; - }); - - // Clear the invocation ID from TLS - logger::INVOCATION_ID.with(|id| { - id.borrow_mut().clear(); - }); - - let mut message = protocol::StreamingMessage::new(); - message.set_invocation_response(res); - - sender - .try_send(message) - .expect("Failed to send message to response thread"); - } - - fn handle_invocation_request( - registry: &Registry<'static>, - sender: Sender, - req: protocol::InvocationRequest, - pool: &ThreadPool, - ) { - if let Some(func) = registry.get(&req.function_id) { - pool.spawn(lazy(move || { - Client::invoke_function(func, sender, req); - Ok(()) - })); - return; - } - - let mut res = protocol::InvocationResponse::new(); - res.set_invocation_id(req.invocation_id.clone()); - let mut result = protocol::StatusResult::new(); - result.status = protocol::StatusResult_Status::Failure; - result.result = format!("Function with id '{}' does not exist.", req.function_id); - res.set_result(result); - - let mut message = protocol::StreamingMessage::new(); - message.set_invocation_response(res); - - sender - .send(message) - .expect("Failed to send message to response thread"); - } - - fn handle_worker_status_request(sender: Sender, _req: protocol::WorkerStatusRequest) { - let mut message = protocol::StreamingMessage::new(); - { - message.mut_worker_status_response(); - // TODO: in the future, this message might have fields to set - } - - sender - .send(message) - .expect("Failed to send message to response thread"); - } - - fn handle_request( - registry: &mut Registry<'static>, - sender: Sender, - mut msg: protocol::StreamingMessage, - pool: &ThreadPool, - ) { - if msg.has_function_load_request() { - Client::handle_function_load_request( - registry, - sender, - msg.take_function_load_request(), - ); - return; - } - if msg.has_invocation_request() { - Client::handle_invocation_request( - registry, - sender, - msg.take_invocation_request(), - pool, - ); - return; - } - if msg.has_worker_status_request() { - Client::handle_worker_status_request(sender, msg.take_worker_status_request()); - return; - } - if msg.has_file_change_event_request() { - // Not supported (no-op) - return; - } - if msg.has_invocation_cancel() { - // Not supported (no-op) - return; - } - if msg.has_function_environment_reload_request() { - // Not supported (no-op) - return; - } - - panic!("Unexpected message from host: {:?}.", msg); - } - - fn handle_panic(info: &PanicInfo) { - let backtrace = Backtrace::new(); - match info.location() { - Some(location) => { - error!( - "Azure Function '{}' panicked with '{}', {}:{}:{}{}", - FUNCTION_NAME.with(|f| *f.borrow()), - info.payload() - .downcast_ref::<&str>() - .cloned() - .unwrap_or_else(|| info - .payload() - .downcast_ref::() - .map(String::as_str) - .unwrap_or(UNKNOWN)), - location.file(), - location.line(), - location.column(), - backtrace - ); - } - None => { - error!( - "Azure Function '{}' panicked with '{}'{}", - FUNCTION_NAME.with(|f| *f.borrow()), - info.payload() - .downcast_ref::<&str>() - .cloned() - .unwrap_or_else(|| info - .payload() - .downcast_ref::() - .map(String::as_str) - .unwrap_or(UNKNOWN)), - backtrace - ); - } - }; - } -} diff --git a/azure-functions/src/util.rs b/azure-functions/src/util.rs index 1bbcbf4..8b67773 100644 --- a/azure-functions/src/util.rs +++ b/azure-functions/src/util.rs @@ -1,48 +1,40 @@ -use crate::rpc::protocol; +use crate::rpc::{typed_data::Data, TypedData}; use chrono::{DateTime, FixedOffset, Utc}; use serde::{de::Error, de::IntoDeserializer, Deserialize, Deserializer}; use serde_json::from_str; use std::str::{from_utf8, FromStr}; -pub fn convert_from<'a, T>(data: &'a protocol::TypedData) -> Option +pub fn convert_from<'a, T>(data: &'a TypedData) -> Option where T: FromStr + Deserialize<'a>, { - if data.has_string() { - return data.get_string().parse::().ok(); - } - - if data.has_json() { - return from_str(data.get_json()).ok(); - } - - if data.has_bytes() { - if let Ok(s) = from_utf8(data.get_bytes()) { - return s.parse::().ok(); + match &data.data { + Some(Data::String(s)) => s.parse::().ok(), + Some(Data::Json(s)) => from_str(s).ok(), + Some(Data::Bytes(b)) => { + if let Ok(s) = from_utf8(b) { + return s.parse::().ok(); + } + None } - return None; - } - - if data.has_stream() { - if let Ok(s) = from_utf8(data.get_stream()) { - return s.parse::().ok(); + Some(Data::Stream(s)) => { + if let Ok(s) = from_utf8(s) { + return s.parse::().ok(); + } + None } - return None; + Some(Data::Int(i)) => { + let deserializer: ::serde::de::value::I64Deserializer<::serde_json::error::Error> = + i.into_deserializer(); + T::deserialize(deserializer).ok() + } + Some(Data::Double(d)) => { + let deserializer: ::serde::de::value::F64Deserializer<::serde_json::error::Error> = + d.into_deserializer(); + T::deserialize(deserializer).ok() + } + _ => None, } - - if data.has_int() { - let deserializer: ::serde::de::value::I64Deserializer<::serde_json::error::Error> = - data.get_int().into_deserializer(); - return T::deserialize(deserializer).ok(); - } - - if data.has_double() { - let deserializer: ::serde::de::value::F64Deserializer<::serde_json::error::Error> = - data.get_double().into_deserializer(); - return T::deserialize(deserializer).ok(); - } - - None } pub fn deserialize_datetime<'a, D>(deserializer: D) -> Result, D::Error> @@ -70,8 +62,9 @@ mod tests { fn it_converts_from_string_data() { const DATA: &'static str = "test"; - let mut data = protocol::TypedData::new(); - data.set_string(DATA.to_string()); + let data = TypedData { + data: Some(Data::String(DATA.to_string())), + }; let s: String = convert_from(&data).unwrap(); assert_eq!(s, DATA); @@ -79,8 +72,9 @@ mod tests { #[test] fn it_converts_from_json_data() { - let mut data = protocol::TypedData::new(); - data.set_json(r#""hello world""#.to_string()); + let data = TypedData { + data: Some(Data::Json(r#""hello world""#.to_string())), + }; let s: String = convert_from(&data).unwrap(); assert_eq!(s, "hello world"); @@ -88,10 +82,11 @@ mod tests { #[test] fn it_converts_from_bytes_data() { - let mut data = protocol::TypedData::new(); - data.set_bytes(vec![ - 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, - ]); + let data = TypedData { + data: Some(Data::Bytes(vec![ + 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, + ])), + }; let s: String = convert_from(&data).unwrap(); assert_eq!(s, "hello world"); @@ -99,10 +94,11 @@ mod tests { #[test] fn it_converts_from_stream_data() { - let mut data = protocol::TypedData::new(); - data.set_stream(vec![ - 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, - ]); + let data = TypedData { + data: Some(Data::Stream(vec![ + 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, + ])), + }; let s: String = convert_from(&data).unwrap(); assert_eq!(s, "hello world"); @@ -112,8 +108,9 @@ mod tests { fn it_converts_from_int_data() { const DATA: i64 = 42; - let mut data = protocol::TypedData::new(); - data.set_int(DATA); + let data = TypedData { + data: Some(Data::Int(DATA)), + }; let d: i64 = convert_from(&data).unwrap(); assert_eq!(d, DATA); @@ -123,8 +120,9 @@ mod tests { fn it_converts_from_double_data() { const DATA: f64 = 42.24; - let mut data = protocol::TypedData::new(); - data.set_double(DATA); + let data = TypedData { + data: Some(Data::Double(DATA)), + }; let d: f64 = convert_from(&data).unwrap(); assert_eq!(d, DATA); diff --git a/docker/build-image/Dockerfile b/docker/build-image/Dockerfile index d4cc735..39d68a9 100644 --- a/docker/build-image/Dockerfile +++ b/docker/build-image/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update \ && wget https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip \ && unzip protoc-3.6.1-linux-x86_64.zip -d /usr \ && rm protoc-3.6.1-linux-x86_64.zip \ - && apt-get install -y cmake g++ dotnet-sdk-2.2 \ + && apt-get install -y dotnet-sdk-2.2 \ && apt-get remove -y --purge wget unzip apt-transport-https gnupg \ && apt-get autoremove -y \ && apt-get clean \ diff --git a/examples/service-bus/Dockerfile b/examples/service-bus/Dockerfile index d819ac9..2e387d8 100644 --- a/examples/service-bus/Dockerfile +++ b/examples/service-bus/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile-upstream:experimental -FROM peterhuene/azure-functions-rs-build:0.5.2 AS build-image +FROM peterhuene/azure-functions-rs-build:0.7.0 AS build-image WORKDIR /src COPY . /src