Showing preview only (1,182K chars total). Download the full file or copy to clipboard to get everything.
Repository: tsloughter/grpcbox
Branch: main
Commit: 5a57125e76ea
Files: 78
Total size: 1.1 MB
Directory structure:
gitextract_caytn9d6/
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── LICENSE
├── README.md
├── benchmark/
│ ├── README.md
│ ├── config/
│ │ ├── sys.config
│ │ └── test.config
│ ├── proto/
│ │ └── benchmark_service.proto
│ ├── src/
│ │ ├── benchmark_service_pb.erl
│ │ ├── grpc_testing_benchmark_service.erl
│ │ ├── grpc_testing_benchmark_service_bhvr.erl
│ │ └── grpc_testing_benchmark_service_client.erl
│ └── test/
│ └── grpcbox_benchmark_client_SUITE.erl
├── config/
│ └── test.config
├── elvis.config
├── include/
│ └── grpcbox.hrl
├── interop/
│ ├── config/
│ │ └── sys.config
│ ├── include/
│ │ └── grpcbox_interop_tests.hrl
│ ├── proto/
│ │ ├── empty.proto
│ │ ├── messages.proto
│ │ └── test.proto
│ ├── run_server_tests.sh
│ ├── src/
│ │ ├── empty_pb.erl
│ │ ├── grpc_testing_reconnect_service_bhvr.erl
│ │ ├── grpc_testing_reconnect_service_client.erl
│ │ ├── grpc_testing_test_service.erl
│ │ ├── grpc_testing_test_service_bhvr.erl
│ │ ├── grpc_testing_test_service_client.erl
│ │ ├── grpc_testing_unimplemented_service_bhvr.erl
│ │ ├── grpc_testing_unimplemented_service_client.erl
│ │ ├── messages_pb.erl
│ │ └── test_pb.erl
│ └── test/
│ └── grpcbox_interop_client_SUITE.erl
├── proto/
│ ├── health.proto
│ └── reflection.proto
├── rebar.config
├── src/
│ ├── grpcbox.app.src
│ ├── grpcbox.erl
│ ├── grpcbox_acceptor.erl
│ ├── grpcbox_app.erl
│ ├── grpcbox_chain_interceptor.erl
│ ├── grpcbox_channel.erl
│ ├── grpcbox_channel_sup.erl
│ ├── grpcbox_client.erl
│ ├── grpcbox_client_stream.erl
│ ├── grpcbox_frame.erl
│ ├── grpcbox_health_bhvr.erl
│ ├── grpcbox_health_client.erl
│ ├── grpcbox_health_pb.erl
│ ├── grpcbox_health_service.erl
│ ├── grpcbox_metadata.erl
│ ├── grpcbox_name_resolver.erl
│ ├── grpcbox_oc_stats.erl
│ ├── grpcbox_oc_stats_handler.erl
│ ├── grpcbox_pool.erl
│ ├── grpcbox_reflection_bhvr.erl
│ ├── grpcbox_reflection_client.erl
│ ├── grpcbox_reflection_pb.erl
│ ├── grpcbox_reflection_service.erl
│ ├── grpcbox_services_simple_sup.erl
│ ├── grpcbox_services_sup.erl
│ ├── grpcbox_socket.erl
│ ├── grpcbox_stream.erl
│ ├── grpcbox_subchannel.erl
│ ├── grpcbox_sup.erl
│ ├── grpcbox_trace.erl
│ └── grpcbox_utils.erl
└── test/
├── grpcbox_SUITE.erl
├── grpcbox_SUITE_data/
│ ├── certificates/
│ │ ├── ca.pem
│ │ ├── server1.key
│ │ └── server1.pem
│ ├── route_guide.proto
│ └── route_guide_db.json
├── route_guide_pb.erl
├── routeguide_route_guide.erl
├── routeguide_route_guide_bhvr.erl
├── routeguide_route_guide_client.erl
└── test_stats_handler.erl
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/main.yml
================================================
name: Common Test
on:
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
jobs:
build:
name: Test on OTP ${{ matrix.otp_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
otp_version: ['26.0', '25.2.3', '24.1.2', '23.3']
rebar3_version: ['3.20.0']
os: [ubuntu-20.04]
env:
OTP_VERSION: ${{ matrix.otp_version }}
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Compile
run: rebar3 compile
- name: Tests
run: rebar3 ct --cover
- name: Covertool
run: rebar3 covertool generate
- uses: codecov/codecov-action@v2
if: ${{ always() }}
with:
file: _build/test/covertool/grpcbox.covertool.xml
env_vars: OTP_VERSION
- name: Setup Go 1.21.4
uses: actions/setup-go@v4
with:
# Semantic version range syntax or exact version of Go
go-version: '1.21.4'
- uses: actions/checkout@v4
with:
repository: 'grpc/grpc-go'
path: 'grpc-go'
- name: Install grpc-go interop client
run: |
cd grpc-go
go build -o ./go-grpc-interop-client ./interop/client
- name: Run interop tests
run: |
rebar3 as interop release
_build/interop/rel/grpc_interop/bin/grpc_interop daemon
PATH=grpc-go/:$PATH interop/run_server_tests.sh
dialyzer:
name: Dialyze on OTP ${{ matrix.otp_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
otp_version: ['26.0']
rebar3_version: ['3.22.1']
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }}
version-type: 'strict'
- uses: actions/cache@v2
name: Cache
with:
path: |
_build
key: ${{ runner.os }}-build-${{ matrix.otp_version }}-${{ hashFiles('rebar.lock') }}-5
restore-keys: |
${{ runner.os }}-dialyzer-${{ matrix.otp_version }}-5-
- name: Compile
run: rebar3 compile
- name: Dialyzer
run: rebar3 as dialyzer dialyzer
================================================
FILE: .gitignore
================================================
.rebar3
_*
.eunit
*.o
*.beam
*.plt
*.swp
*.swo
.erlang.cookie
ebin
log
erl_crash.dump
.rebar
logs
_build
.idea
*.iml
rebar3.crashdump
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2017, Tristan Sloughter <t@crashfast.com>.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
grpcbox
=====

[](https://codecov.io/gh/tsloughter/grpcbox)
[](https://hex.pm/packages/grpcbox)
[](https://hex.pm/packages/grpcbox)
Library for creating [grpc](https://grpc.io) services (client and server) in Erlang, based on the [chatterbox](https://github.com/joedevivo/chatterbox) http2 library.
Features
---
* Unary, client stream, server stream and bidirectional rpcs
* Client load balancing
* Interceptors
* Health check service
* Reflection service
* [OpenCensus](https://opencensus.io) interceptors for stats and tracing
* [Plugin](https://github.com/tsloughter/grpcbox_plugin) for generating clients and behaviour type specs for service server implementation
Implementing a Service Server
----
The quickest way to play around is with the test service and client that is used by `grpcbox`. Simply pull up a shell with, `rebar3 as test shell` and the route guide service will start on port 8080 and you'll have the client, `routeguide_route_guide_client`, in the path.
The easiest way to get started on your own project is using the plugin, [grpcbox_plugin](https://github.com/tsloughter/grpcbox_plugin):
```erlang
{deps, [grpcbox]}.
{grpc, [{protos, "protos"},
{gpb_opts, [{module_name_suffix, "_pb"}]}]}.
{plugins, [grpcbox_plugin]}.
```
Currently `grpcbox` and the plugin are a bit picky and the `gpb` options will always include `[use_packages, maps, {i, "."}, {o, "src"}]`.
Assuming the `protos` directory of your application has the `route_guide.proto` found in this repo, `protos/route_guide.proto`, the output from running the plugin will be:
```shell
$ rebar3 grpc gen
===> Writing src/route_guide_pb.erl
===> Writing src/grpcbox_route_guide_bhvr.erl
```
A behaviour is used because it provides a way to generate the interface and types without being where the actual implementation is also done. This way if a change happens to the proto you can regenerate the interface without any issues with the implementation of the service, simply then update the implementation callbacks to match the changed interface.
Runtime configuration for `grpcbox` can be done in `sys.config`, specifying the compiled proto modules to use for finding the services available, which services to actually enable for requests and what module implements them, acceptor pool and http server settings. See `interop/config/sys.config` for a working example.
In the interop config the portion for defining services to handle requests for is:
``` erlrang
{grpcbox, [{servers, [#{grpc_opts => #{service_protos => [test_pb],
services => #{'grpc.testing.TestService' => grpc_testing_test_service}}}]},
...
```
`test_pb` is the `gpb` generated module that exports `get_service_names/0`. The results of that function are used to construct the metadata needed for handling requests. The `services` map gives the module to call for handling methods of a service. If a service is not defined in that map it will result in the grpc error code 12, `Unimplemented`.
The services will be started when the application starts assuming the services are all configured in the `sys.config` and it is loaded. To manually start a service use either `grpcbox:start_server/1` which will start a `grpcbox_service_sup` supervisor under the `grpcbox_services_simple_sup` simple one for one supervisor, or get a child spec `grpcbox:server_child_spec(ServerOpts, GrpcOpts, ListenOpts, PoolOpts, TransportOpts)` to include the service supervisor in your own supervision tree.
#### Unary RPC
Unary RPCs receive a single request and return a single response. The RPC `GetFeature` takes a single `Point` and returns the `Feature` at that point:
```protobuf
rpc GetFeature(Point) returns (Feature) {}
```
The callback generated by the `grpcbox_plugin` will look like:
```erlang
-callback get_feature(ctx:ctx(), route_guide_pb:point()) ->
{ok, route_guide_pb:feature(), ctx:ctx(} | grpcbox_stream:grpc_error_response().
```
And the implementation is as simple as an Erlang function that takes the arguments `Ctx`, the context of this current request, and a `Point` map, returning a `Feature` map:
```erlang
get_feature(Ctx, Point) ->
Feature = #{name => find_point(Point, data()),
location => Point},
{ok, Feature, Ctx}.
```
#### Streaming Output
Instead of returning a single feature the server can stream a response of multiple features by defining the RPC to have a `stream Feature` return:
```protobuf
rpc ListFeatures(Rectangle) returns (stream Feature) {}
```
In this case the callback still receives a map argument but also a `grpcbox_stream` argument:
```erlang
-callback list_features(route_guide_pb:rectangle(), grpcbox_stream:t()) ->
ok | {error, term()}.
```
The `GrpcStream` variable is passed to `grpcbox_stream:send/2` for returning an individual feature over the stream to the client. The stream is ended by the server when the function completes.
```erlang
list_features(_Message, GrpcStream) ->
grpcbox_stream:send(#{name => <<"Tour Eiffel">>,
location => #{latitude => 3,
longitude => 5}}, GrpcStream),
grpcbox_stream:send(#{name => <<"Louvre">>,
location => #{latitude => 4,
longitude => 5}}, GrpcStream),
ok.
```
#### Streaming Input
The client can also stream a sequence of messages:
```protobuf
rpc RecordRoute(stream Point) returns (RouteSummary) {}
```
In this case the callback receives a `reference()` instead of a direct value from the client:
```erlang
-callback record_route(reference(), grpcbox_stream:t()) ->
{ok, route_guide_pb:route_summary()} | {error, term()}.
```
The process the callback is running in will receive the individual messages on the stream as tuples `{reference(), route_guide_pb:point()}`. The end of the stream is sent as the message `{reference(), eos}` at which point the function can return the response:
```erlang
record_route(Ref, GrpcStream) ->
record_route(Ref, #{t_start => erlang:system_time(1),
acc => []}, GrpcStream).
record_route(Ref, Data=#{t_start := T0, acc := Points}, GrpcStream) ->
receive
{Ref, eos} ->
{ok, #{elapsed_time => erlang:system_time(1) - T0,
point_count => length(Points),
feature_count => count_features(Points),
distance => distance(Points)}, GrpcStream};
{Ref, Point} ->
record_route(Ref, Data#{acc => [Point | Points]}, GrpcStream)
end.
```
#### Streaming In and Out
A bidrectional streaming RPC is defined when both input and output are streams:
```protobuf
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
```
```erlang
-callback route_chat(reference(), grpcbox_stream:t()) ->
ok | {error, term()}.
```
The sequence of input messages will again be sent to the callback's process as Erlang messages and any output messages are sent to the client with `grpcbox_stream`:
```erlang
route_chat(Ref, GrpcStream) ->
route_chat(Ref, [], GrpcStream).
route_chat(Ref, Data, GrpcStream) ->
receive
{Ref, eos} ->
ok;
{Ref, #{location := Location} = P} ->
Messages = proplists:get_all_values(Location, Data),
[grpcbox_stream:send(Message, GrpcStream) || Message <- Messages],
route_chat(Ref, [{Location, P} | Data], GrpcStream)
end.
```
#### Interceptors
##### Unary Interceptor
A unary interceptor can be any function that accepts a context, decoded request body, server info map and the method function:
```erlang
some_unary_interceptor(Ctx, Request, ServerInfo, Fun) ->
%% do some interception stuff
Fun(Ctx, Request).
```
The interceptor is configured in the `grpc_opts` set in the environment or passed to the supervisor `start_child` function. An example from the test suite sets `grpc_opts` in the application environment:
```erlang
#{service_protos => [route_guide_pb],
unary_interceptor => fun(Ctx, Req, _, Method) ->
Method(Ctx, #{latitude => 30,
longitude => 90})
end}
```
##### Streaming Interceptor
##### Middleware
There is a provided interceptor `grpcbox_chain_interceptor` which accepts a list of interceptors to apply in order, with the final interceptor calling the method handler. An example from the test suite adds a trailer in each interceptor to show the chain working:
```erlang
#{service_protos => [route_guide_pb],
unary_interceptor =>
grpcbox_chain_interceptor:unary([fun ?MODULE:one/4,
fun ?MODULE:two/4,
fun ?MODULE:three/4])}
```
#### Tracing
The provided interceptor `grpcbox_trace` supports the [OpenCensus](http://opencensus.io/) wire protocol using [opencensus-erlang](https://github.com/census-instrumentation/opencensus-erlang). It will use the `trace_id`, `span_id` and any options or tags from the trace context.
Configure as an interceptor:
```erlang
#{service_protos => [route_guide_pb],
unary_interceptor => {grpcbox_trace, unary}}
```
Or as a middleware in the chain interceptor:
```erlang
#{service_protos => [route_guide_pb],
unary_interceptor =>
grpcbox_chain_interceptor:unary([...,
fun grpcbox_trace:unary/4,
...])}
```
See [opencensus-erlang](https://github.com/census-instrumentation/opencensus-erlang) for details on configuring reporters.
#### Statistics
Statistics are collected by implementing a stats handler module. A handler for OpenCensus stats (be sure to include [OpenCensus](https://hex.pm/packages/opencensus) as a dependency and make sure it starts on boot) is provided and can be enabled for the server with a config option:
``` erlang
{grpcbox, [{servers, [#{grpc_opts => #{stats_handler => grpcbox_oc_stats_handler
...}}]}]}
```
For the client the stats handler is a per-channel configuration, see the Defining Channels section below.
You can verify it is working by enabling the stdout exporter:
``` erlang
{opencensus, [{stat, [{exporters, [{oc_stat_exporter_stdout, []}]}]}]}
```
For actual use, an [exporter for Prometheus](https://github.com/opencensus-beam/prometheus) is available.
Details on all the metrics that are collected can be found in the [OpenCensus gRPC Stats specification](https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/gRPC.md).
#### Metadata
Metadata is sent in headers and trailers.
Using a Service Client
----
For each service in the protos passed to `rebar3 gprc gen` it will generate a `<service>_client` module containing a function for each method in the service.
#### Defining Channels
Channels maintain connections to grpc servers and offer client side load balancing between servers with various methods, round robin, random, hash.
If no channel is specified in the options to a rpc call the `default_channel` is used. Setting the default to connect to localhost on port 8080 in your `sys.config` would look like:
```
{client, #{channels => [{default_channel, [{http, "localhost", 8080, []}], #{}}]}}
```
Unix sockets (UDS) may also be used with the same notation that is defined in `gen_tcp`. Considerations:
* for UDS, only the `http` scheme is permitted
* the port must strictly be `0`
* only available on POSIX operating systems
* abstract UDS are only available on Linux, and such sockets' names must start with a zero byte
```
{client, #{channels => [{default_channel, [{http, {local, "/path/to/unix/socket_name"}, 0, []}], #{}}]}}
%% or to use an abstract Unix socket:
%% {client, #{channels => [{default_channel, [{http, {local, [0 | "socket_name"]}, 0, []}], #{}}]}}
```
The empty map at the end can contain configuration for the load balancing algorithm, interceptors, statistics handling and compression:
```
#{balancer => round_robin | random | hash | direct | claim,
encoding => identity | gzip | deflate | snappy | atom(),
stats_handler => grpcbox_oc_stats_handler,
unary_interceptor => term(),
stream_interceptor => term()}
```
The default balancer is round robin and encoding is identity (no compression). Encoding can also be passed in the options map to individual requests.
#### Calling Unary Client RPC
The `RouteGuide` service has a single unary method, `GetFeature`, in the client we have a function `get_feature/2`:
```erlang
Point = #{latitude => 409146138, longitude => -746188906},
{ok, Feature, HeadersAndTrailers} = routeguide_route_guide_client:get_feature(Point).
```
#### Client Streaming RPC
```erlang
{ok, S} = routeguide_route_guide_client:record_route(),
ok = grpcbox_client:send(S, #{latitude => 409146138, longitude => -746188906}),
ok = grpcbox_client:send(S, #{latitude => 234818903, longitude => -823423910}),
ok = grpcbox_client:close_send(S),
{ok, #{point_count := 2} = grpcbox_client:recv_data(S)).
```
#### Client with Server Streaming RPC
```erlang
Rectangle = #{hi => #{latitude => 1, longitude => 2},
lo => #{latitude => 3, longitude => 5}},
{ok, S} = routeguide_route_guide_client:list_features(Rectangle),
{ok, #{<<":status">> := <<"200">>}} = grpcbox_client:recv_headers(S),
{ok, #{name := _} = grpcbox_client:recv_data(S),
{ok, #{name := _}} = grpcbox_client:recv_data(S),
{ok, _} = grpcbox_client:recv_trailers(S).
```
#### Bidirectional RPC
```erlrang
{ok, S} = routeguide_route_guide_client:route_chat(),
ok = grpcbox_client:send(S, #{location => #{latitude => 1, longitude => 1}, message => <<"hello there">>}),
ok = grpcbox_client:send(S, #{location => #{latitude => 1, longitude => 1}, message => <<"hello there">>}),
{ok, #{message := <<"hello there">>}} = grpcbox_client:recv_data(S)),
ok = grpcbox_client:send(S, #{location => #{latitude => 1, longitude => 1}, message => <<"hello there">>}),
{ok, #{message := <<"hello there">>}}, grpcbox_client:close_and_recv(S)).
```
#### Context
Client calls optionally accept a [context](https://hex.pm/packages/ctx) as the first argument. Contexts are used to set and propagate deadlines and [OpenCensus](https://hex.pm/packages/opencensus) tags.
```erlang
Ctx = ctx:with_deadline_after(300, seconds),
Point = #{latitude => 409146138, longitude => -746188906},
{ok, Feature, HeadersAndTrailers} = routeguide_route_guide_client:get_feature(Ctx, Point).
```
CT Tests
---
To run the Common Test suite:
```
$ rebar3 ct
```
Interop Tests
---
The `interop` rebar3 profile builds with an implementation of the `test.proto` for grpc interop testing:
For testing grpcbox's server:
```
$ rebar3 as interop shell
```
With the shell running the tests can then be run from a script:
```
$ interop/run_server_tests.sh
```
The script by default uses the Go test client that can be installed with the following:
```
$ go get -u github.com/grpc/grpc-go/interop
$ go build -o $GOPATH/bin/go-grpc-interop-client github.com/grpc/grpc-go/interop/client
```
For testing the grpcbox client you can use the Go test server. But first, add `_ "google.golang.org/grpc/encoding/gzip"` to `server.go` imports or else the gzip tests will fail. Then simply build and run it:
```
$ go build -o $GOPATH/bin/go-grpc-interop-server github.com/grpc/grpc-go/interop/server
$ $GOPATH/bin/go-grpc-interop-server -port 8080
```
And run the interop client test suite:
```
rebar3 as interop ct
```
================================================
FILE: benchmark/README.md
================================================
Benchmark
=========
Utilities for benchmarking grpcbox. The used protocol is compatible with the one defined in [grpc](https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/benchmark_service.proto) and for example the Go benchmark client and server can be used against grpcbox.
Grpcbox benchmark server
------------------------
To run the grpcbox benchmark server:
```
$ rebar3 as benchmark shell
```
Server options can be changed in `benchmark/config/sys.config`
Grpcbox benchmark client
------------------------
The benchmark client is implemented as a Common Test. First set test parameters in `benchmark/config/test.config`. The available parameters are described in the file. Also the chatterbox client options can be set. After setting test parameters and starting a server to test against, run the grpcbox benchmark client:
```
$ rebar3 as benchmark ct --verbose
```
The --verbose option needs to be set for the measurements to be printed out.
Go benchmark client and server
------------------------------
Grpcbox benchmark is compatible with the Go benchmark client and server.
To build the Go client and server:
```
$ go build -o $GOPATH/bin/go-grpc-benchmark-client <path-to-grpc-go>/benchmark/client
$ go build -o $GOPATH/bin/go-grpc-benchmark-server <path-to-grpc-go>/benchmark/server
```
Example of running the Go benchmark server:
```
$ go-grpc-benchmark-server -port 8080 -test_name mytest
```
Example of running the Go benchmark client:
```
$ go-grpc-benchmark-client -port 8080 -test_name mytest -d 10 -w 1 -r 100 -c 1 -rpc_type unary -req 1 -resp 1
```
================================================
FILE: benchmark/config/sys.config
================================================
[
{grpcbox, [%% {client, #{channels => [{default_channel, [{http, "localhost", 8080, []}], #{}}]}},
{servers,
[#{grpc_opts => #{service_protos => [benchmark_service_pb],
services => #{'grpc.testing.BenchmarkService' => grpc_testing_benchmark_service},
client_cert_dir => "test/grpcbox_SUITE_data/certificates/"},
transport_opts => #{ssl => false,
keyfile => "test/grpcbox_SUITE_data/certificates/server1.key",
certfile => "test/grpcbox_SUITE_data/certificates/server1.pem",
cacertfile => "test/grpcbox_SUITE_data/certificates/ca.pem"},
listen_opts => #{port => 8080,
ip => {0,0,0,0}},
pool_opts => #{size => 10},
server_opts => #{server_header_table_size => 4096,
server_enable_push => 1,
server_max_concurrent_streams => unlimited,
server_initial_window_size => 100000000,
server_max_frame_size => 16384,
server_max_header_list_size => unlimited}}]}]},
{opencensus, [{sampler, {oc_sampler_always, []}},
{reporters, [{oc_reporter_stdout, []}]},
{stat, [{exporters, [{oc_stat_exporter_stdout, []}]}]}]},
{kernel,
[
{logger,
[
{handler, default, logger_std_h,
#{filters => [{progress, {fun logger_filters:progress/2, stop}}],
formatter => {logger_formatter, #{single_line => true}}}}]}]}
].
================================================
FILE: benchmark/config/test.config
================================================
%% Test options
{server_addr, "localhost"}. %% Server address to connect to
{server_port, 8080}. %% Server port to connect to
{num_rpc, 100}. %% The number of concurrent RPCs on each connection
{num_conn, 1}. %% The number of parallel connections
{warmup_dur, 1}. %% Warm-up duration in seconds
{duration, 10}. %% Benchmark duration in seconds
{rq_size, 1}. %% Request message size in bytes
{rsp_size, 1}. %% Response message size in bytes
{rpc_type, unary}. %% RPC type, unary or streaming
%% Client options
{chatterbox,
[
{client_header_table_size,4096},
{client_enable_push,1},
{client_max_concurrent_streams,unlimited},
{client_initial_window_size,100000000},
{client_max_frame_size,16384},
{client_max_header_list_size,unlimited},
{client_flow_control,auto}
]
}.
================================================
FILE: benchmark/proto/benchmark_service.proto
================================================
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";
import "interop/proto/messages.proto";
package grpc.testing;
service BenchmarkService {
// One request followed by one response.
// The server returns the client payload as-is.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
// Repeated sequence of one request followed by one response.
// Should be called streaming ping-pong
// The server returns the client payload as-is on each response
rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse);
// Single-sided unbounded streaming from client to server
// The server returns the client payload as-is once the client does WritesDone
rpc StreamingFromClient(stream SimpleRequest) returns (SimpleResponse);
// Single-sided unbounded streaming from server to client
// The server repeatedly returns the client payload as-is
rpc StreamingFromServer(SimpleRequest) returns (stream SimpleResponse);
// Two-sided unbounded streaming between server to client
// Both sides send the content of their own choice to the other
rpc StreamingBothWays(stream SimpleRequest) returns (stream SimpleResponse);
}
================================================
FILE: benchmark/src/benchmark_service_pb.erl
================================================
%% -*- coding: utf-8 -*-
%% @private
%% Automatically generated, do not edit
%% Generated by gpb_compile version 4.7.3
-module(benchmark_service_pb).
-export([encode_msg/2, encode_msg/3]).
-export([decode_msg/2, decode_msg/3]).
-export([merge_msgs/3, merge_msgs/4]).
-export([verify_msg/2, verify_msg/3]).
-export([get_msg_defs/0]).
-export([get_msg_names/0]).
-export([get_group_names/0]).
-export([get_msg_or_group_names/0]).
-export([get_enum_names/0]).
-export([find_msg_def/1, fetch_msg_def/1]).
-export([find_enum_def/1, fetch_enum_def/1]).
-export([enum_symbol_by_value/2, enum_value_by_symbol/2]).
-export(['enum_symbol_by_value_grpc.testing.PayloadType'/1, 'enum_value_by_symbol_grpc.testing.PayloadType'/1]).
-export([get_service_names/0]).
-export([get_service_def/1]).
-export([get_rpc_names/1]).
-export([find_rpc_def/2, fetch_rpc_def/2]).
-export([fqbin_to_service_name/1]).
-export([service_name_to_fqbin/1]).
-export([fqbins_to_service_and_rpc_name/2]).
-export([service_and_rpc_name_to_fqbins/2]).
-export([fqbin_to_msg_name/1]).
-export([msg_name_to_fqbin/1]).
-export([fqbin_to_enum_name/1]).
-export([enum_name_to_fqbin/1]).
-export([get_package_name/0]).
-export([uses_packages/0]).
-export([source_basename/0]).
-export([get_all_source_basenames/0]).
-export([get_all_proto_names/0]).
-export([get_msg_containment/1]).
-export([get_pkg_containment/1]).
-export([get_service_containment/1]).
-export([get_rpc_containment/1]).
-export([get_enum_containment/1]).
-export([get_proto_by_msg_name_as_fqbin/1]).
-export([get_proto_by_service_name_as_fqbin/1]).
-export([get_proto_by_enum_name_as_fqbin/1]).
-export([get_protos_by_pkg_name_as_fqbin/1]).
-export([descriptor/0, descriptor/1]).
-export([gpb_version_as_string/0, gpb_version_as_list/0]).
%% enumerated types
-type 'grpc.testing.PayloadType'() :: 'COMPRESSABLE'.
-export_type(['grpc.testing.PayloadType'/0]).
%% message types
-type bool_value() ::
#{value => boolean() | 0 | 1 % = 1
}.
-type payload() ::
#{type => 'COMPRESSABLE' | integer(), % = 1, enum grpc.testing.PayloadType
body => iodata() % = 2
}.
-type echo_status() ::
#{code => integer(), % = 1, 32 bits
message => iodata() % = 2
}.
-type simple_request() ::
#{response_type => 'COMPRESSABLE' | integer(), % = 1, enum grpc.testing.PayloadType
response_size => integer(), % = 2, 32 bits
payload => payload(), % = 3
fill_username => boolean() | 0 | 1, % = 4
fill_oauth_scope => boolean() | 0 | 1, % = 5
response_compressed => bool_value(), % = 6
response_status => echo_status(), % = 7
expect_compressed => bool_value() % = 8
}.
-type simple_response() ::
#{payload => payload(), % = 1
username => iodata(), % = 2
oauth_scope => iodata() % = 3
}.
-type streaming_input_call_request() ::
#{payload => payload(), % = 1
expect_compressed => bool_value() % = 2
}.
-type streaming_input_call_response() ::
#{aggregated_payload_size => integer() % = 1, 32 bits
}.
-type response_parameters() ::
#{size => integer(), % = 1, 32 bits
interval_us => integer(), % = 2, 32 bits
compressed => bool_value() % = 3
}.
-type streaming_output_call_request() ::
#{response_type => 'COMPRESSABLE' | integer(), % = 1, enum grpc.testing.PayloadType
response_parameters => [response_parameters()], % = 2
payload => payload(), % = 3
response_status => echo_status() % = 7
}.
-type streaming_output_call_response() ::
#{payload => payload() % = 1
}.
-type reconnect_params() ::
#{max_reconnect_backoff_ms => integer() % = 1, 32 bits
}.
-type reconnect_info() ::
#{passed => boolean() | 0 | 1, % = 1
backoff_ms => [integer()] % = 2, 32 bits
}.
-export_type(['bool_value'/0, 'payload'/0, 'echo_status'/0, 'simple_request'/0, 'simple_response'/0, 'streaming_input_call_request'/0, 'streaming_input_call_response'/0, 'response_parameters'/0, 'streaming_output_call_request'/0, 'streaming_output_call_response'/0, 'reconnect_params'/0, 'reconnect_info'/0]).
-spec encode_msg(bool_value() | payload() | echo_status() | simple_request() | simple_response() | streaming_input_call_request() | streaming_input_call_response() | response_parameters() | streaming_output_call_request() | streaming_output_call_response() | reconnect_params() | reconnect_info(), atom()) -> binary().
encode_msg(Msg, MsgName) when is_atom(MsgName) ->
encode_msg(Msg, MsgName, []).
-spec encode_msg(bool_value() | payload() | echo_status() | simple_request() | simple_response() | streaming_input_call_request() | streaming_input_call_response() | response_parameters() | streaming_output_call_request() | streaming_output_call_response() | reconnect_params() | reconnect_info(), atom(), list()) -> binary().
encode_msg(Msg, MsgName, Opts) ->
case proplists:get_bool(verify, Opts) of
true -> verify_msg(Msg, MsgName, Opts);
false -> ok
end,
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
bool_value ->
encode_msg_bool_value(id(Msg, TrUserData), TrUserData);
payload ->
encode_msg_payload(id(Msg, TrUserData), TrUserData);
echo_status ->
encode_msg_echo_status(id(Msg, TrUserData), TrUserData);
simple_request ->
encode_msg_simple_request(id(Msg, TrUserData),
TrUserData);
simple_response ->
encode_msg_simple_response(id(Msg, TrUserData),
TrUserData);
streaming_input_call_request ->
encode_msg_streaming_input_call_request(id(Msg,
TrUserData),
TrUserData);
streaming_input_call_response ->
encode_msg_streaming_input_call_response(id(Msg,
TrUserData),
TrUserData);
response_parameters ->
encode_msg_response_parameters(id(Msg, TrUserData),
TrUserData);
streaming_output_call_request ->
encode_msg_streaming_output_call_request(id(Msg,
TrUserData),
TrUserData);
streaming_output_call_response ->
encode_msg_streaming_output_call_response(id(Msg,
TrUserData),
TrUserData);
reconnect_params ->
encode_msg_reconnect_params(id(Msg, TrUserData),
TrUserData);
reconnect_info ->
encode_msg_reconnect_info(id(Msg, TrUserData),
TrUserData)
end.
encode_msg_bool_value(Msg, TrUserData) ->
encode_msg_bool_value(Msg, <<>>, TrUserData).
encode_msg_bool_value(#{} = M, Bin, TrUserData) ->
case M of
#{value := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= false -> Bin;
true -> e_type_bool(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end.
encode_msg_payload(Msg, TrUserData) ->
encode_msg_payload(Msg, <<>>, TrUserData).
encode_msg_payload(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{type := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 'COMPRESSABLE'; TrF1 =:= 0 -> Bin;
true ->
'e_enum_grpc.testing.PayloadType'(TrF1,
<<Bin/binary, 8>>,
TrUserData)
end
end;
_ -> Bin
end,
case M of
#{body := F2} ->
begin
TrF2 = id(F2, TrUserData),
case iolist_size(TrF2) of
0 -> B1;
_ -> e_type_bytes(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_echo_status(Msg, TrUserData) ->
encode_msg_echo_status(Msg, <<>>, TrUserData).
encode_msg_echo_status(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{code := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true ->
e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{message := F2} ->
begin
TrF2 = id(F2, TrUserData),
case is_empty_string(TrF2) of
true -> B1;
false ->
e_type_string(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_simple_request(Msg, TrUserData) ->
encode_msg_simple_request(Msg, <<>>, TrUserData).
encode_msg_simple_request(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{response_type := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 'COMPRESSABLE'; TrF1 =:= 0 -> Bin;
true ->
'e_enum_grpc.testing.PayloadType'(TrF1,
<<Bin/binary, 8>>,
TrUserData)
end
end;
_ -> Bin
end,
B2 = case M of
#{response_size := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= 0 -> B1;
true ->
e_type_int32(TrF2, <<B1/binary, 16>>, TrUserData)
end
end;
_ -> B1
end,
B3 = case M of
#{payload := F3} ->
begin
TrF3 = id(F3, TrUserData),
if TrF3 =:= undefined -> B2;
true ->
e_mfield_simple_request_payload(TrF3, <<B2/binary, 26>>,
TrUserData)
end
end;
_ -> B2
end,
B4 = case M of
#{fill_username := F4} ->
begin
TrF4 = id(F4, TrUserData),
if TrF4 =:= false -> B3;
true -> e_type_bool(TrF4, <<B3/binary, 32>>, TrUserData)
end
end;
_ -> B3
end,
B5 = case M of
#{fill_oauth_scope := F5} ->
begin
TrF5 = id(F5, TrUserData),
if TrF5 =:= false -> B4;
true -> e_type_bool(TrF5, <<B4/binary, 40>>, TrUserData)
end
end;
_ -> B4
end,
B6 = case M of
#{response_compressed := F6} ->
begin
TrF6 = id(F6, TrUserData),
if TrF6 =:= undefined -> B5;
true ->
e_mfield_simple_request_response_compressed(TrF6,
<<B5/binary,
50>>,
TrUserData)
end
end;
_ -> B5
end,
B7 = case M of
#{response_status := F7} ->
begin
TrF7 = id(F7, TrUserData),
if TrF7 =:= undefined -> B6;
true ->
e_mfield_simple_request_response_status(TrF7,
<<B6/binary,
58>>,
TrUserData)
end
end;
_ -> B6
end,
case M of
#{expect_compressed := F8} ->
begin
TrF8 = id(F8, TrUserData),
if TrF8 =:= undefined -> B7;
true ->
e_mfield_simple_request_expect_compressed(TrF8,
<<B7/binary, 66>>,
TrUserData)
end
end;
_ -> B7
end.
encode_msg_simple_response(Msg, TrUserData) ->
encode_msg_simple_response(Msg, <<>>, TrUserData).
encode_msg_simple_response(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{payload := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= undefined -> Bin;
true ->
e_mfield_simple_response_payload(TrF1,
<<Bin/binary, 10>>,
TrUserData)
end
end;
_ -> Bin
end,
B2 = case M of
#{username := F2} ->
begin
TrF2 = id(F2, TrUserData),
case is_empty_string(TrF2) of
true -> B1;
false ->
e_type_string(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end,
case M of
#{oauth_scope := F3} ->
begin
TrF3 = id(F3, TrUserData),
case is_empty_string(TrF3) of
true -> B2;
false ->
e_type_string(TrF3, <<B2/binary, 26>>, TrUserData)
end
end;
_ -> B2
end.
encode_msg_streaming_input_call_request(Msg,
TrUserData) ->
encode_msg_streaming_input_call_request(Msg, <<>>,
TrUserData).
encode_msg_streaming_input_call_request(#{} = M, Bin,
TrUserData) ->
B1 = case M of
#{payload := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= undefined -> Bin;
true ->
e_mfield_streaming_input_call_request_payload(TrF1,
<<Bin/binary,
10>>,
TrUserData)
end
end;
_ -> Bin
end,
case M of
#{expect_compressed := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= undefined -> B1;
true ->
e_mfield_streaming_input_call_request_expect_compressed(TrF2,
<<B1/binary,
18>>,
TrUserData)
end
end;
_ -> B1
end.
encode_msg_streaming_input_call_response(Msg,
TrUserData) ->
encode_msg_streaming_input_call_response(Msg, <<>>,
TrUserData).
encode_msg_streaming_input_call_response(#{} = M, Bin,
TrUserData) ->
case M of
#{aggregated_payload_size := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true ->
e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end.
encode_msg_response_parameters(Msg, TrUserData) ->
encode_msg_response_parameters(Msg, <<>>, TrUserData).
encode_msg_response_parameters(#{} = M, Bin,
TrUserData) ->
B1 = case M of
#{size := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true ->
e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end,
B2 = case M of
#{interval_us := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= 0 -> B1;
true ->
e_type_int32(TrF2, <<B1/binary, 16>>, TrUserData)
end
end;
_ -> B1
end,
case M of
#{compressed := F3} ->
begin
TrF3 = id(F3, TrUserData),
if TrF3 =:= undefined -> B2;
true ->
e_mfield_response_parameters_compressed(TrF3,
<<B2/binary, 26>>,
TrUserData)
end
end;
_ -> B2
end.
encode_msg_streaming_output_call_request(Msg,
TrUserData) ->
encode_msg_streaming_output_call_request(Msg, <<>>,
TrUserData).
encode_msg_streaming_output_call_request(#{} = M, Bin,
TrUserData) ->
B1 = case M of
#{response_type := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 'COMPRESSABLE'; TrF1 =:= 0 -> Bin;
true ->
'e_enum_grpc.testing.PayloadType'(TrF1,
<<Bin/binary, 8>>,
TrUserData)
end
end;
_ -> Bin
end,
B2 = case M of
#{response_parameters := F2} ->
TrF2 = id(F2, TrUserData),
if TrF2 == [] -> B1;
true ->
e_field_streaming_output_call_request_response_parameters(TrF2,
B1,
TrUserData)
end;
_ -> B1
end,
B3 = case M of
#{payload := F3} ->
begin
TrF3 = id(F3, TrUserData),
if TrF3 =:= undefined -> B2;
true ->
e_mfield_streaming_output_call_request_payload(TrF3,
<<B2/binary,
26>>,
TrUserData)
end
end;
_ -> B2
end,
case M of
#{response_status := F4} ->
begin
TrF4 = id(F4, TrUserData),
if TrF4 =:= undefined -> B3;
true ->
e_mfield_streaming_output_call_request_response_status(TrF4,
<<B3/binary,
58>>,
TrUserData)
end
end;
_ -> B3
end.
encode_msg_streaming_output_call_response(Msg,
TrUserData) ->
encode_msg_streaming_output_call_response(Msg, <<>>,
TrUserData).
encode_msg_streaming_output_call_response(#{} = M, Bin,
TrUserData) ->
case M of
#{payload := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= undefined -> Bin;
true ->
e_mfield_streaming_output_call_response_payload(TrF1,
<<Bin/binary,
10>>,
TrUserData)
end
end;
_ -> Bin
end.
encode_msg_reconnect_params(Msg, TrUserData) ->
encode_msg_reconnect_params(Msg, <<>>, TrUserData).
encode_msg_reconnect_params(#{} = M, Bin, TrUserData) ->
case M of
#{max_reconnect_backoff_ms := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true ->
e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end.
encode_msg_reconnect_info(Msg, TrUserData) ->
encode_msg_reconnect_info(Msg, <<>>, TrUserData).
encode_msg_reconnect_info(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{passed := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= false -> Bin;
true -> e_type_bool(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{backoff_ms := F2} ->
TrF2 = id(F2, TrUserData),
if TrF2 == [] -> B1;
true ->
e_field_reconnect_info_backoff_ms(TrF2, B1, TrUserData)
end;
_ -> B1
end.
e_mfield_simple_request_payload(Msg, Bin, TrUserData) ->
SubBin = encode_msg_payload(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_simple_request_response_compressed(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_bool_value(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_simple_request_response_status(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_echo_status(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_simple_request_expect_compressed(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_bool_value(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_simple_response_payload(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_payload(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_streaming_input_call_request_payload(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_payload(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_streaming_input_call_request_expect_compressed(Msg,
Bin, TrUserData) ->
SubBin = encode_msg_bool_value(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_response_parameters_compressed(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_bool_value(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_streaming_output_call_request_response_parameters(Msg,
Bin, TrUserData) ->
SubBin = encode_msg_response_parameters(Msg, <<>>,
TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_field_streaming_output_call_request_response_parameters([Elem
| Rest],
Bin, TrUserData) ->
Bin2 = <<Bin/binary, 18>>,
Bin3 =
e_mfield_streaming_output_call_request_response_parameters(id(Elem,
TrUserData),
Bin2,
TrUserData),
e_field_streaming_output_call_request_response_parameters(Rest,
Bin3, TrUserData);
e_field_streaming_output_call_request_response_parameters([],
Bin, _TrUserData) ->
Bin.
e_mfield_streaming_output_call_request_payload(Msg, Bin,
TrUserData) ->
SubBin = encode_msg_payload(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_streaming_output_call_request_response_status(Msg,
Bin, TrUserData) ->
SubBin = encode_msg_echo_status(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_streaming_output_call_response_payload(Msg,
Bin, TrUserData) ->
SubBin = encode_msg_payload(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_field_reconnect_info_backoff_ms(Elems, Bin,
TrUserData)
when Elems =/= [] ->
SubBin = e_pfield_reconnect_info_backoff_ms(Elems, <<>>,
TrUserData),
Bin2 = <<Bin/binary, 18>>,
Bin3 = e_varint(byte_size(SubBin), Bin2),
<<Bin3/binary, SubBin/binary>>;
e_field_reconnect_info_backoff_ms([], Bin,
_TrUserData) ->
Bin.
e_pfield_reconnect_info_backoff_ms([Value | Rest], Bin,
TrUserData) ->
Bin2 = e_type_int32(id(Value, TrUserData), Bin,
TrUserData),
e_pfield_reconnect_info_backoff_ms(Rest, Bin2,
TrUserData);
e_pfield_reconnect_info_backoff_ms([], Bin,
_TrUserData) ->
Bin.
'e_enum_grpc.testing.PayloadType'('COMPRESSABLE', Bin,
_TrUserData) ->
<<Bin/binary, 0>>;
'e_enum_grpc.testing.PayloadType'(V, Bin,
_TrUserData) ->
e_varint(V, Bin).
-compile({nowarn_unused_function,e_type_sint/3}).
e_type_sint(Value, Bin, _TrUserData) when Value >= 0 ->
e_varint(Value * 2, Bin);
e_type_sint(Value, Bin, _TrUserData) ->
e_varint(Value * -2 - 1, Bin).
-compile({nowarn_unused_function,e_type_int32/3}).
e_type_int32(Value, Bin, _TrUserData)
when 0 =< Value, Value =< 127 ->
<<Bin/binary, Value>>;
e_type_int32(Value, Bin, _TrUserData) ->
<<N:64/unsigned-native>> = <<Value:64/signed-native>>,
e_varint(N, Bin).
-compile({nowarn_unused_function,e_type_int64/3}).
e_type_int64(Value, Bin, _TrUserData)
when 0 =< Value, Value =< 127 ->
<<Bin/binary, Value>>;
e_type_int64(Value, Bin, _TrUserData) ->
<<N:64/unsigned-native>> = <<Value:64/signed-native>>,
e_varint(N, Bin).
-compile({nowarn_unused_function,e_type_bool/3}).
e_type_bool(true, Bin, _TrUserData) ->
<<Bin/binary, 1>>;
e_type_bool(false, Bin, _TrUserData) ->
<<Bin/binary, 0>>;
e_type_bool(1, Bin, _TrUserData) -> <<Bin/binary, 1>>;
e_type_bool(0, Bin, _TrUserData) -> <<Bin/binary, 0>>.
-compile({nowarn_unused_function,e_type_string/3}).
e_type_string(S, Bin, _TrUserData) ->
Utf8 = unicode:characters_to_binary(S),
Bin2 = e_varint(byte_size(Utf8), Bin),
<<Bin2/binary, Utf8/binary>>.
-compile({nowarn_unused_function,e_type_bytes/3}).
e_type_bytes(Bytes, Bin, _TrUserData)
when is_binary(Bytes) ->
Bin2 = e_varint(byte_size(Bytes), Bin),
<<Bin2/binary, Bytes/binary>>;
e_type_bytes(Bytes, Bin, _TrUserData)
when is_list(Bytes) ->
BytesBin = iolist_to_binary(Bytes),
Bin2 = e_varint(byte_size(BytesBin), Bin),
<<Bin2/binary, BytesBin/binary>>.
-compile({nowarn_unused_function,e_type_fixed32/3}).
e_type_fixed32(Value, Bin, _TrUserData) ->
<<Bin/binary, Value:32/little>>.
-compile({nowarn_unused_function,e_type_sfixed32/3}).
e_type_sfixed32(Value, Bin, _TrUserData) ->
<<Bin/binary, Value:32/little-signed>>.
-compile({nowarn_unused_function,e_type_fixed64/3}).
e_type_fixed64(Value, Bin, _TrUserData) ->
<<Bin/binary, Value:64/little>>.
-compile({nowarn_unused_function,e_type_sfixed64/3}).
e_type_sfixed64(Value, Bin, _TrUserData) ->
<<Bin/binary, Value:64/little-signed>>.
-compile({nowarn_unused_function,e_type_float/3}).
e_type_float(V, Bin, _) when is_number(V) ->
<<Bin/binary, V:32/little-float>>;
e_type_float(infinity, Bin, _) ->
<<Bin/binary, 0:16, 128, 127>>;
e_type_float('-infinity', Bin, _) ->
<<Bin/binary, 0:16, 128, 255>>;
e_type_float(nan, Bin, _) ->
<<Bin/binary, 0:16, 192, 127>>.
-compile({nowarn_unused_function,e_type_double/3}).
e_type_double(V, Bin, _) when is_number(V) ->
<<Bin/binary, V:64/little-float>>;
e_type_double(infinity, Bin, _) ->
<<Bin/binary, 0:48, 240, 127>>;
e_type_double('-infinity', Bin, _) ->
<<Bin/binary, 0:48, 240, 255>>;
e_type_double(nan, Bin, _) ->
<<Bin/binary, 0:48, 248, 127>>.
-compile({nowarn_unused_function,e_varint/3}).
e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin).
-compile({nowarn_unused_function,e_varint/2}).
e_varint(N, Bin) when N =< 127 -> <<Bin/binary, N>>;
e_varint(N, Bin) ->
Bin2 = <<Bin/binary, (N band 127 bor 128)>>,
e_varint(N bsr 7, Bin2).
is_empty_string("") -> true;
is_empty_string(<<>>) -> true;
is_empty_string(L) when is_list(L) ->
not string_has_chars(L);
is_empty_string(B) when is_binary(B) -> false.
string_has_chars([C | _]) when is_integer(C) -> true;
string_has_chars([H | T]) ->
case string_has_chars(H) of
true -> true;
false -> string_has_chars(T)
end;
string_has_chars(B)
when is_binary(B), byte_size(B) =/= 0 ->
true;
string_has_chars(C) when is_integer(C) -> true;
string_has_chars(<<>>) -> false;
string_has_chars([]) -> false.
decode_msg(Bin, MsgName) when is_binary(Bin) ->
decode_msg(Bin, MsgName, []).
decode_msg(Bin, MsgName, Opts) when is_binary(Bin) ->
TrUserData = proplists:get_value(user_data, Opts),
decode_msg_1_catch(Bin, MsgName, TrUserData).
-ifdef('OTP_RELEASE').
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-else.
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason ->
StackTrace = erlang:get_stacktrace(),
error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-endif.
decode_msg_2_doit(bool_value, Bin, TrUserData) ->
id(decode_msg_bool_value(Bin, TrUserData), TrUserData);
decode_msg_2_doit(payload, Bin, TrUserData) ->
id(decode_msg_payload(Bin, TrUserData), TrUserData);
decode_msg_2_doit(echo_status, Bin, TrUserData) ->
id(decode_msg_echo_status(Bin, TrUserData), TrUserData);
decode_msg_2_doit(simple_request, Bin, TrUserData) ->
id(decode_msg_simple_request(Bin, TrUserData),
TrUserData);
decode_msg_2_doit(simple_response, Bin, TrUserData) ->
id(decode_msg_simple_response(Bin, TrUserData),
TrUserData);
decode_msg_2_doit(streaming_input_call_request, Bin,
TrUserData) ->
id(decode_msg_streaming_input_call_request(Bin,
TrUserData),
TrUserData);
decode_msg_2_doit(streaming_input_call_response, Bin,
TrUserData) ->
id(decode_msg_streaming_input_call_response(Bin,
TrUserData),
TrUserData);
decode_msg_2_doit(response_parameters, Bin,
TrUserData) ->
id(decode_msg_response_parameters(Bin, TrUserData),
TrUserData);
decode_msg_2_doit(streaming_output_call_request, Bin,
TrUserData) ->
id(decode_msg_streaming_output_call_request(Bin,
TrUserData),
TrUserData);
decode_msg_2_doit(streaming_output_call_response, Bin,
TrUserData) ->
id(decode_msg_streaming_output_call_response(Bin,
TrUserData),
TrUserData);
decode_msg_2_doit(reconnect_params, Bin, TrUserData) ->
id(decode_msg_reconnect_params(Bin, TrUserData),
TrUserData);
decode_msg_2_doit(reconnect_info, Bin, TrUserData) ->
id(decode_msg_reconnect_info(Bin, TrUserData),
TrUserData).
decode_msg_bool_value(Bin, TrUserData) ->
dfp_read_field_def_bool_value(Bin, 0, 0,
id(false, TrUserData), TrUserData).
dfp_read_field_def_bool_value(<<8, Rest/binary>>, Z1,
Z2, F@_1, TrUserData) ->
d_field_bool_value_value(Rest, Z1, Z2, F@_1,
TrUserData);
dfp_read_field_def_bool_value(<<>>, 0, 0, F@_1, _) ->
#{value => F@_1};
dfp_read_field_def_bool_value(Other, Z1, Z2, F@_1,
TrUserData) ->
dg_read_field_def_bool_value(Other, Z1, Z2, F@_1,
TrUserData).
dg_read_field_def_bool_value(<<1:1, X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_bool_value(Rest, N + 7, X bsl N + Acc,
F@_1, TrUserData);
dg_read_field_def_bool_value(<<0:1, X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_bool_value_value(Rest, 0, 0, F@_1, TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_bool_value(Rest, 0, 0, F@_1, TrUserData);
1 -> skip_64_bool_value(Rest, 0, 0, F@_1, TrUserData);
2 ->
skip_length_delimited_bool_value(Rest, 0, 0, F@_1,
TrUserData);
3 ->
skip_group_bool_value(Rest, Key bsr 3, 0, F@_1,
TrUserData);
5 -> skip_32_bool_value(Rest, 0, 0, F@_1, TrUserData)
end
end;
dg_read_field_def_bool_value(<<>>, 0, 0, F@_1, _) ->
#{value => F@_1}.
d_field_bool_value_value(<<1:1, X:7, Rest/binary>>, N,
Acc, F@_1, TrUserData)
when N < 57 ->
d_field_bool_value_value(Rest, N + 7, X bsl N + Acc,
F@_1, TrUserData);
d_field_bool_value_value(<<0:1, X:7, Rest/binary>>, N,
Acc, _, TrUserData) ->
{NewFValue, RestF} = {id(X bsl N + Acc =/= 0,
TrUserData),
Rest},
dfp_read_field_def_bool_value(RestF, 0, 0, NewFValue,
TrUserData).
skip_varint_bool_value(<<1:1, _:7, Rest/binary>>, Z1,
Z2, F@_1, TrUserData) ->
skip_varint_bool_value(Rest, Z1, Z2, F@_1, TrUserData);
skip_varint_bool_value(<<0:1, _:7, Rest/binary>>, Z1,
Z2, F@_1, TrUserData) ->
dfp_read_field_def_bool_value(Rest, Z1, Z2, F@_1,
TrUserData).
skip_length_delimited_bool_value(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
skip_length_delimited_bool_value(Rest, N + 7,
X bsl N + Acc, F@_1, TrUserData);
skip_length_delimited_bool_value(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_bool_value(Rest2, 0, 0, F@_1,
TrUserData).
skip_group_bool_value(Bin, FNum, Z2, F@_1,
TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_bool_value(Rest, 0, Z2, F@_1,
TrUserData).
skip_32_bool_value(<<_:32, Rest/binary>>, Z1, Z2, F@_1,
TrUserData) ->
dfp_read_field_def_bool_value(Rest, Z1, Z2, F@_1,
TrUserData).
skip_64_bool_value(<<_:64, Rest/binary>>, Z1, Z2, F@_1,
TrUserData) ->
dfp_read_field_def_bool_value(Rest, Z1, Z2, F@_1,
TrUserData).
decode_msg_payload(Bin, TrUserData) ->
dfp_read_field_def_payload(Bin, 0, 0,
id('COMPRESSABLE', TrUserData),
id(<<>>, TrUserData), TrUserData).
dfp_read_field_def_payload(<<8, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
d_field_payload_type(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_payload(<<18, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
d_field_payload_body(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_payload(<<>>, 0, 0, F@_1, F@_2, _) ->
#{type => F@_1, body => F@_2};
dfp_read_field_def_payload(Other, Z1, Z2, F@_1, F@_2,
TrUserData) ->
dg_read_field_def_payload(Other, Z1, Z2, F@_1, F@_2,
TrUserData).
dg_read_field_def_payload(<<1:1, X:7, Rest/binary>>, N,
Acc, F@_1, F@_2, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_payload(Rest, N + 7, X bsl N + Acc,
F@_1, F@_2, TrUserData);
dg_read_field_def_payload(<<0:1, X:7, Rest/binary>>, N,
Acc, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_payload_type(Rest, 0, 0, F@_1, F@_2,
TrUserData);
18 ->
d_field_payload_body(Rest, 0, 0, F@_1, F@_2,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_payload(Rest, 0, 0, F@_1, F@_2, TrUserData);
1 ->
skip_64_payload(Rest, 0, 0, F@_1, F@_2, TrUserData);
2 ->
skip_length_delimited_payload(Rest, 0, 0, F@_1, F@_2,
TrUserData);
3 ->
skip_group_payload(Rest, Key bsr 3, 0, F@_1, F@_2,
TrUserData);
5 -> skip_32_payload(Rest, 0, 0, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_payload(<<>>, 0, 0, F@_1, F@_2, _) ->
#{type => F@_1, body => F@_2}.
d_field_payload_type(<<1:1, X:7, Rest/binary>>, N, Acc,
F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_payload_type(Rest, N + 7, X bsl N + Acc, F@_1,
F@_2, TrUserData);
d_field_payload_type(<<0:1, X:7, Rest/binary>>, N, Acc,
_, F@_2, TrUserData) ->
{NewFValue, RestF} =
{id('d_enum_grpc.testing.PayloadType'(begin
<<Res:32/signed-native>> = <<(X
bsl
N
+
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end),
TrUserData),
Rest},
dfp_read_field_def_payload(RestF, 0, 0, NewFValue, F@_2,
TrUserData).
d_field_payload_body(<<1:1, X:7, Rest/binary>>, N, Acc,
F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_payload_body(Rest, N + 7, X bsl N + Acc, F@_1,
F@_2, TrUserData);
d_field_payload_body(<<0:1, X:7, Rest/binary>>, N, Acc,
F@_1, _, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bytes:Len/binary, Rest2/binary>> = Rest,
{id(binary:copy(Bytes), TrUserData), Rest2}
end,
dfp_read_field_def_payload(RestF, 0, 0, F@_1, NewFValue,
TrUserData).
skip_varint_payload(<<1:1, _:7, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
skip_varint_payload(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
skip_varint_payload(<<0:1, _:7, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
dfp_read_field_def_payload(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
skip_length_delimited_payload(<<1:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
skip_length_delimited_payload(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
skip_length_delimited_payload(<<0:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_payload(Rest2, 0, 0, F@_1, F@_2,
TrUserData).
skip_group_payload(Bin, FNum, Z2, F@_1, F@_2,
TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_payload(Rest, 0, Z2, F@_1, F@_2,
TrUserData).
skip_32_payload(<<_:32, Rest/binary>>, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dfp_read_field_def_payload(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
skip_64_payload(<<_:64, Rest/binary>>, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dfp_read_field_def_payload(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
decode_msg_echo_status(Bin, TrUserData) ->
dfp_read_field_def_echo_status(Bin, 0, 0,
id(0, TrUserData), id(<<>>, TrUserData),
TrUserData).
dfp_read_field_def_echo_status(<<8, Rest/binary>>, Z1,
Z2, F@_1, F@_2, TrUserData) ->
d_field_echo_status_code(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_echo_status(<<18, Rest/binary>>, Z1,
Z2, F@_1, F@_2, TrUserData) ->
d_field_echo_status_message(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_echo_status(<<>>, 0, 0, F@_1, F@_2,
_) ->
#{code => F@_1, message => F@_2};
dfp_read_field_def_echo_status(Other, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dg_read_field_def_echo_status(Other, Z1, Z2, F@_1, F@_2,
TrUserData).
dg_read_field_def_echo_status(<<1:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_echo_status(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
dg_read_field_def_echo_status(<<0:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_echo_status_code(Rest, 0, 0, F@_1, F@_2,
TrUserData);
18 ->
d_field_echo_status_message(Rest, 0, 0, F@_1, F@_2,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_echo_status(Rest, 0, 0, F@_1, F@_2,
TrUserData);
1 ->
skip_64_echo_status(Rest, 0, 0, F@_1, F@_2, TrUserData);
2 ->
skip_length_delimited_echo_status(Rest, 0, 0, F@_1,
F@_2, TrUserData);
3 ->
skip_group_echo_status(Rest, Key bsr 3, 0, F@_1, F@_2,
TrUserData);
5 ->
skip_32_echo_status(Rest, 0, 0, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_echo_status(<<>>, 0, 0, F@_1, F@_2,
_) ->
#{code => F@_1, message => F@_2}.
d_field_echo_status_code(<<1:1, X:7, Rest/binary>>, N,
Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_echo_status_code(Rest, N + 7, X bsl N + Acc,
F@_1, F@_2, TrUserData);
d_field_echo_status_code(<<0:1, X:7, Rest/binary>>, N,
Acc, _, F@_2, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_echo_status(RestF, 0, 0, NewFValue,
F@_2, TrUserData).
d_field_echo_status_message(<<1:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_echo_status_message(Rest, N + 7, X bsl N + Acc,
F@_1, F@_2, TrUserData);
d_field_echo_status_message(<<0:1, X:7, Rest/binary>>,
N, Acc, F@_1, _, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bytes:Len/binary, Rest2/binary>> = Rest,
{id(binary:copy(Bytes), TrUserData), Rest2}
end,
dfp_read_field_def_echo_status(RestF, 0, 0, F@_1,
NewFValue, TrUserData).
skip_varint_echo_status(<<1:1, _:7, Rest/binary>>, Z1,
Z2, F@_1, F@_2, TrUserData) ->
skip_varint_echo_status(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
skip_varint_echo_status(<<0:1, _:7, Rest/binary>>, Z1,
Z2, F@_1, F@_2, TrUserData) ->
dfp_read_field_def_echo_status(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
skip_length_delimited_echo_status(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
skip_length_delimited_echo_status(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
skip_length_delimited_echo_status(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_echo_status(Rest2, 0, 0, F@_1, F@_2,
TrUserData).
skip_group_echo_status(Bin, FNum, Z2, F@_1, F@_2,
TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_echo_status(Rest, 0, Z2, F@_1, F@_2,
TrUserData).
skip_32_echo_status(<<_:32, Rest/binary>>, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dfp_read_field_def_echo_status(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
skip_64_echo_status(<<_:64, Rest/binary>>, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dfp_read_field_def_echo_status(Rest, Z1, Z2, F@_1, F@_2,
TrUserData).
decode_msg_simple_request(Bin, TrUserData) ->
dfp_read_field_def_simple_request(Bin, 0, 0,
id('COMPRESSABLE', TrUserData),
id(0, TrUserData),
id('$undef', TrUserData),
id(false, TrUserData),
id(false, TrUserData),
id('$undef', TrUserData),
id('$undef', TrUserData),
id('$undef', TrUserData), TrUserData).
dfp_read_field_def_simple_request(<<8, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_response_type(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData);
dfp_read_field_def_simple_request(<<16, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_response_size(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData);
dfp_read_field_def_simple_request(<<26, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_payload(Rest, Z1, Z2, F@_1, F@_2,
F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
dfp_read_field_def_simple_request(<<32, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_fill_username(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData);
dfp_read_field_def_simple_request(<<40, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_fill_oauth_scope(Rest, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
dfp_read_field_def_simple_request(<<50, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_response_compressed(Rest, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData);
dfp_read_field_def_simple_request(<<58, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_response_status(Rest, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
dfp_read_field_def_simple_request(<<66, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
d_field_simple_request_expect_compressed(Rest, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
dfp_read_field_def_simple_request(<<>>, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
_) ->
S1 = #{response_type => F@_1, response_size => F@_2,
fill_username => F@_4, fill_oauth_scope => F@_5},
S2 = if F@_3 == '$undef' -> S1;
true -> S1#{payload => F@_3}
end,
S3 = if F@_6 == '$undef' -> S2;
true -> S2#{response_compressed => F@_6}
end,
S4 = if F@_7 == '$undef' -> S3;
true -> S3#{response_status => F@_7}
end,
if F@_8 == '$undef' -> S4;
true -> S4#{expect_compressed => F@_8}
end;
dfp_read_field_def_simple_request(Other, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData) ->
dg_read_field_def_simple_request(Other, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
dg_read_field_def_simple_request(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_simple_request(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8, TrUserData);
dg_read_field_def_simple_request(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_simple_request_response_type(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
16 ->
d_field_simple_request_response_size(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
26 ->
d_field_simple_request_payload(Rest, 0, 0, F@_1, F@_2,
F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
32 ->
d_field_simple_request_fill_username(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
40 ->
d_field_simple_request_fill_oauth_scope(Rest, 0, 0,
F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData);
50 ->
d_field_simple_request_response_compressed(Rest, 0, 0,
F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8,
TrUserData);
58 ->
d_field_simple_request_response_status(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData);
66 ->
d_field_simple_request_expect_compressed(Rest, 0, 0,
F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_simple_request(Rest, 0, 0, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
1 ->
skip_64_simple_request(Rest, 0, 0, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
2 ->
skip_length_delimited_simple_request(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8,
TrUserData);
3 ->
skip_group_simple_request(Rest, Key bsr 3, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData);
5 ->
skip_32_simple_request(Rest, 0, 0, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8, TrUserData)
end
end;
dg_read_field_def_simple_request(<<>>, 0, 0, F@_1, F@_2,
F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, _) ->
S1 = #{response_type => F@_1, response_size => F@_2,
fill_username => F@_4, fill_oauth_scope => F@_5},
S2 = if F@_3 == '$undef' -> S1;
true -> S1#{payload => F@_3}
end,
S3 = if F@_6 == '$undef' -> S2;
true -> S2#{response_compressed => F@_6}
end,
S4 = if F@_7 == '$undef' -> S3;
true -> S3#{response_status => F@_7}
end,
if F@_8 == '$undef' -> S4;
true -> S4#{expect_compressed => F@_8}
end.
d_field_simple_request_response_type(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_response_type(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8, TrUserData);
d_field_simple_request_response_type(<<0:1, X:7,
Rest/binary>>,
N, Acc, _, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
{NewFValue, RestF} =
{id('d_enum_grpc.testing.PayloadType'(begin
<<Res:32/signed-native>> = <<(X
bsl
N
+
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end),
TrUserData),
Rest},
dfp_read_field_def_simple_request(RestF, 0, 0,
NewFValue, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData).
d_field_simple_request_response_size(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_response_size(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8, TrUserData);
d_field_simple_request_response_size(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, _, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
NewFValue, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData).
d_field_simple_request_payload(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_payload(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData);
d_field_simple_request_payload(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, Prev, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_payload(Bs, TrUserData), TrUserData),
Rest2}
end,
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_payload(Prev, NewFValue,
TrUserData)
end,
F@_4, F@_5, F@_6, F@_7, F@_8, TrUserData).
d_field_simple_request_fill_username(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_fill_username(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8, TrUserData);
d_field_simple_request_fill_username(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, _, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
{NewFValue, RestF} = {id(X bsl N + Acc =/= 0,
TrUserData),
Rest},
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2, F@_3, NewFValue, F@_5, F@_6, F@_7,
F@_8, TrUserData).
d_field_simple_request_fill_oauth_scope(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_fill_oauth_scope(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
d_field_simple_request_fill_oauth_scope(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, _, F@_6,
F@_7, F@_8, TrUserData) ->
{NewFValue, RestF} = {id(X bsl N + Acc =/= 0,
TrUserData),
Rest},
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2, F@_3, F@_4, NewFValue, F@_6, F@_7,
F@_8, TrUserData).
d_field_simple_request_response_compressed(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_response_compressed(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
d_field_simple_request_response_compressed(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
Prev, F@_7, F@_8, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_bool_value(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_bool_value(Prev,
NewFValue,
TrUserData)
end,
F@_7, F@_8, TrUserData).
d_field_simple_request_response_status(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_response_status(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
d_field_simple_request_response_status(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, Prev, F@_8, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_echo_status(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_echo_status(Prev,
NewFValue,
TrUserData)
end,
F@_8, TrUserData).
d_field_simple_request_expect_compressed(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, F@_8, TrUserData)
when N < 57 ->
d_field_simple_request_expect_compressed(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData);
d_field_simple_request_expect_compressed(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5,
F@_6, F@_7, Prev, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_bool_value(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_simple_request(RestF, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_bool_value(Prev,
NewFValue,
TrUserData)
end,
TrUserData).
skip_varint_simple_request(<<1:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData) ->
skip_varint_simple_request(Rest, Z1, Z2, F@_1, F@_2,
F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, TrUserData);
skip_varint_simple_request(<<0:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7,
F@_8, TrUserData) ->
dfp_read_field_def_simple_request(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
skip_length_delimited_simple_request(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData)
when N < 57 ->
skip_length_delimited_simple_request(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3, F@_4,
F@_5, F@_6, F@_7, F@_8, TrUserData);
skip_length_delimited_simple_request(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6,
F@_7, F@_8, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_simple_request(Rest2, 0, 0, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
skip_group_simple_request(Bin, FNum, Z2, F@_1, F@_2,
F@_3, F@_4, F@_5, F@_6, F@_7, F@_8, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_simple_request(Rest, 0, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
skip_32_simple_request(<<_:32, Rest/binary>>, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData) ->
dfp_read_field_def_simple_request(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
skip_64_simple_request(<<_:64, Rest/binary>>, Z1, Z2,
F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData) ->
dfp_read_field_def_simple_request(Rest, Z1, Z2, F@_1,
F@_2, F@_3, F@_4, F@_5, F@_6, F@_7, F@_8,
TrUserData).
decode_msg_simple_response(Bin, TrUserData) ->
dfp_read_field_def_simple_response(Bin, 0, 0,
id('$undef', TrUserData),
id(<<>>, TrUserData),
id(<<>>, TrUserData), TrUserData).
dfp_read_field_def_simple_response(<<10, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_simple_response_payload(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData);
dfp_read_field_def_simple_response(<<18, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_simple_response_username(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData);
dfp_read_field_def_simple_response(<<26, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_simple_response_oauth_scope(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData);
dfp_read_field_def_simple_response(<<>>, 0, 0, F@_1,
F@_2, F@_3, _) ->
S1 = #{username => F@_2, oauth_scope => F@_3},
if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end;
dfp_read_field_def_simple_response(Other, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData) ->
dg_read_field_def_simple_response(Other, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData).
dg_read_field_def_simple_response(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_simple_response(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
dg_read_field_def_simple_response(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 ->
d_field_simple_response_payload(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
18 ->
d_field_simple_response_username(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
26 ->
d_field_simple_response_oauth_scope(Rest, 0, 0, F@_1,
F@_2, F@_3, TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_simple_response(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
1 ->
skip_64_simple_response(Rest, 0, 0, F@_1, F@_2, F@_3,
TrUserData);
2 ->
skip_length_delimited_simple_response(Rest, 0, 0, F@_1,
F@_2, F@_3, TrUserData);
3 ->
skip_group_simple_response(Rest, Key bsr 3, 0, F@_1,
F@_2, F@_3, TrUserData);
5 ->
skip_32_simple_response(Rest, 0, 0, F@_1, F@_2, F@_3,
TrUserData)
end
end;
dg_read_field_def_simple_response(<<>>, 0, 0, F@_1,
F@_2, F@_3, _) ->
S1 = #{username => F@_2, oauth_scope => F@_3},
if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end.
d_field_simple_response_payload(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_simple_response_payload(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_simple_response_payload(<<0:1, X:7,
Rest/binary>>,
N, Acc, Prev, F@_2, F@_3, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_payload(Bs, TrUserData), TrUserData),
Rest2}
end,
dfp_read_field_def_simple_response(RestF, 0, 0,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_payload(Prev, NewFValue,
TrUserData)
end,
F@_2, F@_3, TrUserData).
d_field_simple_response_username(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_simple_response_username(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_simple_response_username(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, _, F@_3, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bytes:Len/binary, Rest2/binary>> = Rest,
{id(binary:copy(Bytes), TrUserData), Rest2}
end,
dfp_read_field_def_simple_response(RestF, 0, 0, F@_1,
NewFValue, F@_3, TrUserData).
d_field_simple_response_oauth_scope(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_simple_response_oauth_scope(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_simple_response_oauth_scope(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, _, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bytes:Len/binary, Rest2/binary>> = Rest,
{id(binary:copy(Bytes), TrUserData), Rest2}
end,
dfp_read_field_def_simple_response(RestF, 0, 0, F@_1,
F@_2, NewFValue, TrUserData).
skip_varint_simple_response(<<1:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
skip_varint_simple_response(Rest, Z1, Z2, F@_1, F@_2,
F@_3, TrUserData);
skip_varint_simple_response(<<0:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_simple_response(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData).
skip_length_delimited_simple_response(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
skip_length_delimited_simple_response(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
skip_length_delimited_simple_response(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_simple_response(Rest2, 0, 0, F@_1,
F@_2, F@_3, TrUserData).
skip_group_simple_response(Bin, FNum, Z2, F@_1, F@_2,
F@_3, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_simple_response(Rest, 0, Z2, F@_1,
F@_2, F@_3, TrUserData).
skip_32_simple_response(<<_:32, Rest/binary>>, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_simple_response(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData).
skip_64_simple_response(<<_:64, Rest/binary>>, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_simple_response(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData).
decode_msg_streaming_input_call_request(Bin,
TrUserData) ->
dfp_read_field_def_streaming_input_call_request(Bin, 0,
0, id('$undef', TrUserData),
id('$undef', TrUserData),
TrUserData).
dfp_read_field_def_streaming_input_call_request(<<10,
Rest/binary>>,
Z1, Z2, F@_1, F@_2,
TrUserData) ->
d_field_streaming_input_call_request_payload(Rest, Z1,
Z2, F@_1, F@_2, TrUserData);
dfp_read_field_def_streaming_input_call_request(<<18,
Rest/binary>>,
Z1, Z2, F@_1, F@_2,
TrUserData) ->
d_field_streaming_input_call_request_expect_compressed(Rest,
Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_streaming_input_call_request(<<>>, 0,
0, F@_1, F@_2, _) ->
S1 = #{},
S2 = if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end,
if F@_2 == '$undef' -> S2;
true -> S2#{expect_compressed => F@_2}
end;
dfp_read_field_def_streaming_input_call_request(Other,
Z1, Z2, F@_1, F@_2,
TrUserData) ->
dg_read_field_def_streaming_input_call_request(Other,
Z1, Z2, F@_1, F@_2,
TrUserData).
dg_read_field_def_streaming_input_call_request(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_streaming_input_call_request(Rest,
N + 7, X bsl N + Acc, F@_1,
F@_2, TrUserData);
dg_read_field_def_streaming_input_call_request(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2,
TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 ->
d_field_streaming_input_call_request_payload(Rest, 0, 0,
F@_1, F@_2, TrUserData);
18 ->
d_field_streaming_input_call_request_expect_compressed(Rest,
0, 0, F@_1,
F@_2,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_streaming_input_call_request(Rest, 0, 0,
F@_1, F@_2,
TrUserData);
1 ->
skip_64_streaming_input_call_request(Rest, 0, 0, F@_1,
F@_2, TrUserData);
2 ->
skip_length_delimited_streaming_input_call_request(Rest,
0, 0, F@_1,
F@_2,
TrUserData);
3 ->
skip_group_streaming_input_call_request(Rest, Key bsr 3,
0, F@_1, F@_2,
TrUserData);
5 ->
skip_32_streaming_input_call_request(Rest, 0, 0, F@_1,
F@_2, TrUserData)
end
end;
dg_read_field_def_streaming_input_call_request(<<>>, 0,
0, F@_1, F@_2, _) ->
S1 = #{},
S2 = if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end,
if F@_2 == '$undef' -> S2;
true -> S2#{expect_compressed => F@_2}
end.
d_field_streaming_input_call_request_payload(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_streaming_input_call_request_payload(Rest,
N + 7, X bsl N + Acc, F@_1,
F@_2, TrUserData);
d_field_streaming_input_call_request_payload(<<0:1, X:7,
Rest/binary>>,
N, Acc, Prev, F@_2, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_payload(Bs, TrUserData), TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_input_call_request(RestF,
0, 0,
if Prev == '$undef' ->
NewFValue;
true ->
merge_msg_payload(Prev,
NewFValue,
TrUserData)
end,
F@_2, TrUserData).
d_field_streaming_input_call_request_expect_compressed(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2,
TrUserData)
when N < 57 ->
d_field_streaming_input_call_request_expect_compressed(Rest,
N + 7, X bsl N + Acc,
F@_1, F@_2,
TrUserData);
d_field_streaming_input_call_request_expect_compressed(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, Prev,
TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_bool_value(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_input_call_request(RestF,
0, 0, F@_1,
if Prev == '$undef' ->
NewFValue;
true ->
merge_msg_bool_value(Prev,
NewFValue,
TrUserData)
end,
TrUserData).
skip_varint_streaming_input_call_request(<<1:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
skip_varint_streaming_input_call_request(Rest, Z1, Z2,
F@_1, F@_2, TrUserData);
skip_varint_streaming_input_call_request(<<0:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
dfp_read_field_def_streaming_input_call_request(Rest,
Z1, Z2, F@_1, F@_2,
TrUserData).
skip_length_delimited_streaming_input_call_request(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2,
TrUserData)
when N < 57 ->
skip_length_delimited_streaming_input_call_request(Rest,
N + 7, X bsl N + Acc,
F@_1, F@_2, TrUserData);
skip_length_delimited_streaming_input_call_request(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2,
TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_streaming_input_call_request(Rest2,
0, 0, F@_1, F@_2,
TrUserData).
skip_group_streaming_input_call_request(Bin, FNum, Z2,
F@_1, F@_2, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_streaming_input_call_request(Rest, 0,
Z2, F@_1, F@_2, TrUserData).
skip_32_streaming_input_call_request(<<_:32,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
dfp_read_field_def_streaming_input_call_request(Rest,
Z1, Z2, F@_1, F@_2,
TrUserData).
skip_64_streaming_input_call_request(<<_:64,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
dfp_read_field_def_streaming_input_call_request(Rest,
Z1, Z2, F@_1, F@_2,
TrUserData).
decode_msg_streaming_input_call_response(Bin,
TrUserData) ->
dfp_read_field_def_streaming_input_call_response(Bin, 0,
0, id(0, TrUserData),
TrUserData).
dfp_read_field_def_streaming_input_call_response(<<8,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
d_field_streaming_input_call_response_aggregated_payload_size(Rest,
Z1, Z2, F@_1,
TrUserData);
dfp_read_field_def_streaming_input_call_response(<<>>,
0, 0, F@_1, _) ->
#{aggregated_payload_size => F@_1};
dfp_read_field_def_streaming_input_call_response(Other,
Z1, Z2, F@_1, TrUserData) ->
dg_read_field_def_streaming_input_call_response(Other,
Z1, Z2, F@_1, TrUserData).
dg_read_field_def_streaming_input_call_response(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_streaming_input_call_response(Rest,
N + 7, X bsl N + Acc, F@_1,
TrUserData);
dg_read_field_def_streaming_input_call_response(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_streaming_input_call_response_aggregated_payload_size(Rest,
0, 0,
F@_1,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_streaming_input_call_response(Rest, 0, 0,
F@_1, TrUserData);
1 ->
skip_64_streaming_input_call_response(Rest, 0, 0, F@_1,
TrUserData);
2 ->
skip_length_delimited_streaming_input_call_response(Rest,
0, 0, F@_1,
TrUserData);
3 ->
skip_group_streaming_input_call_response(Rest,
Key bsr 3, 0, F@_1,
TrUserData);
5 ->
skip_32_streaming_input_call_response(Rest, 0, 0, F@_1,
TrUserData)
end
end;
dg_read_field_def_streaming_input_call_response(<<>>, 0,
0, F@_1, _) ->
#{aggregated_payload_size => F@_1}.
d_field_streaming_input_call_response_aggregated_payload_size(<<1:1,
X:7,
Rest/binary>>,
N, Acc, F@_1,
TrUserData)
when N < 57 ->
d_field_streaming_input_call_response_aggregated_payload_size(Rest,
N + 7,
X bsl N + Acc,
F@_1,
TrUserData);
d_field_streaming_input_call_response_aggregated_payload_size(<<0:1,
X:7,
Rest/binary>>,
N, Acc, _,
TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_streaming_input_call_response(RestF,
0, 0, NewFValue,
TrUserData).
skip_varint_streaming_input_call_response(<<1:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
skip_varint_streaming_input_call_response(Rest, Z1, Z2,
F@_1, TrUserData);
skip_varint_streaming_input_call_response(<<0:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_input_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
skip_length_delimited_streaming_input_call_response(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
skip_length_delimited_streaming_input_call_response(Rest,
N + 7, X bsl N + Acc,
F@_1, TrUserData);
skip_length_delimited_streaming_input_call_response(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_streaming_input_call_response(Rest2,
0, 0, F@_1, TrUserData).
skip_group_streaming_input_call_response(Bin, FNum, Z2,
F@_1, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_streaming_input_call_response(Rest,
0, Z2, F@_1, TrUserData).
skip_32_streaming_input_call_response(<<_:32,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_input_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
skip_64_streaming_input_call_response(<<_:64,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_input_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
decode_msg_response_parameters(Bin, TrUserData) ->
dfp_read_field_def_response_parameters(Bin, 0, 0,
id(0, TrUserData), id(0, TrUserData),
id('$undef', TrUserData),
TrUserData).
dfp_read_field_def_response_parameters(<<8,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_response_parameters_size(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData);
dfp_read_field_def_response_parameters(<<16,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_response_parameters_interval_us(Rest, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData);
dfp_read_field_def_response_parameters(<<26,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
d_field_response_parameters_compressed(Rest, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData);
dfp_read_field_def_response_parameters(<<>>, 0, 0, F@_1,
F@_2, F@_3, _) ->
S1 = #{size => F@_1, interval_us => F@_2},
if F@_3 == '$undef' -> S1;
true -> S1#{compressed => F@_3}
end;
dfp_read_field_def_response_parameters(Other, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData) ->
dg_read_field_def_response_parameters(Other, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData).
dg_read_field_def_response_parameters(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_response_parameters(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
dg_read_field_def_response_parameters(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_response_parameters_size(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
16 ->
d_field_response_parameters_interval_us(Rest, 0, 0,
F@_1, F@_2, F@_3, TrUserData);
26 ->
d_field_response_parameters_compressed(Rest, 0, 0, F@_1,
F@_2, F@_3, TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_response_parameters(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
1 ->
skip_64_response_parameters(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData);
2 ->
skip_length_delimited_response_parameters(Rest, 0, 0,
F@_1, F@_2, F@_3,
TrUserData);
3 ->
skip_group_response_parameters(Rest, Key bsr 3, 0, F@_1,
F@_2, F@_3, TrUserData);
5 ->
skip_32_response_parameters(Rest, 0, 0, F@_1, F@_2,
F@_3, TrUserData)
end
end;
dg_read_field_def_response_parameters(<<>>, 0, 0, F@_1,
F@_2, F@_3, _) ->
S1 = #{size => F@_1, interval_us => F@_2},
if F@_3 == '$undef' -> S1;
true -> S1#{compressed => F@_3}
end.
d_field_response_parameters_size(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_response_parameters_size(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_response_parameters_size(<<0:1, X:7,
Rest/binary>>,
N, Acc, _, F@_2, F@_3, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_response_parameters(RestF, 0, 0,
NewFValue, F@_2, F@_3, TrUserData).
d_field_response_parameters_interval_us(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_response_parameters_interval_us(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_response_parameters_interval_us(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, _, F@_3, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_response_parameters(RestF, 0, 0,
F@_1, NewFValue, F@_3, TrUserData).
d_field_response_parameters_compressed(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
d_field_response_parameters_compressed(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
d_field_response_parameters_compressed(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, Prev, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_bool_value(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_response_parameters(RestF, 0, 0,
F@_1, F@_2,
if Prev == '$undef' -> NewFValue;
true ->
merge_msg_bool_value(Prev,
NewFValue,
TrUserData)
end,
TrUserData).
skip_varint_response_parameters(<<1:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
skip_varint_response_parameters(Rest, Z1, Z2, F@_1,
F@_2, F@_3, TrUserData);
skip_varint_response_parameters(<<0:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_response_parameters(Rest, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData).
skip_length_delimited_response_parameters(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, TrUserData)
when N < 57 ->
skip_length_delimited_response_parameters(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, F@_3,
TrUserData);
skip_length_delimited_response_parameters(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_response_parameters(Rest2, 0, 0,
F@_1, F@_2, F@_3, TrUserData).
skip_group_response_parameters(Bin, FNum, Z2, F@_1,
F@_2, F@_3, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_response_parameters(Rest, 0, Z2,
F@_1, F@_2, F@_3, TrUserData).
skip_32_response_parameters(<<_:32, Rest/binary>>, Z1,
Z2, F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_response_parameters(Rest, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData).
skip_64_response_parameters(<<_:64, Rest/binary>>, Z1,
Z2, F@_1, F@_2, F@_3, TrUserData) ->
dfp_read_field_def_response_parameters(Rest, Z1, Z2,
F@_1, F@_2, F@_3, TrUserData).
decode_msg_streaming_output_call_request(Bin,
TrUserData) ->
dfp_read_field_def_streaming_output_call_request(Bin, 0,
0,
id('COMPRESSABLE',
TrUserData),
id([], TrUserData),
id('$undef', TrUserData),
id('$undef', TrUserData),
TrUserData).
dfp_read_field_def_streaming_output_call_request(<<8,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
d_field_streaming_output_call_request_response_type(Rest,
Z1, Z2, F@_1, F@_2,
F@_3, F@_4, TrUserData);
dfp_read_field_def_streaming_output_call_request(<<18,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
d_field_streaming_output_call_request_response_parameters(Rest,
Z1, Z2, F@_1,
F@_2, F@_3, F@_4,
TrUserData);
dfp_read_field_def_streaming_output_call_request(<<26,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
d_field_streaming_output_call_request_payload(Rest, Z1,
Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData);
dfp_read_field_def_streaming_output_call_request(<<58,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
d_field_streaming_output_call_request_response_status(Rest,
Z1, Z2, F@_1, F@_2,
F@_3, F@_4,
TrUserData);
dfp_read_field_def_streaming_output_call_request(<<>>,
0, 0, F@_1, R1, F@_3, F@_4,
TrUserData) ->
S1 = #{response_type => F@_1},
S2 = if R1 == '$undef' -> S1;
true ->
S1#{response_parameters =>
lists_reverse(R1, TrUserData)}
end,
S3 = if F@_3 == '$undef' -> S2;
true -> S2#{payload => F@_3}
end,
if F@_4 == '$undef' -> S3;
true -> S3#{response_status => F@_4}
end;
dfp_read_field_def_streaming_output_call_request(Other,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
dg_read_field_def_streaming_output_call_request(Other,
Z1, Z2, F@_1, F@_2, F@_3,
F@_4, TrUserData).
dg_read_field_def_streaming_output_call_request(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4,
TrUserData)
when N < 32 - 7 ->
dg_read_field_def_streaming_output_call_request(Rest,
N + 7, X bsl N + Acc, F@_1,
F@_2, F@_3, F@_4,
TrUserData);
dg_read_field_def_streaming_output_call_request(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_streaming_output_call_request_response_type(Rest,
0, 0, F@_1, F@_2,
F@_3, F@_4,
TrUserData);
18 ->
d_field_streaming_output_call_request_response_parameters(Rest,
0, 0, F@_1,
F@_2, F@_3,
F@_4,
TrUserData);
26 ->
d_field_streaming_output_call_request_payload(Rest, 0,
0, F@_1, F@_2, F@_3,
F@_4, TrUserData);
58 ->
d_field_streaming_output_call_request_response_status(Rest,
0, 0, F@_1,
F@_2, F@_3,
F@_4,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_streaming_output_call_request(Rest, 0, 0,
F@_1, F@_2, F@_3,
F@_4, TrUserData);
1 ->
skip_64_streaming_output_call_request(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4,
TrUserData);
2 ->
skip_length_delimited_streaming_output_call_request(Rest,
0, 0, F@_1,
F@_2, F@_3,
F@_4,
TrUserData);
3 ->
skip_group_streaming_output_call_request(Rest,
Key bsr 3, 0, F@_1,
F@_2, F@_3, F@_4,
TrUserData);
5 ->
skip_32_streaming_output_call_request(Rest, 0, 0, F@_1,
F@_2, F@_3, F@_4,
TrUserData)
end
end;
dg_read_field_def_streaming_output_call_request(<<>>, 0,
0, F@_1, R1, F@_3, F@_4,
TrUserData) ->
S1 = #{response_type => F@_1},
S2 = if R1 == '$undef' -> S1;
true ->
S1#{response_parameters =>
lists_reverse(R1, TrUserData)}
end,
S3 = if F@_3 == '$undef' -> S2;
true -> S2#{payload => F@_3}
end,
if F@_4 == '$undef' -> S3;
true -> S3#{response_status => F@_4}
end.
d_field_streaming_output_call_request_response_type(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
F@_4, TrUserData)
when N < 57 ->
d_field_streaming_output_call_request_response_type(Rest,
N + 7, X bsl N + Acc,
F@_1, F@_2, F@_3, F@_4,
TrUserData);
d_field_streaming_output_call_request_response_type(<<0:1,
X:7, Rest/binary>>,
N, Acc, _, F@_2, F@_3, F@_4,
TrUserData) ->
{NewFValue, RestF} =
{id('d_enum_grpc.testing.PayloadType'(begin
<<Res:32/signed-native>> = <<(X
bsl
N
+
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end),
TrUserData),
Rest},
dfp_read_field_def_streaming_output_call_request(RestF,
0, 0, NewFValue, F@_2,
F@_3, F@_4, TrUserData).
d_field_streaming_output_call_request_response_parameters(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2,
F@_3, F@_4,
TrUserData)
when N < 57 ->
d_field_streaming_output_call_request_response_parameters(Rest,
N + 7,
X bsl N + Acc,
F@_1, F@_2, F@_3,
F@_4, TrUserData);
d_field_streaming_output_call_request_response_parameters(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, Prev,
F@_3, F@_4,
TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_response_parameters(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_output_call_request(RestF,
0, 0, F@_1,
cons(NewFValue, Prev,
TrUserData),
F@_3, F@_4, TrUserData).
d_field_streaming_output_call_request_payload(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3, F@_4,
TrUserData)
when N < 57 ->
d_field_streaming_output_call_request_payload(Rest,
N + 7, X bsl N + Acc, F@_1,
F@_2, F@_3, F@_4, TrUserData);
d_field_streaming_output_call_request_payload(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, Prev, F@_4,
TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_payload(Bs, TrUserData), TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_output_call_request(RestF,
0, 0, F@_1, F@_2,
if Prev == '$undef' ->
NewFValue;
true ->
merge_msg_payload(Prev,
NewFValue,
TrUserData)
end,
F@_4, TrUserData).
d_field_streaming_output_call_request_response_status(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
F@_4, TrUserData)
when N < 57 ->
d_field_streaming_output_call_request_response_status(Rest,
N + 7, X bsl N + Acc,
F@_1, F@_2, F@_3,
F@_4, TrUserData);
d_field_streaming_output_call_request_response_status(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
Prev, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_echo_status(Bs, TrUserData),
TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_output_call_request(RestF,
0, 0, F@_1, F@_2, F@_3,
if Prev == '$undef' ->
NewFValue;
true ->
merge_msg_echo_status(Prev,
NewFValue,
TrUserData)
end,
TrUserData).
skip_varint_streaming_output_call_request(<<1:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
skip_varint_streaming_output_call_request(Rest, Z1, Z2,
F@_1, F@_2, F@_3, F@_4,
TrUserData);
skip_varint_streaming_output_call_request(<<0:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
dfp_read_field_def_streaming_output_call_request(Rest,
Z1, Z2, F@_1, F@_2, F@_3,
F@_4, TrUserData).
skip_length_delimited_streaming_output_call_request(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
F@_4, TrUserData)
when N < 57 ->
skip_length_delimited_streaming_output_call_request(Rest,
N + 7, X bsl N + Acc,
F@_1, F@_2, F@_3, F@_4,
TrUserData);
skip_length_delimited_streaming_output_call_request(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, F@_3,
F@_4, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_streaming_output_call_request(Rest2,
0, 0, F@_1, F@_2, F@_3,
F@_4, TrUserData).
skip_group_streaming_output_call_request(Bin, FNum, Z2,
F@_1, F@_2, F@_3, F@_4, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_streaming_output_call_request(Rest,
0, Z2, F@_1, F@_2, F@_3,
F@_4, TrUserData).
skip_32_streaming_output_call_request(<<_:32,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
dfp_read_field_def_streaming_output_call_request(Rest,
Z1, Z2, F@_1, F@_2, F@_3,
F@_4, TrUserData).
skip_64_streaming_output_call_request(<<_:64,
Rest/binary>>,
Z1, Z2, F@_1, F@_2, F@_3, F@_4,
TrUserData) ->
dfp_read_field_def_streaming_output_call_request(Rest,
Z1, Z2, F@_1, F@_2, F@_3,
F@_4, TrUserData).
decode_msg_streaming_output_call_response(Bin,
TrUserData) ->
dfp_read_field_def_streaming_output_call_response(Bin,
0, 0,
id('$undef', TrUserData),
TrUserData).
dfp_read_field_def_streaming_output_call_response(<<10,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
d_field_streaming_output_call_response_payload(Rest, Z1,
Z2, F@_1, TrUserData);
dfp_read_field_def_streaming_output_call_response(<<>>,
0, 0, F@_1, _) ->
S1 = #{},
if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end;
dfp_read_field_def_streaming_output_call_response(Other,
Z1, Z2, F@_1, TrUserData) ->
dg_read_field_def_streaming_output_call_response(Other,
Z1, Z2, F@_1, TrUserData).
dg_read_field_def_streaming_output_call_response(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_streaming_output_call_response(Rest,
N + 7, X bsl N + Acc, F@_1,
TrUserData);
dg_read_field_def_streaming_output_call_response(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 ->
d_field_streaming_output_call_response_payload(Rest, 0,
0, F@_1, TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_streaming_output_call_response(Rest, 0, 0,
F@_1, TrUserData);
1 ->
skip_64_streaming_output_call_response(Rest, 0, 0, F@_1,
TrUserData);
2 ->
skip_length_delimited_streaming_output_call_response(Rest,
0, 0, F@_1,
TrUserData);
3 ->
skip_group_streaming_output_call_response(Rest,
Key bsr 3, 0, F@_1,
TrUserData);
5 ->
skip_32_streaming_output_call_response(Rest, 0, 0, F@_1,
TrUserData)
end
end;
dg_read_field_def_streaming_output_call_response(<<>>,
0, 0, F@_1, _) ->
S1 = #{},
if F@_1 == '$undef' -> S1;
true -> S1#{payload => F@_1}
end.
d_field_streaming_output_call_response_payload(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
d_field_streaming_output_call_response_payload(Rest,
N + 7, X bsl N + Acc, F@_1,
TrUserData);
d_field_streaming_output_call_response_payload(<<0:1,
X:7, Rest/binary>>,
N, Acc, Prev, TrUserData) ->
{NewFValue, RestF} = begin
Len = X bsl N + Acc,
<<Bs:Len/binary, Rest2/binary>> = Rest,
{id(decode_msg_payload(Bs, TrUserData), TrUserData),
Rest2}
end,
dfp_read_field_def_streaming_output_call_response(RestF,
0, 0,
if Prev == '$undef' ->
NewFValue;
true ->
merge_msg_payload(Prev,
NewFValue,
TrUserData)
end,
TrUserData).
skip_varint_streaming_output_call_response(<<1:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
skip_varint_streaming_output_call_response(Rest, Z1, Z2,
F@_1, TrUserData);
skip_varint_streaming_output_call_response(<<0:1, _:7,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_output_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
skip_length_delimited_streaming_output_call_response(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
skip_length_delimited_streaming_output_call_response(Rest,
N + 7, X bsl N + Acc,
F@_1, TrUserData);
skip_length_delimited_streaming_output_call_response(<<0:1,
X:7, Rest/binary>>,
N, Acc, F@_1,
TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_streaming_output_call_response(Rest2,
0, 0, F@_1, TrUserData).
skip_group_streaming_output_call_response(Bin, FNum, Z2,
F@_1, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_streaming_output_call_response(Rest,
0, Z2, F@_1, TrUserData).
skip_32_streaming_output_call_response(<<_:32,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_output_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
skip_64_streaming_output_call_response(<<_:64,
Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_streaming_output_call_response(Rest,
Z1, Z2, F@_1, TrUserData).
decode_msg_reconnect_params(Bin, TrUserData) ->
dfp_read_field_def_reconnect_params(Bin, 0, 0,
id(0, TrUserData), TrUserData).
dfp_read_field_def_reconnect_params(<<8, Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
d_field_reconnect_params_max_reconnect_backoff_ms(Rest,
Z1, Z2, F@_1, TrUserData);
dfp_read_field_def_reconnect_params(<<>>, 0, 0, F@_1,
_) ->
#{max_reconnect_backoff_ms => F@_1};
dfp_read_field_def_reconnect_params(Other, Z1, Z2, F@_1,
TrUserData) ->
dg_read_field_def_reconnect_params(Other, Z1, Z2, F@_1,
TrUserData).
dg_read_field_def_reconnect_params(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_reconnect_params(Rest, N + 7,
X bsl N + Acc, F@_1, TrUserData);
dg_read_field_def_reconnect_params(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_reconnect_params_max_reconnect_backoff_ms(Rest,
0, 0, F@_1,
TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_reconnect_params(Rest, 0, 0, F@_1,
TrUserData);
1 ->
skip_64_reconnect_params(Rest, 0, 0, F@_1, TrUserData);
2 ->
skip_length_delimited_reconnect_params(Rest, 0, 0, F@_1,
TrUserData);
3 ->
skip_group_reconnect_params(Rest, Key bsr 3, 0, F@_1,
TrUserData);
5 ->
skip_32_reconnect_params(Rest, 0, 0, F@_1, TrUserData)
end
end;
dg_read_field_def_reconnect_params(<<>>, 0, 0, F@_1,
_) ->
#{max_reconnect_backoff_ms => F@_1}.
d_field_reconnect_params_max_reconnect_backoff_ms(<<1:1,
X:7, Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
d_field_reconnect_params_max_reconnect_backoff_ms(Rest,
N + 7, X bsl N + Acc,
F@_1, TrUserData);
d_field_reconnect_params_max_reconnect_backoff_ms(<<0:1,
X:7, Rest/binary>>,
N, Acc, _, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_reconnect_params(RestF, 0, 0,
NewFValue, TrUserData).
skip_varint_reconnect_params(<<1:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
skip_varint_reconnect_params(Rest, Z1, Z2, F@_1,
TrUserData);
skip_varint_reconnect_params(<<0:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, TrUserData) ->
dfp_read_field_def_reconnect_params(Rest, Z1, Z2, F@_1,
TrUserData).
skip_length_delimited_reconnect_params(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData)
when N < 57 ->
skip_length_delimited_reconnect_params(Rest, N + 7,
X bsl N + Acc, F@_1, TrUserData);
skip_length_delimited_reconnect_params(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_reconnect_params(Rest2, 0, 0, F@_1,
TrUserData).
skip_group_reconnect_params(Bin, FNum, Z2, F@_1,
TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_reconnect_params(Rest, 0, Z2, F@_1,
TrUserData).
skip_32_reconnect_params(<<_:32, Rest/binary>>, Z1, Z2,
F@_1, TrUserData) ->
dfp_read_field_def_reconnect_params(Rest, Z1, Z2, F@_1,
TrUserData).
skip_64_reconnect_params(<<_:64, Rest/binary>>, Z1, Z2,
F@_1, TrUserData) ->
dfp_read_field_def_reconnect_params(Rest, Z1, Z2, F@_1,
TrUserData).
decode_msg_reconnect_info(Bin, TrUserData) ->
dfp_read_field_def_reconnect_info(Bin, 0, 0,
id(false, TrUserData), id([], TrUserData),
TrUserData).
dfp_read_field_def_reconnect_info(<<8, Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
d_field_reconnect_info_passed(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
dfp_read_field_def_reconnect_info(<<18, Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
d_pfield_reconnect_info_backoff_ms(Rest, Z1, Z2, F@_1,
F@_2, TrUserData);
dfp_read_field_def_reconnect_info(<<16, Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
d_field_reconnect_info_backoff_ms(Rest, Z1, Z2, F@_1,
F@_2, TrUserData);
dfp_read_field_def_reconnect_info(<<>>, 0, 0, F@_1, R1,
TrUserData) ->
#{passed => F@_1,
backoff_ms => lists_reverse(R1, TrUserData)};
dfp_read_field_def_reconnect_info(Other, Z1, Z2, F@_1,
F@_2, TrUserData) ->
dg_read_field_def_reconnect_info(Other, Z1, Z2, F@_1,
F@_2, TrUserData).
dg_read_field_def_reconnect_info(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 32 - 7 ->
dg_read_field_def_reconnect_info(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
dg_read_field_def_reconnect_info(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 ->
d_field_reconnect_info_passed(Rest, 0, 0, F@_1, F@_2,
TrUserData);
18 ->
d_pfield_reconnect_info_backoff_ms(Rest, 0, 0, F@_1,
F@_2, TrUserData);
16 ->
d_field_reconnect_info_backoff_ms(Rest, 0, 0, F@_1,
F@_2, TrUserData);
_ ->
case Key band 7 of
0 ->
skip_varint_reconnect_info(Rest, 0, 0, F@_1, F@_2,
TrUserData);
1 ->
skip_64_reconnect_info(Rest, 0, 0, F@_1, F@_2,
TrUserData);
2 ->
skip_length_delimited_reconnect_info(Rest, 0, 0, F@_1,
F@_2, TrUserData);
3 ->
skip_group_reconnect_info(Rest, Key bsr 3, 0, F@_1,
F@_2, TrUserData);
5 ->
skip_32_reconnect_info(Rest, 0, 0, F@_1, F@_2,
TrUserData)
end
end;
dg_read_field_def_reconnect_info(<<>>, 0, 0, F@_1, R1,
TrUserData) ->
#{passed => F@_1,
backoff_ms => lists_reverse(R1, TrUserData)}.
d_field_reconnect_info_passed(<<1:1, X:7, Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_reconnect_info_passed(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
d_field_reconnect_info_passed(<<0:1, X:7, Rest/binary>>,
N, Acc, _, F@_2, TrUserData) ->
{NewFValue, RestF} = {id(X bsl N + Acc =/= 0,
TrUserData),
Rest},
dfp_read_field_def_reconnect_info(RestF, 0, 0,
NewFValue, F@_2, TrUserData).
d_field_reconnect_info_backoff_ms(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_field_reconnect_info_backoff_ms(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
d_field_reconnect_info_backoff_ms(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, Prev, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
dfp_read_field_def_reconnect_info(RestF, 0, 0, F@_1,
cons(NewFValue, Prev, TrUserData),
TrUserData).
d_pfield_reconnect_info_backoff_ms(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
d_pfield_reconnect_info_backoff_ms(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
d_pfield_reconnect_info_backoff_ms(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, E, TrUserData) ->
Len = X bsl N + Acc,
<<PackedBytes:Len/binary, Rest2/binary>> = Rest,
NewSeq =
d_packed_field_reconnect_info_backoff_ms(PackedBytes, 0,
0, E, TrUserData),
dfp_read_field_def_reconnect_info(Rest2, 0, 0, F@_1,
NewSeq, TrUserData).
d_packed_field_reconnect_info_backoff_ms(<<1:1, X:7,
Rest/binary>>,
N, Acc, AccSeq, TrUserData)
when N < 57 ->
d_packed_field_reconnect_info_backoff_ms(Rest, N + 7,
X bsl N + Acc, AccSeq, TrUserData);
d_packed_field_reconnect_info_backoff_ms(<<0:1, X:7,
Rest/binary>>,
N, Acc, AccSeq, TrUserData) ->
{NewFValue, RestF} = {begin
<<Res:32/signed-native>> = <<(X bsl N +
Acc):32/unsigned-native>>,
id(Res, TrUserData)
end,
Rest},
d_packed_field_reconnect_info_backoff_ms(RestF, 0, 0,
[NewFValue | AccSeq], TrUserData);
d_packed_field_reconnect_info_backoff_ms(<<>>, 0, 0,
AccSeq, _) ->
AccSeq.
skip_varint_reconnect_info(<<1:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
skip_varint_reconnect_info(Rest, Z1, Z2, F@_1, F@_2,
TrUserData);
skip_varint_reconnect_info(<<0:1, _:7, Rest/binary>>,
Z1, Z2, F@_1, F@_2, TrUserData) ->
dfp_read_field_def_reconnect_info(Rest, Z1, Z2, F@_1,
F@_2, TrUserData).
skip_length_delimited_reconnect_info(<<1:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData)
when N < 57 ->
skip_length_delimited_reconnect_info(Rest, N + 7,
X bsl N + Acc, F@_1, F@_2, TrUserData);
skip_length_delimited_reconnect_info(<<0:1, X:7,
Rest/binary>>,
N, Acc, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_reconnect_info(Rest2, 0, 0, F@_1,
F@_2, TrUserData).
skip_group_reconnect_info(Bin, FNum, Z2, F@_1, F@_2,
TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_reconnect_info(Rest, 0, Z2, F@_1,
F@_2, TrUserData).
skip_32_reconnect_info(<<_:32, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
dfp_read_field_def_reconnect_info(Rest, Z1, Z2, F@_1,
F@_2, TrUserData).
skip_64_reconnect_info(<<_:64, Rest/binary>>, Z1, Z2,
F@_1, F@_2, TrUserData) ->
dfp_read_field_def_reconnect_info(Rest, Z1, Z2, F@_1,
F@_2, TrUserData).
'd_enum_grpc.testing.PayloadType'(0) -> 'COMPRESSABLE';
'd_enum_grpc.testing.PayloadType'(V) -> V.
read_group(Bin, FieldNum) ->
{NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum),
<<Group:NumBytes/binary, _:EndTagLen/binary, Rest/binary>> = Bin,
{Group, Rest}.
%% Like skipping over fields, but record the total length,
%% Each field is <(FieldNum bsl 3) bor FieldType> ++ <FieldValue>
%% Record the length because varints may be non-optimally encoded.
%%
%% Groups can be nested, but assume the same FieldNum cannot be nested
%% because group field numbers are shared with the rest of the fields
%% numbers. Thus we can search just for an group-end with the same
%% field number.
%%
%% (The only time the same group field number could occur would
%% be in a nested sub message, but then it would be inside a
%% length-delimited entry, which we skip-read by length.)
read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum)
when N < (32-7) ->
read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum);
read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen,
FieldNum) ->
Key = X bsl N + Acc,
TagLen1 = TagLen + 1,
case {Key bsr 3, Key band 7} of
{FieldNum, 4} -> % 4 = group_end
{NumBytes, TagLen1};
{_, 0} -> % 0 = varint
read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum);
{_, 1} -> % 1 = bits64
<<_:64, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum);
{_, 2} -> % 2 = length_delimited
read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum);
{_, 3} -> % 3 = group_start
read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum);
{_, 4} -> % 4 = group_end
read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum);
{_, 5} -> % 5 = bits32
<<_:32, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum)
end.
read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum)
when N < (64-7) ->
read_gr_vi(Tl, N+7, NumBytes+1, FieldNum);
read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) ->
read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum).
read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum)
when N < (64-7) ->
read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum);
read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) ->
Len = X bsl N + Acc,
NumBytes1 = NumBytes + 1,
<<_:Len/binary, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum).
merge_msgs(Prev, New, MsgName) when is_atom(MsgName) ->
merge_msgs(Prev, New, MsgName, []).
merge_msgs(Prev, New, MsgName, Opts) ->
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
bool_value ->
merge_msg_bool_value(Prev, New, TrUserData);
payload -> merge_msg_payload(Prev, New, TrUserData);
echo_status ->
merge_msg_echo_status(Prev, New, TrUserData);
simple_request ->
merge_msg_simple_request(Prev, New, TrUserData);
simple_response ->
merge_msg_simple_response(Prev, New, TrUserData);
streaming_input_call_request ->
merge_msg_streaming_input_call_request(Prev, New,
TrUserData);
streaming_input_call_response ->
merge_msg_streaming_input_call_response(Prev, New,
TrUserData);
response_parameters ->
merge_msg_response_parameters(Prev, New, TrUserData);
streaming_output_call_request ->
merge_msg_streaming_output_call_request(Prev, New,
TrUserData);
streaming_output_call_response ->
merge_msg_streaming_output_call_response(Prev, New,
TrUserData);
reconnect_params ->
merge_msg_reconnect_params(Prev, New, TrUserData);
reconnect_info ->
merge_msg_reconnect_info(Prev, New, TrUserData)
end.
-compile({nowarn_unused_function,merge_msg_bool_value/3}).
merge_msg_bool_value(PMsg, NMsg, _) ->
S1 = #{},
case {PMsg, NMsg} of
{_, #{value := NFvalue}} -> S1#{value => NFvalue};
{#{value := PFvalue}, _} -> S1#{value => PFvalue};
_ -> S1
end.
-compile({nowarn_unused_function,merge_msg_payload/3}).
merge_msg_payload(PMsg, NMsg, _) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{type := NFtype}} -> S1#{type => NFtype};
{#{type := PFtype}, _} -> S1#{type => PFtype};
_ -> S1
end,
case {PMsg, NMsg} of
{_, #{body := NFbody}} -> S2#{body => NFbody};
{#{body := PFbody}, _} -> S2#{body => PFbody};
_ -> S2
end.
-compile({nowarn_unused_function,merge_msg_echo_status/3}).
merge_msg_echo_status(PMsg, NMsg, _) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{code := NFcode}} -> S1#{code => NFcode};
{#{code := PFcode}, _} -> S1#{code => PFcode};
_ -> S1
end,
case {PMsg, NMsg} of
{_, #{message := NFmessage}} ->
S2#{message => NFmessage};
{#{message := PFmessage}, _} ->
S2#{message => PFmessage};
_ -> S2
end.
-compile({nowarn_unused_function,merge_msg_simple_request/3}).
merge_msg_simple_request(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{response_type := NFresponse_type}} ->
S1#{response_type => NFresponse_type};
{#{response_type := PFresponse_type}, _} ->
S1#{response_type => PFresponse_type};
_ -> S1
end,
S3 = case {PMsg, NMsg} of
{_, #{response_size := NFresponse_size}} ->
S2#{response_size => NFresponse_size};
{#{response_size := PFresponse_size}, _} ->
S2#{response_size => PFresponse_size};
_ -> S2
end,
S4 = case {PMsg, NMsg} of
{#{payload := PFpayload}, #{payload := NFpayload}} ->
S3#{payload =>
merge_msg_payload(PFpayload, NFpayload, TrUserData)};
{_, #{payload := NFpayload}} ->
S3#{payload => NFpayload};
{#{payload := PFpayload}, _} ->
S3#{payload => PFpayload};
{_, _} -> S3
end,
S5 = case {PMsg, NMsg} of
{_, #{fill_username := NFfill_username}} ->
S4#{fill_username => NFfill_username};
{#{fill_username := PFfill_username}, _} ->
S4#{fill_username => PFfill_username};
_ -> S4
end,
S6 = case {PMsg, NMsg} of
{_, #{fill_oauth_scope := NFfill_oauth_scope}} ->
S5#{fill_oauth_scope => NFfill_oauth_scope};
{#{fill_oauth_scope := PFfill_oauth_scope}, _} ->
S5#{fill_oauth_scope => PFfill_oauth_scope};
_ -> S5
end,
S7 = case {PMsg, NMsg} of
{#{response_compressed := PFresponse_compressed},
#{response_compressed := NFresponse_compressed}} ->
S6#{response_compressed =>
merge_msg_bool_value(PFresponse_compressed,
NFresponse_compressed, TrUserData)};
{_, #{response_compressed := NFresponse_compressed}} ->
S6#{response_compressed => NFresponse_compressed};
{#{response_compressed := PFresponse_compressed}, _} ->
S6#{response_compressed => PFresponse_compressed};
{_, _} -> S6
end,
S8 = case {PMsg, NMsg} of
{#{response_status := PFresponse_status},
#{response_status := NFresponse_status}} ->
S7#{response_status =>
merge_msg_echo_status(PFresponse_status,
NFresponse_status, TrUserData)};
{_, #{response_status := NFresponse_status}} ->
S7#{response_status => NFresponse_status};
{#{response_status := PFresponse_status}, _} ->
S7#{response_status => PFresponse_status};
{_, _} -> S7
end,
case {PMsg, NMsg} of
{#{expect_compressed := PFexpect_compressed},
#{expect_compressed := NFexpect_compressed}} ->
S8#{expect_compressed =>
merge_msg_bool_value(PFexpect_compressed,
NFexpect_compressed, TrUserData)};
{_, #{expect_compressed := NFexpect_compressed}} ->
S8#{expect_compressed => NFexpect_compressed};
{#{expect_compressed := PFexpect_compressed}, _} ->
S8#{expect_compressed => PFexpect_compressed};
{_, _} -> S8
end.
-compile({nowarn_unused_function,merge_msg_simple_response/3}).
merge_msg_simple_response(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{#{payload := PFpayload}, #{payload := NFpayload}} ->
S1#{payload =>
merge_msg_payload(PFpayload, NFpayload, TrUserData)};
{_, #{payload := NFpayload}} ->
S1#{payload => NFpayload};
{#{payload := PFpayload}, _} ->
S1#{payload => PFpayload};
{_, _} -> S1
end,
S3 = case {PMsg, NMsg} of
{_, #{username := NFusername}} ->
S2#{username => NFusername};
{#{username := PFusername}, _} ->
S2#{username => PFusername};
_ -> S2
end,
case {PMsg, NMsg} of
{_, #{oauth_scope := NFoauth_scope}} ->
S3#{oauth_scope => NFoauth_scope};
{#{oauth_scope := PFoauth_scope}, _} ->
S3#{oauth_scope => PFoauth_scope};
_ -> S3
end.
-compile({nowarn_unused_function,merge_msg_streaming_input_call_request/3}).
merge_msg_streaming_input_call_request(PMsg, NMsg,
TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{#{payload := PFpayload}, #{payload := NFpayload}} ->
S1#{payload =>
merge_msg_payload(PFpayload, NFpayload, TrUserData)};
{_, #{payload := NFpayload}} ->
S1#{payload => NFpayload};
{#{payload := PFpayload}, _} ->
S1#{payload => PFpayload};
{_, _} -> S1
end,
case {PMsg, NMsg} of
{#{expect_compressed := PFexpect_compressed},
#{expect_compressed := NFexpect_compressed}} ->
S2#{expect_compressed =>
merge_msg_bool_value(PFexpect_compressed,
NFexpect_compressed, TrUserData)};
{_, #{expect_compressed := NFexpect_compressed}} ->
S2#{expect_compressed => NFexpect_compressed};
{#{expect_compressed := PFexpect_compressed}, _} ->
S2#{expect_compressed => PFexpect_compressed};
{_, _} -> S2
end.
-compile({nowarn_unused_function,merge_msg_streaming_input_call_response/3}).
merge_msg_streaming_input_call_response(PMsg, NMsg,
_) ->
S1 = #{},
case {PMsg, NMsg} of
{_,
#{aggregated_payload_size :=
NFaggregated_payload_size}} ->
S1#{aggregated_payload_size =>
NFaggregated_payload_size};
{#{aggregated_payload_size :=
PFaggregated_payload_size},
_} ->
S1#{aggregated_payload_size =>
PFaggregated_payload_size};
_ -> S1
end.
-compile({nowarn_unused_function,merge_msg_response_parameters/3}).
merge_msg_response_parameters(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{size := NFsize}} -> S1#{size => NFsize};
{#{size := PFsize}, _} -> S1#{size => PFsize};
_ -> S1
end,
S3 = case {PMsg, NMsg} of
{_, #{interval_us := NFinterval_us}} ->
S2#{interval_us => NFinterval_us};
{#{interval_us := PFinterval_us}, _} ->
S2#{interval_us => PFinterval_us};
_ -> S2
end,
case {PMsg, NMsg} of
{#{compressed := PFcompressed},
#{compressed := NFcompressed}} ->
S3#{compressed =>
merge_msg_bool_value(PFcompressed, NFcompressed,
TrUserData)};
{_, #{compressed := NFcompressed}} ->
S3#{compressed => NFcompressed};
{#{compressed := PFcompressed}, _} ->
S3#{compressed => PFcompressed};
{_, _} -> S3
end.
-compile({nowarn_unused_function,merge_msg_streaming_output_call_request/3}).
merge_msg_streaming_output_call_request(PMsg, NMsg,
TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{response_type := NFresponse_type}} ->
S1#{response_type => NFresponse_type};
{#{response_type := PFresponse_type}, _} ->
S1#{response_type => PFresponse_type};
_ -> S1
end,
S3 = case {PMsg, NMsg} of
{#{response_parameters := PFresponse_parameters},
#{response_parameters := NFresponse_parameters}} ->
S2#{response_parameters =>
'erlang_++'(PFresponse_parameters,
NFresponse_parameters, TrUserData)};
{_, #{response_parameters := NFresponse_parameters}} ->
S2#{response_parameters => NFresponse_parameters};
{#{response_parameters := PFresponse_parameters}, _} ->
S2#{response_parameters => PFresponse_parameters};
{_, _} -> S2
end,
S4 = case {PMsg, NMsg} of
{#{payload := PFpayload}, #{payload := NFpayload}} ->
S3#{payload =>
merge_msg_payload(PFpayload, NFpayload, TrUserData)};
{_, #{payload := NFpayload}} ->
S3#{payload => NFpayload};
{#{payload := PFpayload}, _} ->
S3#{payload => PFpayload};
{_, _} -> S3
end,
case {PMsg, NMsg} of
{#{response_status := PFresponse_status},
#{response_status := NFresponse_status}} ->
S4#{response_status =>
merge_msg_echo_status(PFresponse_status,
NFresponse_status, TrUserData)};
{_, #{response_status := NFresponse_status}} ->
S4#{response_status => NFresponse_status};
{#{response_status := PFresponse_status}, _} ->
S4#{response_status => PFresponse_status};
{_, _} -> S4
end.
-compile({nowarn_unused_function,merge_msg_streaming_output_call_response/3}).
merge_msg_streaming_output_call_response(PMsg, NMsg,
TrUserData) ->
S1 = #{},
case {PMsg, NMsg} of
{#{payload := PFpayload}, #{payload := NFpayload}} ->
S1#{payload =>
merge_msg_payload(PFpayload, NFpayload, TrUserData)};
{_, #{payload := NFpayload}} ->
S1#{payload => NFpayload};
{#{payload := PFpayload}, _} ->
S1#{payload => PFpayload};
{_, _} -> S1
end.
-compile({nowarn_unused_function,merge_msg_reconnect_params/3}).
merge_msg_reconnect_params(PMsg, NMsg, _) ->
S1 = #{},
case {PMsg, NMsg} of
{_,
#{max_reconnect_backoff_ms :=
NFmax_reconnect_backoff_ms}} ->
S1#{max_reconnect_backoff_ms =>
NFmax_reconnect_backoff_ms};
{#{max_reconnect_backoff_ms :=
PFmax_reconnect_backoff_ms},
_} ->
S1#{max_reconnect_backoff_ms =>
PFmax_reconnect_backoff_ms};
_ -> S1
end.
-compile({nowarn_unused_function,merge_msg_reconnect_info/3}).
merge_msg_reconnect_info(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{passed := NFpassed}} -> S1#{passed => NFpassed};
{#{passed := PFpassed}, _} -> S1#{passed => PFpassed};
_ -> S1
end,
case {PMsg, NMsg} of
{#{backoff_ms := PFbackoff_ms},
#{backoff_ms := NFbackoff_ms}} ->
S2#{backoff_ms =>
'erlang_++'(PFbackoff_ms, NFbackoff_ms, TrUserData)};
{_, #{backoff_ms := NFbackoff_ms}} ->
S2#{backoff_ms => NFbackoff_ms};
{#{backoff_ms := PFbackoff_ms}, _} ->
S2#{backoff_ms => PFbackoff_ms};
{_, _} -> S2
end.
verify_msg(Msg, MsgName) when is_atom(MsgName) ->
verify_msg(Msg, MsgName, []).
verify_msg(Msg, MsgName, Opts) ->
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
bool_value ->
v_msg_bool_value(Msg, [MsgName], TrUserData);
payload -> v_msg_payload(Msg, [MsgName], TrUserData);
echo_status ->
v_msg_echo_status(Msg, [MsgName], TrUserData);
simple_request ->
v_msg_simple_request(Msg, [MsgName], TrUserData);
simple_response ->
v_msg_simple_response(Msg, [MsgName], TrUserData);
streaming_input_call_request ->
v_msg_streaming_input_call_request(Msg, [MsgName],
TrUserData);
streaming_input_call_response ->
v_msg_streaming_input_call_response(Msg, [MsgName],
TrUserData);
response_parameters ->
v_msg_response_parameters(Msg, [MsgName], TrUserData);
streaming_output_call_request ->
v_msg_streaming_output_call_request(Msg, [MsgName],
TrUserData);
streaming_output_call_response ->
v_msg_streaming_output_call_response(Msg, [MsgName],
TrUserData);
reconnect_params ->
v_msg_reconnect_params(Msg, [MsgName], TrUserData);
reconnect_info ->
v_msg_reconnect_info(Msg, [MsgName], TrUserData);
_ -> mk_type_error(not_a_known_message, Msg, [])
end.
-compile({nowarn_unused_function,v_msg_bool_value/3}).
-dialyzer({nowarn_function,v_msg_bool_value/3}).
v_msg_bool_value(#{} = M, Path, TrUserData) ->
case M of
#{value := F1} ->
v_type_bool(F1, [value | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (value) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_bool_value(M, Path, _TrUserData) when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
bool_value},
M, Path);
v_msg_bool_value(X, Path, _TrUserData) ->
mk_type_error({expected_msg, bool_value}, X, Path).
-compile({nowarn_unused_function,v_msg_payload/3}).
-dialyzer({nowarn_function,v_msg_payload/3}).
v_msg_payload(#{} = M, Path, TrUserData) ->
case M of
#{type := F1} ->
'v_enum_grpc.testing.PayloadType'(F1, [type | Path],
TrUserData);
_ -> ok
end,
case M of
#{body := F2} ->
v_type_bytes(F2, [body | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (type) -> ok;
(body) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_payload(M, Path, _TrUserData) when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
payload},
M, Path);
v_msg_payload(X, Path, _TrUserData) ->
mk_type_error({expected_msg, payload}, X, Path).
-compile({nowarn_unused_function,v_msg_echo_status/3}).
-dialyzer({nowarn_function,v_msg_echo_status/3}).
v_msg_echo_status(#{} = M, Path, TrUserData) ->
case M of
#{code := F1} ->
v_type_int32(F1, [code | Path], TrUserData);
_ -> ok
end,
case M of
#{message := F2} ->
v_type_string(F2, [message | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (code) -> ok;
(message) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_echo_status(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
echo_status},
M, Path);
v_msg_echo_status(X, Path, _TrUserData) ->
mk_type_error({expected_msg, echo_status}, X, Path).
-compile({nowarn_unused_function,v_msg_simple_request/3}).
-dialyzer({nowarn_function,v_msg_simple_request/3}).
v_msg_simple_request(#{} = M, Path, TrUserData) ->
case M of
#{response_type := F1} ->
'v_enum_grpc.testing.PayloadType'(F1,
[response_type | Path], TrUserData);
_ -> ok
end,
case M of
#{response_size := F2} ->
v_type_int32(F2, [response_size | Path], TrUserData);
_ -> ok
end,
case M of
#{payload := F3} ->
v_msg_payload(F3, [payload | Path], TrUserData);
_ -> ok
end,
case M of
#{fill_username := F4} ->
v_type_bool(F4, [fill_username | Path], TrUserData);
_ -> ok
end,
case M of
#{fill_oauth_scope := F5} ->
v_type_bool(F5, [fill_oauth_scope | Path], TrUserData);
_ -> ok
end,
case M of
#{response_compressed := F6} ->
v_msg_bool_value(F6, [response_compressed | Path],
TrUserData);
_ -> ok
end,
case M of
#{response_status := F7} ->
v_msg_echo_status(F7, [response_status | Path],
TrUserData);
_ -> ok
end,
case M of
#{expect_compressed := F8} ->
v_msg_bool_value(F8, [expect_compressed | Path],
TrUserData);
_ -> ok
end,
lists:foreach(fun (response_type) -> ok;
(response_size) -> ok;
(payload) -> ok;
(fill_username) -> ok;
(fill_oauth_scope) -> ok;
(response_compressed) -> ok;
(response_status) -> ok;
(expect_compressed) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_simple_request(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
simple_request},
M, Path);
v_msg_simple_request(X, Path, _TrUserData) ->
mk_type_error({expected_msg, simple_request}, X, Path).
-compile({nowarn_unused_function,v_msg_simple_response/3}).
-dialyzer({nowarn_function,v_msg_simple_response/3}).
v_msg_simple_response(#{} = M, Path, TrUserData) ->
case M of
#{payload := F1} ->
v_msg_payload(F1, [payload | Path], TrUserData);
_ -> ok
end,
case M of
#{username := F2} ->
v_type_string(F2, [username | Path], TrUserData);
_ -> ok
end,
case M of
#{oauth_scope := F3} ->
v_type_string(F3, [oauth_scope | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (payload) -> ok;
(username) -> ok;
(oauth_scope) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_simple_response(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
simple_response},
M, Path);
v_msg_simple_response(X, Path, _TrUserData) ->
mk_type_error({expected_msg, simple_response}, X, Path).
-compile({nowarn_unused_function,v_msg_streaming_input_call_request/3}).
-dialyzer({nowarn_function,v_msg_streaming_input_call_request/3}).
v_msg_streaming_input_call_request(#{} = M, Path,
TrUserData) ->
case M of
#{payload := F1} ->
v_msg_payload(F1, [payload | Path], TrUserData);
_ -> ok
end,
case M of
#{expect_compressed := F2} ->
v_msg_bool_value(F2, [expect_compressed | Path],
TrUserData);
_ -> ok
end,
lists:foreach(fun (payload) -> ok;
(expect_compressed) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_streaming_input_call_request(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
streaming_input_call_request},
M, Path);
v_msg_streaming_input_call_request(X, Path,
_TrUserData) ->
mk_type_error({expected_msg,
streaming_input_call_request},
X, Path).
-compile({nowarn_unused_function,v_msg_streaming_input_call_response/3}).
-dialyzer({nowarn_function,v_msg_streaming_input_call_response/3}).
v_msg_streaming_input_call_response(#{} = M, Path,
TrUserData) ->
case M of
#{aggregated_payload_size := F1} ->
v_type_int32(F1, [aggregated_payload_size | Path],
TrUserData);
_ -> ok
end,
lists:foreach(fun (aggregated_payload_size) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_streaming_input_call_response(M, Path,
_TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
streaming_input_call_response},
M, Path);
v_msg_streaming_input_call_response(X, Path,
_TrUserData) ->
mk_type_error({expected_msg,
streaming_input_call_response},
X, Path).
-compile({nowarn_unused_function,v_msg_response_parameters/3}).
-dialyzer({nowarn_function,v_msg_response_parameters/3}).
v_msg_response_parameters(#{} = M, Path, TrUserData) ->
case M of
#{size := F1} ->
v_type_int32(F1, [size | Path], TrUserData);
_ -> ok
end,
case M of
#{interval_us := F2} ->
v_type_int32(F2, [interval_us | Path], TrUserData);
_ -> ok
end,
case M of
#{compressed := F3} ->
v_msg_bool_value(F3, [compressed | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (size) -> ok;
(interval_us) -> ok;
(compressed) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_response_parameters(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
response_parameters},
M, Path);
v_msg_response_parameters(X, Path, _TrUserData) ->
mk_type_error({expected_msg, response_parameters}, X,
Path).
-compile({nowarn_unused_function,v_msg_streaming_output_call_request/3}).
-dialyzer({nowarn_function,v_msg_streaming_output_call_request/3}).
v_msg_streaming_output_call_request(#{} = M, Path,
TrUserData) ->
case M of
#{response_type := F1} ->
'v_enum_grpc.testing.PayloadType'(F1,
[response_type | Path], TrUserData);
_ -> ok
end,
case M of
#{response_parameters := F2} ->
if is_list(F2) ->
_ = [v_msg_response_parameters(Elem,
[response_parameters | Path],
TrUserData)
|| Elem <- F2],
ok;
true ->
mk_type_error({invalid_list_of,
{msg, response_parameters}},
F2, [response_parameters | Path])
end;
_ -> ok
end,
case M of
#{payload := F3} ->
v_msg_payload(F3, [payload | Path], TrUserData);
_ -> ok
end,
case M of
#{response_status := F4} ->
v_msg_echo_status(F4, [response_status | Path],
TrUserData);
_ -> ok
end,
lists:foreach(fun (response_type) -> ok;
(response_parameters) -> ok;
(payload) -> ok;
(response_status) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_streaming_output_call_request(M, Path,
_TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
streaming_output_call_request},
M, Path);
v_msg_streaming_output_call_request(X, Path,
_TrUserData) ->
mk_type_error({expected_msg,
streaming_output_call_request},
X, Path).
-compile({nowarn_unused_function,v_msg_streaming_output_call_response/3}).
-dialyzer({nowarn_function,v_msg_streaming_output_call_response/3}).
v_msg_streaming_output_call_response(#{} = M, Path,
TrUserData) ->
case M of
#{payload := F1} ->
v_msg_payload(F1, [payload | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (payload) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_streaming_output_call_response(M, Path,
_TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
streaming_output_call_response},
M, Path);
v_msg_streaming_output_call_response(X, Path,
_TrUserData) ->
mk_type_error({expected_msg,
streaming_output_call_response},
X, Path).
-compile({nowarn_unused_function,v_msg_reconnect_params/3}).
-dialyzer({nowarn_function,v_msg_reconnect_params/3}).
v_msg_reconnect_params(#{} = M, Path, TrUserData) ->
case M of
#{max_reconnect_backoff_ms := F1} ->
v_type_int32(F1, [max_reconnect_backoff_ms | Path],
TrUserData);
_ -> ok
end,
lists:foreach(fun (max_reconnect_backoff_ms) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_reconnect_params(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
reconnect_params},
M, Path);
v_msg_reconnect_params(X, Path, _TrUserData) ->
mk_type_error({expected_msg, reconnect_params}, X,
Path).
-compile({nowarn_unused_function,v_msg_reconnect_info/3}).
-dialyzer({nowarn_function,v_msg_reconnect_info/3}).
v_msg_reconnect_info(#{} = M, Path, TrUserData) ->
case M of
#{passed := F1} ->
v_type_bool(F1, [passed | Path], TrUserData);
_ -> ok
end,
case M of
#{backoff_ms := F2} ->
if is_list(F2) ->
_ = [v_type_int32(Elem, [backoff_ms | Path], TrUserData)
|| Elem <- F2],
ok;
true ->
mk_type_error({invalid_list_of, int32}, F2,
[backoff_ms | Path])
end;
_ -> ok
end,
lists:foreach(fun (passed) -> ok;
(backoff_ms) -> ok;
(OtherKey) ->
mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_reconnect_info(M, Path, _TrUserData)
when is_map(M) ->
mk_type_error({missing_fields, [] -- maps:keys(M),
reconnect_info},
M, Path);
v_msg_reconnect_info(X, Path, _TrUserData) ->
mk_type_error({expected_msg, reconnect_info}, X, Path).
-compile({nowarn_unused_function,'v_enum_grpc.testing.PayloadType'/3}).
-dialyzer({nowarn_function,'v_enum_grpc.testing.PayloadType'/3}).
'v_enum_grpc.testing.PayloadType'('COMPRESSABLE', _Path,
_TrUserData) ->
ok;
'v_enum_grpc.testing.PayloadType'(V, Path, TrUserData)
when is_integer(V) ->
v_type_sint32(V, Path, TrUserData);
'v_enum_grpc.testing.PayloadType'(X, Path,
_TrUserData) ->
mk_type_error({invalid_enum,
'grpc.testing.PayloadType'},
X, Path).
-compile({nowarn_unused_function,v_type_sint32/3}).
-dialyzer({nowarn_function,v_type_sint32/3}).
v_type_sint32(N, _Path, _TrUserData)
when -2147483648 =< N, N =< 2147483647 ->
ok;
v_type_sint32(N, Path, _TrUserData)
when is_integer(N) ->
mk_type_error({value_out_of_range, sint32, signed, 32},
N, Path);
v_type_sint32(X, Path, _TrUserData) ->
mk_type_error({bad_integer, sint32, signed, 32}, X,
Path).
-compile({nowarn_unused_function,v_type_int32/3}).
-dialyzer({nowarn_function,v_type_int32/3}).
v_type_int32(N, _Path, _TrUserData)
when -2147483648 =< N, N =< 2147483647 ->
ok;
v_type_int32(N, Path, _TrUserData) when is_integer(N) ->
mk_type_error({value_out_of_range, int32, signed, 32},
N, Path);
v_type_int32(X, Path, _TrUserData) ->
mk_type_error({bad_integer, int32, signed, 32}, X,
Path).
-compile({nowarn_unused_function,v_type_bool/3}).
-dialyzer({nowarn_function,v_type_bool/3}).
v_type_bool(false, _Path, _TrUserData) -> ok;
v_type_bool(true, _Path, _TrUserData) -> ok;
v_type_bool(0, _Path, _TrUserData) -> ok;
v_type_bool(1, _Path, _TrUserData) -> ok;
v_type_bool(X, Path, _TrUserData) ->
mk_type_error(bad_boolean_value, X, Path).
-compile({nowarn_unused_function,v_type_string/3}).
-dialyzer({nowarn_function,v_type_string/3}).
v_type_string(S, Path, _TrUserData)
when is_list(S); is_binary(S) ->
try unicode:characters_to_binary(S) of
B when is_binary(B) -> ok;
{error, _, _} ->
mk_type_error(bad_unicode_string, S, Path)
catch
error:badarg ->
mk_type_error(bad_unicode_string, S, Path)
end;
v_type_string(X, Path, _TrUserData) ->
mk_type_error(bad_unicode_string, X, Path).
-compile({nowarn_unused_function,v_type_bytes/3}).
-dialyzer({nowarn_function,v_type_bytes/3}).
v_type_bytes(B, _Path, _TrUserData) when is_binary(B) ->
ok;
v_type_bytes(B, _Path, _TrUserData) when is_list(B) ->
ok;
v_type_bytes(X, Path, _TrUserData) ->
mk_type_error(bad_binary_value, X, Path).
-compile({nowarn_unused_function,mk_type_error/3}).
-spec mk_type_error(_, _, list()) -> no_return().
mk_type_error(Error, ValueSeen, Path) ->
Path2 = prettify_path(Path),
erlang:error({gpb_type_error,
{Error, [{value, ValueSeen}, {path, Path2}]}}).
-compile({nowarn_unused_function,prettify_path/1}).
-dialyzer({nowarn_function,prettify_path/1}).
prettify_path([]) -> top_level;
prettify_path(PathR) ->
list_to_atom(lists:append(lists:join(".",
lists:map(fun atom_to_list/1,
lists:reverse(PathR))))).
-compile({nowarn_unused_function,id/2}).
-compile({inline,id/2}).
id(X, _TrUserData) -> X.
-compile({nowarn_unused_function,v_ok/3}).
-compile({inline,v_ok/3}).
v_ok(_Value, _Path, _TrUserData) -> ok.
-compile({nowarn_unused_function,m_overwrite/3}).
-compile({inline,m_overwrite/3}).
m_overwrite(_Prev, New, _TrUserData) -> New.
-compile({nowarn_unused_function,cons/3}).
-compile({inline,cons/3}).
cons(Elem, Acc, _TrUserData) -> [Elem | Acc].
-compile({nowarn_unused_function,lists_reverse/2}).
-compile({inline,lists_reverse/2}).
'lists_reverse'(L, _TrUserData) -> lists:reverse(L).
-compile({nowarn_unused_function,'erlang_++'/3}).
-compile({inline,'erlang_++'/3}).
'erlang_++'(A, B, _TrUserData) -> A ++ B.
get_msg_defs() ->
[{{enum, 'grpc.testing.PayloadType'},
[{'COMPRESSABLE', 0}]},
{{msg, bool_value},
[#{name => value, fnum => 1, rnum => 2, type => bool,
occurrence => optional, opts => []}]},
{{msg, payload},
[#{name => type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => body, fnum => 2, rnum => 3, type => bytes,
occurrence => optional, opts => []}]},
{{msg, echo_status},
[#{name => code, fnum => 1, rnum => 2, type => int32,
occurrence => optional, opts => []},
#{name => message, fnum => 2, rnum => 3, type => string,
occurrence => optional, opts => []}]},
{{msg, simple_request},
[#{name => response_type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => response_size, fnum => 2, rnum => 3,
type => int32, occurrence => optional, opts => []},
#{name => payload, fnum => 3, rnum => 4,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => fill_username, fnum => 4, rnum => 5,
type => bool, occurrence => optional, opts => []},
#{name => fill_oauth_scope, fnum => 5, rnum => 6,
type => bool, occurrence => optional, opts => []},
#{name => response_compressed, fnum => 6, rnum => 7,
type => {msg, bool_value}, occurrence => optional,
opts => []},
#{name => response_status, fnum => 7, rnum => 8,
type => {msg, echo_status}, occurrence => optional,
opts => []},
#{name => expect_compressed, fnum => 8, rnum => 9,
type => {msg, bool_value}, occurrence => optional,
opts => []}]},
{{msg, simple_response},
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => username, fnum => 2, rnum => 3,
type => string, occurrence => optional, opts => []},
#{name => oauth_scope, fnum => 3, rnum => 4,
type => string, occurrence => optional, opts => []}]},
{{msg, streaming_input_call_request},
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => expect_compressed, fnum => 2, rnum => 3,
type => {msg, bool_value}, occurrence => optional,
opts => []}]},
{{msg, streaming_input_call_response},
[#{name => aggregated_payload_size, fnum => 1,
rnum => 2, type => int32, occurrence => optional,
opts => []}]},
{{msg, response_parameters},
[#{name => size, fnum => 1, rnum => 2, type => int32,
occurrence => optional, opts => []},
#{name => interval_us, fnum => 2, rnum => 3,
type => int32, occurrence => optional, opts => []},
#{name => compressed, fnum => 3, rnum => 4,
type => {msg, bool_value}, occurrence => optional,
opts => []}]},
{{msg, streaming_output_call_request},
[#{name => response_type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => response_parameters, fnum => 2, rnum => 3,
type => {msg, response_parameters},
occurrence => repeated, opts => []},
#{name => payload, fnum => 3, rnum => 4,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => response_status, fnum => 7, rnum => 5,
type => {msg, echo_status}, occurrence => optional,
opts => []}]},
{{msg, streaming_output_call_response},
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []}]},
{{msg, reconnect_params},
[#{name => max_reconnect_backoff_ms, fnum => 1,
rnum => 2, type => int32, occurrence => optional,
opts => []}]},
{{msg, reconnect_info},
[#{name => passed, fnum => 1, rnum => 2, type => bool,
occurrence => optional, opts => []},
#{name => backoff_ms, fnum => 2, rnum => 3,
type => int32, occurrence => repeated,
opts => [packed]}]}].
get_msg_names() ->
[bool_value, payload, echo_status, simple_request,
simple_response, streaming_input_call_request,
streaming_input_call_response, response_parameters,
streaming_output_call_request,
streaming_output_call_response, reconnect_params,
reconnect_info].
get_group_names() -> [].
get_msg_or_group_names() ->
[bool_value, payload, echo_status, simple_request,
simple_response, streaming_input_call_request,
streaming_input_call_response, response_parameters,
streaming_output_call_request,
streaming_output_call_response, reconnect_params,
reconnect_info].
get_enum_names() -> ['grpc.testing.PayloadType'].
fetch_msg_def(MsgName) ->
case find_msg_def(MsgName) of
Fs when is_list(Fs) -> Fs;
error -> erlang:error({no_such_msg, MsgName})
end.
fetch_enum_def(EnumName) ->
case find_enum_def(EnumName) of
Es when is_list(Es) -> Es;
error -> erlang:error({no_such_enum, EnumName})
end.
find_msg_def(bool_value) ->
[#{name => value, fnum => 1, rnum => 2, type => bool,
occurrence => optional, opts => []}];
find_msg_def(payload) ->
[#{name => type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => body, fnum => 2, rnum => 3, type => bytes,
occurrence => optional, opts => []}];
find_msg_def(echo_status) ->
[#{name => code, fnum => 1, rnum => 2, type => int32,
occurrence => optional, opts => []},
#{name => message, fnum => 2, rnum => 3, type => string,
occurrence => optional, opts => []}];
find_msg_def(simple_request) ->
[#{name => response_type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => response_size, fnum => 2, rnum => 3,
type => int32, occurrence => optional, opts => []},
#{name => payload, fnum => 3, rnum => 4,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => fill_username, fnum => 4, rnum => 5,
type => bool, occurrence => optional, opts => []},
#{name => fill_oauth_scope, fnum => 5, rnum => 6,
type => bool, occurrence => optional, opts => []},
#{name => response_compressed, fnum => 6, rnum => 7,
type => {msg, bool_value}, occurrence => optional,
opts => []},
#{name => response_status, fnum => 7, rnum => 8,
type => {msg, echo_status}, occurrence => optional,
opts => []},
#{name => expect_compressed, fnum => 8, rnum => 9,
type => {msg, bool_value}, occurrence => optional,
opts => []}];
find_msg_def(simple_response) ->
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => username, fnum => 2, rnum => 3,
type => string, occurrence => optional, opts => []},
#{name => oauth_scope, fnum => 3, rnum => 4,
type => string, occurrence => optional, opts => []}];
find_msg_def(streaming_input_call_request) ->
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => expect_compressed, fnum => 2, rnum => 3,
type => {msg, bool_value}, occurrence => optional,
opts => []}];
find_msg_def(streaming_input_call_response) ->
[#{name => aggregated_payload_size, fnum => 1,
rnum => 2, type => int32, occurrence => optional,
opts => []}];
find_msg_def(response_parameters) ->
[#{name => size, fnum => 1, rnum => 2, type => int32,
occurrence => optional, opts => []},
#{name => interval_us, fnum => 2, rnum => 3,
type => int32, occurrence => optional, opts => []},
#{name => compressed, fnum => 3, rnum => 4,
type => {msg, bool_value}, occurrence => optional,
opts => []}];
find_msg_def(streaming_output_call_request) ->
[#{name => response_type, fnum => 1, rnum => 2,
type => {enum, 'grpc.testing.PayloadType'},
occurrence => optional, opts => []},
#{name => response_parameters, fnum => 2, rnum => 3,
type => {msg, response_parameters},
occurrence => repeated, opts => []},
#{name => payload, fnum => 3, rnum => 4,
type => {msg, payload}, occurrence => optional,
opts => []},
#{name => response_status, fnum => 7, rnum => 5,
type => {msg, echo_status}, occurrence => optional,
opts => []}];
find_msg_def(streaming_output_call_response) ->
[#{name => payload, fnum => 1, rnum => 2,
type => {msg, payload}, occurrence => optional,
opts => []}];
find_msg_def(reconnect_params) ->
[#{name => max_reconnect_backoff_ms, fnum => 1,
rnum => 2, type => int32, occurrence => optional,
opts => []}];
find_msg_def(reconnect_info) ->
[#{name => passed, fnum => 1, rnum => 2, type => bool,
occurrence => optional, opts => []},
#{name => backoff_ms, fnum => 2, rnum => 3,
type => int32, occurrence => repeated,
opts => [packed]}];
find_msg_def(_) -> error.
find_enum_def('grpc.testing.PayloadType') ->
[{'COMPRESSABLE', 0}];
find_enum_def(_) -> error.
enum_symbol_by_value('grpc.testing.PayloadType',
Value) ->
'enum_symbol_by_value_grpc.testing.PayloadType'(Value).
enum_value_by_symbol('grpc.testing.PayloadType', Sym) ->
'enum_value_by_symbol_grpc.testing.PayloadType'(Sym).
'enum_symbol_by_value_grpc.testing.PayloadType'(0) ->
'COMPRESSABLE'.
'enum_value_by_symbol_grpc.testing.PayloadType'('COMPRESSABLE') ->
0.
get_service_names() ->
['grpc.testing.BenchmarkService'].
get_service_def('grpc.testing.BenchmarkService') ->
{{service, 'grpc.testing.BenchmarkService'},
[#{name => 'UnaryCall', input => simple_request,
output => simple_response, input_stream => false,
output_stream => false, opts => []},
#{name => 'StreamingCall', input => simple_request,
output => simple_response, input_stream => true,
output_stream => true, opts => []},
#{name => 'StreamingFromClient',
input => simple_request, output => simple_response,
input_stream => true, output_stream => false,
opts => []},
#{name => 'StreamingFromServer',
input => simple_request, output => simple_response,
input_stream => false, output_stream => true,
opts => []},
#{name => 'StreamingBothWays', input => simple_request,
output => simple_response, input_stream => true,
output_stream => true, opts => []}]};
get_service_def(_) -> error.
get_rpc_names('grpc.testing.BenchmarkService') ->
['UnaryCall', 'StreamingCall', 'StreamingFromClient',
'StreamingFromServer', 'StreamingBothWays'];
get_rpc_names(_) -> error.
find_rpc_def('grpc.testing.BenchmarkService',
RpcName) ->
'find_rpc_def_grpc.testing.BenchmarkService'(RpcName);
find_rpc_def(_, _) -> error.
'find_rpc_def_grpc.testing.BenchmarkService'('UnaryCall') ->
#{name => 'UnaryCall', input => simple_request,
output => simple_response, input_stream => false,
output_stream => false, opts => []};
'find_rpc_def_grpc.testing.BenchmarkService'('StreamingCall') ->
#{name => 'StreamingCall', input => simple_request,
output => simple_response, input_stream => true,
output_stream => true, opts => []};
'find_rpc_def_grpc.testing.BenchmarkService'('StreamingFromClient') ->
#{name => 'StreamingFromClient',
input => simple_request, output => simple_response,
input_stream => true, output_stream => false,
opts => []};
'find_rpc_def_grpc.testing.BenchmarkService'('StreamingFromServer') ->
#{name => 'StreamingFromServer',
input => simple_request, output => simple_response,
input_stream => false, output_stream => true,
opts => []};
'find_rpc_def_grpc.testing.BenchmarkService'('StreamingBothWays') ->
#{name => 'StreamingBothWays', input => simple_request,
output => simple_response, input_stream => true,
output_stream => true, opts => []};
'find_rpc_def_grpc.testing.BenchmarkService'(_) ->
error.
fetch_rpc_def(ServiceName, RpcName) ->
case find_rpc_def(ServiceName, RpcName) of
Def when is_map(Def) -> Def;
error ->
erlang:error({no_such_rpc, ServiceName, RpcName})
end.
%% Convert a a fully qualified (ie with package name) service name
%% as a binary to a service name as an atom.
fqbin_to_service_name(<<"grpc.testing.BenchmarkService">>) ->
'grpc.testing.BenchmarkService';
fqbin_to_service_name(X) ->
error({gpb_error, {badservice, X}}).
%% Convert a service name as an atom to a fully qualified
%% (ie with package name) name as a binary.
service_name_to_fqbin('grpc.testing.BenchmarkService') ->
<<"grpc.testing.BenchmarkService">>;
service_name_to_fqbin(X) ->
error({gpb_error, {badservice, X}}).
%% Convert a a fully qualified (ie with package name) service name
%% and an rpc name, both as binaries to a service name and an rpc
%% name, as atoms.
fqbins_to_service_and_rpc_name(<<"grpc.testing.BenchmarkService">>, <<"UnaryCall">>) ->
{'grpc.testing.BenchmarkService', 'UnaryCall'};
fqbins_to_service_and_rpc_name(<<"grpc.testing.BenchmarkService">>, <<"StreamingCall">>) ->
{'grpc.testing.BenchmarkService', 'StreamingCall'};
fqbins_to_service_and_rpc_name(<<"grpc.testing.BenchmarkService">>, <<"StreamingFromClient">>) ->
{'grpc.testing.BenchmarkService',
'StreamingFromClient'};
fqbins_to_service_and_rpc_name(<<"grpc.testing.BenchmarkService">>, <<"StreamingFromServer">>) ->
{'grpc.testing.BenchmarkService',
'StreamingFromServer'};
fqbins_to_service_and_rpc_name(<<"grpc.testing.BenchmarkService">>, <<"StreamingBothWays">>) ->
{'grpc.testing.BenchmarkService', 'StreamingBothWays'};
fqbins_to_service_and_rpc_name(S, R) ->
error({gpb_error, {badservice_or_rpc, {S, R}}}).
%% Convert a service name and an rpc name, both as atoms,
%% to a fully qualified (ie with package name) service name and
%% an rpc name as binaries.
service_and_rpc_name_to_fqbins('grpc.testing.BenchmarkService',
'UnaryCall') ->
{<<"grpc.testing.BenchmarkService">>, <<"UnaryCall">>};
service_and_rpc_name_to_fqbins('grpc.testing.BenchmarkService',
'StreamingCall') ->
{<<"grpc.testing.BenchmarkService">>, <<"StreamingCall">>};
service_and_rpc_name_to_fqbins('grpc.testing.BenchmarkService',
'StreamingFromClient') ->
{<<"grpc.testing.BenchmarkService">>, <<"StreamingFromClient">>};
service_and_rpc_name_to_fqbins('grpc.testing.BenchmarkService',
'StreamingFromServer') ->
{<<"grpc.testing.BenchmarkService">>, <<"StreamingFromServer">>};
service_and_rpc_name_to_fqbins('grpc.testing.BenchmarkService',
'StreamingBothWays') ->
{<<"grpc.testing.BenchmarkService">>, <<"StreamingBothWays">>};
service_and_rpc_name_to_fqbins(S, R) ->
error({gpb_error, {badservice_or_rpc, {S, R}}}).
fqbin_to_msg_name(<<"grpc.testing.BoolValue">>) -> bool_value;
fqbin_to_msg_name(<<"grpc.testing.Payload">>) -> payload;
fqbin_to_msg_name(<<"grpc.testing.EchoStatus">>) -> echo_status;
fqbin_to_msg_name(<<"grpc.testing.SimpleRequest">>) -> simple_request;
fqbin_to_msg_name(<<"grpc.testing.SimpleResponse">>) -> simple_response;
fqbin_to_msg_name(<<"grpc.testing.StreamingInputCallRequest">>) ->
streaming_input_call_request;
fqbin_to_msg_name(<<"grpc.testing.StreamingInputCallResponse">>) ->
streaming_input_call_response;
fqbin_to_msg_name(<<"grpc.testing.ResponseParameters">>) -> response_parameters;
fqbin_to_msg_name(<<"grpc.testing.StreamingOutputCallRequest">>) ->
streaming_output_call_request;
fqbin_to_msg_name(<<"grpc.testing.StreamingOutputCallResponse">>) ->
streaming_output_call_response;
fqbin_to_msg_name(<<"grpc.testing.ReconnectParams">>) -> reconnect_params;
fqbin_to_msg_name(<<"grpc.testing.ReconnectInfo">>) -> reconnect_info;
fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}).
msg_name_to_fqbin(bool_value) -> <<"grpc.testing.BoolValue">>;
msg_name_to_fqbin(payload) -> <<"grpc.testing.Payload">>;
msg_name_to_fqbin(echo_status) -> <<"grpc.testing.EchoStatus">>;
msg_name_to_fqbin(simple_request) -> <<"grpc.testing.SimpleRequest">>;
msg_name_to_fqbin(simple_response) -> <<"grpc.testing.SimpleResponse">>;
msg_name_to_fqbin(streaming_input_call_request) ->
<<"grpc.testing.StreamingInputCallRequest">>;
msg_name_to_fqbin(streaming_input_call_response) ->
<<"grpc.testing.StreamingInputCallResponse">>;
msg_name_to_fqbin(response_parameters) -> <<"grpc.testing.ResponseParameters">>;
msg_name_to_fqbin(streaming_output_call_request) ->
<<"grpc.testing.StreamingOutputCallRequest">>;
msg_name_to_fqbin(streaming_output_call_response) ->
<<"grpc.testing.StreamingOutputCallResponse">>;
msg_name_to_fqbin(reconnect_params) -> <<"grpc.testing.ReconnectParams">>;
msg_name_to_fqbin(reconnect_info) -> <<"grpc.testing.ReconnectInfo">>;
msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}).
fqbin_to_enum_name(<<"grpc.testing.PayloadType">>) ->
'grpc.testing.PayloadType';
fqbin_to_enum_name(E) ->
error({gpb_error, {badenum, E}}).
enum_name_to_fqbin('grpc.testing.PayloadType') ->
<<"grpc.testing.PayloadType">>;
enum_name_to_fqbin(E) ->
error({gpb_error, {badenum, E}}).
get_package_name() -> 'grpc.testing'.
%% Whether or not the message names
%% are prepended with package name or not.
uses_packages() -> true.
source_basename() -> "benchmark_service.proto".
%% Retrieve all proto file names, also imported ones.
%% The order is top-down. The first element is always the main
%% source file. The files are returned with extension,
%% see get_all_proto_names/0 for a version that returns
%% the basenames sans extension
get_all_source_basenames() ->
["benchmark_service.proto", "messages.proto"].
%% Retrieve all proto file names, also imported ones.
%% The order is top-down. The first element is always the main
%% source file. The files are returned sans .proto extension,
%% to make it easier to use them with the various get_xyz_containment
%% functions.
get_all_proto_names() ->
["benchmark_service", "messages"].
get_msg_containment("benchmark_service") -> [];
get_msg_containment("messages") ->
[bool_value, echo_status, payload, reconnect_info,
reconnect_params, response_parameters, simple_request,
simple_response, streaming_input_call_request,
streaming_input_call_response,
streaming_output_call_request,
streaming_output_call_response];
get_msg_containment(P) ->
error({gpb_error, {badproto, P}}).
get_pkg_containment("benchmark_service") ->
'grpc.testing';
get_pkg_containment("messages") -> 'grpc.testing';
get_pkg_containment(P) ->
error({gpb_error, {badproto, P}}).
get_service_containment("benchmark_service") ->
['grpc.testing.BenchmarkService'];
get_service_containment("messages") -> [];
get_service_containment(P) ->
error({gpb_error, {badproto, P}}).
get_rpc_containment("benchmark_service") ->
[{'grpc.testing.BenchmarkService', 'UnaryCall'},
{'grpc.testing.BenchmarkService', 'StreamingCall'},
{'grpc.testing.BenchmarkService',
'StreamingFromClient'},
{'grpc.testing.BenchmarkService',
'StreamingFromServer'},
{'grpc.testing.BenchmarkService', 'StreamingBothWays'}];
get_rpc_containment("messages") -> [];
get_rpc_containment(P) ->
error({gpb_error, {badproto, P}}).
get_enum_containment("benchmark_service") -> [];
get_enum_containment("messages") ->
['grpc.testing.PayloadType'];
get_enum_containment(P) ->
error({gpb_error, {badproto, P}}).
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.ResponseParameters">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.ReconnectParams">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.EchoStatus">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.StreamingOutputCallRequest">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.StreamingInputCallRequest">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.SimpleRequest">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.Payload">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.StreamingOutputCallResponse">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.StreamingInputCallResponse">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.SimpleResponse">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.BoolValue">>) -> "messages";
get_proto_by_msg_name_as_fqbin(<<"grpc.testing.ReconnectInfo">>) -> "messages";
get_proto_by_msg_name_as_fqbin(E) ->
error({gpb_error, {badmsg, E}}).
get_proto_by_service_name_as_fqbin(<<"grpc.testing.BenchmarkService">>) ->
"benchmark_service";
get_proto_by_service_name_as_fqbin(E) ->
error({gpb_error, {badservice, E}}).
get_proto_by_enum_name_as_fqbin(<<"grpc.testing.PayloadType">>) -> "messages";
get_proto_by_enum_name_as_fqbin(E) ->
error({gpb_error, {badenum, E}}).
get_protos_by_pkg_name_as_fqbin(<<"grpc.testing">>) ->
["benchmark_service", "messages"];
get_protos_by_pkg_name_as_fqbin(E) ->
error({gpb_error, {badpkg, E}}).
descriptor() ->
<<10, 237, 3, 10, 36, 103, 114, 112, 99, 47, 116, 101,
115, 116, 105, 110, 103, 47, 98, 101, 110, 99, 104, 109,
97, 114, 107, 95, 115, 101, 114, 118, 105, 99, 101, 46,
112, 114, 111, 116, 111, 18, 12, 103, 114, 112, 99, 46,
116, 101, 115, 116, 105, 110, 103, 50, 174, 3, 10, 16,
66, 101, 110, 99, 104, 109, 97, 114, 107, 83, 101, 114,
118, 105, 99, 101, 18, 74, 10, 9, 85, 110, 97, 114, 121,
67, 97, 108, 108, 18, 27, 46, 103, 114, 112, 99, 46,
116, 101, 115, 116, 105, 110, 103, 46, 83, 105, 109,
112, 108, 101, 82, 101, 113, 117, 101, 115, 116, 26, 28,
46, 103, 114, 112, 99, 46, 116, 101, 115, 116, 105, 110,
103, 46, 83, 105, 109, 112, 108, 101, 82, 101, 115, 112,
111, 110, 115, 101, 40, 0, 48, 0, 18, 78, 10, 13, 83,
116, 114, 101, 97, 109, 105, 110, 103, 67, 97, 108, 108,
18, 27, 46, 103, 114, 112, 99, 46, 116, 101, 115, 116,
105, 110, 103, 46, 83, 105, 109, 112, 108, 101, 82, 101,
113, 117, 101, 115, 116, 26, 28, 46, 103, 114, 112, 99,
46, 116, 101, 115, 116, 105, 110, 103, 46, 83, 105, 109,
112, 108, 101, 82, 101, 115, 112, 111, 110, 115, 101,
40, 0, 48, 0, 18, 84, 10, 19, 83, 116, 114, 101, 97,
109, 105, 110, 103, 70, 114, 111, 109, 67, 108, 105,
101, 110, 116, 18, 27, 46, 103, 114, 112, 99, 46, 116,
101, 115, 116, 105, 110, 103, 46, 83, 105, 109, 112,
108, 101, 82, 101, 113, 117, 101, 115, 116, 26, 28, 46,
103, 114, 112, 99, 46, 116, 101, 115, 116, 105, 110,
103, 46, 83, 105, 109, 112, 108, 101, 82, 101, 115, 112,
111, 110, 115, 101, 40, 0, 48, 0, 18, 84, 10, 19, 83,
116, 114, 101, 97, 109, 105, 110, 103, 70, 114, 111,
109, 83, 101, 114, 118, 101, 114, 18, 27, 46, 103, 114,
112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46, 83,
105, 109, 112, 108, 101, 82, 101, 113, 117, 101, 115,
116, 26, 28, 46, 103, 114, 112, 99, 46, 116, 101, 115,
116, 105, 110, 103, 46, 83, 105, 109, 112, 108, 101, 82,
101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 82,
10, 17, 83, 116, 114, 101, 97, 109, 105, 110, 103, 66,
111, 116, 104, 87, 97, 121, 115, 18, 27, 46, 103, 114,
112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46, 83,
105, 109, 112, 108, 101, 82, 101, 113, 117, 101, 115,
116, 26, 28, 46, 103, 114, 112, 99, 46, 116, 101, 115,
116, 105, 110, 103, 46, 83, 105, 109, 112, 108, 101, 82,
101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 98, 6,
112, 114, 111, 116, 111, 51, 10, 215, 10, 10, 27, 103,
114, 112, 99, 47, 116, 101, 115, 116, 105, 110, 103, 47,
109, 101, 115, 115, 97, 103, 101, 115, 46, 112, 114,
111, 116, 111, 18, 12, 103, 114, 112, 99, 46, 116, 101,
115, 116, 105, 110, 103, 34, 26, 10, 9, 66, 111, 111,
108, 86, 97, 108, 117, 101, 18, 13, 10, 5, 118, 97, 108,
117, 101, 24, 1, 32, 1, 40, 8, 34, 43, 10, 10, 69, 99,
104, 111, 83, 116, 97, 116, 117, 115, 18, 12, 10, 4, 99,
111, 100, 101, 24, 1, 32, 1, 40, 5, 18, 15, 10, 7, 109,
101, 115, 115, 97, 103, 101, 24, 2, 32, 1, 40, 9, 34,
64, 10, 7, 80, 97, 121, 108, 111, 97, 100, 18, 39, 10,
4, 116, 121, 112, 101, 24, 1, 32, 1, 40, 14, 50, 25, 46,
103, 114, 112, 99, 46, 116, 101, 115, 116, 105, 110,
103, 46, 80, 97, 121, 108, 111, 97, 100, 84, 121, 112,
101, 18, 12, 10, 4, 98, 111, 100, 121, 24, 2, 32, 1, 40,
12, 34, 63, 10, 13, 82, 101, 99, 111, 110, 110, 101, 99,
116, 73, 110, 102, 111, 18, 14, 10, 6, 112, 97, 115,
115, 101, 100, 24, 1, 32, 1, 40, 8, 18, 30, 10, 10, 98,
97, 99, 107, 111, 102, 102, 95, 109, 115, 24, 2, 32, 3,
40, 5, 66, 10, 8, 0, 16, 1, 48, 0, 40, 0, 80, 0, 34, 51,
10, 15, 82, 101, 99, 111, 110, 110, 101, 99, 116, 80,
97, 114, 97, 109, 115, 18, 32, 10, 24, 109, 97, 120, 95,
114, 101, 99, 111, 110, 110, 101, 99, 116, 95, 98, 97,
99, 107, 111, 102, 102, 95, 109, 115, 24, 1, 32, 1, 40,
5, 34, 100, 10, 18, 82, 101, 115, 112, 111, 110, 115,
101, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 18,
12, 10, 4, 115, 105, 122, 101, 24, 1, 32, 1, 40, 5, 18,
19, 10, 11, 105, 110, 116, 101, 114, 118, 97, 108, 95,
117, 115, 24, 2, 32, 1, 40, 5, 18, 43, 10, 10, 99, 111,
109, 112, 114, 101, 115, 115, 101, 100, 24, 3, 32, 1,
40, 11, 50, 23, 46, 103, 114, 112, 99, 46, 116, 101,
115, 116, 105, 110, 103, 46, 66, 111, 111, 108, 86, 97,
108, 117, 101, 34, 206, 2, 10, 13, 83, 105, 109, 112,
108, 101, 82, 101, 113, 117, 101, 115, 116, 18, 48, 10,
13, 114, 101, 115, 112, 111, 110, 115, 101, 95, 116,
121, 112, 101, 24, 1, 32, 1, 40, 14, 50, 25, 46, 103,
114, 112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46,
80, 97, 121, 108, 111, 97, 100, 84, 121, 112, 101, 18,
21, 10, 13, 114, 101, 115, 112, 111, 110, 115, 101, 95,
115, 105, 122, 101, 24, 2, 32, 1, 40, 5, 18, 38, 10, 7,
112, 97, 121, 108, 111, 97, 100, 24, 3, 32, 1, 40, 11,
50, 21, 46, 103, 114, 112, 99, 46, 116, 101, 115, 116,
105, 110, 103, 46, 80, 97, 121, 108, 111, 97, 100, 18,
21, 10, 13, 102, 105, 108, 108, 95, 117, 115, 101, 114,
110, 97, 109, 101, 24, 4, 32, 1, 40, 8, 18, 24, 10, 16,
102, 105, 108, 108, 95, 111, 97, 117, 116, 104, 95, 115,
99, 111, 112, 101, 24, 5, 32, 1, 40, 8, 18, 52, 10, 19,
114, 101, 115, 112, 111, 110, 115, 101, 95, 99, 111,
109, 112, 114, 101, 115, 115, 101, 100, 24, 6, 32, 1,
40, 11, 50, 23, 46, 103, 114, 112, 99, 46, 116, 101,
115, 116, 105, 110, 103, 46, 66, 111, 111, 108, 86, 97,
108, 117, 101, 18, 49, 10, 15, 114, 101, 115, 112, 111,
110, 115, 101, 95, 115, 116, 97, 116, 117, 115, 24, 7,
32, 1, 40, 11, 50, 24, 46, 103, 114, 112, 99, 46, 116,
101, 115, 116, 105, 110, 103, 46, 69, 99, 104, 111, 83,
116, 97, 116, 117, 115, 18, 50, 10, 17, 101, 120, 112,
101, 99, 116, 95, 99, 111, 109, 112, 114, 101, 115, 115,
101, 100, 24, 8, 32, 1, 40, 11, 50, 23, 46, 103, 114,
112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46, 66,
111, 111, 108, 86, 97, 108, 117, 101, 34, 95, 10, 14,
83, 105, 109, 112, 108, 101, 82, 101, 115, 112, 111,
110, 115, 101, 18, 38, 10, 7, 112, 97, 121, 108, 111,
97, 100, 24, 1, 32, 1, 40, 11, 50, 21, 46, 103, 114,
112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46, 80,
97, 121, 108, 111, 97, 100, 18, 16, 10, 8, 117, 115,
101, 114, 110, 97, 109, 101, 24, 2, 32, 1, 40, 9, 18,
19, 10, 11, 111, 97, 117, 116, 104, 95, 115, 99, 111,
112, 101, 24, 3, 32, 1, 40, 9, 34, 119, 10, 25, 83, 116,
114, 101, 97, 109, 105, 110, 103, 73, 110, 112, 117,
116, 67, 97, 108, 108, 82, 101, 113, 117, 101, 115, 116,
18, 38, 10, 7, 112, 97, 121, 108, 111, 97, 100, 24, 1,
32, 1, 40, 11, 50, 21, 46, 103, 114, 112, 99, 46, 116,
101, 115, 116, 105, 110, 103, 46, 80, 97, 121, 108, 111,
97, 100, 18, 50, 10, 17, 101, 120, 112, 101, 99, 116,
95, 99, 111, 109, 112, 114, 101, 115, 115, 101, 100, 24,
2, 32, 1, 40, 11, 50, 23, 46, 103, 114, 112, 99, 46,
116, 101, 115, 116, 105, 110, 103, 46, 66, 111, 111,
108, 86, 97, 108, 117, 101, 34, 61, 10, 26, 83, 116,
114, 101, 97, 109, 105, 110, 103, 73, 110, 112, 117,
116, 67, 97, 108, 108, 82, 101, 115, 112, 111, 110, 115,
101, 18, 31, 10, 23, 97, 103, 103, 114, 101, 103, 97,
116, 101, 100, 95, 112, 97, 121, 108, 111, 97, 100, 95,
115, 105, 122, 101, 24, 1, 32, 1, 40, 5, 34, 232, 1, 10,
26, 83, 116, 114, 101, 97, 109, 105, 110, 103, 79, 117,
116, 112, 117, 116, 67, 97, 108, 108, 82, 101, 113, 117,
101, 115, 116, 18, 48, 10, 13, 114, 101, 115, 112, 111,
110, 115, 101, 95, 116, 121, 112, 101, 24, 1, 32, 1, 40,
14, 50, 25, 46, 103, 114, 112, 99, 46, 116, 101, 115,
116, 105, 110, 103, 46, 80, 97, 121, 108, 111, 97, 100,
84, 121, 112, 101, 18, 61, 10, 19, 114, 101, 115, 112,
111, 110, 115, 101, 95, 112, 97, 114, 97, 109, 101, 116,
101, 114, 115, 24, 2, 32, 3, 40, 11, 50, 32, 46, 103,
114, 112, 99, 46, 116, 101, 115, 116, 105, 110, 103, 46,
82, 101, 115, 112, 111, 110, 115, 101, 80, 97, 114, 97,
109, 101, 116, 101, 114, 115, 18, 38, 10, 7, 112, 97,
121, 108, 111, 97, 100, 24, 3, 32, 1, 40, 11, 50, 21,
46, 103, 114, 112, 99, 46, 116, 101, 115, 116, 105, 110,
103, 46, 80, 97, 121, 108, 111, 97, 100, 18, 49, 10, 15,
114, 101, 115, 112, 111, 110, 115, 101, 95, 115, 116,
97, 116, 117, 115, 24, 7, 32, 1, 40, 11, 50, 24, 46,
103, 114, 112, 99, 46, 116, 101, 115, 116, 105, 110,
103, 46, 69, 99, 104, 111, 83, 116, 97, 116, 117, 115,
34, 69, 10, 27, 83, 116, 114, 101, 97, 109, 105, 110,
103, 79, 117, 116, 112, 117, 116, 67, 97, 108, 108, 82,
101, 115, 112, 111, 110, 115, 101, 18, 38, 10, 7, 112,
97, 121, 108, 111, 97, 100, 24, 1, 32, 1, 40, 11, 50,
21, 46, 103, 114, 112, 99, 46, 116, 101, 115, 116, 105,
110, 103, 46, 80, 97, 121, 108, 111, 97, 100, 42, 31,
10, 11, 80, 97, 121, 108, 111, 97, 100, 84, 121, 112,
101, 18, 16, 10, 12, 67, 79, 77, 80, 82, 69, 83, 83, 65,
66, 76, 69, 16, 0, 98, 6, 112, 114, 111, 116, 111, 51>>.
descriptor("benchmark_service
gitextract_caytn9d6/
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── LICENSE
├── README.md
├── benchmark/
│ ├── README.md
│ ├── config/
│ │ ├── sys.config
│ │ └── test.config
│ ├── proto/
│ │ └── benchmark_service.proto
│ ├── src/
│ │ ├── benchmark_service_pb.erl
│ │ ├── grpc_testing_benchmark_service.erl
│ │ ├── grpc_testing_benchmark_service_bhvr.erl
│ │ └── grpc_testing_benchmark_service_client.erl
│ └── test/
│ └── grpcbox_benchmark_client_SUITE.erl
├── config/
│ └── test.config
├── elvis.config
├── include/
│ └── grpcbox.hrl
├── interop/
│ ├── config/
│ │ └── sys.config
│ ├── include/
│ │ └── grpcbox_interop_tests.hrl
│ ├── proto/
│ │ ├── empty.proto
│ │ ├── messages.proto
│ │ └── test.proto
│ ├── run_server_tests.sh
│ ├── src/
│ │ ├── empty_pb.erl
│ │ ├── grpc_testing_reconnect_service_bhvr.erl
│ │ ├── grpc_testing_reconnect_service_client.erl
│ │ ├── grpc_testing_test_service.erl
│ │ ├── grpc_testing_test_service_bhvr.erl
│ │ ├── grpc_testing_test_service_client.erl
│ │ ├── grpc_testing_unimplemented_service_bhvr.erl
│ │ ├── grpc_testing_unimplemented_service_client.erl
│ │ ├── messages_pb.erl
│ │ └── test_pb.erl
│ └── test/
│ └── grpcbox_interop_client_SUITE.erl
├── proto/
│ ├── health.proto
│ └── reflection.proto
├── rebar.config
├── src/
│ ├── grpcbox.app.src
│ ├── grpcbox.erl
│ ├── grpcbox_acceptor.erl
│ ├── grpcbox_app.erl
│ ├── grpcbox_chain_interceptor.erl
│ ├── grpcbox_channel.erl
│ ├── grpcbox_channel_sup.erl
│ ├── grpcbox_client.erl
│ ├── grpcbox_client_stream.erl
│ ├── grpcbox_frame.erl
│ ├── grpcbox_health_bhvr.erl
│ ├── grpcbox_health_client.erl
│ ├── grpcbox_health_pb.erl
│ ├── grpcbox_health_service.erl
│ ├── grpcbox_metadata.erl
│ ├── grpcbox_name_resolver.erl
│ ├── grpcbox_oc_stats.erl
│ ├── grpcbox_oc_stats_handler.erl
│ ├── grpcbox_pool.erl
│ ├── grpcbox_reflection_bhvr.erl
│ ├── grpcbox_reflection_client.erl
│ ├── grpcbox_reflection_pb.erl
│ ├── grpcbox_reflection_service.erl
│ ├── grpcbox_services_simple_sup.erl
│ ├── grpcbox_services_sup.erl
│ ├── grpcbox_socket.erl
│ ├── grpcbox_stream.erl
│ ├── grpcbox_subchannel.erl
│ ├── grpcbox_sup.erl
│ ├── grpcbox_trace.erl
│ └── grpcbox_utils.erl
└── test/
├── grpcbox_SUITE.erl
├── grpcbox_SUITE_data/
│ ├── certificates/
│ │ ├── ca.pem
│ │ ├── server1.key
│ │ └── server1.pem
│ ├── route_guide.proto
│ └── route_guide_db.json
├── route_guide_pb.erl
├── routeguide_route_guide.erl
├── routeguide_route_guide_bhvr.erl
├── routeguide_route_guide_client.erl
└── test_stats_handler.erl
Condensed preview — 78 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,230K chars).
[
{
"path": ".github/workflows/main.yml",
"chars": 2369,
"preview": "name: Common Test\n\non:\n pull_request:\n branches:\n - 'main'\n push:\n branches:\n - 'main'\n\njobs:\n build:"
},
{
"path": ".gitignore",
"chars": 134,
"preview": ".rebar3\n_*\n.eunit\n*.o\n*.beam\n*.plt\n*.swp\n*.swo\n.erlang.cookie\nebin\nlog\nerl_crash.dump\n.rebar\nlogs\n_build\n.idea\n*.iml\nreb"
},
{
"path": "LICENSE",
"chars": 10783,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 15840,
"preview": "grpcbox\n=====\n\n\n\n[;\n// you may not use"
},
{
"path": "benchmark/src/benchmark_service_pb.erl",
"chars": 173119,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.3\n-"
},
{
"path": "benchmark/src/grpc_testing_benchmark_service.erl",
"chars": 1960,
"preview": "-module(grpc_testing_benchmark_service).\n\n-behaviour(grpc_testing_benchmark_service_bhvr).\n\n-export([unary_call/2,\n "
},
{
"path": "benchmark/src/grpc_testing_benchmark_service_bhvr.erl",
"chars": 1135,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "benchmark/src/grpc_testing_benchmark_service_client.erl",
"chars": 5657,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.testi"
},
{
"path": "benchmark/test/grpcbox_benchmark_client_SUITE.erl",
"chars": 5362,
"preview": "-module(grpcbox_benchmark_client_SUITE).\n\n-compile([export_all]).\n\n-include_lib(\"eunit/include/eunit.hrl\").\n-include_lib"
},
{
"path": "config/test.config",
"chars": 1934,
"preview": "[\n {grpcbox, [{client, #{channels => [{default_channel, [{http, \"localhost\", 8080, []}],\n "
},
{
"path": "elvis.config",
"chars": 1270,
"preview": "[\n {\n elvis,\n [\n {config,\n [#{dirs => [\"src\"],\n filter => \"*.erl\",\n ignore => [],\n rules"
},
{
"path": "include/grpcbox.hrl",
"chars": 1576,
"preview": "-record(method, {key :: {unicode:chardata() | '$1', unicode:chardata() | '_'} | '_',\n proto :: m"
},
{
"path": "interop/config/sys.config",
"chars": 1951,
"preview": "[\n {grpcbox, [%% {client, #{channels => [{default_channel, [{http, \"localhost\", 8080, []}], #{}}]}},\n {server"
},
{
"path": "interop/include/grpcbox_interop_tests.hrl",
"chars": 266,
"preview": "-define(INITIAL_METADATA_KEY, <<\"x-grpc-test-echo-initial\">>).\n-define(TRAILING_METADATA_KEY, <<\"x-grpc-test-echo-traili"
},
{
"path": "interop/proto/empty.proto",
"chars": 957,
"preview": "\n// Copyright 2015 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not us"
},
{
"path": "interop/proto/messages.proto",
"chars": 5439,
"preview": "\n// Copyright 2015-2016 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "interop/proto/test.proto",
"chars": 3274,
"preview": "\n// Copyright 2015-2016 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "interop/run_server_tests.sh",
"chars": 807,
"preview": "#!/bin/bash\n\nPORT=8080\nTLS=false\n\ntests=(\n empty_unary\n large_unary\n client_streaming\n server_streaming\n "
},
{
"path": "interop/src/empty_pb.erl",
"chars": 18434,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.1\n-"
},
{
"path": "interop/src/grpc_testing_reconnect_service_bhvr.erl",
"chars": 669,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "interop/src/grpc_testing_reconnect_service_client.erl",
"chars": 2808,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.testi"
},
{
"path": "interop/src/grpc_testing_test_service.erl",
"chars": 5056,
"preview": "-module(grpc_testing_test_service).\n\n-behaviour(grpc_testing_test_service_bhvr).\n\n-export([empty_call/2,\n unary_"
},
{
"path": "interop/src/grpc_testing_test_service_bhvr.erl",
"chars": 1563,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "interop/src/grpc_testing_test_service_client.erl",
"chars": 8537,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.testi"
},
{
"path": "interop/src/grpc_testing_unimplemented_service_bhvr.erl",
"chars": 532,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "interop/src/grpc_testing_unimplemented_service_client.erl",
"chars": 2065,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.testi"
},
{
"path": "interop/src/messages_pb.erl",
"chars": 163297,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.1\n-"
},
{
"path": "interop/src/test_pb.erl",
"chars": 188054,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.1\n-"
},
{
"path": "interop/test/grpcbox_interop_client_SUITE.erl",
"chars": 5922,
"preview": "-module(grpcbox_interop_client_SUITE).\n\n-compile([export_all]).\n\n-include_lib(\"eunit/include/eunit.hrl\").\n-include_lib(\""
},
{
"path": "proto/health.proto",
"chars": 2416,
"preview": "// Copyright 2015 The gRPC Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not "
},
{
"path": "proto/reflection.proto",
"chars": 5443,
"preview": "// Copyright 2016 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "rebar.config",
"chars": 2844,
"preview": "{erl_opts, [debug_info]}.\n\n{deps, [{chatterbox, {pkg, ts_chatterbox}},\n ctx,\n acceptor_pool,\n gproc"
},
{
"path": "src/grpcbox.app.src",
"chars": 1322,
"preview": "{application, grpcbox,\n [{description,\"Erlang grpc library based on chatterbox\"},\n {vsn,\"git\"},\n {registered,[]},\n {m"
},
{
"path": "src/grpcbox.erl",
"chars": 1811,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpc client\n%% @end\n%%%------------------"
},
{
"path": "src/grpcbox_acceptor.erl",
"chars": 1073,
"preview": "-module(grpcbox_acceptor).\n\n-behaviour(acceptor).\n\n-export([acceptor_init/3,\n acceptor_continue/3,\n acce"
},
{
"path": "src/grpcbox_app.erl",
"chars": 919,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpcbox public API\n%% @end\n%%%-----------"
},
{
"path": "src/grpcbox_chain_interceptor.erl",
"chars": 4183,
"preview": "-module(grpcbox_chain_interceptor).\n\n-export([stream_chain/1,\n unary_client/1,\n new_stream_client/1,\n "
},
{
"path": "src/grpcbox_channel.erl",
"chars": 7151,
"preview": "-module(grpcbox_channel).\n\n-behaviour(gen_statem).\n\n-export([start_link/3,\n is_ready/1,\n pick/2,\n "
},
{
"path": "src/grpcbox_channel_sup.erl",
"chars": 1620,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpcbox client connection supervisor.\n%% "
},
{
"path": "src/grpcbox_client.erl",
"chars": 9181,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpc client\n%% @end\n%%%------------------"
},
{
"path": "src/grpcbox_client_stream.erl",
"chars": 10557,
"preview": "-module(grpcbox_client_stream).\n\n-export([new_stream/5,\n send_request/6,\n send_msg/2,\n recv_msg/"
},
{
"path": "src/grpcbox_frame.erl",
"chars": 1552,
"preview": "-module(grpcbox_frame).\n\n-export([encode/2,\n split/2]).\n\n-include(\"grpcbox.hrl\").\n\nencode(gzip, Bin) ->\n Comp"
},
{
"path": "src/grpcbox_health_bhvr.erl",
"chars": 637,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "src/grpcbox_health_client.erl",
"chars": 3079,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.healt"
},
{
"path": "src/grpcbox_health_pb.erl",
"chars": 49597,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.3\n-"
},
{
"path": "src/grpcbox_health_service.erl",
"chars": 311,
"preview": "-module(grpcbox_health_service).\n\n-export([check/2,\n watch/2]).\n\ncheck(Ctx, #{service := <<>>}) ->\n {ok, #{st"
},
{
"path": "src/grpcbox_metadata.erl",
"chars": 2156,
"preview": "-module(grpcbox_metadata).\n\n-export([new/1,\n new_incoming_ctx/1,\n append_to_outgoing_ctx/2,\n pai"
},
{
"path": "src/grpcbox_name_resolver.erl",
"chars": 348,
"preview": "-module(grpcbox_name_resolver).\n\n-export([resolve/1]).\n\n%% dns:///localhost\n%% ipv4:///127.0.0.1\n\nresolve(Name) ->\n c"
},
{
"path": "src/grpcbox_oc_stats.erl",
"chars": 8210,
"preview": "-module(grpcbox_oc_stats).\n\n-export([register_measures/0,\n register_measures/1,\n subscribe_views/0,\n "
},
{
"path": "src/grpcbox_oc_stats_handler.erl",
"chars": 3804,
"preview": "-module(grpcbox_oc_stats_handler).\n\n-export([init/0,\n init/1,\n handle/5]).\n\n-record(stats, {recv_bytes "
},
{
"path": "src/grpcbox_pool.erl",
"chars": 1565,
"preview": "-module(grpcbox_pool).\n\n-behaviour(acceptor_pool).\n\n-export([start_link/4,\n accept_socket/3]).\n\n-export([init/1]"
},
{
"path": "src/grpcbox_reflection_bhvr.erl",
"chars": 463,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service g"
},
{
"path": "src/grpcbox_reflection_client.erl",
"chars": 2054,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service grpc.refle"
},
{
"path": "src/grpcbox_reflection_pb.erl",
"chars": 208987,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.3\n-"
},
{
"path": "src/grpcbox_reflection_service.erl",
"chars": 4312,
"preview": "-module(grpcbox_reflection_service).\n\n-export([server_reflection_info/2]).\n\n-include(\"grpcbox.hrl\").\n\n-define(UNIMPLEMEN"
},
{
"path": "src/grpcbox_services_simple_sup.erl",
"chars": 1489,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpcbox services simple one for one super"
},
{
"path": "src/grpcbox_services_sup.erl",
"chars": 7959,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpcbox supervisor for set of services on"
},
{
"path": "src/grpcbox_socket.erl",
"chars": 2511,
"preview": "-module(grpcbox_socket).\n\n-behaviour(gen_server).\n\n-export([start_link/3]).\n\n-export([init/1,\n handle_call/3,\n "
},
{
"path": "src/grpcbox_stream.erl",
"chars": 22429,
"preview": "-module(grpcbox_stream).\n\n-include_lib(\"chatterbox/include/http2.hrl\").\n-include_lib(\"kernel/include/logger.hrl\").\n-incl"
},
{
"path": "src/grpcbox_subchannel.erl",
"chars": 5766,
"preview": "-module(grpcbox_subchannel).\n\n-behaviour(gen_statem).\n\n-export([start_link/5,\n conn/1,\n conn/2,\n "
},
{
"path": "src/grpcbox_sup.erl",
"chars": 1055,
"preview": "%%%-------------------------------------------------------------------\n%% @doc grpcbox top level supervisor.\n%% @end\n%%%"
},
{
"path": "src/grpcbox_trace.erl",
"chars": 2206,
"preview": "%% interceptors for opencensus tracing and stats\n-module(grpcbox_trace).\n\n-export([%% server side\n unary/4,\n "
},
{
"path": "src/grpcbox_utils.erl",
"chars": 3728,
"preview": "-module(grpcbox_utils).\n\n-export([headers_to_metadata/1,\n maybe_decode_header/2,\n decode_header/1,\n "
},
{
"path": "test/grpcbox_SUITE.erl",
"chars": 37908,
"preview": "-module(grpcbox_SUITE).\n\n-compile(export_all).\n\n-include_lib(\"common_test/include/ct.hrl\").\n-include_lib(\"eunit/include/"
},
{
"path": "test/grpcbox_SUITE_data/certificates/ca.pem",
"chars": 1363,
"preview": "-----BEGIN CERTIFICATE-----\nMIIDwDCCAqigAwIBAgIUXMlP8/6iUkU3Rem9PhcISuywVVQwDQYJKoZIhvcNAQEL\nBQAwOzESMBAGA1UEAwwJbG9jYWx"
},
{
"path": "test/grpcbox_SUITE_data/certificates/server1.key",
"chars": 1704,
"preview": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDLxtcJStNPpCB9\nIv+QwXMTLaErCnjPzC+2K2wgU7E"
},
{
"path": "test/grpcbox_SUITE_data/certificates/server1.pem",
"chars": 1493,
"preview": "-----BEGIN CERTIFICATE-----\nMIIEIDCCAwigAwIBAgIUE+a3wRyVr9Ou3L5yhlagUfs+eRwwDQYJKoZIhvcNAQEL\nBQAwOzESMBAGA1UEAwwJbG9jYWx"
},
{
"path": "test/grpcbox_SUITE_data/route_guide.proto",
"chars": 3757,
"preview": "// Copyright 2015 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use"
},
{
"path": "test/grpcbox_SUITE_data/route_guide_db.json",
"chars": 13768,
"preview": "[{\n \"location\": {\n \"latitude\": 407838351,\n \"longitude\": -746143763\n },\n \"name\": \"Patriots Path, M"
},
{
"path": "test/route_guide_pb.erl",
"chars": 75066,
"preview": "%% -*- coding: utf-8 -*-\n%% @private\n%% Automatically generated, do not edit\n%% Generated by gpb_compile version 4.7.3\n-"
},
{
"path": "test/routeguide_route_guide.erl",
"chars": 4321,
"preview": "-module(routeguide_route_guide).\n\n-include(\"grpcbox.hrl\").\n\n-export([get_feature/2,\n list_features/2,\n r"
},
{
"path": "test/routeguide_route_guide_bhvr.erl",
"chars": 1223,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Behaviour to implement for grpc service r"
},
{
"path": "test/routeguide_route_guide_client.erl",
"chars": 6264,
"preview": "%%%-------------------------------------------------------------------\n%% @doc Client module for grpc service routeguide"
},
{
"path": "test/test_stats_handler.erl",
"chars": 692,
"preview": "-module(test_stats_handler).\n\n-export([handle/5]).\n\nhandle(Ctx, _, rpc_begin, _, Stats) ->\n stats_pid ! {rpc_begin, e"
}
]
About this extraction
This page contains the full source code of the tsloughter/grpcbox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 78 files (1.1 MB), approximately 349.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.