aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakastornov <akastornov@yandex-team.ru>2022-02-10 16:46:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:03 +0300
commit8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c
parent3a2de774d91ca8d7325aaf81c200b1d2047725e6 (diff)
downloadydb-8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3.tar.gz
Restoring authorship annotation for <akastornov@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--build/plugins/java.py192
-rw-r--r--build/plugins/pybuild.py4
-rw-r--r--build/plugins/scarab_cant_clash.py114
-rw-r--r--build/plugins/ytest.py112
-rw-r--r--build/scripts/collect_java_srcs.py82
-rw-r--r--build/scripts/compile_java.py132
-rw-r--r--build/scripts/copy_to_dir.py100
-rw-r--r--build/scripts/create_jcoverage_report.py84
-rwxr-xr-xbuild/scripts/fetch_from.py6
-rwxr-xr-xbuild/scripts/fetch_from_sandbox.py72
-rw-r--r--build/scripts/fetch_resource.py66
-rw-r--r--build/scripts/generate_pom.py2
-rw-r--r--build/scripts/link_dyn_lib.py60
-rw-r--r--build/scripts/merge_coverage_data.py24
-rw-r--r--build/scripts/pack_jcoverage_resources.py14
-rw-r--r--build/scripts/resolve_java_srcs.py22
-rw-r--r--build/scripts/run_javac.py142
-rw-r--r--build/scripts/run_sonar.py146
-rw-r--r--build/scripts/stderr2stdout.py12
-rw-r--r--build/scripts/tared_protoc.py62
-rw-r--r--build/scripts/unpacking_jtest_runner.py56
-rw-r--r--build/scripts/writer.py14
-rw-r--r--build/sysincl/darwin.yml6
-rw-r--r--build/sysincl/intrinsic.yml4
-rw-r--r--build/sysincl/misc.yml20
-rw-r--r--build/sysincl/stl-to-libcxx.yml2
-rw-r--r--build/sysincl/stl-to-nothing.yml2
-rw-r--r--build/sysincl/unsorted.yml44
-rw-r--r--build/sysincl/windows.yml6
-rw-r--r--build/ya.conf.json26
-rw-r--r--build/ymake.core.conf100
-rwxr-xr-xbuild/ymake_conf.py36
-rw-r--r--contrib/libs/grpc/LICENSE6
-rw-r--r--contrib/libs/grpc/include/grpc++/alarm.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/channel.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/client_context.h28
-rw-r--r--contrib/libs/grpc/include/grpc++/completion_queue.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/create_channel.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/create_channel_posix.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/ext/proto_server_reflection_plugin.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/generic/async_generic_service.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/generic/generic_stub.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/grpc++.h28
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/client_unary_call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/async_stream.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/async_unary_call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/call_hook.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/channel_interface.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/client_context.h28
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/client_unary_call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue_tag.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/config.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/config_protobuf.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen_interface.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/create_auth_context.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/grpc_library.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/method_handler_impl.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/proto_utils.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/rpc_method.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/rpc_service_method.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/security/auth_context.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/serialization_traits.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/server_context.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/server_interface.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/service_type.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/status.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/status_code_enum.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/string_ref.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/stub_options.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/sync_stream.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/codegen/time.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/grpc_library.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/method_handler_impl.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/rpc_method.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/rpc_service_method.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/serialization_traits.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/server_builder_option.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/server_builder_plugin.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/server_initializer.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/impl/service_type.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/resource_quota.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/security/auth_context.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/security/auth_metadata_processor.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/security/credentials.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/security/server_credentials.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/server.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/server_builder.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/server_context.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/server_posix.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/async_stream.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/async_unary_call.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/byte_buffer.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/channel_arguments.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/config.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/slice.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/status.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/status_code_enum.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/string_ref.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/stub_options.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/sync_stream.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/support/time.h26
-rw-r--r--contrib/libs/grpc/include/grpc++/test/server_context_test_spouse.h26
-rw-r--r--contrib/libs/grpc/include/grpc/byte_buffer.h28
-rw-r--r--contrib/libs/grpc/include/grpc/byte_buffer_reader.h28
-rw-r--r--contrib/libs/grpc/include/grpc/census.h54
-rw-r--r--contrib/libs/grpc/include/grpc/compression.h90
-rw-r--r--contrib/libs/grpc/include/grpc/grpc.h566
-rw-r--r--contrib/libs/grpc/include/grpc/grpc_cronet.h46
-rw-r--r--contrib/libs/grpc/include/grpc/grpc_posix.h86
-rw-r--r--contrib/libs/grpc/include/grpc/grpc_security.h408
-rw-r--r--contrib/libs/grpc/include/grpc/grpc_security_constants.h128
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/atm.h138
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_atomic.h74
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_sync.h130
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/atm_windows.h162
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/byte_buffer_reader.h54
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/compression_types.h168
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/connectivity_state.h68
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/gpr_slice.h108
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/gpr_types.h84
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/grpc_types.h694
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/port_platform.h704
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/propagation_bits.h80
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/slice.h166
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/status.h238
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/sync.h78
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/sync_generic.h52
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/sync_posix.h44
-rw-r--r--contrib/libs/grpc/include/grpc/impl/codegen/sync_windows.h48
-rw-r--r--contrib/libs/grpc/include/grpc/module.modulemap14
-rw-r--r--contrib/libs/grpc/include/grpc/slice.h150
-rw-r--r--contrib/libs/grpc/include/grpc/slice_buffer.h68
-rw-r--r--contrib/libs/grpc/include/grpc/status.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/alloc.h54
-rw-r--r--contrib/libs/grpc/include/grpc/support/atm.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/atm_gcc_atomic.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/atm_gcc_sync.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/atm_windows.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/cpu.h62
-rw-r--r--contrib/libs/grpc/include/grpc/support/log.h26
-rw-r--r--contrib/libs/grpc/include/grpc/support/log_windows.h52
-rw-r--r--contrib/libs/grpc/include/grpc/support/port_platform.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/string_util.h68
-rw-r--r--contrib/libs/grpc/include/grpc/support/sync.h420
-rw-r--r--contrib/libs/grpc/include/grpc/support/sync_generic.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/sync_posix.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/sync_windows.h28
-rw-r--r--contrib/libs/grpc/include/grpc/support/time.h136
-rw-r--r--contrib/libs/grpc/src/compiler/README.md6
-rw-r--r--contrib/libs/grpc/src/compiler/config.h82
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator.cc1822
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator.h112
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator_helpers.h88
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_plugin.cc28
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator.cc1122
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator.h40
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator_helpers.h58
-rw-r--r--contrib/libs/grpc/src/compiler/generator_helpers.h454
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator.cc420
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator.h38
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator_helpers.h58
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator.cc352
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator.h48
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h54
-rw-r--r--contrib/libs/grpc/src/compiler/php_generator.cc220
-rw-r--r--contrib/libs/grpc/src/compiler/php_generator_helpers.h54
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator.cc934
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator.h76
-rw-r--r--contrib/libs/grpc/src/compiler/python_plugin.cc36
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator.cc332
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator.h38
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h84
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h84
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h168
-rw-r--r--contrib/libs/grpc/src/core/README.md4
-rw-r--r--contrib/libs/grpc/src/core/ext/README.md10
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/alpn/alpn.h42
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.h28
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/client/insecure/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/client/secure/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/server/chttp2_server.h36
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/server/insecure/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/server/secure/README.md2
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/README.md8
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.h68
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.h50
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h40
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame.h70
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_data.h84
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.h72
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_ping.h40
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_rst_stream.h42
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_settings.h70
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_window_update.h44
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.h94
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h132
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h120
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_tables.txt132
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/huffsyms.h40
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.h38
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/internal.h628
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/stream_map.h82
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/varint.h100
-rw-r--r--contrib/libs/grpc/src/core/lib/README.md12
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/README.md8
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/channel_args.h84
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/channel_stack.h328
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/channel_stack_builder.h190
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/connected_channel.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/context.h64
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/handshaker.h116
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/handshaker_factory.h44
-rw-r--r--contrib/libs/grpc/src/core/lib/channel/handshaker_registry.h46
-rw-r--r--contrib/libs/grpc/src/core/lib/compression/algorithm_metadata.h46
-rw-r--r--contrib/libs/grpc/src/core/lib/compression/message_compress.h48
-rw-r--r--contrib/libs/grpc/src/core/lib/debug/trace.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/http/format_request.h36
-rw-r--r--contrib/libs/grpc/src/core/lib/http/httpcli.h158
-rw-r--r--contrib/libs/grpc/src/core/lib/http/parser.h148
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/README.md12
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/closure.h122
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/combiner.h52
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/endpoint.h112
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/endpoint_pair.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/error.h234
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/ev_poll_posix.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/ev_posix.h160
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/exec_ctx.h74
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/executor.h34
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/iocp_windows.h54
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/iomgr.h38
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/iomgr_internal.h56
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/iomgr_posix.h28
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/load_file.h42
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/polling_entity.h64
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/pollset.h112
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/pollset_set.h44
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/pollset_set_windows.h28
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/pollset_uv.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/pollset_windows.h98
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/port.h152
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/resolve_address.h50
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/resource_quota.h176
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/sockaddr.h38
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/sockaddr_posix.h38
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/sockaddr_utils.h74
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h36
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/socket_mutator.h66
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/socket_utils.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/socket_utils_posix.h200
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/socket_windows.h170
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/tcp_client.h50
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.h34
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/tcp_posix.h76
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/tcp_server.h136
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/tcp_windows.h60
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/time_averaged_stats.h120
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/timer.h128
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/timer_generic.h38
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/timer_heap.h40
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/udp_server.h76
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/unix_sockets_posix.h50
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_pipe.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_posix.h166
-rw-r--r--contrib/libs/grpc/src/core/lib/json/json.h40
-rw-r--r--contrib/libs/grpc/src/core/lib/profiling/stap_probes.d14
-rw-r--r--contrib/libs/grpc/src/core/lib/profiling/timers.h114
-rw-r--r--contrib/libs/grpc/src/core/lib/security/context/security_context.h102
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/composite/composite_credentials.h44
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/credentials.h210
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/fake/fake_credentials.h48
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/google_default/google_default_credentials.h68
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/iam/iam_credentials.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/jwt/json_token.h88
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_credentials.h52
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.h164
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h96
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/plugin/plugin_credentials.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/security/credentials/ssl/ssl_credentials.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/security/transport/auth_filters.h34
-rw-r--r--contrib/libs/grpc/src/core/lib/security/transport/secure_endpoint.h38
-rw-r--r--contrib/libs/grpc/src/core/lib/security/transport/security_handshaker.h36
-rw-r--r--contrib/libs/grpc/src/core/lib/security/transport/tsi_error.h30
-rw-r--r--contrib/libs/grpc/src/core/lib/security/util/json_util.h52
-rw-r--r--contrib/libs/grpc/src/core/lib/slice/percent_encoding.h94
-rw-r--r--contrib/libs/grpc/src/core/lib/slice/slice_internal.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/slice/slice_string_helpers.h48
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/README.md8
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/api_trace.h76
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/call.h118
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/call_test_only.h54
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/channel.h74
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/channel_init.h114
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/channel_stack_type.h66
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/completion_queue.h92
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/event_string.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/init.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/lame_client.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/surface/server.h32
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/README.md14
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/byte_stream.h50
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/connectivity_state.h46
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/metadata.h136
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/metadata_batch.h138
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/pid_controller.h46
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/static_metadata.h244
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/timeout_encoding.h34
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/transport.h284
-rw-r--r--contrib/libs/grpc/src/core/lib/transport/transport_impl.h86
-rwxr-xr-xcontrib/libs/grpc/src/cpp/README.md34
-rw-r--r--contrib/libs/grpc/src/cpp/client/channel_cc.cc192
-rw-r--r--contrib/libs/grpc/src/cpp/client/client_context.cc190
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.h44
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_posix.cc52
-rw-r--r--contrib/libs/grpc/src/cpp/client/credentials_cc.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/client/insecure_credentials.cc60
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.cc296
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.h108
-rw-r--r--contrib/libs/grpc/src/cpp/codegen/codegen_init.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc118
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_arguments.cc292
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.cc122
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.h456
-rw-r--r--contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc82
-rw-r--r--contrib/libs/grpc/src/cpp/common/core_codegen.cc254
-rw-r--r--contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc44
-rw-r--r--contrib/libs/grpc/src/cpp/common/rpc_method.cc20
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.cc134
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.h78
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc46
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc44
-rw-r--r--contrib/libs/grpc/src/cpp/common/version_cc.cc26
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc352
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h128
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc118
-rw-r--r--contrib/libs/grpc/src/cpp/server/async_generic_service.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc48
-rw-r--r--contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc178
-rw-r--r--contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h102
-rw-r--r--contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc58
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc178
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.h108
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_builder.cc450
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_cc.cc690
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_context.cc222
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_credentials.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_posix.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/server/thread_pool_interface.h58
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc164
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h210
-rw-r--r--contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc64
-rw-r--r--contrib/libs/grpc/src/cpp/util/status.cc30
-rw-r--r--contrib/libs/grpc/src/cpp/util/string_ref.cc28
-rw-r--r--contrib/libs/grpc/src/cpp/util/time_cc.cc116
-rw-r--r--contrib/libs/grpc/src/proto/grpc/binary_log/v1alpha/log.proto166
-rw-r--r--contrib/libs/grpc/src/proto/grpc/health/v1/health.proto50
-rw-r--r--contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.options10
-rw-r--r--contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.proto162
-rw-r--r--contrib/libs/grpc/src/proto/grpc/reflection/v1alpha/reflection.proto252
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/compiler_test.proto100
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/control.proto454
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/duplicate/echo_duplicate.proto34
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/echo.proto44
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/echo_messages.proto88
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/empty.proto36
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/messages.proto310
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/metrics.proto76
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/payloads.proto60
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2.proto24
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2_extensions.proto36
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/stats.proto118
-rw-r--r--contrib/libs/grpc/src/proto/grpc/testing/test.proto138
-rw-r--r--contrib/libs/grpc/src/proto/math/math.proto110
-rw-r--r--contrib/libs/grpc/src/python/grpcio/README.rst200
-rw-r--r--contrib/libs/grpc/src/python/grpcio/_spawn_patch.py100
-rw-r--r--contrib/libs/grpc/src/python/grpcio/commands.py450
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/__init__.py1304
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_auth.py68
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_channel.py920
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_common.py146
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/README.rst104
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pxd.pxi20
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi130
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi14
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi30
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi22
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi80
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi42
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi102
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi868
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi26
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi42
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi304
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi12
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi16
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi34
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi186
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pxd26
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx54
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_plugin_wrapping.py62
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_server.py1034
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/_utilities.py274
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/_client_adaptations.py1054
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/_server_adaptations.py612
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/implementations.py554
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/interfaces.py310
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/beta/utilities.py274
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/common/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/common/cardinality.py32
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/common/style.py28
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/abandonment.py24
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/callable_util.py164
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/future.py422
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/logging_pool.py112
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream.py70
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream_util.py264
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/base.py612
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/utilities.py100
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/face.py2060
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/utilities.py316
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc_core_dependencies.py16
-rw-r--r--contrib/libs/grpc/src/python/grpcio/grpc_version.py12
-rw-r--r--contrib/libs/grpc/src/python/grpcio/support.py178
-rw-r--r--contrib/libs/grpc/src/python/grpcio/ya.make58
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/README.rst18
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/health.py44
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/grpc_version.py12
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/health_commands.py94
-rw-r--r--contrib/libs/grpc/src/python/grpcio_health_checking/setup.py40
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py6
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py58
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/grpc_version.py12
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/reflection_commands.py98
-rw-r--r--contrib/libs/grpc/src/python/grpcio_reflection/setup.py42
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/any.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/api.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/api.pb.h4
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/descriptor.proto2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/duration.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/empty.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/struct.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/struct.proto2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/type.pb.cc2
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/type.pb.h4
-rw-r--r--contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc2
-rw-r--r--contrib/libs/protobuf/ya.make4
-rw-r--r--contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h2
-rw-r--r--contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc10
-rw-r--r--contrib/libs/ya.make22
-rw-r--r--contrib/python/PyYAML/py2/yaml/scanner.py12
-rw-r--r--contrib/python/protobuf/py2/google/protobuf/pyext/message.cc2
-rw-r--r--contrib/python/protobuf/py3/google/protobuf/pyext/message.cc2
-rw-r--r--contrib/python/ya.make16
-rw-r--r--contrib/restricted/ya.make2
-rw-r--r--contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp252
-rw-r--r--contrib/tools/protoc/plugins/grpc_python/ya.make4
-rw-r--r--contrib/tools/ya.make2
-rw-r--r--library/cpp/messagebus/monitoring/ya.make2
-rw-r--r--library/python/pytest/yatest_tools.py40
-rw-r--r--library/python/testing/yatest_common/yatest/common/process.py6
-rw-r--r--library/python/testing/yatest_common/yatest/common/runtime.py14
-rw-r--r--library/python/testing/yatest_common/yatest/common/runtime_java.py44
-rw-r--r--tools/ya.make2
-rw-r--r--util/folder/dirent_win.c2
-rw-r--r--util/folder/lstat_win.c2
-rw-r--r--ydb/library/aclib/protos/ya.make2
-rw-r--r--ydb/library/yql/parser/proto_ast/gen/ya.make2
-rw-r--r--ydb/library/yql/parser/proto_ast/ya.make8
-rw-r--r--ydb/library/yql/providers/common/proto/ya.make2
493 files changed, 25022 insertions, 25022 deletions
diff --git a/build/plugins/java.py b/build/plugins/java.py
index 309d98bc9d..16fc126734 100644
--- a/build/plugins/java.py
+++ b/build/plugins/java.py
@@ -1,43 +1,43 @@
-import _common as common
+import _common as common
import ymake
-import json
+import json
import os
-import base64
-
-
-DELIM = '================================'
-
-
-def split_args(s): # TODO quotes, escapes
- return filter(None, s.split())
-
-
-def extract_macro_calls(unit, macro_value_name, macro_calls_delim):
- if not unit.get(macro_value_name):
- return []
-
- return filter(None, map(split_args, unit.get(macro_value_name).replace('$' + macro_value_name, '').split(macro_calls_delim)))
-
-
-def extract_macro_calls2(unit, macro_value_name):
- if not unit.get(macro_value_name):
- return []
-
- calls = []
- for call_encoded_args in unit.get(macro_value_name).strip().split():
- call_args = json.loads(base64.b64decode(call_encoded_args), encoding='utf-8')
- calls.append(call_args)
-
- return calls
-
-
+import base64
+
+
+DELIM = '================================'
+
+
+def split_args(s): # TODO quotes, escapes
+ return filter(None, s.split())
+
+
+def extract_macro_calls(unit, macro_value_name, macro_calls_delim):
+ if not unit.get(macro_value_name):
+ return []
+
+ return filter(None, map(split_args, unit.get(macro_value_name).replace('$' + macro_value_name, '').split(macro_calls_delim)))
+
+
+def extract_macro_calls2(unit, macro_value_name):
+ if not unit.get(macro_value_name):
+ return []
+
+ calls = []
+ for call_encoded_args in unit.get(macro_value_name).strip().split():
+ call_args = json.loads(base64.b64decode(call_encoded_args), encoding='utf-8')
+ calls.append(call_args)
+
+ return calls
+
+
def on_run_jbuild_program(unit, *args):
args = list(args)
"""
Custom code generation
@link: https://wiki.yandex-team.ru/yatool/java/#kodogeneracijarunjavaprogram
"""
-
+
flat, kv = common.sort_by_keywords({'IN': -1, 'IN_DIR': -1, 'OUT': -1, 'OUT_DIR': -1, 'CWD': 1, 'CLASSPATH': -1, 'CP_USE_COMMAND_FILE': 1, 'ADD_SRCS_TO_CLASSPATH': 0}, args)
depends = kv.get('CLASSPATH', []) + kv.get('JAR', [])
fake_out = None
@@ -45,18 +45,18 @@ def on_run_jbuild_program(unit, *args):
# XXX: hack to force ymake to build dependencies
fake_out = "fake.out.{}".format(hash(tuple(args)))
unit.on_run_java(['TOOL'] + depends + ["OUT", fake_out])
-
+
if not kv.get('CP_USE_COMMAND_FILE'):
args += ['CP_USE_COMMAND_FILE', unit.get(['JAVA_PROGRAM_CP_USE_COMMAND_FILE']) or 'yes']
if fake_out is not None:
args += ['FAKE_OUT', fake_out]
- prev = unit.get(['RUN_JAVA_PROGRAM_VALUE']) or ''
- new_val = (prev + ' ' + base64.b64encode(json.dumps(list(args), encoding='utf-8'))).strip()
- unit.set(['RUN_JAVA_PROGRAM_VALUE', new_val])
-
-
+ prev = unit.get(['RUN_JAVA_PROGRAM_VALUE']) or ''
+ new_val = (prev + ' ' + base64.b64encode(json.dumps(list(args), encoding='utf-8'))).strip()
+ unit.set(['RUN_JAVA_PROGRAM_VALUE', new_val])
+
+
def ongenerate_script(unit, *args):
"""
heretic@ promised to make tutorial here
@@ -74,48 +74,48 @@ def ongenerate_script(unit, *args):
unit.set(['GENERATE_SCRIPT_VALUE', new_val])
-def onjava_module(unit, *args):
- args_delim = unit.get('ARGS_DELIM')
+def onjava_module(unit, *args):
+ args_delim = unit.get('ARGS_DELIM')
idea_only = True if 'IDEA_ONLY' in args else False
-
+
if idea_only:
if unit.get('YA_IDE_IDEA') != 'yes':
return
if unit.get('YMAKE_JAVA_MODULES') != 'yes':
return
- data = {
+ data = {
'BUNDLE_NAME': unit.name(),
- 'PATH': unit.path(),
+ 'PATH': unit.path(),
'IDEA_ONLY': 'yes' if idea_only else 'no',
- 'MODULE_TYPE': unit.get('MODULE_TYPE'),
- 'MODULE_ARGS': unit.get('MODULE_ARGS'),
+ 'MODULE_TYPE': unit.get('MODULE_TYPE'),
+ 'MODULE_ARGS': unit.get('MODULE_ARGS'),
'MANAGED_PEERS': '${MANAGED_PEERS}',
'MANAGED_PEERS_CLOSURE': '${MANAGED_PEERS_CLOSURE}',
'NON_NAMAGEABLE_PEERS': '${NON_NAMAGEABLE_PEERS}',
'TEST_CLASSPATH_MANAGED': '${TEST_CLASSPATH_MANAGED}',
- 'EXCLUDE': extract_macro_calls(unit, 'EXCLUDE_VALUE', args_delim),
- 'JAVA_SRCS': extract_macro_calls(unit, 'JAVA_SRCS_VALUE', args_delim),
- 'JAVAC_FLAGS': extract_macro_calls(unit, 'JAVAC_FLAGS_VALUE', args_delim),
- 'ANNOTATION_PROCESSOR': extract_macro_calls(unit, 'ANNOTATION_PROCESSOR_VALUE', args_delim),
- 'EXTERNAL_JAR': extract_macro_calls(unit, 'EXTERNAL_JAR_VALUE', args_delim),
- 'RUN_JAVA_PROGRAM': extract_macro_calls2(unit, 'RUN_JAVA_PROGRAM_VALUE'),
+ 'EXCLUDE': extract_macro_calls(unit, 'EXCLUDE_VALUE', args_delim),
+ 'JAVA_SRCS': extract_macro_calls(unit, 'JAVA_SRCS_VALUE', args_delim),
+ 'JAVAC_FLAGS': extract_macro_calls(unit, 'JAVAC_FLAGS_VALUE', args_delim),
+ 'ANNOTATION_PROCESSOR': extract_macro_calls(unit, 'ANNOTATION_PROCESSOR_VALUE', args_delim),
+ 'EXTERNAL_JAR': extract_macro_calls(unit, 'EXTERNAL_JAR_VALUE', args_delim),
+ 'RUN_JAVA_PROGRAM': extract_macro_calls2(unit, 'RUN_JAVA_PROGRAM_VALUE'),
'RUN_JAVA_PROGRAM_MANAGED': '${RUN_JAVA_PROGRAM_MANAGED}',
'MAVEN_GROUP_ID': extract_macro_calls(unit, 'MAVEN_GROUP_ID_VALUE', args_delim),
'JAR_INCLUDE_FILTER': extract_macro_calls(unit, 'JAR_INCLUDE_FILTER_VALUE', args_delim),
'JAR_EXCLUDE_FILTER': extract_macro_calls(unit, 'JAR_EXCLUDE_FILTER_VALUE', args_delim),
-
- # TODO remove when java test dart is in prod
- 'UNITTEST_DIR': unit.get('UNITTEST_DIR'),
- 'SYSTEM_PROPERTIES': extract_macro_calls(unit, 'SYSTEM_PROPERTIES_VALUE', args_delim),
- 'JVM_ARGS': extract_macro_calls(unit, 'JVM_ARGS_VALUE', args_delim),
- 'TEST_CWD': extract_macro_calls(unit, 'TEST_CWD_VALUE', args_delim),
- 'TEST_DATA': extract_macro_calls(unit, '__test_data', args_delim),
- 'TEST_FORK_MODE': extract_macro_calls(unit, 'TEST_FORK_MODE', args_delim),
- 'SPLIT_FACTOR': extract_macro_calls(unit, 'TEST_SPLIT_FACTOR', args_delim),
- 'TIMEOUT': extract_macro_calls(unit, 'TEST_TIMEOUT', args_delim),
- 'TAG': extract_macro_calls(unit, 'TEST_TAGS_VALUE', args_delim),
- 'SIZE': extract_macro_calls(unit, 'TEST_SIZE_NAME', args_delim),
+
+ # TODO remove when java test dart is in prod
+ 'UNITTEST_DIR': unit.get('UNITTEST_DIR'),
+ 'SYSTEM_PROPERTIES': extract_macro_calls(unit, 'SYSTEM_PROPERTIES_VALUE', args_delim),
+ 'JVM_ARGS': extract_macro_calls(unit, 'JVM_ARGS_VALUE', args_delim),
+ 'TEST_CWD': extract_macro_calls(unit, 'TEST_CWD_VALUE', args_delim),
+ 'TEST_DATA': extract_macro_calls(unit, '__test_data', args_delim),
+ 'TEST_FORK_MODE': extract_macro_calls(unit, 'TEST_FORK_MODE', args_delim),
+ 'SPLIT_FACTOR': extract_macro_calls(unit, 'TEST_SPLIT_FACTOR', args_delim),
+ 'TIMEOUT': extract_macro_calls(unit, 'TEST_TIMEOUT', args_delim),
+ 'TAG': extract_macro_calls(unit, 'TEST_TAGS_VALUE', args_delim),
+ 'SIZE': extract_macro_calls(unit, 'TEST_SIZE_NAME', args_delim),
'DEPENDS': extract_macro_calls(unit, 'TEST_DEPENDS_VALUE', args_delim),
'IDEA_EXCLUDE': extract_macro_calls(unit, 'IDEA_EXCLUDE_DIRS_VALUE', args_delim),
'IDEA_RESOURCE': extract_macro_calls(unit, 'IDEA_RESOURCE_DIRS_VALUE', args_delim),
@@ -125,17 +125,17 @@ def onjava_module(unit, *args):
'TEST_DATA': extract_macro_calls(unit, 'TEST_DATA_VALUE', args_delim),
'JAVA_FORBIDDEN_LIBRARIES': extract_macro_calls(unit, 'JAVA_FORBIDDEN_LIBRARIES_VALUE', args_delim),
'JDK_RESOURCE': 'JDK' + (unit.get('JDK_VERSION') or '_DEFAULT')
- }
+ }
if unit.get('ENABLE_PREVIEW_VALUE') == 'yes' and unit.get('JDK_VERSION') in ('15', '16', '17'):
data['ENABLE_PREVIEW'] = extract_macro_calls(unit, 'ENABLE_PREVIEW_VALUE', args_delim)
if unit.get('SAVE_JAVAC_GENERATED_SRCS_DIR') and unit.get('SAVE_JAVAC_GENERATED_SRCS_TAR'):
data['SAVE_JAVAC_GENERATED_SRCS_DIR'] = extract_macro_calls(unit, 'SAVE_JAVAC_GENERATED_SRCS_DIR', args_delim)
data['SAVE_JAVAC_GENERATED_SRCS_TAR'] = extract_macro_calls(unit, 'SAVE_JAVAC_GENERATED_SRCS_TAR', args_delim)
-
+
if unit.get('JAVA_ADD_DLLS_VALUE') == 'yes':
data['ADD_DLLS_FROM_DEPENDS'] = extract_macro_calls(unit, 'JAVA_ADD_DLLS_VALUE', args_delim)
-
+
if unit.get('ERROR_PRONE_VALUE') == 'yes':
data['ERROR_PRONE'] = extract_macro_calls(unit, 'ERROR_PRONE_VALUE', args_delim)
@@ -189,36 +189,36 @@ def onjava_module(unit, *args):
if macro_str and macro_str == 'yes':
data['VCS_INFO_DISABLE_CACHE__NO_UID__'] = macro_val
- for java_srcs_args in data['JAVA_SRCS']:
- external = None
-
- for i in xrange(len(java_srcs_args)):
- arg = java_srcs_args[i]
-
- if arg == 'EXTERNAL':
- if not i + 1 < len(java_srcs_args):
- continue # TODO configure error
-
- ex = java_srcs_args[i + 1]
-
- if ex in ('EXTERNAL', 'SRCDIR', 'PACKAGE_PREFIX', 'EXCLUDE'):
- continue # TODO configure error
-
- if external is not None:
- continue # TODO configure error
-
- external = ex
-
- if external:
- unit.onpeerdir(external)
-
- for k, v in data.items():
- if not v:
- data.pop(k)
-
- dart = 'JAVA_DART: ' + base64.b64encode(json.dumps(data)) + '\n' + DELIM + '\n'
-
- unit.set_property(['JAVA_DART_DATA', dart])
+ for java_srcs_args in data['JAVA_SRCS']:
+ external = None
+
+ for i in xrange(len(java_srcs_args)):
+ arg = java_srcs_args[i]
+
+ if arg == 'EXTERNAL':
+ if not i + 1 < len(java_srcs_args):
+ continue # TODO configure error
+
+ ex = java_srcs_args[i + 1]
+
+ if ex in ('EXTERNAL', 'SRCDIR', 'PACKAGE_PREFIX', 'EXCLUDE'):
+ continue # TODO configure error
+
+ if external is not None:
+ continue # TODO configure error
+
+ external = ex
+
+ if external:
+ unit.onpeerdir(external)
+
+ for k, v in data.items():
+ if not v:
+ data.pop(k)
+
+ dart = 'JAVA_DART: ' + base64.b64encode(json.dumps(data)) + '\n' + DELIM + '\n'
+
+ unit.set_property(['JAVA_DART_DATA', dart])
if not idea_only and unit.get('MODULE_TYPE') in ('JAVA_PROGRAM', 'JAVA_LIBRARY', 'JTEST', 'TESTNG', 'JUNIT5') and not unit.path().startswith('$S/contrib/java'):
unit.on_add_classpath_clash_check()
if unit.get('LINT_LEVEL_VALUE') != "none":
diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py
index 87252f1ba0..f32a2d39a0 100644
--- a/build/plugins/pybuild.py
+++ b/build/plugins/pybuild.py
@@ -498,7 +498,7 @@ def onpy_srcs(unit, *args):
unit.onpeerdir(py_runtime_path)
unit.onpeerdir(unit.get("PY_PROTO_DEPS").split())
-
+
proto_paths = [path for path, mod in protos]
unit.on_generate_py_protos_internal(proto_paths)
unit.onpy_srcs([
@@ -506,7 +506,7 @@ def onpy_srcs(unit, *args):
for path, mod in protos
for py_suf in unit.get("PY_PROTO_SUFFIXES").split()
])
-
+
if optimize_proto and need_gazetteer_peerdir:
unit.onpeerdir(['kernel/gazetteer/proto'])
diff --git a/build/plugins/scarab_cant_clash.py b/build/plugins/scarab_cant_clash.py
index 5f3dcf6c35..77dc303183 100644
--- a/build/plugins/scarab_cant_clash.py
+++ b/build/plugins/scarab_cant_clash.py
@@ -1,65 +1,65 @@
-import _common as common
-
-
-def onacceleo(unit, *args):
+import _common as common
+
+
+def onacceleo(unit, *args):
if unit.get("YMAKE_JAVA_MODULES") == "yes":
return
- flat, kv = common.sort_by_keywords(
+ flat, kv = common.sort_by_keywords(
{'XSD': -1, 'MTL': -1, 'MTL_ROOT': 1, 'LANG': -1, 'OUT': -1, 'OUT_NOAUTO': -1, 'OUTPUT_INCLUDES': -1, 'DEBUG': 0},
- args
- )
-
- try:
- mtlroot = kv['MTL_ROOT'][0]
- except Exception:
- mtlroot = unit.path().replace('$S/', '')
-
- classpath = ['$SCARAB', ] # XXX special word for ya make to replace following paths with real classpath
- classpath.append('tools/acceleo')
-
+ args
+ )
+
+ try:
+ mtlroot = kv['MTL_ROOT'][0]
+ except Exception:
+ mtlroot = unit.path().replace('$S/', '')
+
+ classpath = ['$SCARAB', ] # XXX special word for ya make to replace following paths with real classpath
+ classpath.append('tools/acceleo')
+
depends = []
- if not unit.get('IDE_MSVS_CALL'):
- for jar in classpath[1:]:
+ if not unit.get('IDE_MSVS_CALL'):
+ for jar in classpath[1:]:
depends.append(jar)
-
- classpath = ':'.join(classpath)
-
- # Generate java cmd
- cmd = [
- '-classpath',
- classpath,
- '-Dfile.encoding=UTF-8',
- 'ru.yandex.se.logsng.tool.Cli',
- ]
-
- for xsd in kv.get('XSD', []):
- cmd += ['--xsd', xsd]
-
- for mtl in kv.get('MTL', []):
- cmd += ['--mtl', mtl]
-
- for lang in kv.get('LANG', []):
- cmd += ['--lang', lang]
-
- cmd += ['--output-dir', unit.path().replace('$S/', '${ARCADIA_BUILD_ROOT}/')]
- cmd += ['--build-root', '${ARCADIA_BUILD_ROOT}']
- cmd += ['--source-root', '${ARCADIA_ROOT}']
- cmd += ['--mtl-root', mtlroot]
-
- # Generate RUN_JAVA args
- run_java = cmd
-
- if 'DEBUG' not in kv:
- run_java += ['HIDE_OUTPUT']
-
- inputs = kv.get('XSD', []) + kv.get('MTL', []) + kv.get('LANG', [])
- if inputs:
- run_java += ['IN'] + inputs
-
- for k in 'OUT', 'OUT_NOAUTO', 'OUTPUT_INCLUDES':
- if kv.get(k):
- run_java += [k] + kv[k]
-
+
+ classpath = ':'.join(classpath)
+
+ # Generate java cmd
+ cmd = [
+ '-classpath',
+ classpath,
+ '-Dfile.encoding=UTF-8',
+ 'ru.yandex.se.logsng.tool.Cli',
+ ]
+
+ for xsd in kv.get('XSD', []):
+ cmd += ['--xsd', xsd]
+
+ for mtl in kv.get('MTL', []):
+ cmd += ['--mtl', mtl]
+
+ for lang in kv.get('LANG', []):
+ cmd += ['--lang', lang]
+
+ cmd += ['--output-dir', unit.path().replace('$S/', '${ARCADIA_BUILD_ROOT}/')]
+ cmd += ['--build-root', '${ARCADIA_BUILD_ROOT}']
+ cmd += ['--source-root', '${ARCADIA_ROOT}']
+ cmd += ['--mtl-root', mtlroot]
+
+ # Generate RUN_JAVA args
+ run_java = cmd
+
+ if 'DEBUG' not in kv:
+ run_java += ['HIDE_OUTPUT']
+
+ inputs = kv.get('XSD', []) + kv.get('MTL', []) + kv.get('LANG', [])
+ if inputs:
+ run_java += ['IN'] + inputs
+
+ for k in 'OUT', 'OUT_NOAUTO', 'OUTPUT_INCLUDES':
+ if kv.get(k):
+ run_java += [k] + kv[k]
+
if depends:
run_java += ['TOOL'] + depends
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py
index a490589b4c..8970837f0f 100644
--- a/build/plugins/ytest.py
+++ b/build/plugins/ytest.py
@@ -1,9 +1,9 @@
import os
import re
import sys
-import json
+import json
import copy
-import base64
+import base64
import shlex
import _common
import lib._metric_resolvers as mr
@@ -348,7 +348,7 @@ def count_entries(x):
def get_values_list(unit, key):
- res = map(str.strip, (unit.get(key) or '').replace('$' + key, '').strip().split())
+ res = map(str.strip, (unit.get(key) or '').replace('$' + key, '').strip().split())
return [r for r in res if r and r not in ['""', "''"]]
@@ -416,7 +416,7 @@ def get_project_tidy_config(unit):
def onadd_ytest(unit, *args):
keywords = {"DEPENDS": -1, "DATA": -1, "TIMEOUT": 1, "FORK_MODE": 1, "SPLIT_FACTOR": 1,
"FORK_SUBTESTS": 0, "FORK_TESTS": 0}
- flat_args, spec_args = _common.sort_by_keywords(keywords, args)
+ flat_args, spec_args = _common.sort_by_keywords(keywords, args)
test_data = sorted(_common.filter_out_by_keyword(spec_args.get('DATA', []) + get_norm_paths(unit, 'TEST_DATA_VALUE'), 'AUTOUPDATED'))
@@ -547,7 +547,7 @@ def onadd_check(unit, *args):
if unit.get("TIDY") == "yes":
# graph changed for clang_tidy tests
return
- flat_args, spec_args = _common.sort_by_keywords({"DEPENDS": -1, "TIMEOUT": 1, "DATA": -1, "TAG": -1, "REQUIREMENTS": -1, "FORK_MODE": 1,
+ flat_args, spec_args = _common.sort_by_keywords({"DEPENDS": -1, "TIMEOUT": 1, "DATA": -1, "TAG": -1, "REQUIREMENTS": -1, "FORK_MODE": 1,
"SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0, "SIZE": 1}, args)
check_type = flat_args[0]
test_dir = get_norm_unit_path(unit)
@@ -770,40 +770,40 @@ def add_test_to_dart(unit, test_type, binary_path=None, runner_bin=None):
_dump_test(unit, test_type, test_files, timeout, get_norm_unit_path(unit), custom_deps, test_data, python_paths, split_factor, fork_mode, test_size, tags, requirements, binary_path, test_cwd=test_cwd, runner_bin=runner_bin, yt_spec=yt_spec, data_files=data_files)
-def extract_java_system_properties(unit, args):
- if len(args) % 2:
+def extract_java_system_properties(unit, args):
+ if len(args) % 2:
return [], 'Wrong use of SYSTEM_PROPERTIES in {}: odd number of arguments'.format(unit.path())
-
+
props = []
- for x, y in zip(args[::2], args[1::2]):
- if x == 'FILE':
- if y.startswith('${BINDIR}') or y.startswith('${ARCADIA_BUILD_ROOT}') or y.startswith('/'):
+ for x, y in zip(args[::2], args[1::2]):
+ if x == 'FILE':
+ if y.startswith('${BINDIR}') or y.startswith('${ARCADIA_BUILD_ROOT}') or y.startswith('/'):
return [], 'Wrong use of SYSTEM_PROPERTIES in {}: absolute/build file path {}'.format(unit.path(), y)
-
- y = _common.rootrel_arc_src(y, unit)
- if not os.path.exists(unit.resolve('$S/' + y)):
+
+ y = _common.rootrel_arc_src(y, unit)
+ if not os.path.exists(unit.resolve('$S/' + y)):
return [], 'Wrong use of SYSTEM_PROPERTIES in {}: can\'t resolve {}'.format(unit.path(), y)
-
- y = '${ARCADIA_ROOT}/' + y
- props.append({'type': 'file', 'path': y})
- else:
- props.append({'type': 'inline', 'key': x, 'value': y})
-
+
+ y = '${ARCADIA_ROOT}/' + y
+ props.append({'type': 'file', 'path': y})
+ else:
+ props.append({'type': 'inline', 'key': x, 'value': y})
+
return props, None
-
-
-def onjava_test(unit, *args):
+
+
+def onjava_test(unit, *args):
if unit.get("TIDY") == "yes":
# graph changed for clang_tidy tests
return
- assert unit.get('MODULE_TYPE') is not None
-
- if unit.get('MODULE_TYPE') == 'JTEST_FOR':
- if not unit.get('UNITTEST_DIR'):
+ assert unit.get('MODULE_TYPE') is not None
+
+ if unit.get('MODULE_TYPE') == 'JTEST_FOR':
+ if not unit.get('UNITTEST_DIR'):
ymake.report_configure_error('skip JTEST_FOR in {}: no args provided'.format(unit.path()))
return
-
+
java_cp_arg_type = unit.get('JAVA_CLASSPATH_CMD_TYPE_VALUE') or 'MANIFEST'
if java_cp_arg_type not in ('MANIFEST', 'COMMAND_FILE', 'LIST'):
ymake.report_configure_error('{}: TEST_JAVA_CLASSPATH_CMD_TYPE({}) are invalid. Choose argument from MANIFEST, COMMAND_FILE or LIST)'.format(unit.path(), java_cp_arg_type))
@@ -811,11 +811,11 @@ def onjava_test(unit, *args):
unit_path = unit.path()
path = _common.strip_roots(unit_path)
-
+
test_data = get_norm_paths(unit, 'TEST_DATA_VALUE')
test_data.append('arcadia/build/scripts/run_junit.py')
test_data.append('arcadia/build/scripts/unpacking_jtest_runner.py')
-
+
data, data_files = get_canonical_test_resources(unit)
test_data += data
@@ -823,49 +823,49 @@ def onjava_test(unit, *args):
if error_mgs:
ymake.report_configure_error(error_mgs)
return
- for prop in props:
- if prop['type'] == 'file':
- test_data.append(prop['path'].replace('${ARCADIA_ROOT}', 'arcadia'))
-
- props = base64.b64encode(json.dumps(props, encoding='utf-8'))
-
- test_cwd = unit.get('TEST_CWD_VALUE') or '' # TODO: validate test_cwd value
-
+ for prop in props:
+ if prop['type'] == 'file':
+ test_data.append(prop['path'].replace('${ARCADIA_ROOT}', 'arcadia'))
+
+ props = base64.b64encode(json.dumps(props, encoding='utf-8'))
+
+ test_cwd = unit.get('TEST_CWD_VALUE') or '' # TODO: validate test_cwd value
+
if unit.get('MODULE_TYPE') == 'JUNIT5':
script_rel_path = 'junit5.test'
else:
script_rel_path = 'junit.test'
ymake_java_test = unit.get('YMAKE_JAVA_TEST') == 'yes'
- test_record = {
- 'SOURCE-FOLDER-PATH': path,
- 'TEST-NAME': '-'.join([os.path.basename(os.path.dirname(path)), os.path.basename(path)]),
+ test_record = {
+ 'SOURCE-FOLDER-PATH': path,
+ 'TEST-NAME': '-'.join([os.path.basename(os.path.dirname(path)), os.path.basename(path)]),
'SCRIPT-REL-PATH': script_rel_path,
'TEST-TIMEOUT': unit.get('TEST_TIMEOUT') or '',
'TESTED-PROJECT-NAME': path,
'TEST-ENV': prepare_env(unit.get("TEST_ENV_VALUE")),
# 'TEST-PRESERVE-ENV': 'da',
'TEST-DATA': serialize_list(sorted(_common.filter_out_by_keyword(test_data, 'AUTOUPDATED'))),
- 'FORK-MODE': unit.get('TEST_FORK_MODE') or '',
- 'SPLIT-FACTOR': unit.get('TEST_SPLIT_FACTOR') or '',
- 'CUSTOM-DEPENDENCIES': ' '.join(get_values_list(unit, 'TEST_DEPENDS_VALUE')),
+ 'FORK-MODE': unit.get('TEST_FORK_MODE') or '',
+ 'SPLIT-FACTOR': unit.get('TEST_SPLIT_FACTOR') or '',
+ 'CUSTOM-DEPENDENCIES': ' '.join(get_values_list(unit, 'TEST_DEPENDS_VALUE')),
'TAG': serialize_list(_get_test_tags(unit)),
- 'SIZE': unit.get('TEST_SIZE_NAME') or '',
+ 'SIZE': unit.get('TEST_SIZE_NAME') or '',
'REQUIREMENTS': serialize_list(get_values_list(unit, 'TEST_REQUIREMENTS_VALUE')),
'TEST-RECIPES': prepare_recipes(unit.get("TEST_RECIPES_VALUE")),
-
- # JTEST/JTEST_FOR only
- 'MODULE_TYPE': unit.get('MODULE_TYPE'),
- 'UNITTEST_DIR': unit.get('UNITTEST_DIR') or '',
- 'JVM_ARGS': serialize_list(get_values_list(unit, 'JVM_ARGS_VALUE')),
- 'SYSTEM_PROPERTIES': props,
- 'TEST-CWD': test_cwd,
+
+ # JTEST/JTEST_FOR only
+ 'MODULE_TYPE': unit.get('MODULE_TYPE'),
+ 'UNITTEST_DIR': unit.get('UNITTEST_DIR') or '',
+ 'JVM_ARGS': serialize_list(get_values_list(unit, 'JVM_ARGS_VALUE')),
+ 'SYSTEM_PROPERTIES': props,
+ 'TEST-CWD': test_cwd,
'SKIP_TEST': unit.get('SKIP_TEST_VALUE') or '',
'JAVA_CLASSPATH_CMD_TYPE': java_cp_arg_type,
'NO_JBUILD': 'yes' if ymake_java_test else 'no',
'JDK_RESOURCE': 'JDK' + (unit.get('JDK_VERSION') or '_DEFAULT'),
'JDK_FOR_TESTS': 'JDK' + (unit.get('JDK_VERSION') or '_DEFAULT') + '_FOR_TESTS',
- }
+ }
test_classpath_origins = unit.get('TEST_CLASSPATH_VALUE')
if test_classpath_origins:
test_record['TEST_CLASSPATH_ORIGINS'] = test_classpath_origins
@@ -877,12 +877,12 @@ def onjava_test(unit, *args):
test_record['TEST_JAR'] = '${UNITTEST_MOD}'
else:
test_record['TEST_JAR'] = '{}/{}.jar'.format(unit.get('MODDIR'), unit.get('REALPRJNAME'))
-
+
data = dump_test(unit, test_record)
if data:
unit.set_property(['DART_DATA', data])
-
-
+
+
def onjava_test_deps(unit, *args):
if unit.get("TIDY") == "yes":
# graph changed for clang_tidy tests
diff --git a/build/scripts/collect_java_srcs.py b/build/scripts/collect_java_srcs.py
index a8056932cc..170002520a 100644
--- a/build/scripts/collect_java_srcs.py
+++ b/build/scripts/collect_java_srcs.py
@@ -1,51 +1,51 @@
-import os
-import sys
-import contextlib
-import tarfile
-import zipfile
-
-
-if __name__ == '__main__':
- build_root = sys.argv[1]
+import os
+import sys
+import contextlib
+import tarfile
+import zipfile
+
+
+if __name__ == '__main__':
+ build_root = sys.argv[1]
root = os.path.normpath(sys.argv[2])
dest = os.path.normpath(sys.argv[3])
- srcs = sys.argv[4:]
-
- for src in srcs:
+ srcs = sys.argv[4:]
+
+ for src in srcs:
src = os.path.normpath(src)
if src.endswith('.java') or src.endswith('.kt'):
- src_rel_path = os.path.relpath(src, root)
-
- if os.path.join(root, src_rel_path) == src:
- # Inside root
- dst = os.path.join(dest, src_rel_path)
-
- else:
- # Outside root
+ src_rel_path = os.path.relpath(src, root)
+
+ if os.path.join(root, src_rel_path) == src:
+ # Inside root
+ dst = os.path.join(dest, src_rel_path)
+
+ else:
+ # Outside root
print>>sys.stderr, 'External src file "{}" is outside of srcdir {}, ignore'.format(
- os.path.relpath(src, build_root),
- os.path.relpath(root, build_root),
- )
- continue
-
- if os.path.exists(dst):
- print>>sys.stderr, 'Duplicate external src file {}, choice is undefined'.format(
- os.path.relpath(dst, root)
- )
-
- else:
+ os.path.relpath(src, build_root),
+ os.path.relpath(root, build_root),
+ )
+ continue
+
+ if os.path.exists(dst):
+ print>>sys.stderr, 'Duplicate external src file {}, choice is undefined'.format(
+ os.path.relpath(dst, root)
+ )
+
+ else:
destdir = os.path.dirname(dst)
if destdir and not os.path.exists(destdir):
os.makedirs(destdir)
os.rename(src, dst)
-
- elif src.endswith('.jsr'):
- with contextlib.closing(tarfile.open(src, 'r')) as tf:
- tf.extractall(dst)
-
- elif src.endswith('-sources.jar'):
+
+ elif src.endswith('.jsr'):
+ with contextlib.closing(tarfile.open(src, 'r')) as tf:
+ tf.extractall(dst)
+
+ elif src.endswith('-sources.jar'):
with zipfile.ZipFile(src) as zf:
- zf.extractall(dst)
-
- else:
- print>>sys.stderr, 'Unrecognized file type', os.path.relpath(src, build_root)
+ zf.extractall(dst)
+
+ else:
+ print>>sys.stderr, 'Unrecognized file type', os.path.relpath(src, build_root)
diff --git a/build/scripts/compile_java.py b/build/scripts/compile_java.py
index 8f2ad79e4a..e95869e853 100644
--- a/build/scripts/compile_java.py
+++ b/build/scripts/compile_java.py
@@ -1,29 +1,29 @@
-import optparse
-import contextlib
-import os
-import shutil
-import subprocess as sp
-import tarfile
-import zipfile
+import optparse
+import contextlib
+import os
+import shutil
+import subprocess as sp
+import tarfile
+import zipfile
import sys
-
-
+
+
def parse_args(args):
- parser = optparse.OptionParser()
- parser.add_option('--javac-bin')
- parser.add_option('--jar-bin')
+ parser = optparse.OptionParser()
+ parser.add_option('--javac-bin')
+ parser.add_option('--jar-bin')
parser.add_option('--vcs-mf')
- parser.add_option('--package-prefix')
- parser.add_option('--jar-output')
- parser.add_option('--srcs-jar-output')
+ parser.add_option('--package-prefix')
+ parser.add_option('--jar-output')
+ parser.add_option('--srcs-jar-output')
return parser.parse_args(args)
-
-
-def mkdir_p(directory):
- if not os.path.exists(directory):
- os.makedirs(directory)
-
-
+
+
+def mkdir_p(directory):
+ if not os.path.exists(directory):
+ os.makedirs(directory)
+
+
def split_cmd_by_delim(cmd, delim='DELIM'):
result = [[]]
for arg in cmd:
@@ -34,69 +34,69 @@ def split_cmd_by_delim(cmd, delim='DELIM'):
return result
-def main():
+def main():
cmd_parts = split_cmd_by_delim(sys.argv)
assert len(cmd_parts) == 3
args, javac_opts, peers = cmd_parts
opts, jsrcs = parse_args(args)
-
+
jsrcs += list(filter(lambda x: x.endswith('.jsrc'), peers))
peers = list(filter(lambda x: not x.endswith('.jsrc'), peers))
- sources_dir = 'src'
- mkdir_p(sources_dir)
- for s in jsrcs:
- if s.endswith('.jsrc'):
- with contextlib.closing(tarfile.open(s, 'r')) as tf:
- tf.extractall(sources_dir)
-
- srcs = []
- for r, _, files in os.walk(sources_dir):
- for f in files:
- srcs.append(os.path.join(r, f))
+ sources_dir = 'src'
+ mkdir_p(sources_dir)
+ for s in jsrcs:
+ if s.endswith('.jsrc'):
+ with contextlib.closing(tarfile.open(s, 'r')) as tf:
+ tf.extractall(sources_dir)
+
+ srcs = []
+ for r, _, files in os.walk(sources_dir):
+ for f in files:
+ srcs.append(os.path.join(r, f))
srcs += jsrcs
srcs = list(filter(lambda x: x.endswith('.java'), srcs))
-
- classes_dir = 'cls'
- mkdir_p(classes_dir)
+
+ classes_dir = 'cls'
+ mkdir_p(classes_dir)
classpath = os.pathsep.join(peers)
-
- if srcs:
+
+ if srcs:
temp_sources_file = 'temp.sources.list'
with open(temp_sources_file, 'w') as ts:
ts.write(' '.join(srcs))
sp.check_call([opts.javac_bin, '-nowarn', '-g', '-classpath', classpath, '-encoding', 'UTF-8', '-d', classes_dir] + javac_opts + ['@' + temp_sources_file])
-
- for s in jsrcs:
- if s.endswith('-sources.jar'):
- with zipfile.ZipFile(s) as zf:
- zf.extractall(sources_dir)
-
- elif s.endswith('.jar'):
- with zipfile.ZipFile(s) as zf:
- zf.extractall(classes_dir)
-
+
+ for s in jsrcs:
+ if s.endswith('-sources.jar'):
+ with zipfile.ZipFile(s) as zf:
+ zf.extractall(sources_dir)
+
+ elif s.endswith('.jar'):
+ with zipfile.ZipFile(s) as zf:
+ zf.extractall(classes_dir)
+
if opts.vcs_mf:
sp.check_call([opts.jar_bin, 'cfm', opts.jar_output, opts.vcs_mf, os.curdir], cwd=classes_dir)
else:
sp.check_call([opts.jar_bin, 'cfM', opts.jar_output, os.curdir], cwd=classes_dir)
-
- if opts.srcs_jar_output:
- for s in jsrcs:
- if s.endswith('.java'):
- if opts.package_prefix:
- d = os.path.join(sources_dir, *(opts.package_prefix.split('.') + [os.path.basename(s)]))
-
- else:
- d = os.path.join(sources_dir, os.path.basename(s))
-
- shutil.copyfile(s, d)
-
+
+ if opts.srcs_jar_output:
+ for s in jsrcs:
+ if s.endswith('.java'):
+ if opts.package_prefix:
+ d = os.path.join(sources_dir, *(opts.package_prefix.split('.') + [os.path.basename(s)]))
+
+ else:
+ d = os.path.join(sources_dir, os.path.basename(s))
+
+ shutil.copyfile(s, d)
+
if opts.vcs_mf:
sp.check_call([opts.jar_bin, 'cfm', opts.srcs_jar_output, opts.vcs_mf, os.curdir], cwd=sources_dir)
else:
sp.check_call([opts.jar_bin, 'cfM', opts.srcs_jar_output, os.curdir], cwd=sources_dir)
-
-
-if __name__ == '__main__':
- main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/build/scripts/copy_to_dir.py b/build/scripts/copy_to_dir.py
index 8044b0b0bf..9baeb5ffac 100644
--- a/build/scripts/copy_to_dir.py
+++ b/build/scripts/copy_to_dir.py
@@ -2,19 +2,19 @@ import errno
import sys
import os
import shutil
-import optparse
-import tarfile
+import optparse
+import tarfile
-def parse_args():
- parser = optparse.OptionParser()
- parser.add_option('--build-root')
- parser.add_option('--dest-dir')
- parser.add_option('--dest-arch')
- return parser.parse_args()
-
-
-def ensure_dir_exists(path):
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.add_option('--build-root')
+ parser.add_option('--dest-dir')
+ parser.add_option('--dest-arch')
+ return parser.parse_args()
+
+
+def ensure_dir_exists(path):
try:
os.makedirs(path)
except OSError as e:
@@ -24,52 +24,52 @@ def ensure_dir_exists(path):
raise
-def hardlink_or_copy(src, dst):
- if os.name == 'nt':
- shutil.copy(src, dst)
- else:
- try:
- os.link(src, dst)
- except OSError as e:
- if e.errno == errno.EEXIST:
- return
- elif e.errno == errno.EXDEV:
+def hardlink_or_copy(src, dst):
+ if os.name == 'nt':
+ shutil.copy(src, dst)
+ else:
+ try:
+ os.link(src, dst)
+ except OSError as e:
+ if e.errno == errno.EEXIST:
+ return
+ elif e.errno == errno.EXDEV:
sys.stderr.write("Can't make cross-device hardlink - fallback to copy: {} -> {}\n".format(src, dst))
- shutil.copy(src, dst)
- else:
- raise
-
-
+ shutil.copy(src, dst)
+ else:
+ raise
+
+
def main():
- opts, args = parse_args()
- assert opts.build_root
- assert opts.dest_dir
-
- dest_arch = None
- if opts.dest_arch:
- if opts.dest_arch.endswith('.tar'):
+ opts, args = parse_args()
+ assert opts.build_root
+ assert opts.dest_dir
+
+ dest_arch = None
+ if opts.dest_arch:
+ if opts.dest_arch.endswith('.tar'):
dest_arch = tarfile.open(opts.dest_arch, 'w', dereference=True)
- elif opts.dest_arch.endswith('.tar.gz') or opts.dest_arch.endswith('.tgz'):
+ elif opts.dest_arch.endswith('.tar.gz') or opts.dest_arch.endswith('.tgz'):
dest_arch = tarfile.open(opts.dest_arch, 'w:gz', dereference=True)
- else:
- # TODO: move check to graph generation stage
- raise Exception('Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.'.format(os.path.basename(opts.dest_arch)))
-
- for arg in args:
+ else:
+ # TODO: move check to graph generation stage
+ raise Exception('Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.'.format(os.path.basename(opts.dest_arch)))
+
+ for arg in args:
dst = arg
- if dst.startswith(opts.build_root):
- dst = dst[len(opts.build_root) + 1:]
+ if dst.startswith(opts.build_root):
+ dst = dst[len(opts.build_root) + 1:]
if dest_arch and not arg.endswith('.pkg.fake'):
- dest_arch.add(arg, arcname=dst)
+ dest_arch.add(arg, arcname=dst)
+
+ dst = os.path.join(opts.dest_dir, dst)
+ ensure_dir_exists(os.path.dirname(dst))
+ hardlink_or_copy(arg, dst)
+
+ if dest_arch:
+ dest_arch.close()
+
- dst = os.path.join(opts.dest_dir, dst)
- ensure_dir_exists(os.path.dirname(dst))
- hardlink_or_copy(arg, dst)
-
- if dest_arch:
- dest_arch.close()
-
-
if __name__ == '__main__':
sys.exit(main())
diff --git a/build/scripts/create_jcoverage_report.py b/build/scripts/create_jcoverage_report.py
index 578183e9b9..45083ff4f7 100644
--- a/build/scripts/create_jcoverage_report.py
+++ b/build/scripts/create_jcoverage_report.py
@@ -1,8 +1,8 @@
import argparse
import tarfile
-import zipfile
+import zipfile
import os
-import sys
+import sys
import time
import subprocess
@@ -26,66 +26,66 @@ class Timer(object):
def main(source, output, java, prefix_filter, exclude_filter, jars_list, output_format, tar_output, agent_disposition, runners_paths):
timer = Timer()
- reports_dir = 'jacoco_reports_dir'
- mkdir_p(reports_dir)
- with tarfile.open(source) as tf:
- tf.extractall(reports_dir)
+ reports_dir = 'jacoco_reports_dir'
+ mkdir_p(reports_dir)
+ with tarfile.open(source) as tf:
+ tf.extractall(reports_dir)
timer.step("Coverage data extracted")
- reports = [os.path.join(reports_dir, fname) for fname in os.listdir(reports_dir)]
-
- with open(jars_list) as f:
- jars = f.read().strip().split()
+ reports = [os.path.join(reports_dir, fname) for fname in os.listdir(reports_dir)]
+
+ with open(jars_list) as f:
+ jars = f.read().strip().split()
if jars and runners_paths:
for r in runners_paths:
try:
jars.remove(r)
except ValueError:
pass
-
- src_dir = 'sources_dir'
- cls_dir = 'classes_dir'
-
- mkdir_p(src_dir)
- mkdir_p(cls_dir)
-
- for jar in jars:
- if jar.endswith('devtools-jacoco-agent.jar'):
- agent_disposition = jar
-
+
+ src_dir = 'sources_dir'
+ cls_dir = 'classes_dir'
+
+ mkdir_p(src_dir)
+ mkdir_p(cls_dir)
+
+ for jar in jars:
+ if jar.endswith('devtools-jacoco-agent.jar'):
+ agent_disposition = jar
+
# Skip java contrib - it's irrelevant coverage
if jar.startswith('contrib/java'):
continue
- with zipfile.ZipFile(jar) as jf:
- for entry in jf.infolist():
- if entry.filename.endswith('.java'):
- dest = src_dir
-
- elif entry.filename.endswith('.class'):
- dest = cls_dir
-
- else:
- continue
-
+ with zipfile.ZipFile(jar) as jf:
+ for entry in jf.infolist():
+ if entry.filename.endswith('.java'):
+ dest = src_dir
+
+ elif entry.filename.endswith('.class'):
+ dest = cls_dir
+
+ else:
+ continue
+
entry.filename = entry.filename.encode('utf-8')
- jf.extract(entry, dest)
+ jf.extract(entry, dest)
timer.step("Jar files extracted")
-
- if not agent_disposition:
- print>>sys.stderr, 'Can\'t find jacoco agent. Will not generate html report for java coverage.'
-
+
+ if not agent_disposition:
+ print>>sys.stderr, 'Can\'t find jacoco agent. Will not generate html report for java coverage.'
+
if tar_output:
report_dir = 'java.report.temp'
else:
report_dir = output
mkdir_p(report_dir)
- if agent_disposition:
+ if agent_disposition:
agent_cmd = [java, '-jar', agent_disposition, src_dir, cls_dir, prefix_filter or '.', exclude_filter or '__no_exclude__', report_dir, output_format]
- agent_cmd += reports
- subprocess.check_call(agent_cmd)
+ agent_cmd += reports
+ subprocess.check_call(agent_cmd)
timer.step("Jacoco finished")
-
+
if tar_output:
with tarfile.open(output, 'w') as outf:
outf.add(report_dir, arcname='.')
@@ -103,7 +103,7 @@ if __name__ == '__main__':
parser.add_argument('--java', action='store')
parser.add_argument('--prefix-filter', action='store')
parser.add_argument('--exclude-filter', action='store')
- parser.add_argument('--jars-list', action='store')
+ parser.add_argument('--jars-list', action='store')
parser.add_argument('--output-format', action='store', default="html")
parser.add_argument('--raw-output', dest='tar_output', action='store_false', default=True)
parser.add_argument('--agent-disposition', action='store')
diff --git a/build/scripts/fetch_from.py b/build/scripts/fetch_from.py
index 3860974ac4..db4fea50bf 100755
--- a/build/scripts/fetch_from.py
+++ b/build/scripts/fetch_from.py
@@ -321,15 +321,15 @@ def process(fetched_file, file_name, args, remove=True):
hardlink_or_copy(fetched_file, args.copy_to)
if not args.outputs:
args.outputs = [args.copy_to]
-
+
if args.rename_to:
args.rename.append(fetched_file)
if not args.outputs:
args.outputs = [args.rename_to]
-
+
if args.copy_to_dir:
hardlink_or_copy(fetched_file, os.path.join(args.copy_to_dir, file_name))
-
+
if args.untar_to:
ensure_dir(args.untar_to)
# Extract only requested files
diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py
index f8533f1223..a99542e174 100755
--- a/build/scripts/fetch_from_sandbox.py
+++ b/build/scripts/fetch_from_sandbox.py
@@ -18,19 +18,19 @@ MDS_PREFIX = 'http://storage-int.mds.yandex.net/get-sandbox/'
TEMPORARY_ERROR_CODES = (429, 500, 503, 504)
-def parse_args():
+def parse_args():
parser = argparse.ArgumentParser()
fetch_from.add_common_arguments(parser)
parser.add_argument('--resource-id', type=int, required=True)
parser.add_argument('--custom-fetcher')
parser.add_argument('--resource-file')
return parser.parse_args()
-
-
-class ResourceInfoError(Exception):
- pass
-
-
+
+
+class ResourceInfoError(Exception):
+ pass
+
+
class UnsupportedProtocolException(Exception):
pass
@@ -75,37 +75,37 @@ def download_by_skynet(resource_info, file_name):
def _urlopen(url, data=None, headers=None):
- n = 10
+ n = 10
tout = 30
started = time.time()
reqid = uuid.uuid4()
-
+
request = urllib2.Request(url, data=data, headers=headers or {})
request.add_header('X-Request-Timeout', str(tout))
request.add_header('X-Request-Id', str(reqid))
request.add_header('User-Agent', 'fetch_from_sandbox.py')
- for i in xrange(n):
+ for i in xrange(n):
retry_after = i
- try:
+ try:
request.add_header('X-Request-Duration', str(int(time.time() - started)))
return urllib2.urlopen(request, timeout=tout).read()
-
- except urllib2.HTTPError as e:
+
+ except urllib2.HTTPError as e:
logging.warning('failed to fetch URL %s with HTTP code %d: %s', url, e.code, e)
retry_after = int(e.headers.get('Retry-After', str(retry_after)))
-
+
if e.code not in TEMPORARY_ERROR_CODES:
- raise
-
- except Exception as e:
+ raise
+
+ except Exception as e:
logging.warning('failed to fetch URL %s: %s', url, e)
-
- if i + 1 == n:
- raise e
-
+
+ if i + 1 == n:
+ raise e
+
time.sleep(retry_after)
-
-
+
+
def _query(url):
return json.loads(_urlopen(url))
@@ -133,19 +133,19 @@ def fetch_via_script(script, resource_id):
def fetch(resource_id, custom_fetcher):
- try:
+ try:
resource_info = get_resource_info(resource_id, touch=True, no_links=True)
- except Exception as e:
+ except Exception as e:
sys.stderr.write(
"Failed to fetch resource {}: {}\n".format(resource_id, str(e))
)
raise
-
+
if resource_info.get('state', 'DELETED') != 'READY':
raise ResourceInfoError("Resource {} is not READY".format(resource_id))
- logging.info('Resource %s info %s', str(resource_id), json.dumps(resource_info))
-
+ logging.info('Resource %s info %s', str(resource_id), json.dumps(resource_info))
+
resource_file_name = os.path.basename(resource_info["file_name"])
expected_md5 = resource_info.get('md5')
@@ -183,9 +183,9 @@ def fetch(resource_id, custom_fetcher):
if mds_link is not None:
yield lambda: fetch_from.fetch_url(mds_link, True, resource_file_name, expected_md5)
- if resource_info.get('attributes', {}).get('ttl') != 'inf':
- sys.stderr.write('WARNING: resource {} ttl is not "inf".\n'.format(resource_id))
-
+ if resource_info.get('attributes', {}).get('ttl') != 'inf':
+ sys.stderr.write('WARNING: resource {} ttl is not "inf".\n'.format(resource_id))
+
exc_info = None
for i, action in enumerate(itertools.islice(iter_tries(), 0, 10)):
try:
@@ -210,10 +210,10 @@ def fetch(resource_id, custom_fetcher):
raise exc_info[0], exc_info[1], exc_info[2]
else:
raise Exception("No available protocol and/or server to fetch resource")
-
+
return fetched_file, resource_info['file_name']
-
+
def _get_resource_info_from_file(resource_file):
if resource_file is None or not os.path.exists(resource_file):
return None
@@ -242,7 +242,7 @@ def _get_resource_info_from_file(resource_file):
def main(args):
custom_fetcher = os.environ.get('YA_CUSTOM_FETCHER')
-
+
resource_info = _get_resource_info_from_file(args.resource_file)
if resource_info:
fetched_file = args.resource_file
@@ -250,14 +250,14 @@ def main(args):
else:
# This code should be merged to ya and removed.
fetched_file, file_name = fetch(args.resource_id, custom_fetcher)
-
+
fetch_from.process(fetched_file, file_name, args, remove=not custom_fetcher and not resource_info)
if __name__ == '__main__':
args = parse_args()
fetch_from.setup_logging(args, os.path.basename(__file__))
-
+
try:
main(args)
except Exception as e:
diff --git a/build/scripts/fetch_resource.py b/build/scripts/fetch_resource.py
index ba046ad88e..d5af311e5d 100644
--- a/build/scripts/fetch_resource.py
+++ b/build/scripts/fetch_resource.py
@@ -1,43 +1,43 @@
-import urllib2
+import urllib2
import argparse
-import xmlrpclib
-
-
-def parse_args():
+import xmlrpclib
+
+
+def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--resource-id', type=int, required=True)
parser.add_argument('-o', '--output', required=True)
return parser.parse_args()
-
-
-def fetch(url, retries=4, timeout=5):
- for i in xrange(retries):
- try:
- return urllib2.urlopen(url, timeout=timeout).read()
-
- except Exception:
- if i + 1 < retries:
- continue
-
- else:
- raise
-
-
-def fetch_resource(id_):
+
+
+def fetch(url, retries=4, timeout=5):
+ for i in xrange(retries):
+ try:
+ return urllib2.urlopen(url, timeout=timeout).read()
+
+ except Exception:
+ if i + 1 < retries:
+ continue
+
+ else:
+ raise
+
+
+def fetch_resource(id_):
urls = xmlrpclib.ServerProxy("https://sandbox.yandex-team.ru/sandbox/xmlrpc").get_resource_http_links(id_)
-
- for u in urls:
- try:
- return fetch(u)
-
+
+ for u in urls:
+ try:
+ return fetch(u)
+
except Exception:
- continue
-
- raise Exception('Cannot fetch resource {}'.format(id_))
-
-
-if __name__ == '__main__':
+ continue
+
+ raise Exception('Cannot fetch resource {}'.format(id_))
+
+
+if __name__ == '__main__':
args = parse_args()
-
+
with open(args.output, 'wb') as f:
f.write(fetch_resource(int(args.resource_id)))
diff --git a/build/scripts/generate_pom.py b/build/scripts/generate_pom.py
index 28d5c988eb..200caebc0b 100644
--- a/build/scripts/generate_pom.py
+++ b/build/scripts/generate_pom.py
@@ -247,7 +247,7 @@ def build_pom_and_export_to_maven(**kwargs):
_indent(project)
- et.ElementTree(project).write(pom_path)
+ et.ElementTree(project).write(pom_path)
sys.stderr.write("[MAVEN EXPORT] Generated {} file for target {}\n".format(os.path.basename(pom_path), target_path))
diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py
index 0b14f0cc99..23487f5c1e 100644
--- a/build/scripts/link_dyn_lib.py
+++ b/build/scripts/link_dyn_lib.py
@@ -3,7 +3,7 @@ import os
import subprocess
import tempfile
import collections
-import optparse
+import optparse
import pipes
from process_whole_archive_option import ProcessWholeArchiveOption
@@ -158,26 +158,26 @@ def fix_cmd(arch, musl, c):
return sum((do_fix(x) for x in c), [])
-def parse_args():
- parser = optparse.OptionParser()
- parser.disable_interspersed_args()
- parser.add_option('--arch')
- parser.add_option('--target')
- parser.add_option('--soname')
- parser.add_option('--fix-elf')
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.disable_interspersed_args()
+ parser.add_option('--arch')
+ parser.add_option('--target')
+ parser.add_option('--soname')
+ parser.add_option('--fix-elf')
parser.add_option('--linker-output')
parser.add_option('--musl', action='store_true')
parser.add_option('--whole-archive-peers', action='append')
parser.add_option('--whole-archive-libs', action='append')
- return parser.parse_args()
+ return parser.parse_args()
-if __name__ == '__main__':
- opts, args = parse_args()
-
- assert opts.arch
- assert opts.target
-
+if __name__ == '__main__':
+ opts, args = parse_args()
+
+ assert opts.arch
+ assert opts.target
+
cmd = fix_cmd(opts.arch, opts.musl, args)
cmd = ProcessWholeArchiveOption(opts.arch, opts.whole_archive_peers, opts.whole_archive_libs).construct_cmd(cmd)
@@ -187,27 +187,27 @@ if __name__ == '__main__':
stdout = sys.stdout
proc = subprocess.Popen(cmd, shell=False, stderr=sys.stderr, stdout=stdout)
- proc.communicate()
-
- if proc.returncode:
+ proc.communicate()
+
+ if proc.returncode:
print >>sys.stderr, 'linker has failed with retcode:', proc.returncode
print >>sys.stderr, 'linker command:', shlex_join(cmd)
- sys.exit(proc.returncode)
-
- if opts.fix_elf:
- cmd = [opts.fix_elf, opts.target]
- proc = subprocess.Popen(cmd, shell=False, stderr=sys.stderr, stdout=sys.stdout)
- proc.communicate()
-
- if proc.returncode:
+ sys.exit(proc.returncode)
+
+ if opts.fix_elf:
+ cmd = [opts.fix_elf, opts.target]
+ proc = subprocess.Popen(cmd, shell=False, stderr=sys.stderr, stdout=sys.stdout)
+ proc.communicate()
+
+ if proc.returncode:
print >>sys.stderr, 'fix_elf has failed with retcode:', proc.returncode
print >>sys.stderr, 'fix_elf command:', shlex_join(cmd)
- sys.exit(proc.returncode)
-
- if opts.soname and opts.soname != opts.target:
+ sys.exit(proc.returncode)
+
+ if opts.soname and opts.soname != opts.target:
if os.path.exists(opts.soname):
os.unlink(opts.soname)
- os.link(opts.target, opts.soname)
+ os.link(opts.target, opts.soname)
# -----------------Test---------------- #
diff --git a/build/scripts/merge_coverage_data.py b/build/scripts/merge_coverage_data.py
index 6e4aa9fde9..b7fa3c6a86 100644
--- a/build/scripts/merge_coverage_data.py
+++ b/build/scripts/merge_coverage_data.py
@@ -2,29 +2,29 @@ import sys
import tarfile
import copy
import os
-import uuid
+import uuid
def main(args):
- output_file, args = args[0], args[1:]
+ output_file, args = args[0], args[1:]
# heretic@: Splits files on which could be merged( files ) and which should not be merged( expendables )
# expendables will be in output_file in form {name}{ordinal number of archive in args[]}.{extension}
- try:
- split_i = args.index('-no-merge')
- except ValueError:
- split_i = len(args)
- files, expendables = args[:split_i], args[split_i + 1:]
+ try:
+ split_i = args.index('-no-merge')
+ except ValueError:
+ split_i = len(args)
+ files, expendables = args[:split_i], args[split_i + 1:]
with tarfile.open(output_file, 'w') as outf:
- for x in files:
+ for x in files:
with tarfile.open(x) as tf:
for tarinfo in tf:
new_tarinfo = copy.deepcopy(tarinfo)
if new_tarinfo.name in expendables:
- dirname, basename = os.path.split(new_tarinfo.name)
- basename_parts = basename.split('.', 1)
- new_basename = '.'.join([basename_parts[0] + str(uuid.uuid4())] + basename_parts[1:])
- new_tarinfo.name = os.path.join(dirname, new_basename)
+ dirname, basename = os.path.split(new_tarinfo.name)
+ basename_parts = basename.split('.', 1)
+ new_basename = '.'.join([basename_parts[0] + str(uuid.uuid4())] + basename_parts[1:])
+ new_tarinfo.name = os.path.join(dirname, new_basename)
outf.addfile(new_tarinfo, tf.extractfile(tarinfo))
diff --git a/build/scripts/pack_jcoverage_resources.py b/build/scripts/pack_jcoverage_resources.py
index 22d2dddbe7..f6e181067a 100644
--- a/build/scripts/pack_jcoverage_resources.py
+++ b/build/scripts/pack_jcoverage_resources.py
@@ -9,16 +9,16 @@ def main(args):
report_file = args[1]
res = subprocess.call(args[args.index('-end') + 1:])
-
- if not os.path.exists(report_file):
- print>>sys.stderr, 'Can\'t find jacoco exec file'
- return res
-
+
+ if not os.path.exists(report_file):
+ print>>sys.stderr, 'Can\'t find jacoco exec file'
+ return res
+
with tarfile.open(output_file, 'w') as outf:
outf.add(report_file, arcname=os.path.basename(report_file))
-
+
return res
if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+ sys.exit(main(sys.argv[1:]))
diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py
index 4919e16ed7..a2e6c20012 100644
--- a/build/scripts/resolve_java_srcs.py
+++ b/build/scripts/resolve_java_srcs.py
@@ -14,8 +14,8 @@ def list_all_files(directory, prefix='/', hidden_files=False):
return result
-def pattern_to_regexp(p):
- return '^' + \
+def pattern_to_regexp(p):
+ return '^' + \
('/' if not p.startswith('**') else '') + \
re.escape(p).replace(
r'\*\*\/', '[_DIR_]'
@@ -26,8 +26,8 @@ def pattern_to_regexp(p):
).replace(
'[_FILE_]', '([^/]*)'
) + '$'
-
-
+
+
def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources, resolve_kotlin=False, resolve_groovy=False):
result = {'java': [], 'not_java': [], 'kotlin': [], 'groovy': []}
include_patterns_normal, include_patterns_hidden, exclude_patterns_normal, exclude_patterns_hidden = [], [], [], []
@@ -43,22 +43,22 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
else:
re_patterns = [re.compile(i) for i in re_patterns]
vis[:], hid[:] = re_patterns[:len(vis)], re_patterns[len(vis):]
-
+
for inc_patterns, exc_patterns, with_hidden_files in (
(include_patterns_normal, exclude_patterns_normal, False),
(include_patterns_hidden, exclude_patterns_hidden, True),
):
for f in list_all_files(srcdir, hidden_files=with_hidden_files):
excluded = False
-
+
for exc_re in exc_patterns:
if exc_re.match(f):
excluded = True
break
-
+
if excluded:
continue
-
+
for inc_re in inc_patterns:
if inc_re.match(f):
s = os.path.normpath(f[1:])
@@ -73,7 +73,7 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
else:
result['not_java'].append(s)
break
-
+
return sorted(result['java']), sorted(result['not_java']), sorted(result['kotlin']), sorted(result['groovy'])
@@ -99,8 +99,8 @@ if __name__ == '__main__':
parser.add_argument('--all-resources', action='store_true', default=False)
parser.add_argument('--resolve-kotlin', action='store_true', default=False)
parser.add_argument('--resolve-groovy', action='store_true', default=False)
- parser.add_argument('--include-patterns', nargs='*', default=[])
- parser.add_argument('--exclude-patterns', nargs='*', default=[])
+ parser.add_argument('--include-patterns', nargs='*', default=[])
+ parser.add_argument('--exclude-patterns', nargs='*', default=[])
args = parser.parse_args()
do_it(**vars(args))
diff --git a/build/scripts/run_javac.py b/build/scripts/run_javac.py
index 2a870af771..c35546e0fe 100644
--- a/build/scripts/run_javac.py
+++ b/build/scripts/run_javac.py
@@ -1,47 +1,47 @@
-import sys
-import subprocess
-import optparse
-import re
-
-
-def parse_args():
- parser = optparse.OptionParser()
- parser.disable_interspersed_args()
- parser.add_option('--sources-list')
- parser.add_option('--verbose', default=False, action='store_true')
- parser.add_option('--remove-notes', default=False, action='store_true')
+import sys
+import subprocess
+import optparse
+import re
+
+
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.disable_interspersed_args()
+ parser.add_option('--sources-list')
+ parser.add_option('--verbose', default=False, action='store_true')
+ parser.add_option('--remove-notes', default=False, action='store_true')
parser.add_option('--ignore-errors', default=False, action='store_true')
parser.add_option('--kotlin', default=False, action='store_true')
- return parser.parse_args()
-
-
-COLORING = {
- r'^(?P<path>.*):(?P<line>\d*): error: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(
- path=m.group('path'),
- line=m.group('line'),
- msg=m.group('msg'),
- ),
- r'^(?P<path>.*):(?P<line>\d*): warning: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-yellow]]warning[[rst]]: {msg}'.format(
- path=m.group('path'),
- line=m.group('line'),
- msg=m.group('msg'),
- ),
- r'^warning: ': lambda m: '[[c:light-yellow]]warning[[rst]]: ',
- r'^error: (?P<msg>.*)': lambda m: '[[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(msg=m.group('msg')),
- r'^Note: ': lambda m: '[[c:light-cyan]]Note[[rst]]: ',
-}
-
-
-def colorize(err):
- for regex, sub in COLORING.iteritems():
- err = re.sub(regex, sub, err, flags=re.MULTILINE)
- return err
-
-
-def remove_notes(err):
- return '\n'.join([line for line in err.split('\n') if not line.startswith('Note:')])
-
-
+ return parser.parse_args()
+
+
+COLORING = {
+ r'^(?P<path>.*):(?P<line>\d*): error: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(
+ path=m.group('path'),
+ line=m.group('line'),
+ msg=m.group('msg'),
+ ),
+ r'^(?P<path>.*):(?P<line>\d*): warning: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-yellow]]warning[[rst]]: {msg}'.format(
+ path=m.group('path'),
+ line=m.group('line'),
+ msg=m.group('msg'),
+ ),
+ r'^warning: ': lambda m: '[[c:light-yellow]]warning[[rst]]: ',
+ r'^error: (?P<msg>.*)': lambda m: '[[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(msg=m.group('msg')),
+ r'^Note: ': lambda m: '[[c:light-cyan]]Note[[rst]]: ',
+}
+
+
+def colorize(err):
+ for regex, sub in COLORING.iteritems():
+ err = re.sub(regex, sub, err, flags=re.MULTILINE)
+ return err
+
+
+def remove_notes(err):
+ return '\n'.join([line for line in err.split('\n') if not line.startswith('Note:')])
+
+
def find_javac(cmd):
if not cmd:
return None
@@ -84,39 +84,39 @@ def fix_cmd(cmd):
return cmd
-def main():
- opts, cmd = parse_args()
-
- with open(opts.sources_list) as f:
- input_files = f.read().strip().split()
-
+def main():
+ opts, cmd = parse_args()
+
+ with open(opts.sources_list) as f:
+ input_files = f.read().strip().split()
+
if opts.kotlin:
input_files = [i for i in input_files if i.endswith('.kt')]
- if not input_files:
- if opts.verbose:
- sys.stderr.write('No files to compile, javac is not launched.\n')
-
- else:
+ if not input_files:
+ if opts.verbose:
+ sys.stderr.write('No files to compile, javac is not launched.\n')
+
+ else:
p = subprocess.Popen(fix_cmd(cmd), stderr=subprocess.PIPE)
- _, err = p.communicate()
- rc = p.wait()
-
- if opts.remove_notes:
- err = remove_notes(err)
-
- try:
- err = colorize(err)
-
- except Exception:
- pass
-
+ _, err = p.communicate()
+ rc = p.wait()
+
+ if opts.remove_notes:
+ err = remove_notes(err)
+
+ try:
+ err = colorize(err)
+
+ except Exception:
+ pass
+
if opts.ignore_errors and rc:
sys.stderr.write('error: javac actually failed with exit code {}\n'.format(rc))
rc = 0
- sys.stderr.write(err)
- sys.exit(rc)
-
-
-if __name__ == '__main__':
- main()
+ sys.stderr.write(err)
+ sys.exit(rc)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/build/scripts/run_sonar.py b/build/scripts/run_sonar.py
index a1d06d2c41..761cc34b78 100644
--- a/build/scripts/run_sonar.py
+++ b/build/scripts/run_sonar.py
@@ -1,38 +1,38 @@
-import os
-import sys
-import zipfile
-import tarfile
-import subprocess as sp
-import optparse
-import shutil
+import os
+import sys
+import zipfile
+import tarfile
+import subprocess as sp
+import optparse
+import shutil
import xml.etree.ElementTree as et
-
-
-def parse_args():
- parser = optparse.OptionParser()
- parser.add_option(
- '--classes-jar-path',
- dest='classes_jar_paths',
- action='append',
- default=[],
- )
- parser.add_option('--sources-jar-path')
- parser.add_option('--sonar-scanner-jar-path')
- parser.add_option('--sonar-scanner-main-class')
- parser.add_option('--java-coverage-merged-tar')
- parser.add_option('--java-binary-path')
- parser.add_option('--log-path')
+
+
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.add_option(
+ '--classes-jar-path',
+ dest='classes_jar_paths',
+ action='append',
+ default=[],
+ )
+ parser.add_option('--sources-jar-path')
+ parser.add_option('--sonar-scanner-jar-path')
+ parser.add_option('--sonar-scanner-main-class')
+ parser.add_option('--java-coverage-merged-tar')
+ parser.add_option('--java-binary-path')
+ parser.add_option('--log-path')
parser.add_option('--gcov-report-path')
parser.add_option('--source-root')
parser.add_option('--java-args', action='append', default=[])
- return parser.parse_args()
-
-
-def extract_zip_file(zip_file_path, dest_dir):
- with zipfile.ZipFile(zip_file_path) as arch:
- arch.extractall(dest_dir)
-
-
+ return parser.parse_args()
+
+
+def extract_zip_file(zip_file_path, dest_dir):
+ with zipfile.ZipFile(zip_file_path) as arch:
+ arch.extractall(dest_dir)
+
+
def get_source_real_path(source_root, path):
parts = os.path.normpath(path).split(os.path.sep)
for i in xrange(len(parts)):
@@ -64,58 +64,58 @@ def collect_cpp_sources(report, source_root, destination):
os.link(src, dst)
-def main(opts, props_args):
- sources_dir = os.path.abspath('src')
+def main(opts, props_args):
+ sources_dir = os.path.abspath('src')
base_props_args = ['-Dsonar.sources=' + sources_dir]
- os.mkdir(sources_dir)
+ os.mkdir(sources_dir)
if opts.sources_jar_path:
extract_zip_file(opts.sources_jar_path, sources_dir)
if opts.gcov_report_path:
collect_cpp_sources(opts.gcov_report_path, opts.source_root, sources_dir)
base_props_args += ['-Dsonar.projectBaseDir=' + sources_dir, '-Dsonar.cxx.coverage.reportPath=' + opts.gcov_report_path]
-
- if opts.classes_jar_paths:
- classes_dir = os.path.abspath('cls')
- os.mkdir(classes_dir)
-
- for classes_jar_path in opts.classes_jar_paths:
- extract_zip_file(classes_jar_path, classes_dir)
-
- base_props_args.append('-Dsonar.java.binaries=' + classes_dir)
-
- if opts.java_coverage_merged_tar:
- jacoco_report_path = os.path.abspath('jacoco.exec')
- with open(jacoco_report_path, 'w') as dest:
- with tarfile.open(opts.java_coverage_merged_tar) as tar:
- for src in tar:
+
+ if opts.classes_jar_paths:
+ classes_dir = os.path.abspath('cls')
+ os.mkdir(classes_dir)
+
+ for classes_jar_path in opts.classes_jar_paths:
+ extract_zip_file(classes_jar_path, classes_dir)
+
+ base_props_args.append('-Dsonar.java.binaries=' + classes_dir)
+
+ if opts.java_coverage_merged_tar:
+ jacoco_report_path = os.path.abspath('jacoco.exec')
+ with open(jacoco_report_path, 'w') as dest:
+ with tarfile.open(opts.java_coverage_merged_tar) as tar:
+ for src in tar:
extracted = tar.extractfile(src)
if extracted is not None:
shutil.copyfileobj(extracted, dest)
-
- base_props_args += [
- '-Dsonar.core.codeCoveragePlugin=jacoco',
- '-Dsonar.jacoco.reportPath=' + jacoco_report_path
- ]
+
+ base_props_args += [
+ '-Dsonar.core.codeCoveragePlugin=jacoco',
+ '-Dsonar.jacoco.reportPath=' + jacoco_report_path
+ ]
java_args = ['-{}'.format(i) for i in opts.java_args] + ['-Djava.net.preferIPv6Addresses=true', '-Djava.net.preferIPv4Addresses=false']
-
- sonar_cmd = [
- opts.java_binary_path,
+
+ sonar_cmd = [
+ opts.java_binary_path,
] + java_args + [
- '-classpath',
- opts.sonar_scanner_jar_path,
+ '-classpath',
+ opts.sonar_scanner_jar_path,
] + base_props_args + props_args + [opts.sonar_scanner_main_class, '-X']
-
- p = sp.Popen(sonar_cmd, stdout=sp.PIPE, stderr=sp.STDOUT)
- out, _ = p.communicate()
-
- sys.stderr.write(out)
+
+ p = sp.Popen(sonar_cmd, stdout=sp.PIPE, stderr=sp.STDOUT)
+ out, _ = p.communicate()
+
+ sys.stderr.write(out)
with open(opts.log_path, 'a') as f:
- f.write(out)
-
- sys.exit(p.returncode)
-
-
-if __name__ == '__main__':
- opts, args = parse_args()
- props_args = ['-D' + arg for arg in args]
- main(opts, props_args)
+ f.write(out)
+
+ sys.exit(p.returncode)
+
+
+if __name__ == '__main__':
+ opts, args = parse_args()
+ props_args = ['-D' + arg for arg in args]
+ main(opts, props_args)
diff --git a/build/scripts/stderr2stdout.py b/build/scripts/stderr2stdout.py
index f47803a450..0e510da373 100644
--- a/build/scripts/stderr2stdout.py
+++ b/build/scripts/stderr2stdout.py
@@ -1,6 +1,6 @@
-import subprocess
-import sys
-
-if __name__ == '__main__':
- assert len(sys.argv) > 1
- sys.exit(subprocess.Popen(sys.argv[1:], stderr=sys.stdout).wait())
+import subprocess
+import sys
+
+if __name__ == '__main__':
+ assert len(sys.argv) > 1
+ sys.exit(subprocess.Popen(sys.argv[1:], stderr=sys.stdout).wait())
diff --git a/build/scripts/tared_protoc.py b/build/scripts/tared_protoc.py
index 3207b54b1d..7643e1dbfe 100644
--- a/build/scripts/tared_protoc.py
+++ b/build/scripts/tared_protoc.py
@@ -1,31 +1,31 @@
-import os
-import optparse
-import tarfile
-import contextlib
-import subprocess as sp
-
-
-def parse_args():
- parser = optparse.OptionParser()
- parser.disable_interspersed_args()
- parser.add_option('--tar-output')
- parser.add_option('--protoc-out-dir')
- return parser.parse_args()
-
-
-def main():
- opts, args = parse_args()
- assert opts.tar_output
- assert opts.protoc_out_dir
-
- if not os.path.exists(opts.protoc_out_dir):
- os.makedirs(opts.protoc_out_dir)
-
- sp.check_call(args)
-
- with contextlib.closing(tarfile.open(opts.tar_output, 'w')) as tf:
- tf.add(opts.protoc_out_dir, arcname='')
-
-
-if __name__ == '__main__':
- main()
+import os
+import optparse
+import tarfile
+import contextlib
+import subprocess as sp
+
+
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.disable_interspersed_args()
+ parser.add_option('--tar-output')
+ parser.add_option('--protoc-out-dir')
+ return parser.parse_args()
+
+
+def main():
+ opts, args = parse_args()
+ assert opts.tar_output
+ assert opts.protoc_out_dir
+
+ if not os.path.exists(opts.protoc_out_dir):
+ os.makedirs(opts.protoc_out_dir)
+
+ sp.check_call(args)
+
+ with contextlib.closing(tarfile.open(opts.tar_output, 'w')) as tf:
+ tf.add(opts.protoc_out_dir, arcname='')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/build/scripts/unpacking_jtest_runner.py b/build/scripts/unpacking_jtest_runner.py
index 8b23e3ed26..9730dcd711 100644
--- a/build/scripts/unpacking_jtest_runner.py
+++ b/build/scripts/unpacking_jtest_runner.py
@@ -3,25 +3,25 @@ import json
import optparse
import os
import sys
-import subprocess
+import subprocess
import time
import zipfile
import platform
-
-# This script changes test run classpath by unpacking tests.jar -> tests-dir. The goal
-# is to launch tests with the same classpath as maven does.
-
-
-def parse_args():
- parser = optparse.OptionParser()
- parser.disable_interspersed_args()
+
+# This script changes test run classpath by unpacking tests.jar -> tests-dir. The goal
+# is to launch tests with the same classpath as maven does.
+
+
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.disable_interspersed_args()
parser.add_option('--trace-file')
- parser.add_option('--jar-binary')
- parser.add_option('--tests-jar-path')
+ parser.add_option('--jar-binary')
+ parser.add_option('--tests-jar-path')
parser.add_option('--classpath-option-type', choices=('manifest', 'command_file', 'list'), default='manifest')
- return parser.parse_args()
-
-
+ return parser.parse_args()
+
+
# temporary, for jdk8/jdk9+ compatibility
def fix_cmd(cmd):
if not cmd:
@@ -88,18 +88,18 @@ def make_command_file_from_cp(class_path, out):
cp_file.write(os.pathsep.join(class_path))
-def main():
+def main():
s = time.time()
- opts, args = parse_args()
-
- # unpack tests jar
- try:
+ opts, args = parse_args()
+
+ # unpack tests jar
+ try:
build_root = args[args.index('--build-root') + 1]
dest = os.path.join(build_root, 'test-classes')
- except Exception:
+ except Exception:
build_root = ''
- dest = os.path.abspath('test-classes')
-
+ dest = os.path.abspath('test-classes')
+
extract_jars(dest, opts.tests_jar_path)
metrics = {
@@ -107,7 +107,7 @@ def main():
}
s = time.time()
- # fix java classpath
+ # fix java classpath
cp_idx = args.index('-classpath')
if args[cp_idx + 1].startswith('@'):
real_name = args[cp_idx + 1][1:]
@@ -137,12 +137,12 @@ def main():
if opts.trace_file:
dump_chunk_event({'metrics': metrics}, opts.trace_file)
- # run java cmd
+ # run java cmd
if platform.system() == 'Windows':
sys.exit(subprocess.Popen(args).wait())
else:
os.execv(args[0], args)
-
-
-if __name__ == '__main__':
- main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/build/scripts/writer.py b/build/scripts/writer.py
index 7eceef9ccd..21bb3006e5 100644
--- a/build/scripts/writer.py
+++ b/build/scripts/writer.py
@@ -1,10 +1,10 @@
import sys
import argparse
-
+
import process_command_files as pcf
-
-def parse_args():
+
+def parse_args():
args = pcf.get_args(sys.argv[1:])
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--file', dest='file_path')
@@ -15,7 +15,7 @@ def parse_args():
parser.add_argument('-m', '--content-multiple', nargs='*', dest='content')
parser.add_argument('-P', '--path-list', action='store_true', default=False)
return parser.parse_args(args)
-
+
def smart_shell_quote(v):
if v is None:
@@ -23,11 +23,11 @@ def smart_shell_quote(v):
if ' ' in v or '"' in v or "'" in v:
return "\"{0}\"".format(v.replace('"', '\\"'))
return v
-
-if __name__ == '__main__':
+
+if __name__ == '__main__':
args = parse_args()
open_type = 'a' if args.append else 'w'
-
+
content = args.content
if args.quote:
content = [smart_shell_quote(ln) for ln in content] if content is not None else None
diff --git a/build/sysincl/darwin.yml b/build/sysincl/darwin.yml
index 04a6cc2ce6..582c7e1202 100644
--- a/build/sysincl/darwin.yml
+++ b/build/sysincl/darwin.yml
@@ -99,7 +99,7 @@
- net/if_dl.h
- net/if_media.h
- net/if_types.h
- - net/if_var.h
+ - net/if_var.h
- netinet/in_pcb.h
- netinet/ip_var.h
- netinet/tcp_fsm.h
@@ -115,7 +115,7 @@
- os/proc.h
- os/trace.h
- panel.h
- - pthread_spis.h
+ - pthread_spis.h
- readline/history.h
- readline/readline.h
- readpassphrase.h
@@ -179,7 +179,7 @@
- CoreFoundation/CFPreferences.h
- CoreFoundation/CFRunLoop.h
- CoreFoundation/CFString.h
- - CoreFoundation/CFTimeZone.h
+ - CoreFoundation/CFTimeZone.h
- CoreFoundation/CFUUID.h
- CoreFoundation/CoreFoundation.h
- CoreGraphics/CoreGraphics.h
diff --git a/build/sysincl/intrinsic.yml b/build/sysincl/intrinsic.yml
index 2e89f67c48..9355b61c13 100644
--- a/build/sysincl/intrinsic.yml
+++ b/build/sysincl/intrinsic.yml
@@ -32,11 +32,11 @@
- rtmintrin.h
- s390intrin.h
- sanitizer/asan_interface.h
- - sanitizer/common_interface_defs.h
+ - sanitizer/common_interface_defs.h
- sanitizer/coverage_interface.h
- sanitizer/lsan_interface.h
- sanitizer/msan_interface.h
- - sanitizer/tsan_interface.h
+ - sanitizer/tsan_interface.h
- sanitizer/tsan_interface_atomic.h
- smmintrin.h
- tbmintrin.h
diff --git a/build/sysincl/misc.yml b/build/sysincl/misc.yml
index 28adc3a0a6..e9e6095888 100644
--- a/build/sysincl/misc.yml
+++ b/build/sysincl/misc.yml
@@ -420,20 +420,20 @@
- source_filter: "^contrib/libs/dpdk/"
includes:
- process.h: contrib/libs/dpdk/drivers/bus/dpaa/include/process.h
-
+
- source_filter: "^contrib/libs/dpdk_arm64/"
includes:
- process.h: contrib/libs/dpdk_arm64/drivers/bus/dpaa/include/process.h
-- source_filter: "^contrib/libs/usrsctp/"
- includes:
- - netinet/sctp_uio.h: contrib/libs/usrsctp/usrsctplib/netinet/sctp_uio.h
-
-- source_filter: "^contrib/libs/libsrtp/"
- includes:
- - alloc.h: contrib/libs/libsrtp/crypto/include/alloc.h
- - err.h: contrib/libs/libsrtp/crypto/include/err.h
- - stat.h: contrib/libs/libsrtp/crypto/include/stat.h
+- source_filter: "^contrib/libs/usrsctp/"
+ includes:
+ - netinet/sctp_uio.h: contrib/libs/usrsctp/usrsctplib/netinet/sctp_uio.h
+
+- source_filter: "^contrib/libs/libsrtp/"
+ includes:
+ - alloc.h: contrib/libs/libsrtp/crypto/include/alloc.h
+ - err.h: contrib/libs/libsrtp/crypto/include/err.h
+ - stat.h: contrib/libs/libsrtp/crypto/include/stat.h
- source_filter: "^contrib/restricted/openal-soft"
includes:
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml
index 66b3dac844..7d9600f345 100644
--- a/build/sysincl/stl-to-libcxx.yml
+++ b/build/sysincl/stl-to-libcxx.yml
@@ -48,7 +48,7 @@
- __config: contrib/libs/cxxsupp/libcxx/include/__config
- __undef_macros: contrib/libs/cxxsupp/libcxx/include/__undef_macros
- algorithm: contrib/libs/cxxsupp/libcxx/include/algorithm
- - any: contrib/libs/cxxsupp/libcxx/include/any
+ - any: contrib/libs/cxxsupp/libcxx/include/any
- array: contrib/libs/cxxsupp/libcxx/include/array
- atomic: contrib/libs/cxxsupp/libcxx/include/atomic
- bit: contrib/libs/cxxsupp/libcxx/include/bit
diff --git a/build/sysincl/stl-to-nothing.yml b/build/sysincl/stl-to-nothing.yml
index 62c534b1f4..c7e27d1411 100644
--- a/build/sysincl/stl-to-nothing.yml
+++ b/build/sysincl/stl-to-nothing.yml
@@ -31,7 +31,7 @@
- __config
- __undef_macros
- algorithm
- - any
+ - any
- array
- atomic
- bit
diff --git a/build/sysincl/unsorted.yml b/build/sysincl/unsorted.yml
index bd33e5853c..a889b923a0 100644
--- a/build/sysincl/unsorted.yml
+++ b/build/sysincl/unsorted.yml
@@ -266,8 +266,8 @@
- unlocked-io.h
- cygwin/version.h
- zircon/syscalls.h
- - zircon/types.h
- - zircon/process.h
+ - zircon/types.h
+ - zircon/process.h
- sys/linux-syscalls.h
- tr1/memory
- android/log.h
@@ -289,21 +289,21 @@
- machine/fpu.h
- malloc_np.h
- netinet/sctp_uio.h
- - netinet/ip_options.h
- - netinet/sctp_kdtrace.h
- - netinet/sctp_lock_bsd.h
- - netinet/sctp_lock_empty.h
- - netinet/sctp_os_bsd.h
- - netinet6/in6_pcb.h
- - netinet6/ip6_var.h
- - netinet6/ip6protosw.h
- - netinet6/scope6_var.h
- - netipsec/ipsec.h
- - netipsec/ipsec6.h
- - netipsec/key.h
+ - netinet/ip_options.h
+ - netinet/sctp_kdtrace.h
+ - netinet/sctp_lock_bsd.h
+ - netinet/sctp_lock_empty.h
+ - netinet/sctp_os_bsd.h
+ - netinet6/in6_pcb.h
+ - netinet6/ip6_var.h
+ - netinet6/ip6protosw.h
+ - netinet6/scope6_var.h
+ - netipsec/ipsec.h
+ - netipsec/ipsec6.h
+ - netipsec/key.h
- opie.h
- osreldate.h
- - opt_sctp.h
+ - opt_sctp.h
- pthread_np.h
- ripemd.h
- sha.h
@@ -313,22 +313,22 @@
- sys/cpuset.h
- sys/disklabel.h
- sys/endian.h
- - sys/eventhandler.h
+ - sys/eventhandler.h
- sys/exec.h
- sys/extattr.h
- - sys/filedesc.h
- - sys/gsb_crc32.h
+ - sys/filedesc.h
+ - sys/gsb_crc32.h
- sys/jail.h
- sys/ktrace.h
- sys/machine.h
- sys/module.h
- sys/mpctl.h
- sys/mutex.h
- - sys/rwlock.h
+ - sys/rwlock.h
- sys/semaphore.h
- - sys/smp.h
+ - sys/smp.h
- sys/stdint.h
- - sys/systm.h
+ - sys/systm.h
- sys/thr.h
- sys/timespec.h
- sys/umtx.h
@@ -613,7 +613,7 @@
- tpf/sysapi.h
#endif
- asm/page.h
- - asm/sgidefs.h
+ - asm/sgidefs.h
- wrl\client.h
- wrl\event.h
- wrl\wrappers\corewrappers.h
diff --git a/build/sysincl/windows.yml b/build/sysincl/windows.yml
index a6858cb70f..26ae7b5bfa 100644
--- a/build/sysincl/windows.yml
+++ b/build/sysincl/windows.yml
@@ -164,8 +164,8 @@
- oleacc.h
- oleauto.h
- olectl.h
- - packon.h
- - packoff.h
+ - packon.h
+ - packoff.h
- pathcch.h
- p2p.h
- pdh.h
@@ -305,7 +305,7 @@
- ws2bth.h
- ws2def.h
- ws2ipdef.h
- - ws2spi.h
+ - ws2spi.h
- ws2tcpip.h
- wscapi.h
- wspiapi.h
diff --git a/build/ya.conf.json b/build/ya.conf.json
index a93447e052..5f7cc875d6 100644
--- a/build/ya.conf.json
+++ b/build/ya.conf.json
@@ -1074,14 +1074,14 @@
}
]
},
- "maven_import_sandbox_uploader": {
- "tools": {
+ "maven_import_sandbox_uploader": {
+ "tools": {
"maven_import_sandbox_uploader": {
"bottle": "maven_import_sandbox_uploader",
"executable": "maven_import_sandbox_uploader"
}
- },
- "platforms": [
+ },
+ "platforms": [
{
"host": {
"os": "LINUX"
@@ -1107,8 +1107,8 @@
},
"default": true
}
- ]
- },
+ ]
+ },
"arc": {
"tools": {
"arc": {
@@ -5784,17 +5784,17 @@
]
}
},
- "maven_import_sandbox_uploader": {
- "formula": {
+ "maven_import_sandbox_uploader": {
+ "formula": {
"sandbox_id": 1031028343,
- "match": "uploader"
- },
- "executable": {
+ "match": "uploader"
+ },
+ "executable": {
"maven_import_sandbox_uploader": [
"uploader"
]
- }
- },
+ }
+ },
"arc": {
"formula": {
"sandbox_id": [
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index de815934b4..081833998b 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -936,7 +936,7 @@ otherwise {
macro _JAVA_PROTO_CMD(File) {
.CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT $_JAVA_PROTO_OUT_ARG$ARCADIA_BUILD_ROOT/java_out ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
}
-
+
# tag:proto tag:perl-specific tag:deprecated
### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
@@ -966,8 +966,8 @@ when ($PY_PROTOS_FOR == "yes") {
macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
.CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
.PEERDIR=library/cpp/eventlog/proto
-}
-
+}
+
# tag:python-specific tag:proto
macro _PY_EVLOG_CMD(File) {
.CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
@@ -982,8 +982,8 @@ macro _PY_EVLOG_CMD_INTERNAL(File) {
macro _JAVA_EVLOG_CMD(File) {
.CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
.PEERDIR=library/cpp/eventlog/proto
-}
-
+}
+
# tag:sanitize
RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
@@ -2461,8 +2461,8 @@ module LIBRARY: _LIBRARY {
SET(MODULE_LANG CPP)
ADD_CLANG_TIDY()
-}
-
+}
+
# tag:internal
### @usage: _BARE_MODULE() # internal
###
@@ -2980,8 +2980,8 @@ module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
# as SRCS in packages use macro BUNDLE_SRCS!
-PACKED_PACKAGE_ARGS=
-PACKED_PACKAGE_EXT=
+PACKED_PACKAGE_ARGS=
+PACKED_PACKAGE_EXT=
### @usage: PACK(archive_type)
###
### When placed inside the PACKAGE module, packs the build results tree to the archive with specified extension. Currently supported extensions are `tar` and `tar.gz`
@@ -2991,8 +2991,8 @@ PACKED_PACKAGE_EXT=
### @see: [PACKAGE()](#module_PACKAGE)
macro PACK(Ext) {
SET(PACKED_PACKAGE_EXT $Ext)
-}
-
+}
+
PACKAGE_STRICT_VALUE=
macro PACKAGE_STRICT() {
SET(PACKAGE_STRICT_VALUE yes)
@@ -3416,7 +3416,7 @@ module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
.ALIASES=SRCS=_SRCS_NO_GLOBAL
.ALLOWED=EMBED_JAVA_VCS_INFO
.RESTRICTED=EXTERNAL_JAR
-
+
PEERDIR(build/platform/java/jdk)
PEERDIR+=$JDK_RESOURCE_PEERDIR
@@ -3426,17 +3426,17 @@ module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
-
+
when ($PACKAGE_PREFIX) {
PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
}
-
+
DISABLE(NEED_PLATFORM_PEERDIRS)
NO_PLATFORM()
SET(MODULE_SUFFIX .jar)
SET(MODULE_LANG JAVA)
-}
-
+}
+
# tag:java-specific
ALL_JAR_SOURCES=
LINT_JAVA_SOURCES=
@@ -4050,8 +4050,8 @@ module PY2_LIBRARY: _LIBRARY {
PY_PROTO_MYPY_PLUGIN_INTERNAL=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=__int___pb2.pyi:File} ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.pyi:File} ${nopath;noext;suf=_pb2.pyi:File}"})
}
SET(MODULE_LANG PY2)
-}
-
+}
+
### @usage: _PY3_LIBRARY()
###
@@ -4148,8 +4148,8 @@ module _BASE_PY_PROGRAM: _BASE_PROGRAM {
.IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
.RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
SET(MODULE_LANG PY2)
-}
-
+}
+
# tag:python-specific tag:codenav
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
@@ -4420,7 +4420,7 @@ when ($JDK_VERSION == "8") {
# tag:java-specific
COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --javac-bin $JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $PEERS ${requirements;hide:JAVA_REQUIREMENTS} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${kv;hide:"PEERS $PEERS"}
REAL_SWIG_DLL_JAR_CMD=$GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/build_dll_and_java.py"} $JAVA_SWIG_DELIM $REAL_LINK_DYN_LIB $JAVA_SWIG_DELIM $COMPILE_JAVA $JAVA_SWIG_DELIM $AUTO_INPUT $JAVA_SWIG_DELIM $TARGET $JAVA_SWIG_DELIM ${output;suf=.jar:REALPRJNAME} $JAVA_SWIG_DELIM ${output;suf=-sources.jar:REALPRJNAME} $JAVA_SWIG_DELIM $ARCADIA_BUILD_ROOT $ARCADIA_ROOT
-
+
# tag:deprecated
### @usage: METAQUERY() #deprecated
###
@@ -4433,9 +4433,9 @@ module METAQUERY: _BASE_UNIT {
PRINT_MODULE_TYPE(METAQUERY $MODULE_PREFIX$REALPRJNAME)
}
-ARGS_DELIM="MACRO_CALLS_DELIM"
-
-SYSTEM_PROPERTIES_VALUE=
+ARGS_DELIM="MACRO_CALLS_DELIM"
+
+SYSTEM_PROPERTIES_VALUE=
### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
###
### List of Key,Value pairs that will be available to test via System.getProperty().
@@ -4444,10 +4444,10 @@ SYSTEM_PROPERTIES_VALUE=
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro SYSTEM_PROPERTIES(Args...) {
SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
-}
-
+}
+
# tag:java-specific
-JVM_ARGS_VALUE=
+JVM_ARGS_VALUE=
### @usage: JVM_ARGS(Args...)
###
### Arguments to run Java programs in tests.
@@ -4455,8 +4455,8 @@ JVM_ARGS_VALUE=
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro JVM_ARGS(Args...) {
SET_APPEND(JVM_ARGS_VALUE $Args)
-}
-
+}
+
# tag:java-specific
CHECK_JAVA_DEPS_VALUE=
### @usage: CHECK_JAVA_DEPS(<yes|no>)
@@ -4476,7 +4476,7 @@ macro USE_ERROR_PRONE() {
SET(ERROR_PRONE_VALUE yes)
}
-TEST_CWD_VALUE=
+TEST_CWD_VALUE=
### @usage: TEST_CWD(path)
###
### Defines working directory for test runs. Othen used in conjunction with DATA() macro.
@@ -4485,8 +4485,8 @@ TEST_CWD_VALUE=
### Documentation: https://wiki.yandex-team.ru/yatool/test/
macro TEST_CWD(Arg) {
SET(TEST_CWD_VALUE $Arg)
-}
-
+}
+
# tag:java-specific
MAKE_UBERJAR_VALUE=
### @usage: UBERJAR()
@@ -4640,15 +4640,15 @@ macro IDEA_MODULE_NAME(Name) {
}
# tag:java-specific
-JAVAC_FLAGS_VALUE=
+JAVAC_FLAGS_VALUE=
### @usage: JAVAC_FLAGS(Args...)
###
### Set additional Java compilation flags.
macro JAVAC_FLAGS(Args...) {
SET_APPEND(JAVAC_OPTS $Args)
SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
-}
-
+}
+
# tag:java-specific
ENABLE_PREVIEW_VALUE=
### @usage: ENABLE_PREVIEW()
@@ -4682,26 +4682,26 @@ macro MAVEN_GROUP_ID(Arg) {
}
# tag:java-specific
-ANNOTATION_PROCESSOR_VALUE=
+ANNOTATION_PROCESSOR_VALUE=
### @usage: ANNOTATION_PROCESSOR(processors...)
###
### The macro is in development.
### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
macro ANNOTATION_PROCESSOR(Args...) {
SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
-}
-
-EXCLUDE_VALUE=
+}
+
+EXCLUDE_VALUE=
### EXCLUDE(prefixes)
###
### The macro is in development.
### Specifies which libraries should be excluded from the classpath.
macro EXCLUDE(Args...) {
SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
-}
-
+}
+
# tag:java-specific
-JAVA_SRCS_VALUE=
+JAVA_SRCS_VALUE=
### @usage: JAVA_SRCS(srcs)
###
### Specify java source files and resources. A macro can be contained in any of four java modules.
@@ -4728,8 +4728,8 @@ JAVA_SRCS_VALUE=
### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
macro JAVA_SRCS(Args...) {
SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
-}
-
+}
+
# tag:java-specific
JAVA_ADD_DLLS_VALUE=no
macro ADD_DLLS_TO_JAR() {
@@ -4752,7 +4752,7 @@ TEST_CLASSPATH_VALUE=
TEST_CLASSPATH_MANAGED=
# tag:java-specific
-DEPENDENCY_MANAGEMENT_VALUE=
+DEPENDENCY_MANAGEMENT_VALUE=
### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
###
### Lock version of the library from the contrib/java at some point, so that all unversioned PEERDIRs to this library refer to the specified version.
@@ -4773,8 +4773,8 @@ DEPENDENCY_MANAGEMENT_VALUE=
macro DEPENDENCY_MANAGEMENT(Args...) {
SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
_GHOST_PEERDIR($Args)
-}
-
+}
+
# tag:java-specific
WITH_JDK_VALUE=
### @usage: WITH_JDK()
@@ -4921,8 +4921,8 @@ module _JAVA_PLACEHOLDER: _BASE_UNIT {
DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java-util EXCEPT contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
SET(MODULE_LANG JAVA)
-}
-
+}
+
# tag:java-specific
JAVA_CLASSPATH_CMD_TYPE_VALUE=
@@ -7113,7 +7113,7 @@ when ($MSVC == "yes") {
otherwise {
C_AS_CXX_FLAGS=-x c++ -std=c++17
}
-
+
# tag:cpp-specific
### @usage: COMPILE_C_AS_CXX()
###
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index b5f9ae5655..30219eb85e 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -55,7 +55,7 @@ class Platform(object):
self.is_intel = self.is_x86 or self.is_x86_64
self.is_armv7 = self.arch in ('armv7', 'armv7a', 'armv7a_neon', 'arm', 'armv7a_cortex_a9', 'armv7ahf_cortex_a35', 'armv7ahf_cortex_a53')
- self.is_armv8 = self.arch in ('armv8', 'armv8a', 'arm64', 'aarch64', 'armv8a_cortex_a35', 'armv8a_cortex_a53')
+ self.is_armv8 = self.arch in ('armv8', 'armv8a', 'arm64', 'aarch64', 'armv8a_cortex_a35', 'armv8a_cortex_a53')
self.is_armv8m = self.arch in ('armv8m_cortex_m33',)
self.is_arm64 = self.arch in ('arm64',)
self.is_arm = self.is_armv7 or self.is_armv8 or self.is_armv8m
@@ -70,10 +70,10 @@ class Platform(object):
self.armv7_float_abi = 'softfp'
self.is_cortex_a9 = self.arch in ('armv7a_cortex_a9',)
- self.is_cortex_a35 = self.arch in ('armv7ahf_cortex_a35', 'armv8a_cortex_a35')
- self.is_cortex_a53 = self.arch in ('armv7ahf_cortex_a53', 'armv8a_cortex_a53')
+ self.is_cortex_a35 = self.arch in ('armv7ahf_cortex_a35', 'armv8a_cortex_a35')
+ self.is_cortex_a53 = self.arch in ('armv7ahf_cortex_a53', 'armv8a_cortex_a53')
self.is_cortex_m33 = self.arch in ('armv8m_cortex_m33',)
-
+
self.is_power8le = self.arch == 'ppc64le'
self.is_power9le = self.arch == 'power9le'
self.is_powerpc = self.is_power8le or self.is_power9le
@@ -150,7 +150,7 @@ class Platform(object):
(self.is_i686, 'ARCH_I686'),
(self.is_x86_64, 'ARCH_X86_64'),
(self.is_armv7, 'ARCH_ARM7'),
- (self.is_armv7_neon, 'ARCH_ARM7_NEON'),
+ (self.is_armv7_neon, 'ARCH_ARM7_NEON'),
(self.is_armv8, 'ARCH_ARM64'),
(self.is_armv8m, 'ARCH_ARM8M'),
(self.is_arm, 'ARCH_ARM'),
@@ -783,7 +783,7 @@ when (($USEMPROF == "yes") || ($USE_MPROF == "yes")) {
for variable in self.platform.os_variables:
emit(variable, 'yes')
-
+
if self.platform.is_armv7:
emit('ARM7_FLOAT_ABI', self.platform.armv7_float_abi)
@@ -796,7 +796,7 @@ when (($USEMPROF == "yes") || ($USE_MPROF == "yes")) {
self.print_linux_const()
elif self.platform.is_windows:
self.print_windows_target_const()
-
+
def print_host_settings(self):
emit('HOST_PLATFORM', self.platform.os_compat)
if not self.platform.is_windows:
@@ -1168,13 +1168,13 @@ class GnuToolchain(Toolchain):
(target.is_apple and target.is_x86_64, 'x86_64-apple-darwin14'),
(target.is_apple and target.is_macos_arm64, 'arm64-apple-macos11'),
(target.is_apple and target.is_armv7, 'armv7-apple-darwin14'),
- (target.is_apple and target.is_armv8, 'arm64-apple-darwin14'),
+ (target.is_apple and target.is_armv8, 'arm64-apple-darwin14'),
(target.is_yocto and target.is_armv7, 'arm-poky-linux-gnueabi'),
(target.is_android and target.is_x86, 'i686-linux-android'),
(target.is_android and target.is_x86_64, 'x86_64-linux-android'),
(target.is_android and target.is_armv7, 'armv7a-linux-androideabi'),
(target.is_android and target.is_armv8, 'aarch64-linux-android'),
- ])
+ ])
if target.is_android:
# Android NDK allows specification of API level in target triple, e.g.:
@@ -1194,18 +1194,18 @@ class GnuToolchain(Toolchain):
if target.is_cortex_a9:
self.c_flags_platform.append('-mcpu=cortex-a9')
- if target.is_cortex_a35:
- self.c_flags_platform.append('-mcpu=cortex-a35')
-
- elif target.is_cortex_a53:
- self.c_flags_platform.append('-mcpu=cortex-a53')
-
+ if target.is_cortex_a35:
+ self.c_flags_platform.append('-mcpu=cortex-a35')
+
+ elif target.is_cortex_a53:
+ self.c_flags_platform.append('-mcpu=cortex-a53')
+
elif target.is_cortex_m33:
self.c_flags_platform.append('-mcpu=cortex-m33 -mfpu=fpv5-sp-d16')
- elif target.is_armv7_neon:
- self.c_flags_platform.append('-mfpu=neon')
-
+ elif target.is_armv7_neon:
+ self.c_flags_platform.append('-mfpu=neon')
+
if (target.is_armv7 or target.is_armv8m) and build.is_size_optimized:
# Enable ARM Thumb2 variable-length instruction encoding
# to reduce code size
diff --git a/contrib/libs/grpc/LICENSE b/contrib/libs/grpc/LICENSE
index 75139cb498..d645695673 100644
--- a/contrib/libs/grpc/LICENSE
+++ b/contrib/libs/grpc/LICENSE
@@ -1,10 +1,10 @@
-
+
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,
diff --git a/contrib/libs/grpc/include/grpc++/alarm.h b/contrib/libs/grpc/include/grpc++/alarm.h
index c00fb2e817..dce742ee88 100644
--- a/contrib/libs/grpc/include/grpc++/alarm.h
+++ b/contrib/libs/grpc/include/grpc++/alarm.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_ALARM_H
-#define GRPCXX_ALARM_H
-
+#ifndef GRPCXX_ALARM_H
+#define GRPCXX_ALARM_H
+
#include <grpcpp/alarm.h>
-
-#endif // GRPCXX_ALARM_H
+
+#endif // GRPCXX_ALARM_H
diff --git a/contrib/libs/grpc/include/grpc++/channel.h b/contrib/libs/grpc/include/grpc++/channel.h
index 634b88f59f..b1154cefb3 100644
--- a/contrib/libs/grpc/include/grpc++/channel.h
+++ b/contrib/libs/grpc/include/grpc++/channel.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_CHANNEL_H
-#define GRPCXX_CHANNEL_H
-
+#ifndef GRPCXX_CHANNEL_H
+#define GRPCXX_CHANNEL_H
+
#include <grpcpp/channel.h>
-
-#endif // GRPCXX_CHANNEL_H
+
+#endif // GRPCXX_CHANNEL_H
diff --git a/contrib/libs/grpc/include/grpc++/client_context.h b/contrib/libs/grpc/include/grpc++/client_context.h
index 50e680d48b..4b23644059 100644
--- a/contrib/libs/grpc/include/grpc++/client_context.h
+++ b/contrib/libs/grpc/include/grpc++/client_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-
-#ifndef GRPCXX_CLIENT_CONTEXT_H
-#define GRPCXX_CLIENT_CONTEXT_H
-
+
+#ifndef GRPCXX_CLIENT_CONTEXT_H
+#define GRPCXX_CLIENT_CONTEXT_H
+
#include <grpcpp/client_context.h>
-
-#endif // GRPCXX_CLIENT_CONTEXT_H
+
+#endif // GRPCXX_CLIENT_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/completion_queue.h b/contrib/libs/grpc/include/grpc++/completion_queue.h
index fb3e14300a..98ef18f0f6 100644
--- a/contrib/libs/grpc/include/grpc++/completion_queue.h
+++ b/contrib/libs/grpc/include/grpc++/completion_queue.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_COMPLETION_QUEUE_H
-#define GRPCXX_COMPLETION_QUEUE_H
-
+#ifndef GRPCXX_COMPLETION_QUEUE_H
+#define GRPCXX_COMPLETION_QUEUE_H
+
#include <grpcpp/completion_queue.h>
-
-#endif // GRPCXX_COMPLETION_QUEUE_H
+
+#endif // GRPCXX_COMPLETION_QUEUE_H
diff --git a/contrib/libs/grpc/include/grpc++/create_channel.h b/contrib/libs/grpc/include/grpc++/create_channel.h
index 41f3687c9c..d95f3a9797 100644
--- a/contrib/libs/grpc/include/grpc++/create_channel.h
+++ b/contrib/libs/grpc/include/grpc++/create_channel.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_CREATE_CHANNEL_H
-#define GRPCXX_CREATE_CHANNEL_H
-
+#ifndef GRPCXX_CREATE_CHANNEL_H
+#define GRPCXX_CREATE_CHANNEL_H
+
#include <grpcpp/create_channel.h>
-
-#endif // GRPCXX_CREATE_CHANNEL_H
+
+#endif // GRPCXX_CREATE_CHANNEL_H
diff --git a/contrib/libs/grpc/include/grpc++/create_channel_posix.h b/contrib/libs/grpc/include/grpc++/create_channel_posix.h
index 89d32db7e1..8c8983ba60 100644
--- a/contrib/libs/grpc/include/grpc++/create_channel_posix.h
+++ b/contrib/libs/grpc/include/grpc++/create_channel_posix.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_CREATE_CHANNEL_POSIX_H
-#define GRPCXX_CREATE_CHANNEL_POSIX_H
-
+#ifndef GRPCXX_CREATE_CHANNEL_POSIX_H
+#define GRPCXX_CREATE_CHANNEL_POSIX_H
+
#include <grpcpp/create_channel_posix.h>
-
-#endif // GRPCXX_CREATE_CHANNEL_POSIX_H
+
+#endif // GRPCXX_CREATE_CHANNEL_POSIX_H
diff --git a/contrib/libs/grpc/include/grpc++/ext/proto_server_reflection_plugin.h b/contrib/libs/grpc/include/grpc++/ext/proto_server_reflection_plugin.h
index cf0d803fd6..02e21b9219 100644
--- a/contrib/libs/grpc/include/grpc++/ext/proto_server_reflection_plugin.h
+++ b/contrib/libs/grpc/include/grpc++/ext/proto_server_reflection_plugin.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
-#define GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
-
+#ifndef GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
+#define GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
+
#include <grpcpp/ext/proto_server_reflection_plugin.h>
-
-#endif // GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
+
+#endif // GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
diff --git a/contrib/libs/grpc/include/grpc++/generic/async_generic_service.h b/contrib/libs/grpc/include/grpc++/generic/async_generic_service.h
index 7b540315d0..d3283fac6f 100644
--- a/contrib/libs/grpc/include/grpc++/generic/async_generic_service.h
+++ b/contrib/libs/grpc/include/grpc++/generic/async_generic_service.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
-#define GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
-
+#ifndef GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
+#define GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
+
#include <grpcpp/generic/async_generic_service.h>
-
-#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
+
+#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
diff --git a/contrib/libs/grpc/include/grpc++/generic/generic_stub.h b/contrib/libs/grpc/include/grpc++/generic/generic_stub.h
index a7af497d47..502953b5de 100644
--- a/contrib/libs/grpc/include/grpc++/generic/generic_stub.h
+++ b/contrib/libs/grpc/include/grpc++/generic/generic_stub.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_GENERIC_GENERIC_STUB_H
-#define GRPCXX_GENERIC_GENERIC_STUB_H
-
+#ifndef GRPCXX_GENERIC_GENERIC_STUB_H
+#define GRPCXX_GENERIC_GENERIC_STUB_H
+
#include <grpcpp/generic/generic_stub.h>
-
-#endif // GRPCXX_GENERIC_GENERIC_STUB_H
+
+#endif // GRPCXX_GENERIC_GENERIC_STUB_H
diff --git a/contrib/libs/grpc/include/grpc++/grpc++.h b/contrib/libs/grpc/include/grpc++/grpc++.h
index 13e865a132..9f1d7b1bc1 100644
--- a/contrib/libs/grpc/include/grpc++/grpc++.h
+++ b/contrib/libs/grpc/include/grpc++/grpc++.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-
-#ifndef GRPCXX_GRPCXX_H
-#define GRPCXX_GRPCXX_H
-
+
+#ifndef GRPCXX_GRPCXX_H
+#define GRPCXX_GRPCXX_H
+
#include <grpcpp/grpcpp.h>
-
-#endif // GRPCXX_GRPCXX_H
+
+#endif // GRPCXX_GRPCXX_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/call.h b/contrib/libs/grpc/include/grpc++/impl/call.h
index c20cc0ec53..b1da2b6358 100644
--- a/contrib/libs/grpc/include/grpc++/impl/call.h
+++ b/contrib/libs/grpc/include/grpc++/impl/call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CALL_H
-#define GRPCXX_IMPL_CALL_H
-
+#ifndef GRPCXX_IMPL_CALL_H
+#define GRPCXX_IMPL_CALL_H
+
#include <grpcpp/impl/call.h>
-
-#endif // GRPCXX_IMPL_CALL_H
+
+#endif // GRPCXX_IMPL_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/client_unary_call.h b/contrib/libs/grpc/include/grpc++/impl/client_unary_call.h
index 74d053ba8a..75e656071f 100644
--- a/contrib/libs/grpc/include/grpc++/impl/client_unary_call.h
+++ b/contrib/libs/grpc/include/grpc++/impl/client_unary_call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H
-#define GRPCXX_IMPL_CLIENT_UNARY_CALL_H
-
+#ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H
+#define GRPCXX_IMPL_CLIENT_UNARY_CALL_H
+
#include <grpcpp/impl/client_unary_call.h>
-
-#endif // GRPCXX_IMPL_CLIENT_UNARY_CALL_H
+
+#endif // GRPCXX_IMPL_CLIENT_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/async_stream.h b/contrib/libs/grpc/include/grpc++/impl/codegen/async_stream.h
index 052b7d553b..a034470a70 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/async_stream.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/async_stream.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
-#define GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
+#define GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
+
#include <grpcpp/impl/codegen/async_stream.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
+
+#endif // GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/async_unary_call.h b/contrib/libs/grpc/include/grpc++/impl/codegen/async_unary_call.h
index 668e1c688a..2b08920a30 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/async_unary_call.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/async_unary_call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
-#define GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
+#define GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
+
#include <grpcpp/impl/codegen/async_unary_call.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
+
+#endif // GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/call.h b/contrib/libs/grpc/include/grpc++/impl/codegen/call.h
index 4b1f362f40..dadab5454a 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/call.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CALL_H
-#define GRPCXX_IMPL_CODEGEN_CALL_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CALL_H
+#define GRPCXX_IMPL_CODEGEN_CALL_H
+
#include <grpcpp/impl/codegen/call.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CALL_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/call_hook.h b/contrib/libs/grpc/include/grpc++/impl/codegen/call_hook.h
index c3ba7b2d81..cf5ed571b2 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/call_hook.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/call_hook.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
-#define GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
+#define GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
+
#include <grpcpp/impl/codegen/call_hook.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CALL_HOOK_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/channel_interface.h b/contrib/libs/grpc/include/grpc++/impl/codegen/channel_interface.h
index b28652c4b1..c6e782e9c4 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/channel_interface.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/channel_interface.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
-#define GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
+#define GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
+
#include <grpcpp/impl/codegen/channel_interface.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/client_context.h b/contrib/libs/grpc/include/grpc++/impl/codegen/client_context.h
index d73fe9f9e6..107532cb6b 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/client_context.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/client_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-
-#ifndef GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
-#define GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
-
+
+#ifndef GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
+#define GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
+
#include <grpcpp/impl/codegen/client_context.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/client_unary_call.h b/contrib/libs/grpc/include/grpc++/impl/codegen/client_unary_call.h
index b13460bd49..f7dff1f1f0 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/client_unary_call.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/client_unary_call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
-#define GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
+#define GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
+
#include <grpcpp/impl/codegen/client_unary_call.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue.h b/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue.h
index eceaa44496..107549550b 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
-#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
+#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
+
#include <grpcpp/impl/codegen/completion_queue.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
+
+#endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue_tag.h b/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue_tag.h
index 8bbae31453..994fa2a904 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue_tag.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/completion_queue_tag.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
-#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
+#define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
+
#include <grpcpp/impl/codegen/completion_queue_tag.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
+
+#endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/config.h b/contrib/libs/grpc/include/grpc++/impl/codegen/config.h
index 0cd1f12ea1..237bf38d3e 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/config.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/config.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H
-#define GRPCXX_IMPL_CODEGEN_CONFIG_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H
+#define GRPCXX_IMPL_CODEGEN_CONFIG_H
+
#include <grpcpp/impl/codegen/config.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CONFIG_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CONFIG_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/config_protobuf.h b/contrib/libs/grpc/include/grpc++/impl/codegen/config_protobuf.h
index 05688e5a4e..debd74aae7 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/config_protobuf.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/config_protobuf.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
-#define GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
+#define GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
+
#include <grpcpp/impl/codegen/config_protobuf.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CONFIG_PROTOBUF_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen.h b/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen.h
index 910a778c08..ee600a9d12 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
-#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
+#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
+
#include <grpcpp/impl/codegen/core_codegen.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen_interface.h b/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen_interface.h
index b79b712003..03b3f675e1 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen_interface.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/core_codegen_interface.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
-#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
+#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
+
#include <grpcpp/impl/codegen/core_codegen_interface.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/create_auth_context.h b/contrib/libs/grpc/include/grpc++/impl/codegen/create_auth_context.h
index e5371f5ff9..ef89229f4d 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/create_auth_context.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/create_auth_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
-#define GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
+#define GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
+
#include <grpcpp/impl/codegen/create_auth_context.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
+
+#endif // GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/grpc_library.h b/contrib/libs/grpc/include/grpc++/impl/codegen/grpc_library.h
index 7844937b52..33c3e2546c 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/grpc_library.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/grpc_library.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
-#define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
+#define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
+
#include <grpcpp/impl/codegen/grpc_library.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
+
+#endif // GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/method_handler_impl.h b/contrib/libs/grpc/include/grpc++/impl/codegen/method_handler_impl.h
index 88fb0a6295..82654eb04b 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/method_handler_impl.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/method_handler_impl.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
-#define GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
+#define GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
+
#include <grpcpp/impl/codegen/method_handler.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
+
+#endif // GRPCXX_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/proto_utils.h b/contrib/libs/grpc/include/grpc++/impl/codegen/proto_utils.h
index f0525488ea..1f47884abc 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/proto_utils.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/proto_utils.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
-#define GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
+#define GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
+
#include <grpcpp/impl/codegen/proto_utils.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
+
+#endif // GRPCXX_IMPL_CODEGEN_PROTO_UTILS_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_method.h b/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_method.h
index adb3a055a4..2906c74dda 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_method.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_method.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
-#define GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
+#define GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
+
#include <grpcpp/impl/codegen/rpc_method.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
+
+#endif // GRPCXX_IMPL_CODEGEN_RPC_METHOD_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_service_method.h b/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_service_method.h
index eb67f3f6b6..999c0d5e93 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_service_method.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/rpc_service_method.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
-#define GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
+#define GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
+
#include <grpcpp/impl/codegen/rpc_service_method.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
+
+#endif // GRPCXX_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/security/auth_context.h b/contrib/libs/grpc/include/grpc++/impl/codegen/security/auth_context.h
index e6d5909067..b4663739a6 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/security/auth_context.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/security/auth_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
-#define GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+#define GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+
#include <grpcpp/impl/codegen/security/auth_context.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/serialization_traits.h b/contrib/libs/grpc/include/grpc++/impl/codegen/serialization_traits.h
index 970b92fb3b..480575d109 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/serialization_traits.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/serialization_traits.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
-#define GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
+#define GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
+
#include <grpcpp/impl/codegen/serialization_traits.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/server_context.h b/contrib/libs/grpc/include/grpc++/impl/codegen/server_context.h
index 1414139d4b..1c3342d5d4 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/server_context.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/server_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
-#define GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
+#define GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
+
#include <grpcpp/impl/codegen/server_context.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/server_interface.h b/contrib/libs/grpc/include/grpc++/impl/codegen/server_interface.h
index 52aecbccfb..ceea44c50c 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/server_interface.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/server_interface.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
-#define GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
+#define GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
+
#include <grpcpp/impl/codegen/server_interface.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/service_type.h b/contrib/libs/grpc/include/grpc++/impl/codegen/service_type.h
index ed087e417b..be02b75bae 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/service_type.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/service_type.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
-#define GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
+#define GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
+
#include <grpcpp/impl/codegen/service_type.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SERVICE_TYPE_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/status.h b/contrib/libs/grpc/include/grpc++/impl/codegen/status.h
index cf7f84e4d3..6cf9459fff 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/status.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/status.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_STATUS_H
-#define GRPCXX_IMPL_CODEGEN_STATUS_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_STATUS_H
+#define GRPCXX_IMPL_CODEGEN_STATUS_H
+
#include <grpcpp/impl/codegen/status.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_STATUS_H
+
+#endif // GRPCXX_IMPL_CODEGEN_STATUS_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/status_code_enum.h b/contrib/libs/grpc/include/grpc++/impl/codegen/status_code_enum.h
index 46278ae69f..7503eaeeca 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/status_code_enum.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/status_code_enum.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
-#define GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
+#define GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
+
#include <grpcpp/impl/codegen/status_code_enum.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
+
+#endif // GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/string_ref.h b/contrib/libs/grpc/include/grpc++/impl/codegen/string_ref.h
index 946407b2b5..66e250efdd 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/string_ref.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/string_ref.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_STRING_REF_H
-#define GRPCXX_IMPL_CODEGEN_STRING_REF_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_STRING_REF_H
+#define GRPCXX_IMPL_CODEGEN_STRING_REF_H
+
#include <grpcpp/impl/codegen/string_ref.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_STRING_REF_H
+
+#endif // GRPCXX_IMPL_CODEGEN_STRING_REF_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/stub_options.h b/contrib/libs/grpc/include/grpc++/impl/codegen/stub_options.h
index 53b8a8d9d5..07cb4417b7 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/stub_options.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/stub_options.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
-#define GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
+#define GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
+
#include <grpcpp/impl/codegen/stub_options.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
+
+#endif // GRPCXX_IMPL_CODEGEN_STUB_OPTIONS_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/sync_stream.h b/contrib/libs/grpc/include/grpc++/impl/codegen/sync_stream.h
index 21a6e5caf4..1e6ba27bf5 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/sync_stream.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/sync_stream.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
-#define GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
+#define GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
+
#include <grpcpp/impl/codegen/sync_stream.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
+
+#endif // GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/codegen/time.h b/contrib/libs/grpc/include/grpc++/impl/codegen/time.h
index 9a35730e2b..f9b70f8313 100644
--- a/contrib/libs/grpc/include/grpc++/impl/codegen/time.h
+++ b/contrib/libs/grpc/include/grpc++/impl/codegen/time.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_CODEGEN_TIME_H
-#define GRPCXX_IMPL_CODEGEN_TIME_H
-
+#ifndef GRPCXX_IMPL_CODEGEN_TIME_H
+#define GRPCXX_IMPL_CODEGEN_TIME_H
+
#include <grpcpp/impl/codegen/time.h>
-
-#endif // GRPCXX_IMPL_CODEGEN_TIME_H
+
+#endif // GRPCXX_IMPL_CODEGEN_TIME_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/grpc_library.h b/contrib/libs/grpc/include/grpc++/impl/grpc_library.h
index 34a3502df2..f34a281ac3 100644
--- a/contrib/libs/grpc/include/grpc++/impl/grpc_library.h
+++ b/contrib/libs/grpc/include/grpc++/impl/grpc_library.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_GRPC_LIBRARY_H
-#define GRPCXX_IMPL_GRPC_LIBRARY_H
-
+#ifndef GRPCXX_IMPL_GRPC_LIBRARY_H
+#define GRPCXX_IMPL_GRPC_LIBRARY_H
+
#include <grpcpp/impl/grpc_library.h>
-
-#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
+
+#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/method_handler_impl.h b/contrib/libs/grpc/include/grpc++/impl/method_handler_impl.h
index 590005bcb0..3840f48742 100644
--- a/contrib/libs/grpc/include/grpc++/impl/method_handler_impl.h
+++ b/contrib/libs/grpc/include/grpc++/impl/method_handler_impl.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
-#define GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
-
+#ifndef GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
+#define GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
+
#include <grpcpp/impl/method_handler_impl.h>
-
-#endif // GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
+
+#endif // GRPCXX_IMPL_METHOD_HANDLER_IMPL_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/rpc_method.h b/contrib/libs/grpc/include/grpc++/impl/rpc_method.h
index 1da91c5d37..7cba7c40c4 100644
--- a/contrib/libs/grpc/include/grpc++/impl/rpc_method.h
+++ b/contrib/libs/grpc/include/grpc++/impl/rpc_method.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_RPC_METHOD_H
-#define GRPCXX_IMPL_RPC_METHOD_H
-
+#ifndef GRPCXX_IMPL_RPC_METHOD_H
+#define GRPCXX_IMPL_RPC_METHOD_H
+
#include <grpcpp/impl/rpc_method.h>
-
-#endif // GRPCXX_IMPL_RPC_METHOD_H
+
+#endif // GRPCXX_IMPL_RPC_METHOD_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/rpc_service_method.h b/contrib/libs/grpc/include/grpc++/impl/rpc_service_method.h
index e231d12662..2c75087b7c 100644
--- a/contrib/libs/grpc/include/grpc++/impl/rpc_service_method.h
+++ b/contrib/libs/grpc/include/grpc++/impl/rpc_service_method.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H
-#define GRPCXX_IMPL_RPC_SERVICE_METHOD_H
-
+#ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H
+#define GRPCXX_IMPL_RPC_SERVICE_METHOD_H
+
#include <grpcpp/impl/rpc_service_method.h>
-
-#endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H
+
+#endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/serialization_traits.h b/contrib/libs/grpc/include/grpc++/impl/serialization_traits.h
index 9ca194d561..33b3a0bb31 100644
--- a/contrib/libs/grpc/include/grpc++/impl/serialization_traits.h
+++ b/contrib/libs/grpc/include/grpc++/impl/serialization_traits.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_SERIALIZATION_TRAITS_H
-#define GRPCXX_IMPL_SERIALIZATION_TRAITS_H
-
+#ifndef GRPCXX_IMPL_SERIALIZATION_TRAITS_H
+#define GRPCXX_IMPL_SERIALIZATION_TRAITS_H
+
#include <grpcpp/impl/serialization_traits.h>
-
-#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H
+
+#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/server_builder_option.h b/contrib/libs/grpc/include/grpc++/impl/server_builder_option.h
index 6bc8382edc..833f8db772 100644
--- a/contrib/libs/grpc/include/grpc++/impl/server_builder_option.h
+++ b/contrib/libs/grpc/include/grpc++/impl/server_builder_option.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
-#define GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
-
+#ifndef GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
+#define GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
+
#include <grpcpp/impl/server_builder_option.h>
-
-#endif // GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
+
+#endif // GRPCXX_IMPL_SERVER_BUILDER_OPTION_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/server_builder_plugin.h b/contrib/libs/grpc/include/grpc++/impl/server_builder_plugin.h
index 426e4eed50..844d32c55f 100644
--- a/contrib/libs/grpc/include/grpc++/impl/server_builder_plugin.h
+++ b/contrib/libs/grpc/include/grpc++/impl/server_builder_plugin.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
-#define GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
-
+#ifndef GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
+#define GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
+
#include <grpcpp/impl/server_builder_plugin.h>
-
-#endif // GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
+
+#endif // GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/server_initializer.h b/contrib/libs/grpc/include/grpc++/impl/server_initializer.h
index 7bae991c05..6a1669ccf5 100644
--- a/contrib/libs/grpc/include/grpc++/impl/server_initializer.h
+++ b/contrib/libs/grpc/include/grpc++/impl/server_initializer.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_SERVER_INITIALIZER_H
-#define GRPCXX_IMPL_SERVER_INITIALIZER_H
-
+#ifndef GRPCXX_IMPL_SERVER_INITIALIZER_H
+#define GRPCXX_IMPL_SERVER_INITIALIZER_H
+
#include <grpcpp/impl/server_initializer.h>
-
-#endif // GRPCXX_IMPL_SERVER_INITIALIZER_H
+
+#endif // GRPCXX_IMPL_SERVER_INITIALIZER_H
diff --git a/contrib/libs/grpc/include/grpc++/impl/service_type.h b/contrib/libs/grpc/include/grpc++/impl/service_type.h
index 6acad37db2..86422160d4 100644
--- a/contrib/libs/grpc/include/grpc++/impl/service_type.h
+++ b/contrib/libs/grpc/include/grpc++/impl/service_type.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_IMPL_SERVICE_TYPE_H
-#define GRPCXX_IMPL_SERVICE_TYPE_H
-
+#ifndef GRPCXX_IMPL_SERVICE_TYPE_H
+#define GRPCXX_IMPL_SERVICE_TYPE_H
+
#include <grpcpp/impl/service_type.h>
-
-#endif // GRPCXX_IMPL_SERVICE_TYPE_H
+
+#endif // GRPCXX_IMPL_SERVICE_TYPE_H
diff --git a/contrib/libs/grpc/include/grpc++/resource_quota.h b/contrib/libs/grpc/include/grpc++/resource_quota.h
index 4251a5dbf1..aad1b5659f 100644
--- a/contrib/libs/grpc/include/grpc++/resource_quota.h
+++ b/contrib/libs/grpc/include/grpc++/resource_quota.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_RESOURCE_QUOTA_H
-#define GRPCXX_RESOURCE_QUOTA_H
-
+#ifndef GRPCXX_RESOURCE_QUOTA_H
+#define GRPCXX_RESOURCE_QUOTA_H
+
#include <grpcpp/resource_quota.h>
-
-#endif // GRPCXX_RESOURCE_QUOTA_H
+
+#endif // GRPCXX_RESOURCE_QUOTA_H
diff --git a/contrib/libs/grpc/include/grpc++/security/auth_context.h b/contrib/libs/grpc/include/grpc++/security/auth_context.h
index b830a9bf68..9fe59d448e 100644
--- a/contrib/libs/grpc/include/grpc++/security/auth_context.h
+++ b/contrib/libs/grpc/include/grpc++/security/auth_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SECURITY_AUTH_CONTEXT_H
-#define GRPCXX_SECURITY_AUTH_CONTEXT_H
-
+#ifndef GRPCXX_SECURITY_AUTH_CONTEXT_H
+#define GRPCXX_SECURITY_AUTH_CONTEXT_H
+
#include <grpcpp/security/auth_context.h>
-
-#endif // GRPCXX_SECURITY_AUTH_CONTEXT_H
+
+#endif // GRPCXX_SECURITY_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/security/auth_metadata_processor.h b/contrib/libs/grpc/include/grpc++/security/auth_metadata_processor.h
index e51112cf2a..d045313965 100644
--- a/contrib/libs/grpc/include/grpc++/security/auth_metadata_processor.h
+++ b/contrib/libs/grpc/include/grpc++/security/auth_metadata_processor.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
-#define GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
-
+#ifndef GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
+#define GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
+
#include <grpcpp/security/auth_metadata_processor.h>
-
-#endif // GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
+
+#endif // GRPCXX_SECURITY_AUTH_METADATA_PROCESSOR_H
diff --git a/contrib/libs/grpc/include/grpc++/security/credentials.h b/contrib/libs/grpc/include/grpc++/security/credentials.h
index 1f4820b20a..940441827d 100644
--- a/contrib/libs/grpc/include/grpc++/security/credentials.h
+++ b/contrib/libs/grpc/include/grpc++/security/credentials.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SECURITY_CREDENTIALS_H
-#define GRPCXX_SECURITY_CREDENTIALS_H
-
+#ifndef GRPCXX_SECURITY_CREDENTIALS_H
+#define GRPCXX_SECURITY_CREDENTIALS_H
+
#include <grpcpp/security/credentials.h>
-
-#endif // GRPCXX_SECURITY_CREDENTIALS_H
+
+#endif // GRPCXX_SECURITY_CREDENTIALS_H
diff --git a/contrib/libs/grpc/include/grpc++/security/server_credentials.h b/contrib/libs/grpc/include/grpc++/security/server_credentials.h
index 5b7db478f4..c6d1c4f0e4 100644
--- a/contrib/libs/grpc/include/grpc++/security/server_credentials.h
+++ b/contrib/libs/grpc/include/grpc++/security/server_credentials.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SECURITY_SERVER_CREDENTIALS_H
-#define GRPCXX_SECURITY_SERVER_CREDENTIALS_H
-
+#ifndef GRPCXX_SECURITY_SERVER_CREDENTIALS_H
+#define GRPCXX_SECURITY_SERVER_CREDENTIALS_H
+
#include <grpcpp/security/server_credentials.h>
-
-#endif // GRPCXX_SECURITY_SERVER_CREDENTIALS_H
+
+#endif // GRPCXX_SECURITY_SERVER_CREDENTIALS_H
diff --git a/contrib/libs/grpc/include/grpc++/server.h b/contrib/libs/grpc/include/grpc++/server.h
index f2573d28d3..086c24cc69 100644
--- a/contrib/libs/grpc/include/grpc++/server.h
+++ b/contrib/libs/grpc/include/grpc++/server.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SERVER_H
-#define GRPCXX_SERVER_H
-
+#ifndef GRPCXX_SERVER_H
+#define GRPCXX_SERVER_H
+
#include <grpcpp/server.h>
-
-#endif // GRPCXX_SERVER_H
+
+#endif // GRPCXX_SERVER_H
diff --git a/contrib/libs/grpc/include/grpc++/server_builder.h b/contrib/libs/grpc/include/grpc++/server_builder.h
index f891d4d1dd..2c6dab4445 100644
--- a/contrib/libs/grpc/include/grpc++/server_builder.h
+++ b/contrib/libs/grpc/include/grpc++/server_builder.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SERVER_BUILDER_H
-#define GRPCXX_SERVER_BUILDER_H
-
+#ifndef GRPCXX_SERVER_BUILDER_H
+#define GRPCXX_SERVER_BUILDER_H
+
#include <grpcpp/server_builder.h>
-
-#endif // GRPCXX_SERVER_BUILDER_H
+
+#endif // GRPCXX_SERVER_BUILDER_H
diff --git a/contrib/libs/grpc/include/grpc++/server_context.h b/contrib/libs/grpc/include/grpc++/server_context.h
index e6b165ede3..672ccdca6d 100644
--- a/contrib/libs/grpc/include/grpc++/server_context.h
+++ b/contrib/libs/grpc/include/grpc++/server_context.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SERVER_CONTEXT_H
-#define GRPCXX_SERVER_CONTEXT_H
-
+#ifndef GRPCXX_SERVER_CONTEXT_H
+#define GRPCXX_SERVER_CONTEXT_H
+
#include <grpcpp/server_context.h>
-
-#endif // GRPCXX_SERVER_CONTEXT_H
+
+#endif // GRPCXX_SERVER_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpc++/server_posix.h b/contrib/libs/grpc/include/grpc++/server_posix.h
index 3159f5cdad..d2866d9640 100644
--- a/contrib/libs/grpc/include/grpc++/server_posix.h
+++ b/contrib/libs/grpc/include/grpc++/server_posix.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SERVER_POSIX_H
-#define GRPCXX_SERVER_POSIX_H
-
+#ifndef GRPCXX_SERVER_POSIX_H
+#define GRPCXX_SERVER_POSIX_H
+
#include <grpcpp/server_posix.h>
-
-#endif // GRPCXX_SERVER_POSIX_H
+
+#endif // GRPCXX_SERVER_POSIX_H
diff --git a/contrib/libs/grpc/include/grpc++/support/async_stream.h b/contrib/libs/grpc/include/grpc++/support/async_stream.h
index 79bf15787a..9bb2b725c3 100644
--- a/contrib/libs/grpc/include/grpc++/support/async_stream.h
+++ b/contrib/libs/grpc/include/grpc++/support/async_stream.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_ASYNC_STREAM_H
-#define GRPCXX_SUPPORT_ASYNC_STREAM_H
-
+#ifndef GRPCXX_SUPPORT_ASYNC_STREAM_H
+#define GRPCXX_SUPPORT_ASYNC_STREAM_H
+
#include <grpcpp/support/async_stream.h>
-
-#endif // GRPCXX_SUPPORT_ASYNC_STREAM_H
+
+#endif // GRPCXX_SUPPORT_ASYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpc++/support/async_unary_call.h b/contrib/libs/grpc/include/grpc++/support/async_unary_call.h
index bca6c3950d..56fbf31417 100644
--- a/contrib/libs/grpc/include/grpc++/support/async_unary_call.h
+++ b/contrib/libs/grpc/include/grpc++/support/async_unary_call.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
-#define GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
-
+#ifndef GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
+#define GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
+
#include <grpcpp/support/async_unary_call.h>
-
-#endif // GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
+
+#endif // GRPCXX_SUPPORT_ASYNC_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpc++/support/byte_buffer.h b/contrib/libs/grpc/include/grpc++/support/byte_buffer.h
index e9676bc6ae..ec607ee01a 100644
--- a/contrib/libs/grpc/include/grpc++/support/byte_buffer.h
+++ b/contrib/libs/grpc/include/grpc++/support/byte_buffer.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_BYTE_BUFFER_H
-#define GRPCXX_SUPPORT_BYTE_BUFFER_H
-
+#ifndef GRPCXX_SUPPORT_BYTE_BUFFER_H
+#define GRPCXX_SUPPORT_BYTE_BUFFER_H
+
#include <grpcpp/support/byte_buffer.h>
-
-#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H
+
+#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H
diff --git a/contrib/libs/grpc/include/grpc++/support/channel_arguments.h b/contrib/libs/grpc/include/grpc++/support/channel_arguments.h
index f033f5bf01..6d5300ccb7 100644
--- a/contrib/libs/grpc/include/grpc++/support/channel_arguments.h
+++ b/contrib/libs/grpc/include/grpc++/support/channel_arguments.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
-#define GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
-
+#ifndef GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
+#define GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
+
#include <grpcpp/support/channel_arguments.h>
-
-#endif // GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
+
+#endif // GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H
diff --git a/contrib/libs/grpc/include/grpc++/support/config.h b/contrib/libs/grpc/include/grpc++/support/config.h
index 7951297265..f8eee5075a 100644
--- a/contrib/libs/grpc/include/grpc++/support/config.h
+++ b/contrib/libs/grpc/include/grpc++/support/config.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_CONFIG_H
-#define GRPCXX_SUPPORT_CONFIG_H
-
+#ifndef GRPCXX_SUPPORT_CONFIG_H
+#define GRPCXX_SUPPORT_CONFIG_H
+
#include <grpcpp/support/config.h>
-
-#endif // GRPCXX_SUPPORT_CONFIG_H
+
+#endif // GRPCXX_SUPPORT_CONFIG_H
diff --git a/contrib/libs/grpc/include/grpc++/support/slice.h b/contrib/libs/grpc/include/grpc++/support/slice.h
index 6119e56039..b02b1a977e 100644
--- a/contrib/libs/grpc/include/grpc++/support/slice.h
+++ b/contrib/libs/grpc/include/grpc++/support/slice.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_SLICE_H
-#define GRPCXX_SUPPORT_SLICE_H
-
+#ifndef GRPCXX_SUPPORT_SLICE_H
+#define GRPCXX_SUPPORT_SLICE_H
+
#include <grpcpp/support/slice.h>
-
-#endif // GRPCXX_SUPPORT_SLICE_H
+
+#endif // GRPCXX_SUPPORT_SLICE_H
diff --git a/contrib/libs/grpc/include/grpc++/support/status.h b/contrib/libs/grpc/include/grpc++/support/status.h
index f9269c98c6..e58a18bdf9 100644
--- a/contrib/libs/grpc/include/grpc++/support/status.h
+++ b/contrib/libs/grpc/include/grpc++/support/status.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_STATUS_H
-#define GRPCXX_SUPPORT_STATUS_H
-
+#ifndef GRPCXX_SUPPORT_STATUS_H
+#define GRPCXX_SUPPORT_STATUS_H
+
#include <grpcpp/support/status.h>
-
-#endif // GRPCXX_SUPPORT_STATUS_H
+
+#endif // GRPCXX_SUPPORT_STATUS_H
diff --git a/contrib/libs/grpc/include/grpc++/support/status_code_enum.h b/contrib/libs/grpc/include/grpc++/support/status_code_enum.h
index a81ee8ef6c..c278add0c6 100644
--- a/contrib/libs/grpc/include/grpc++/support/status_code_enum.h
+++ b/contrib/libs/grpc/include/grpc++/support/status_code_enum.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
-#define GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
-
+#ifndef GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
+#define GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
+
#include <grpcpp/support/status_code_enum.h>
-
-#endif // GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
+
+#endif // GRPCXX_SUPPORT_STATUS_CODE_ENUM_H
diff --git a/contrib/libs/grpc/include/grpc++/support/string_ref.h b/contrib/libs/grpc/include/grpc++/support/string_ref.h
index 92094ef46f..49de6dafce 100644
--- a/contrib/libs/grpc/include/grpc++/support/string_ref.h
+++ b/contrib/libs/grpc/include/grpc++/support/string_ref.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_STRING_REF_H
-#define GRPCXX_SUPPORT_STRING_REF_H
-
+#ifndef GRPCXX_SUPPORT_STRING_REF_H
+#define GRPCXX_SUPPORT_STRING_REF_H
+
#include <grpcpp/support/string_ref.h>
-
-#endif // GRPCXX_SUPPORT_STRING_REF_H
+
+#endif // GRPCXX_SUPPORT_STRING_REF_H
diff --git a/contrib/libs/grpc/include/grpc++/support/stub_options.h b/contrib/libs/grpc/include/grpc++/support/stub_options.h
index acad7aa0a6..a712ce8716 100644
--- a/contrib/libs/grpc/include/grpc++/support/stub_options.h
+++ b/contrib/libs/grpc/include/grpc++/support/stub_options.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_STUB_OPTIONS_H
-#define GRPCXX_SUPPORT_STUB_OPTIONS_H
-
+#ifndef GRPCXX_SUPPORT_STUB_OPTIONS_H
+#define GRPCXX_SUPPORT_STUB_OPTIONS_H
+
#include <grpcpp/support/stub_options.h>
-
-#endif // GRPCXX_SUPPORT_STUB_OPTIONS_H
+
+#endif // GRPCXX_SUPPORT_STUB_OPTIONS_H
diff --git a/contrib/libs/grpc/include/grpc++/support/sync_stream.h b/contrib/libs/grpc/include/grpc++/support/sync_stream.h
index 077118f6c1..c118df9f7b 100644
--- a/contrib/libs/grpc/include/grpc++/support/sync_stream.h
+++ b/contrib/libs/grpc/include/grpc++/support/sync_stream.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_SYNC_STREAM_H
-#define GRPCXX_SUPPORT_SYNC_STREAM_H
-
+#ifndef GRPCXX_SUPPORT_SYNC_STREAM_H
+#define GRPCXX_SUPPORT_SYNC_STREAM_H
+
#include <grpcpp/support/sync_stream.h>
-
-#endif // GRPCXX_SUPPORT_SYNC_STREAM_H
+
+#endif // GRPCXX_SUPPORT_SYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpc++/support/time.h b/contrib/libs/grpc/include/grpc++/support/time.h
index 7be1da7906..d356b91001 100644
--- a/contrib/libs/grpc/include/grpc++/support/time.h
+++ b/contrib/libs/grpc/include/grpc++/support/time.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_SUPPORT_TIME_H
-#define GRPCXX_SUPPORT_TIME_H
-
+#ifndef GRPCXX_SUPPORT_TIME_H
+#define GRPCXX_SUPPORT_TIME_H
+
#include <grpcpp/support/time.h>
-
-#endif // GRPCXX_SUPPORT_TIME_H
+
+#endif // GRPCXX_SUPPORT_TIME_H
diff --git a/contrib/libs/grpc/include/grpc++/test/server_context_test_spouse.h b/contrib/libs/grpc/include/grpc++/test/server_context_test_spouse.h
index 5b8fafe12c..48a4838c2d 100644
--- a/contrib/libs/grpc/include/grpc++/test/server_context_test_spouse.h
+++ b/contrib/libs/grpc/include/grpc++/test/server_context_test_spouse.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2018 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.
- *
- */
-
+ *
+ */
+
// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the
// headers in include/grpcpp instead. This header exists only for backwards
// compatibility.
-#ifndef GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
-#define GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
-
+#ifndef GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
+#define GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
+
#include <grpcpp/test/server_context_test_spouse.h>
-
-#endif // GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
+
+#endif // GRPCXX_TEST_SERVER_CONTEXT_TEST_SPOUSE_H
diff --git a/contrib/libs/grpc/include/grpc/byte_buffer.h b/contrib/libs/grpc/include/grpc/byte_buffer.h
index c50a93b9c2..ee740f4794 100644
--- a/contrib/libs/grpc/include/grpc/byte_buffer.h
+++ b/contrib/libs/grpc/include/grpc/byte_buffer.h
@@ -1,27 +1,27 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_BYTE_BUFFER_H
-#define GRPC_BYTE_BUFFER_H
-
+ *
+ */
+
+#ifndef GRPC_BYTE_BUFFER_H
+#define GRPC_BYTE_BUFFER_H
+
#include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/byte_buffer.h>
-#include <grpc/slice_buffer.h>
-
-#endif /* GRPC_BYTE_BUFFER_H */
+#include <grpc/slice_buffer.h>
+
+#endif /* GRPC_BYTE_BUFFER_H */
diff --git a/contrib/libs/grpc/include/grpc/byte_buffer_reader.h b/contrib/libs/grpc/include/grpc/byte_buffer_reader.h
index 94485b36b6..15e06cad7c 100644
--- a/contrib/libs/grpc/include/grpc/byte_buffer_reader.h
+++ b/contrib/libs/grpc/include/grpc/byte_buffer_reader.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_BYTE_BUFFER_READER_H
-#define GRPC_BYTE_BUFFER_READER_H
-
+ *
+ */
+
+#ifndef GRPC_BYTE_BUFFER_READER_H
+#define GRPC_BYTE_BUFFER_READER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/byte_buffer_reader.h>
-
-#endif /* GRPC_BYTE_BUFFER_READER_H */
+#include <grpc/impl/codegen/byte_buffer_reader.h>
+
+#endif /* GRPC_BYTE_BUFFER_READER_H */
diff --git a/contrib/libs/grpc/include/grpc/census.h b/contrib/libs/grpc/include/grpc/census.h
index 8dcde6603d..4894f1c096 100644
--- a/contrib/libs/grpc/include/grpc/census.h
+++ b/contrib/libs/grpc/include/grpc/census.h
@@ -1,40 +1,40 @@
-/*
- *
+/*
+ *
* Copyright 2015-2016 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.
- *
- */
-
-#ifndef GRPC_CENSUS_H
-#define GRPC_CENSUS_H
-
+ *
+ */
+
+#ifndef GRPC_CENSUS_H
+#define GRPC_CENSUS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- A Census Context is a handle used by Census to represent the current tracing
- and stats collection information. Contexts should be propagated across RPC's
+#include <grpc/grpc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ A Census Context is a handle used by Census to represent the current tracing
+ and stats collection information. Contexts should be propagated across RPC's
(this is the responsibility of the local RPC system). */
-typedef struct census_context census_context;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_CENSUS_H */
+typedef struct census_context census_context;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_CENSUS_H */
diff --git a/contrib/libs/grpc/include/grpc/compression.h b/contrib/libs/grpc/include/grpc/compression.h
index fa7f45d311..a4f6a8faf2 100644
--- a/contrib/libs/grpc/include/grpc/compression.h
+++ b/contrib/libs/grpc/include/grpc/compression.h
@@ -1,35 +1,35 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_COMPRESSION_H
-#define GRPC_COMPRESSION_H
-
+ *
+ */
+
+#ifndef GRPC_COMPRESSION_H
+#define GRPC_COMPRESSION_H
+
#include <grpc/impl/codegen/port_platform.h>
-#include <stdlib.h>
-
-#include <grpc/impl/codegen/compression_types.h>
+#include <stdlib.h>
+
+#include <grpc/impl/codegen/compression_types.h>
#include <grpc/slice.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Return if an algorithm is message compression algorithm. */
GRPCAPI int grpc_compression_algorithm_is_message(
grpc_compression_algorithm algorithm);
@@ -40,36 +40,36 @@ GRPCAPI int grpc_compression_algorithm_is_stream(
/** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
* algorithm. Returns 1 upon success, 0 otherwise. */
-GRPCAPI int grpc_compression_algorithm_parse(
+GRPCAPI int grpc_compression_algorithm_parse(
grpc_slice value, grpc_compression_algorithm* algorithm);
-
-/** Updates \a name with the encoding name corresponding to a valid \a
- * algorithm. Note that \a name is statically allocated and must *not* be freed.
- * Returns 1 upon success, 0 otherwise. */
-GRPCAPI int grpc_compression_algorithm_name(
+
+/** Updates \a name with the encoding name corresponding to a valid \a
+ * algorithm. Note that \a name is statically allocated and must *not* be freed.
+ * Returns 1 upon success, 0 otherwise. */
+GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, const char** name);
-
-/** Returns the compression algorithm corresponding to \a level for the
+
+/** Returns the compression algorithm corresponding to \a level for the
* compression algorithms encoded in the \a accepted_encodings bitset.*/
-GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(
- grpc_compression_level level, uint32_t accepted_encodings);
-
+GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(
+ grpc_compression_level level, uint32_t accepted_encodings);
+
GRPCAPI void grpc_compression_options_init(grpc_compression_options* opts);
-
-/** Mark \a algorithm as enabled in \a opts. */
-GRPCAPI void grpc_compression_options_enable_algorithm(
+
+/** Mark \a algorithm as enabled in \a opts. */
+GRPCAPI void grpc_compression_options_enable_algorithm(
grpc_compression_options* opts, grpc_compression_algorithm algorithm);
-
-/** Mark \a algorithm as disabled in \a opts. */
-GRPCAPI void grpc_compression_options_disable_algorithm(
+
+/** Mark \a algorithm as disabled in \a opts. */
+GRPCAPI void grpc_compression_options_disable_algorithm(
grpc_compression_options* opts, grpc_compression_algorithm algorithm);
-
-/** Returns true if \a algorithm is marked as enabled in \a opts. */
-GRPCAPI int grpc_compression_options_is_algorithm_enabled(
+
+/** Returns true if \a algorithm is marked as enabled in \a opts. */
+GRPCAPI int grpc_compression_options_is_algorithm_enabled(
const grpc_compression_options* opts, grpc_compression_algorithm algorithm);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_COMPRESSION_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_COMPRESSION_H */
diff --git a/contrib/libs/grpc/include/grpc/grpc.h b/contrib/libs/grpc/include/grpc/grpc.h
index 1f9f03c708..6001117521 100644
--- a/contrib/libs/grpc/include/grpc/grpc.h
+++ b/contrib/libs/grpc/include/grpc/grpc.h
@@ -1,78 +1,78 @@
-/*
- *
+/*
+ *
* Copyright 2015-2016 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.
- *
- */
-
-#ifndef GRPC_GRPC_H
-#define GRPC_GRPC_H
-
+ *
+ */
+
+#ifndef GRPC_GRPC_H
+#define GRPC_GRPC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/status.h>
-
-#include <grpc/byte_buffer.h>
-#include <grpc/impl/codegen/connectivity_state.h>
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/impl/codegen/propagation_bits.h>
-#include <grpc/slice.h>
-#include <grpc/support/time.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \mainpage GRPC Core
- *
- * The GRPC Core library is a low-level library designed to be wrapped by higher
- * level libraries. The top-level API is provided in grpc.h. Security related
- * functionality lives in grpc_security.h.
- */
-
+#include <grpc/status.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/impl/codegen/connectivity_state.h>
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/codegen/propagation_bits.h>
+#include <grpc/slice.h>
+#include <grpc/support/time.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! \mainpage GRPC Core
+ *
+ * The GRPC Core library is a low-level library designed to be wrapped by higher
+ * level libraries. The top-level API is provided in grpc.h. Security related
+ * functionality lives in grpc_security.h.
+ */
+
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array* array);
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array* array);
-
+
GRPCAPI void grpc_call_details_init(grpc_call_details* details);
GRPCAPI void grpc_call_details_destroy(grpc_call_details* details);
-
-/** Registers a plugin to be initialized and destroyed with the library.
-
- The \a init and \a destroy functions will be invoked as part of
- \a grpc_init() and \a grpc_shutdown(), respectively.
- Note that these functions can be invoked an arbitrary number of times
- (and hence so will \a init and \a destroy).
- It is safe to pass NULL to either argument. Plugins are destroyed in
- the reverse order they were initialized. */
-GRPCAPI void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
-
+
+/** Registers a plugin to be initialized and destroyed with the library.
+
+ The \a init and \a destroy functions will be invoked as part of
+ \a grpc_init() and \a grpc_shutdown(), respectively.
+ Note that these functions can be invoked an arbitrary number of times
+ (and hence so will \a init and \a destroy).
+ It is safe to pass NULL to either argument. Plugins are destroyed in
+ the reverse order they were initialized. */
+GRPCAPI void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
+
GRPCAPI void grpc_init_openssl(void);
GRPCAPI void grpc_dont_init_openssl(void);
-/** Initialize the grpc library.
-
+/** Initialize the grpc library.
+
After it's called, a matching invocation to grpc_shutdown() is expected.
- It is not safe to call any other grpc functions before calling this.
- (To avoid overhead, little checking is done, and some things may work. We
- do not warrant that they will continue to do so in future revisions of this
- library). */
-GRPCAPI void grpc_init(void);
-
-/** Shut down the grpc library.
-
+ It is not safe to call any other grpc functions before calling this.
+ (To avoid overhead, little checking is done, and some things may work. We
+ do not warrant that they will continue to do so in future revisions of this
+ library). */
+GRPCAPI void grpc_init(void);
+
+/** Shut down the grpc library.
+
Before it's called, there should haven been a matching invocation to
grpc_init().
@@ -81,8 +81,8 @@ GRPCAPI void grpc_init(void);
no memory is used by grpc, nor are any instructions executing within the
grpc library. Prior to calling, all application owned grpc objects must
have been destroyed. */
-GRPCAPI void grpc_shutdown(void);
-
+GRPCAPI void grpc_shutdown(void);
+
/** EXPERIMENTAL. Returns 1 if the grpc library has been initialized.
TODO(ericgribkoff) Decide if this should be promoted to non-experimental as
part of stabilizing the fork support API, as tracked in
@@ -93,12 +93,12 @@ GRPCAPI int grpc_is_initialized(void);
This is only for wrapped language to use now. */
GRPCAPI void grpc_shutdown_blocking(void);
-/** Return a string representing the current version of grpc */
+/** Return a string representing the current version of grpc */
GRPCAPI const char* grpc_version_string(void);
-
-/** Return a string specifying what the 'g' in gRPC stands for */
+
+/** Return a string specifying what the 'g' in gRPC stands for */
GRPCAPI const char* grpc_g_stands_for(void);
-
+
/** Returns the completion queue factory based on the attributes. MAY return a
NULL if no factory can be found */
GRPCAPI const grpc_completion_queue_factory*
@@ -122,55 +122,55 @@ GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_callback(
grpc_experimental_completion_queue_functor* shutdown_callback,
void* reserved);
-/** Create a completion queue */
+/** Create a completion queue */
GRPCAPI grpc_completion_queue* grpc_completion_queue_create(
const grpc_completion_queue_factory* factory,
const grpc_completion_queue_attributes* attributes, void* reserved);
-
-/** Blocks until an event is available, the completion queue is being shut down,
- or deadline is reached.
-
- Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,
- otherwise a grpc_event describing the event that occurred.
-
- Callers must not call grpc_completion_queue_next and
- grpc_completion_queue_pluck simultaneously on the same completion queue. */
+
+/** Blocks until an event is available, the completion queue is being shut down,
+ or deadline is reached.
+
+ Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,
+ otherwise a grpc_event describing the event that occurred.
+
+ Callers must not call grpc_completion_queue_next and
+ grpc_completion_queue_pluck simultaneously on the same completion queue. */
GRPCAPI grpc_event grpc_completion_queue_next(grpc_completion_queue* cq,
- gpr_timespec deadline,
+ gpr_timespec deadline,
void* reserved);
-
-/** Blocks until an event with tag 'tag' is available, the completion queue is
- being shutdown or deadline is reached.
-
- Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,
- otherwise a grpc_event describing the event that occurred.
-
- Callers must not call grpc_completion_queue_next and
- grpc_completion_queue_pluck simultaneously on the same completion queue.
-
- Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
- concurrently executing plucks at any time. */
+
+/** Blocks until an event with tag 'tag' is available, the completion queue is
+ being shutdown or deadline is reached.
+
+ Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,
+ otherwise a grpc_event describing the event that occurred.
+
+ Callers must not call grpc_completion_queue_next and
+ grpc_completion_queue_pluck simultaneously on the same completion queue.
+
+ Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
+ concurrently executing plucks at any time. */
GRPCAPI grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq,
void* tag, gpr_timespec deadline,
void* reserved);
-
-/** Maximum number of outstanding grpc_completion_queue_pluck executions per
- completion queue */
-#define GRPC_MAX_COMPLETION_QUEUE_PLUCKERS 6
-
-/** Begin destruction of a completion queue. Once all possible events are
- drained then grpc_completion_queue_next will start to produce
- GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call
- grpc_completion_queue_destroy.
-
- After calling this function applications should ensure that no
- NEW work is added to be published on this completion queue. */
+
+/** Maximum number of outstanding grpc_completion_queue_pluck executions per
+ completion queue */
+#define GRPC_MAX_COMPLETION_QUEUE_PLUCKERS 6
+
+/** Begin destruction of a completion queue. Once all possible events are
+ drained then grpc_completion_queue_next will start to produce
+ GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call
+ grpc_completion_queue_destroy.
+
+ After calling this function applications should ensure that no
+ NEW work is added to be published on this completion queue. */
GRPCAPI void grpc_completion_queue_shutdown(grpc_completion_queue* cq);
-
-/** Destroy a completion queue. The caller must ensure that the queue is
- drained and no threads are executing grpc_completion_queue_next */
+
+/** Destroy a completion queue. The caller must ensure that the queue is
+ drained and no threads are executing grpc_completion_queue_next */
GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue* cq);
-
+
/*********** EXPERIMENTAL API ************/
/** Initializes a thread local cache for \a cq.
* grpc_flush_cq_tls_cache() MUST be called on the same thread,
@@ -178,7 +178,7 @@ GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue* cq);
*/
GRPCAPI void grpc_completion_queue_thread_local_cache_init(
grpc_completion_queue* cq);
-
+
/*********** EXPERIMENTAL API ************/
/** Flushes the thread local cache for \a cq.
* Returns 1 if there was contents in the cache. If there was an event
@@ -187,121 +187,121 @@ GRPCAPI void grpc_completion_queue_thread_local_cache_init(
*/
GRPCAPI int grpc_completion_queue_thread_local_cache_flush(
grpc_completion_queue* cq, void** tag, int* ok);
-
-/** Check the connectivity state of a channel. */
-GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(
+
+/** Check the connectivity state of a channel. */
+GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_channel* channel, int try_to_connect);
-
+
/** Number of active "external connectivity state watchers" attached to a
* channel.
* Useful for testing. **/
GRPCAPI int grpc_channel_num_external_connectivity_watchers(
grpc_channel* channel);
-/** Watch for a change in connectivity state.
- Once the channel connectivity state is different from last_observed_state,
- tag will be enqueued on cq with success=1.
- If deadline expires BEFORE the state is changed, tag will be enqueued on cq
- with success=0. */
-GRPCAPI void grpc_channel_watch_connectivity_state(
+/** Watch for a change in connectivity state.
+ Once the channel connectivity state is different from last_observed_state,
+ tag will be enqueued on cq with success=1.
+ If deadline expires BEFORE the state is changed, tag will be enqueued on cq
+ with success=0. */
+GRPCAPI void grpc_channel_watch_connectivity_state(
grpc_channel* channel, grpc_connectivity_state last_observed_state,
gpr_timespec deadline, grpc_completion_queue* cq, void* tag);
-
+
/** Check whether a grpc channel supports connectivity watcher */
GRPCAPI int grpc_channel_support_connectivity_watcher(grpc_channel* channel);
-/** Create a call given a grpc_channel, in order to call 'method'. All
- completions are sent to 'completion_queue'. 'method' and 'host' need only
- live through the invocation of this function.
- If parent_call is non-NULL, it must be a server-side call. It will be used
- to propagate properties from the server call to this new client call,
- depending on the value of \a propagation_mask (see propagation_bits.h for
- possible values). */
+/** Create a call given a grpc_channel, in order to call 'method'. All
+ completions are sent to 'completion_queue'. 'method' and 'host' need only
+ live through the invocation of this function.
+ If parent_call is non-NULL, it must be a server-side call. It will be used
+ to propagate properties from the server call to this new client call,
+ depending on the value of \a propagation_mask (see propagation_bits.h for
+ possible values). */
GRPCAPI grpc_call* grpc_channel_create_call(
grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask,
grpc_completion_queue* completion_queue, grpc_slice method,
const grpc_slice* host, gpr_timespec deadline, void* reserved);
-
+
/** Pre-register a method/host pair on a channel.
method and host are not owned and must remain alive while the channel is
alive. */
GRPCAPI void* grpc_channel_register_call(grpc_channel* channel,
const char* method, const char* host,
void* reserved);
-
-/** Create a call given a handle returned from grpc_channel_register_call.
- \sa grpc_channel_create_call. */
+
+/** Create a call given a handle returned from grpc_channel_register_call.
+ \sa grpc_channel_create_call. */
GRPCAPI grpc_call* grpc_channel_create_registered_call(
grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask,
grpc_completion_queue* completion_queue, void* registered_call_handle,
gpr_timespec deadline, void* reserved);
-
+
/** Allocate memory in the grpc_call arena: this memory is automatically
discarded at call completion */
GRPCAPI void* grpc_call_arena_alloc(grpc_call* call, size_t size);
-/** Start a batch of operations defined in the array ops; when complete, post a
- completion of type 'tag' to the completion queue bound to the call.
- The order of ops specified in the batch has no significance.
- Only one operation of each type can be active at once in any given
- batch.
- If a call to grpc_call_start_batch returns GRPC_CALL_OK you must call
- grpc_completion_queue_next or grpc_completion_queue_pluck on the completion
- queue associated with 'call' for work to be performed. If a call to
- grpc_call_start_batch returns any value other than GRPC_CALL_OK it is
- guaranteed that no state associated with 'call' is changed and it is not
- appropriate to call grpc_completion_queue_next or
- grpc_completion_queue_pluck consequent to the failed grpc_call_start_batch
- call.
+/** Start a batch of operations defined in the array ops; when complete, post a
+ completion of type 'tag' to the completion queue bound to the call.
+ The order of ops specified in the batch has no significance.
+ Only one operation of each type can be active at once in any given
+ batch.
+ If a call to grpc_call_start_batch returns GRPC_CALL_OK you must call
+ grpc_completion_queue_next or grpc_completion_queue_pluck on the completion
+ queue associated with 'call' for work to be performed. If a call to
+ grpc_call_start_batch returns any value other than GRPC_CALL_OK it is
+ guaranteed that no state associated with 'call' is changed and it is not
+ appropriate to call grpc_completion_queue_next or
+ grpc_completion_queue_pluck consequent to the failed grpc_call_start_batch
+ call.
If a call to grpc_call_start_batch with an empty batch returns
GRPC_CALL_OK, the tag is put in the completion queue immediately.
- THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment
- needs to be synchronized. As an optimization, you may synchronize batches
- containing just send operations independently from batches containing just
+ THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment
+ needs to be synchronized. As an optimization, you may synchronize batches
+ containing just send operations independently from batches containing just
receive operations. Access to grpc_call_start_batch with an empty batch is
thread-compatible. */
GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call* call,
const grpc_op* ops, size_t nops,
void* tag, void* reserved);
-
-/** Returns a newly allocated string representing the endpoint to which this
- call is communicating with. The string is in the uri format accepted by
- grpc_channel_create.
- The returned string should be disposed of with gpr_free().
-
- WARNING: this value is never authenticated or subject to any security
- related code. It must not be used for any authentication related
- functionality. Instead, use grpc_auth_context. */
+
+/** Returns a newly allocated string representing the endpoint to which this
+ call is communicating with. The string is in the uri format accepted by
+ grpc_channel_create.
+ The returned string should be disposed of with gpr_free().
+
+ WARNING: this value is never authenticated or subject to any security
+ related code. It must not be used for any authentication related
+ functionality. Instead, use grpc_auth_context. */
GRPCAPI char* grpc_call_get_peer(grpc_call* call);
-
-struct census_context;
-
+
+struct census_context;
+
/** Set census context for a call; Must be called before first call to
- grpc_call_start_batch(). */
+ grpc_call_start_batch(). */
GRPCAPI void grpc_census_call_set_context(grpc_call* call,
struct census_context* context);
-
+
/** Retrieve the calls current census context. */
GRPCAPI struct census_context* grpc_census_call_get_context(grpc_call* call);
-
-/** Return a newly allocated string representing the target a channel was
- created for. */
+
+/** Return a newly allocated string representing the target a channel was
+ created for. */
GRPCAPI char* grpc_channel_get_target(grpc_channel* channel);
-
-/** Request info about the channel.
- \a channel_info indicates what information is being requested and
- how that information will be returned.
- \a channel_info is owned by the caller. */
+
+/** Request info about the channel.
+ \a channel_info indicates what information is being requested and
+ how that information will be returned.
+ \a channel_info is owned by the caller. */
GRPCAPI void grpc_channel_get_info(grpc_channel* channel,
const grpc_channel_info* channel_info);
-
+
/** EXPERIMENTAL. Resets the channel's connect backoff.
TODO(roth): When we see whether this proves useful, either promote
to non-experimental or remove it. */
GRPCAPI void grpc_channel_reset_connect_backoff(grpc_channel* channel);
-/** Create a client channel to 'target'. Additional channel level configuration
- MAY be provided by grpc_channel_args, though the expectation is that most
+/** Create a client channel to 'target'. Additional channel level configuration
+ MAY be provided by grpc_channel_args, though the expectation is that most
clients will want to simply pass NULL. The user data in 'args' need only
live through the invocation of this function. However, if any args of the
'pointer' type are passed, then the referenced vtable must be maintained
@@ -309,96 +309,96 @@ GRPCAPI void grpc_channel_reset_connect_backoff(grpc_channel* channel);
definition for more on this. */
GRPCAPI grpc_channel* grpc_insecure_channel_create(
const char* target, const grpc_channel_args* args, void* reserved);
-
-/** Create a lame client: this client fails every operation attempted on it. */
+
+/** Create a lame client: this client fails every operation attempted on it. */
GRPCAPI grpc_channel* grpc_lame_client_channel_create(
const char* target, grpc_status_code error_code, const char* error_message);
-
-/** Close and destroy a grpc channel */
+
+/** Close and destroy a grpc channel */
GRPCAPI void grpc_channel_destroy(grpc_channel* channel);
-
+
/** Error handling for grpc_call
- Most grpc_call functions return a grpc_error. If the error is not GRPC_OK
- then the operation failed due to some unsatisfied precondition.
- If a grpc_call fails, it's guaranteed that no change to the call state
- has been made. */
-
+ Most grpc_call functions return a grpc_error. If the error is not GRPC_OK
+ then the operation failed due to some unsatisfied precondition.
+ If a grpc_call fails, it's guaranteed that no change to the call state
+ has been made. */
+
/** Cancel an RPC.
- Can be called multiple times, from any thread.
- THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
+ Can be called multiple times, from any thread.
+ THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
are thread-safe, and can be called at any point before grpc_call_unref
- is called.*/
+ is called.*/
GRPCAPI grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved);
-
+
/** Cancel an RPC.
- Can be called multiple times, from any thread.
- If a status has not been received for the call, set it to the status code
- and description passed in.
- Importantly, this function does not send status nor description to the
+ Can be called multiple times, from any thread.
+ If a status has not been received for the call, set it to the status code
+ and description passed in.
+ Importantly, this function does not send status nor description to the
remote endpoint.
Note that \a description doesn't need be a static string.
It doesn't need to be alive after the call to
grpc_call_cancel_with_status completes.
*/
GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call* call,
- grpc_status_code status,
+ grpc_status_code status,
const char* description,
void* reserved);
-
+
/** Ref a call.
THREAD SAFETY: grpc_call_ref is thread-compatible */
GRPCAPI void grpc_call_ref(grpc_call* call);
-
+
/** Unref a call.
THREAD SAFETY: grpc_call_unref is thread-compatible */
GRPCAPI void grpc_call_unref(grpc_call* call);
-/** Request notification of a new call.
- Once a call is received, a notification tagged with \a tag_new is added to
- \a cq_for_notification. \a call, \a details and \a request_metadata are
- updated with the appropriate call information. \a cq_bound_to_call is bound
- to \a call, and batch operation notifications for that call will be posted
- to \a cq_bound_to_call.
- Note that \a cq_for_notification must have been registered to the server via
- \a grpc_server_register_completion_queue. */
-GRPCAPI grpc_call_error grpc_server_request_call(
+/** Request notification of a new call.
+ Once a call is received, a notification tagged with \a tag_new is added to
+ \a cq_for_notification. \a call, \a details and \a request_metadata are
+ updated with the appropriate call information. \a cq_bound_to_call is bound
+ to \a call, and batch operation notifications for that call will be posted
+ to \a cq_bound_to_call.
+ Note that \a cq_for_notification must have been registered to the server via
+ \a grpc_server_register_completion_queue. */
+GRPCAPI grpc_call_error grpc_server_request_call(
grpc_server* server, grpc_call** call, grpc_call_details* details,
grpc_metadata_array* request_metadata,
grpc_completion_queue* cq_bound_to_call,
grpc_completion_queue* cq_for_notification, void* tag_new);
-
-/** How to handle payloads for a registered method */
-typedef enum {
- /** Don't try to read the payload */
- GRPC_SRM_PAYLOAD_NONE,
- /** Read the initial payload as a byte buffer */
- GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER
-} grpc_server_register_method_payload_handling;
-
-/** Registers a method in the server.
- Methods to this (host, method) pair will not be reported by
- grpc_server_request_call, but instead be reported by
- grpc_server_request_registered_call when passed the appropriate
- registered_method (as returned by this function).
- Must be called before grpc_server_start.
- Returns NULL on failure. */
+
+/** How to handle payloads for a registered method */
+typedef enum {
+ /** Don't try to read the payload */
+ GRPC_SRM_PAYLOAD_NONE,
+ /** Read the initial payload as a byte buffer */
+ GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER
+} grpc_server_register_method_payload_handling;
+
+/** Registers a method in the server.
+ Methods to this (host, method) pair will not be reported by
+ grpc_server_request_call, but instead be reported by
+ grpc_server_request_registered_call when passed the appropriate
+ registered_method (as returned by this function).
+ Must be called before grpc_server_start.
+ Returns NULL on failure. */
GRPCAPI void* grpc_server_register_method(
grpc_server* server, const char* method, const char* host,
- grpc_server_register_method_payload_handling payload_handling,
- uint32_t flags);
-
-/** Request notification of a new pre-registered call. 'cq_for_notification'
- must have been registered to the server via
- grpc_server_register_completion_queue. */
-GRPCAPI grpc_call_error grpc_server_request_registered_call(
+ grpc_server_register_method_payload_handling payload_handling,
+ uint32_t flags);
+
+/** Request notification of a new pre-registered call. 'cq_for_notification'
+ must have been registered to the server via
+ grpc_server_register_completion_queue. */
+GRPCAPI grpc_call_error grpc_server_request_registered_call(
grpc_server* server, void* registered_method, grpc_call** call,
gpr_timespec* deadline, grpc_metadata_array* request_metadata,
grpc_byte_buffer** optional_payload,
grpc_completion_queue* cq_bound_to_call,
grpc_completion_queue* cq_for_notification, void* tag_new);
-
-/** Create a server. Additional configuration for each incoming channel can
- be specified with args. If no additional configuration is needed, args can
+
+/** Create a server. Additional configuration for each incoming channel can
+ be specified with args. If no additional configuration is needed, args can
be NULL. The user data in 'args' need only live through the invocation of
this function. However, if any args of the 'pointer' type are passed, then
the referenced vtable must be maintained by the caller until
@@ -406,89 +406,89 @@ GRPCAPI grpc_call_error grpc_server_request_registered_call(
on this. */
GRPCAPI grpc_server* grpc_server_create(const grpc_channel_args* args,
void* reserved);
-
-/** Register a completion queue with the server. Must be done for any
- notification completion queue that is passed to grpc_server_request_*_call
- and to grpc_server_shutdown_and_notify. Must be performed prior to
- grpc_server_start. */
+
+/** Register a completion queue with the server. Must be done for any
+ notification completion queue that is passed to grpc_server_request_*_call
+ and to grpc_server_shutdown_and_notify. Must be performed prior to
+ grpc_server_start. */
GRPCAPI void grpc_server_register_completion_queue(grpc_server* server,
grpc_completion_queue* cq,
void* reserved);
-
-/** Add a HTTP2 over plaintext over tcp listener.
- Returns bound port number on success, 0 on failure.
- REQUIRES: server not started */
+
+/** Add a HTTP2 over plaintext over tcp listener.
+ Returns bound port number on success, 0 on failure.
+ REQUIRES: server not started */
GRPCAPI int grpc_server_add_insecure_http2_port(grpc_server* server,
const char* addr);
-
-/** Start a server - tells all listeners to start listening */
+
+/** Start a server - tells all listeners to start listening */
GRPCAPI void grpc_server_start(grpc_server* server);
-
-/** Begin shutting down a server.
- After completion, no new calls or connections will be admitted.
- Existing calls will be allowed to complete.
- Send a GRPC_OP_COMPLETE event when there are no more calls being serviced.
- Shutdown is idempotent, and all tags will be notified at once if multiple
- grpc_server_shutdown_and_notify calls are made. 'cq' must have been
- registered to this server via grpc_server_register_completion_queue. */
+
+/** Begin shutting down a server.
+ After completion, no new calls or connections will be admitted.
+ Existing calls will be allowed to complete.
+ Send a GRPC_OP_COMPLETE event when there are no more calls being serviced.
+ Shutdown is idempotent, and all tags will be notified at once if multiple
+ grpc_server_shutdown_and_notify calls are made. 'cq' must have been
+ registered to this server via grpc_server_register_completion_queue. */
GRPCAPI void grpc_server_shutdown_and_notify(grpc_server* server,
grpc_completion_queue* cq,
void* tag);
-
-/** Cancel all in-progress calls.
- Only usable after shutdown. */
+
+/** Cancel all in-progress calls.
+ Only usable after shutdown. */
GRPCAPI void grpc_server_cancel_all_calls(grpc_server* server);
-
-/** Destroy a server.
- Shutdown must have completed beforehand (i.e. all tags generated by
- grpc_server_shutdown_and_notify must have been received, and at least
- one call to grpc_server_shutdown_and_notify must have been made). */
+
+/** Destroy a server.
+ Shutdown must have completed beforehand (i.e. all tags generated by
+ grpc_server_shutdown_and_notify must have been received, and at least
+ one call to grpc_server_shutdown_and_notify must have been made). */
GRPCAPI void grpc_server_destroy(grpc_server* server);
-
-/** Enable or disable a tracer.
-
- Tracers (usually controlled by the environment variable GRPC_TRACE)
- allow printf-style debugging on GRPC internals, and are useful for
- tracking down problems in the field.
-
- Use of this function is not strictly thread-safe, but the
- thread-safety issues raised by it should not be of concern. */
+
+/** Enable or disable a tracer.
+
+ Tracers (usually controlled by the environment variable GRPC_TRACE)
+ allow printf-style debugging on GRPC internals, and are useful for
+ tracking down problems in the field.
+
+ Use of this function is not strictly thread-safe, but the
+ thread-safety issues raised by it should not be of concern. */
GRPCAPI int grpc_tracer_set_enabled(const char* name, int enabled);
-
-/** Check whether a metadata key is legal (will be accepted by core) */
+
+/** Check whether a metadata key is legal (will be accepted by core) */
GRPCAPI int grpc_header_key_is_legal(grpc_slice slice);
-
-/** Check whether a non-binary metadata value is legal (will be accepted by
- core) */
+
+/** Check whether a non-binary metadata value is legal (will be accepted by
+ core) */
GRPCAPI int grpc_header_nonbin_value_is_legal(grpc_slice slice);
-
-/** Check whether a metadata key corresponds to a binary value */
+
+/** Check whether a metadata key corresponds to a binary value */
GRPCAPI int grpc_is_binary_header(grpc_slice slice);
-
-/** Convert grpc_call_error values to a string */
+
+/** Convert grpc_call_error values to a string */
GRPCAPI const char* grpc_call_error_to_string(grpc_call_error error);
-
-/** Create a buffer pool */
+
+/** Create a buffer pool */
GRPCAPI grpc_resource_quota* grpc_resource_quota_create(const char* trace_name);
-
-/** Add a reference to a buffer pool */
+
+/** Add a reference to a buffer pool */
GRPCAPI void grpc_resource_quota_ref(grpc_resource_quota* resource_quota);
-
-/** Drop a reference to a buffer pool */
+
+/** Drop a reference to a buffer pool */
GRPCAPI void grpc_resource_quota_unref(grpc_resource_quota* resource_quota);
-
-/** Update the size of a buffer pool */
+
+/** Update the size of a buffer pool */
GRPCAPI void grpc_resource_quota_resize(grpc_resource_quota* resource_quota,
- size_t new_size);
-
+ size_t new_size);
+
/** Update the size of the maximum number of threads allowed */
GRPCAPI void grpc_resource_quota_set_max_threads(
grpc_resource_quota* resource_quota, int new_max_threads);
-/** Fetch a vtable for a grpc_channel_arg that points to a grpc_resource_quota
- */
+/** Fetch a vtable for a grpc_channel_arg that points to a grpc_resource_quota
+ */
GRPCAPI const grpc_arg_pointer_vtable* grpc_resource_quota_arg_vtable(void);
-
+
/************* CHANNELZ API *************/
/** Channelz is under active development. The following APIs will see some
churn as the feature is implemented. This comment will be removed once
@@ -531,8 +531,8 @@ GRPCAPI char* grpc_channelz_get_subchannel(intptr_t subchannel_id);
is allocated and must be freed by the application. */
GRPCAPI char* grpc_channelz_get_socket(intptr_t socket_id);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_GRPC_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_GRPC_H */
diff --git a/contrib/libs/grpc/include/grpc/grpc_cronet.h b/contrib/libs/grpc/include/grpc/grpc_cronet.h
index c1eb4a58e8..289cfcda67 100644
--- a/contrib/libs/grpc/include/grpc/grpc_cronet.h
+++ b/contrib/libs/grpc/include/grpc/grpc_cronet.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_GRPC_CRONET_H
-#define GRPC_GRPC_CRONET_H
-
+ *
+ */
+
+#ifndef GRPC_GRPC_CRONET_H
+#define GRPC_GRPC_CRONET_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/grpc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
void* engine, const char* target, const grpc_channel_args* args,
void* reserved);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_GRPC_CRONET_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_GRPC_CRONET_H */
diff --git a/contrib/libs/grpc/include/grpc/grpc_posix.h b/contrib/libs/grpc/include/grpc/grpc_posix.h
index a1e6d57b8e..fbce5e13c1 100644
--- a/contrib/libs/grpc/include/grpc/grpc_posix.h
+++ b/contrib/libs/grpc/include/grpc/grpc_posix.h
@@ -1,59 +1,59 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_GRPC_POSIX_H
-#define GRPC_GRPC_POSIX_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_GRPC_POSIX_H
+#define GRPC_GRPC_POSIX_H
+
+#include <grpc/support/port_platform.h>
+
#include <grpc/impl/codegen/grpc_types.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \mainpage GRPC Core POSIX
- *
- * The GRPC Core POSIX library provides some POSIX-specific low-level
- * functionality on top of GRPC Core.
- */
-
-/** Create a client channel to 'target' using file descriptor 'fd'. The 'target'
- argument will be used to indicate the name for this channel. See the comment
- for grpc_insecure_channel_create for description of 'args' argument. */
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! \mainpage GRPC Core POSIX
+ *
+ * The GRPC Core POSIX library provides some POSIX-specific low-level
+ * functionality on top of GRPC Core.
+ */
+
+/** Create a client channel to 'target' using file descriptor 'fd'. The 'target'
+ argument will be used to indicate the name for this channel. See the comment
+ for grpc_insecure_channel_create for description of 'args' argument. */
GRPCAPI grpc_channel* grpc_insecure_channel_create_from_fd(
const char* target, int fd, const grpc_channel_args* args);
-
-/** Add the connected communication channel based on file descriptor 'fd' to the
- 'server'. The 'fd' must be an open file descriptor corresponding to a
- connected socket. Events from the file descriptor may come on any of the
- server completion queues (i.e completion queues registered via the
- grpc_server_register_completion_queue API).
-
- The 'reserved' pointer MUST be NULL.
- */
+
+/** Add the connected communication channel based on file descriptor 'fd' to the
+ 'server'. The 'fd' must be an open file descriptor corresponding to a
+ connected socket. Events from the file descriptor may come on any of the
+ server completion queues (i.e completion queues registered via the
+ grpc_server_register_completion_queue API).
+
+ The 'reserved' pointer MUST be NULL.
+ */
GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
void* reserved, int fd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_GRPC_POSIX_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_GRPC_POSIX_H */
diff --git a/contrib/libs/grpc/include/grpc/grpc_security.h b/contrib/libs/grpc/include/grpc/grpc_security.h
index a06747dd50..1810681b76 100644
--- a/contrib/libs/grpc/include/grpc/grpc_security.h
+++ b/contrib/libs/grpc/include/grpc/grpc_security.h
@@ -1,107 +1,107 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_GRPC_SECURITY_H
-#define GRPC_GRPC_SECURITY_H
-
+ *
+ */
+
+#ifndef GRPC_GRPC_SECURITY_H
+#define GRPC_GRPC_SECURITY_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
-#include <grpc/grpc_security_constants.h>
-#include <grpc/status.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/grpc.h>
+#include <grpc/grpc_security_constants.h>
+#include <grpc/status.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** --- Authentication Context. --- */
-
-typedef struct grpc_auth_context grpc_auth_context;
-
-typedef struct grpc_auth_property_iterator {
+
+typedef struct grpc_auth_context grpc_auth_context;
+
+typedef struct grpc_auth_property_iterator {
const grpc_auth_context* ctx;
- size_t index;
+ size_t index;
const char* name;
-} grpc_auth_property_iterator;
-
+} grpc_auth_property_iterator;
+
/** value, if not NULL, is guaranteed to be NULL terminated. */
-typedef struct grpc_auth_property {
+typedef struct grpc_auth_property {
char* name;
char* value;
- size_t value_length;
-} grpc_auth_property;
-
+ size_t value_length;
+} grpc_auth_property;
+
/** Returns NULL when the iterator is at the end. */
GRPCAPI const grpc_auth_property* grpc_auth_property_iterator_next(
grpc_auth_property_iterator* it);
-
+
/** Iterates over the auth context. */
-GRPCAPI grpc_auth_property_iterator
+GRPCAPI grpc_auth_property_iterator
grpc_auth_context_property_iterator(const grpc_auth_context* ctx);
-
+
/** Gets the peer identity. Returns an empty iterator (first _next will return
- NULL) if the peer is not authenticated. */
-GRPCAPI grpc_auth_property_iterator
+ NULL) if the peer is not authenticated. */
+GRPCAPI grpc_auth_property_iterator
grpc_auth_context_peer_identity(const grpc_auth_context* ctx);
-
+
/** Finds a property in the context. May return an empty iterator (first _next
- will return NULL) if no property with this name was found in the context. */
-GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(
+ will return NULL) if no property with this name was found in the context. */
+GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(
const grpc_auth_context* ctx, const char* name);
-
+
/** Gets the name of the property that indicates the peer identity. Will return
- NULL if the peer is not authenticated. */
+ NULL if the peer is not authenticated. */
GRPCAPI const char* grpc_auth_context_peer_identity_property_name(
const grpc_auth_context* ctx);
-
+
/** Returns 1 if the peer is authenticated, 0 otherwise. */
-GRPCAPI int grpc_auth_context_peer_is_authenticated(
+GRPCAPI int grpc_auth_context_peer_is_authenticated(
const grpc_auth_context* ctx);
-
+
/** Gets the auth context from the call. Caller needs to call
- grpc_auth_context_release on the returned context. */
+ grpc_auth_context_release on the returned context. */
GRPCAPI grpc_auth_context* grpc_call_auth_context(grpc_call* call);
-
+
/** Releases the auth context returned from grpc_call_auth_context. */
GRPCAPI void grpc_auth_context_release(grpc_auth_context* context);
-
+
/** --
- The following auth context methods should only be called by a server metadata
- processor to set properties extracted from auth metadata.
- -- */
-
+ The following auth context methods should only be called by a server metadata
+ processor to set properties extracted from auth metadata.
+ -- */
+
/** Add a property. */
GRPCAPI void grpc_auth_context_add_property(grpc_auth_context* ctx,
const char* name, const char* value,
- size_t value_length);
-
+ size_t value_length);
+
/** Add a C string property. */
GRPCAPI void grpc_auth_context_add_cstring_property(grpc_auth_context* ctx,
const char* name,
const char* value);
-
+
/** Sets the property name. Returns 1 if successful or 0 in case of failure
- (which means that no property with this name exists). */
-GRPCAPI int grpc_auth_context_set_peer_identity_property_name(
+ (which means that no property with this name exists). */
+GRPCAPI int grpc_auth_context_set_peer_identity_property_name(
grpc_auth_context* ctx, const char* name);
-
+
/** --- SSL Session Cache. ---
-
+
A SSL session cache object represents a way to cache client sessions
between connections. Only ticket-based resumption is supported. */
@@ -133,20 +133,20 @@ GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
/** --- grpc_channel_credentials object. ---
- A channel credentials object represents a way to authenticate a client on a
- channel. */
-
-typedef struct grpc_channel_credentials grpc_channel_credentials;
-
+ A channel credentials object represents a way to authenticate a client on a
+ channel. */
+
+typedef struct grpc_channel_credentials grpc_channel_credentials;
+
/** Releases a channel credentials object.
- The creator of the credentials object is responsible for its release. */
+ The creator of the credentials object is responsible for its release. */
GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials* creds);
-
+
/** Creates default credentials to connect to a google gRPC service.
- WARNING: Do NOT use this credentials to connect to a non-google service as
+ WARNING: Do NOT use this credentials to connect to a non-google service as
this could result in an oauth2 token leak. The security level of the
resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
-
+
If specified, the supplied call credentials object will be attached to the
returned channel credentials object. The call_credentials object must remain
valid throughout the lifetime of the returned grpc_channel_credentials
@@ -164,33 +164,33 @@ GRPCAPI grpc_channel_credentials* grpc_google_default_credentials_create(
grpc_call_credentials* call_credentials);
/** Callback for getting the SSL roots override from the application.
- In case of success, *pem_roots_certs must be set to a NULL terminated string
- containing the list of PEM encoded root certificates. The ownership is passed
- to the core and freed (laster by the core) with gpr_free.
- If this function fails and GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is
- set to a valid path, it will override the roots specified this func */
-typedef grpc_ssl_roots_override_result (*grpc_ssl_roots_override_callback)(
+ In case of success, *pem_roots_certs must be set to a NULL terminated string
+ containing the list of PEM encoded root certificates. The ownership is passed
+ to the core and freed (laster by the core) with gpr_free.
+ If this function fails and GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is
+ set to a valid path, it will override the roots specified this func */
+typedef grpc_ssl_roots_override_result (*grpc_ssl_roots_override_callback)(
char** pem_root_certs);
-
+
/** Setup a callback to override the default TLS/SSL roots.
- This function is not thread-safe and must be called at initialization time
- before any ssl credentials are created to have the desired side effect.
- If GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is set to a valid path, the
- callback will not be called. */
-GRPCAPI void grpc_set_ssl_roots_override_callback(
- grpc_ssl_roots_override_callback cb);
-
+ This function is not thread-safe and must be called at initialization time
+ before any ssl credentials are created to have the desired side effect.
+ If GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is set to a valid path, the
+ callback will not be called. */
+GRPCAPI void grpc_set_ssl_roots_override_callback(
+ grpc_ssl_roots_override_callback cb);
+
/** Object that holds a private key / certificate chain pair in PEM format. */
-typedef struct {
+typedef struct {
/** private_key is the NULL-terminated string containing the PEM encoding of
- the client's private key. */
+ the client's private key. */
const char* private_key;
-
+
/** cert_chain is the NULL-terminated string containing the PEM encoding of
- the client's certificate chain. */
+ the client's certificate chain. */
const char* cert_chain;
-} grpc_ssl_pem_key_cert_pair;
-
+} grpc_ssl_pem_key_cert_pair;
+
/** Deprecated in favor of grpc_ssl_verify_peer_options. It will be removed
after all of its call sites are migrated to grpc_ssl_verify_peer_options.
Object that holds additional peer-verification options on a secure
@@ -238,12 +238,12 @@ typedef struct {
grpc_ssl_server_credentials_create_ex. Creates an SSL credentials object.
The security level of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
- pem_root_certs is the NULL-terminated string containing the PEM encoding
- of the server root certificates. If this parameter is NULL, the
- implementation will first try to dereference the file pointed by the
- GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails,
- try to get the roots set by grpc_override_ssl_default_roots. Eventually,
- if all these fail, it will try to get the roots from a well-known place on
- disk (in the grpc install directory).
+ of the server root certificates. If this parameter is NULL, the
+ implementation will first try to dereference the file pointed by the
+ GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails,
+ try to get the roots set by grpc_override_ssl_default_roots. Eventually,
+ if all these fail, it will try to get the roots from a well-known place on
+ disk (in the grpc install directory).
gRPC has implemented root cache if the underlying OpenSSL library supports
it. The gRPC root certificates cache is only applicable on the default
@@ -253,8 +253,8 @@ typedef struct {
copy of the root store. So it is recommended to avoid providing large room
pem with pem_root_certs parameter to avoid excessive memory consumption,
particularly on mobile platforms such as iOS.
- - pem_key_cert_pair is a pointer on the object containing client's private
- key and certificate chain. This parameter can be NULL if the client does
+ - pem_key_cert_pair is a pointer on the object containing client's private
+ key and certificate chain. This parameter can be NULL if the client does
not have such a key/cert pair.
- verify_options is an optional verify_peer_options object which holds
additional options controlling how peer certificates are verified. For
@@ -266,7 +266,7 @@ typedef struct {
GRPCAPI grpc_channel_credentials* grpc_ssl_credentials_create(
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
const verify_peer_options* verify_options, void* reserved);
-
+
/* Creates an SSL credentials object.
The security level of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
- pem_root_certs is the NULL-terminated string containing the PEM encoding
@@ -304,51 +304,51 @@ GRPCAPI grpc_channel_credentials* grpc_ssl_credentials_create_ex(
GRPCAPI grpc_channel_credentials* grpc_composite_channel_credentials_create(
grpc_channel_credentials* channel_creds, grpc_call_credentials* call_creds,
void* reserved);
-
+
/** --- composite credentials. */
/** Creates a composite call credentials object. */
GRPCAPI grpc_call_credentials* grpc_composite_call_credentials_create(
grpc_call_credentials* creds1, grpc_call_credentials* creds2,
void* reserved);
-
+
/** Creates a compute engine credentials object for connecting to Google.
- WARNING: Do NOT use this credentials to connect to a non-google service as
- this could result in an oauth2 token leak. */
+ WARNING: Do NOT use this credentials to connect to a non-google service as
+ this could result in an oauth2 token leak. */
GRPCAPI grpc_call_credentials* grpc_google_compute_engine_credentials_create(
void* reserved);
-
+
GRPCAPI gpr_timespec grpc_max_auth_token_lifetime(void);
-
+
/** Creates a JWT credentials object. May return NULL if the input is invalid.
- - json_key is the JSON key string containing the client's private key.
- - token_lifetime is the lifetime of each Json Web Token (JWT) created with
- this credentials. It should not exceed grpc_max_auth_token_lifetime or
- will be cropped to this value. */
+ - json_key is the JSON key string containing the client's private key.
+ - token_lifetime is the lifetime of each Json Web Token (JWT) created with
+ this credentials. It should not exceed grpc_max_auth_token_lifetime or
+ will be cropped to this value. */
GRPCAPI grpc_call_credentials*
grpc_service_account_jwt_access_credentials_create(const char* json_key,
- gpr_timespec token_lifetime,
+ gpr_timespec token_lifetime,
void* reserved);
-
+
/** Creates an Oauth2 Refresh Token credentials object for connecting to Google.
- May return NULL if the input is invalid.
- WARNING: Do NOT use this credentials to connect to a non-google service as
- this could result in an oauth2 token leak.
- - json_refresh_token is the JSON string containing the refresh token itself
- along with a client_id and client_secret. */
+ May return NULL if the input is invalid.
+ WARNING: Do NOT use this credentials to connect to a non-google service as
+ this could result in an oauth2 token leak.
+ - json_refresh_token is the JSON string containing the refresh token itself
+ along with a client_id and client_secret. */
GRPCAPI grpc_call_credentials* grpc_google_refresh_token_credentials_create(
const char* json_refresh_token, void* reserved);
-
+
/** Creates an Oauth2 Access Token credentials with an access token that was
acquired by an out of band mechanism. */
GRPCAPI grpc_call_credentials* grpc_access_token_credentials_create(
const char* access_token, void* reserved);
-
+
/** Creates an IAM credentials object for connecting to Google. */
GRPCAPI grpc_call_credentials* grpc_google_iam_credentials_create(
const char* authorization_token, const char* authority_selector,
void* reserved);
-
+
/** Options for creating STS Oauth Token Exchange credentials following the IETF
draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.
Optional fields may be set to NULL or empty string. It is the responsibility
@@ -375,38 +375,38 @@ GRPCAPI grpc_call_credentials* grpc_sts_credentials_create(
const grpc_sts_credentials_options* options, void* reserved);
/** Callback function to be called by the metadata credentials plugin
- implementation when the metadata is ready.
- - user_data is the opaque pointer that was passed in the get_metadata method
- of the grpc_metadata_credentials_plugin (see below).
- - creds_md is an array of credentials metadata produced by the plugin. It
- may be set to NULL in case of an error.
- - num_creds_md is the number of items in the creds_md array.
- - status must be GRPC_STATUS_OK in case of success or another specific error
- code otherwise.
- - error_details contains details about the error if any. In case of success
- it should be NULL and will be otherwise ignored. */
-typedef void (*grpc_credentials_plugin_metadata_cb)(
+ implementation when the metadata is ready.
+ - user_data is the opaque pointer that was passed in the get_metadata method
+ of the grpc_metadata_credentials_plugin (see below).
+ - creds_md is an array of credentials metadata produced by the plugin. It
+ may be set to NULL in case of an error.
+ - num_creds_md is the number of items in the creds_md array.
+ - status must be GRPC_STATUS_OK in case of success or another specific error
+ code otherwise.
+ - error_details contains details about the error if any. In case of success
+ it should be NULL and will be otherwise ignored. */
+typedef void (*grpc_credentials_plugin_metadata_cb)(
void* user_data, const grpc_metadata* creds_md, size_t num_creds_md,
grpc_status_code status, const char* error_details);
-
+
/** Context that can be used by metadata credentials plugin in order to create
- auth related metadata. */
-typedef struct {
+ auth related metadata. */
+typedef struct {
/** The fully qualifed service url. */
const char* service_url;
-
+
/** The method name of the RPC being called (not fully qualified).
- The fully qualified method name can be built from the service_url:
- full_qualified_method_name = ctx->service_url + '/' + ctx->method_name. */
+ The fully qualified method name can be built from the service_url:
+ full_qualified_method_name = ctx->service_url + '/' + ctx->method_name. */
const char* method_name;
-
+
/** The auth_context of the channel which gives the server's identity. */
const grpc_auth_context* channel_auth_context;
-
+
/** Reserved for future use. */
void* reserved;
-} grpc_auth_metadata_context;
-
+} grpc_auth_metadata_context;
+
/** Performs a deep copy from \a from to \a to. **/
GRPCAPI void grpc_auth_metadata_context_copy(grpc_auth_metadata_context* from,
grpc_auth_metadata_context* to);
@@ -420,27 +420,27 @@ GRPCAPI void grpc_auth_metadata_context_reset(
#define GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX 4
/** grpc_metadata_credentials plugin is an API user provided structure used to
- create grpc_credentials objects that can be set on a channel (composed) or
- a call. See grpc_credentials_metadata_create_from_plugin below.
- The grpc client stack will call the get_metadata method of the plugin for
- every call in scope for the credentials created from it. */
-typedef struct {
+ create grpc_credentials objects that can be set on a channel (composed) or
+ a call. See grpc_credentials_metadata_create_from_plugin below.
+ The grpc client stack will call the get_metadata method of the plugin for
+ every call in scope for the credentials created from it. */
+typedef struct {
/** The implementation of this method has to be non-blocking, but can
be performed synchronously or asynchronously.
-
+
If processing occurs synchronously, returns non-zero and populates
creds_md, num_creds_md, status, and error_details. In this case,
the caller takes ownership of the entries in creds_md and of
error_details. Note that if the plugin needs to return more than
GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX entries in creds_md, it must
return asynchronously.
-
+
If processing occurs asynchronously, returns zero and invokes \a cb
when processing is completed. \a user_data will be passed as the
first parameter of the callback. NOTE: \a cb MUST be invoked in a
different thread, not from the thread in which \a get_metadata() is
invoked.
-
+
\a context is the information that can be used by the plugin to create
auth metadata. */
int (*get_metadata)(
@@ -462,16 +462,16 @@ typedef struct {
/** Type of credentials that this plugin is implementing. */
const char* type;
-} grpc_metadata_credentials_plugin;
-
+} grpc_metadata_credentials_plugin;
+
/** Creates a credentials object from a plugin with a specified minimum security
* level. */
GRPCAPI grpc_call_credentials* grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin,
grpc_security_level min_security_level, void* reserved);
-
+
/** --- Secure channel creation. --- */
-
+
/** Creates a secure channel using the passed-in credentials. Additional
channel level configuration MAY be provided by grpc_channel_args, though
the expectation is that most clients will want to simply pass NULL. The
@@ -482,18 +482,18 @@ GRPCAPI grpc_call_credentials* grpc_metadata_credentials_create_from_plugin(
GRPCAPI grpc_channel* grpc_secure_channel_create(
grpc_channel_credentials* creds, const char* target,
const grpc_channel_args* args, void* reserved);
-
+
/** --- grpc_server_credentials object. ---
-
- A server credentials object represents a way to authenticate a server. */
-
-typedef struct grpc_server_credentials grpc_server_credentials;
-
+
+ A server credentials object represents a way to authenticate a server. */
+
+typedef struct grpc_server_credentials grpc_server_credentials;
+
/** Releases a server_credentials object.
- The creator of the server_credentials object is responsible for its release.
- */
+ The creator of the server_credentials object is responsible for its release.
+ */
GRPCAPI void grpc_server_credentials_release(grpc_server_credentials* creds);
-
+
/** Server certificate config object holds the server's public certificates and
associated private keys, as well as any CA certificates needed for client
certificate validation (if applicable). Create using
@@ -532,34 +532,34 @@ typedef grpc_ssl_certificate_config_reload_status (
void* user_data, grpc_ssl_server_certificate_config** config);
/** Deprecated in favor of grpc_ssl_server_credentials_create_ex.
- Creates an SSL server_credentials object.
- - pem_roots_cert is the NULL-terminated string containing the PEM encoding of
- the client root certificates. This parameter may be NULL if the server does
- not want the client to be authenticated with SSL.
- - pem_key_cert_pairs is an array private key / certificate chains of the
- server. This parameter cannot be NULL.
- - num_key_cert_pairs indicates the number of items in the private_key_files
- and cert_chain_files parameters. It should be at least 1.
- - force_client_auth, if set to non-zero will force the client to authenticate
- with an SSL cert. Note that this option is ignored if pem_root_certs is
- NULL. */
+ Creates an SSL server_credentials object.
+ - pem_roots_cert is the NULL-terminated string containing the PEM encoding of
+ the client root certificates. This parameter may be NULL if the server does
+ not want the client to be authenticated with SSL.
+ - pem_key_cert_pairs is an array private key / certificate chains of the
+ server. This parameter cannot be NULL.
+ - num_key_cert_pairs indicates the number of items in the private_key_files
+ and cert_chain_files parameters. It should be at least 1.
+ - force_client_auth, if set to non-zero will force the client to authenticate
+ with an SSL cert. Note that this option is ignored if pem_root_certs is
+ NULL. */
GRPCAPI grpc_server_credentials* grpc_ssl_server_credentials_create(
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth, void* reserved);
-
+
/** Deprecated in favor of grpc_ssl_server_credentials_create_with_options.
Same as grpc_ssl_server_credentials_create method except uses
- grpc_ssl_client_certificate_request_type enum to support more ways to
+ grpc_ssl_client_certificate_request_type enum to support more ways to
authenticate client certificates.*/
GRPCAPI grpc_server_credentials* grpc_ssl_server_credentials_create_ex(
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs,
- size_t num_key_cert_pairs,
- grpc_ssl_client_certificate_request_type client_certificate_request,
+ size_t num_key_cert_pairs,
+ grpc_ssl_client_certificate_request_type client_certificate_request,
void* reserved);
-
+
typedef struct grpc_ssl_server_credentials_options
grpc_ssl_server_credentials_options;
-
+
/** Creates an options object using a certificate config. Use this method when
the certificates and keys of the SSL server will not change during the
server's lifetime.
@@ -594,51 +594,51 @@ grpc_ssl_server_credentials_create_with_options(
/** --- Server-side secure ports. --- */
/** Add a HTTP2 over an encrypted link over tcp listener.
- Returns bound port number on success, 0 on failure.
- REQUIRES: server not started */
+ Returns bound port number on success, 0 on failure.
+ REQUIRES: server not started */
GRPCAPI int grpc_server_add_secure_http2_port(grpc_server* server,
const char* addr,
grpc_server_credentials* creds);
-
+
/** --- Call specific credentials. --- */
-
+
/** Sets a credentials to a call. Can only be called on the client side before
- grpc_call_start_batch. */
+ grpc_call_start_batch. */
GRPCAPI grpc_call_error grpc_call_set_credentials(grpc_call* call,
grpc_call_credentials* creds);
-
+
/** --- Auth Metadata Processing --- */
-
+
/** Callback function that is called when the metadata processing is done.
- - Consumed metadata will be removed from the set of metadata available on the
- call. consumed_md may be NULL if no metadata has been consumed.
- - Response metadata will be set on the response. response_md may be NULL.
- - status is GRPC_STATUS_OK for success or a specific status for an error.
- Common error status for auth metadata processing is either
- GRPC_STATUS_UNAUTHENTICATED in case of an authentication failure or
- GRPC_STATUS PERMISSION_DENIED in case of an authorization failure.
- - error_details gives details about the error. May be NULL. */
-typedef void (*grpc_process_auth_metadata_done_cb)(
+ - Consumed metadata will be removed from the set of metadata available on the
+ call. consumed_md may be NULL if no metadata has been consumed.
+ - Response metadata will be set on the response. response_md may be NULL.
+ - status is GRPC_STATUS_OK for success or a specific status for an error.
+ Common error status for auth metadata processing is either
+ GRPC_STATUS_UNAUTHENTICATED in case of an authentication failure or
+ GRPC_STATUS PERMISSION_DENIED in case of an authorization failure.
+ - error_details gives details about the error. May be NULL. */
+typedef void (*grpc_process_auth_metadata_done_cb)(
void* user_data, const grpc_metadata* consumed_md, size_t num_consumed_md,
const grpc_metadata* response_md, size_t num_response_md,
grpc_status_code status, const char* error_details);
-
+
/** Pluggable server-side metadata processor object. */
-typedef struct {
+typedef struct {
/** The context object is read/write: it contains the properties of the
- channel peer and it is the job of the process function to augment it with
- properties derived from the passed-in metadata.
- The lifetime of these objects is guaranteed until cb is invoked. */
+ channel peer and it is the job of the process function to augment it with
+ properties derived from the passed-in metadata.
+ The lifetime of these objects is guaranteed until cb is invoked. */
void (*process)(void* state, grpc_auth_context* context,
const grpc_metadata* md, size_t num_md,
grpc_process_auth_metadata_done_cb cb, void* user_data);
void (*destroy)(void* state);
void* state;
-} grpc_auth_metadata_processor;
-
-GRPCAPI void grpc_server_credentials_set_auth_metadata_processor(
+} grpc_auth_metadata_processor;
+
+GRPCAPI void grpc_server_credentials_set_auth_metadata_processor(
grpc_server_credentials* creds, grpc_auth_metadata_processor processor);
-
+
/** --- ALTS channel/server credentials --- **/
/**
@@ -1045,8 +1045,8 @@ grpc_server_credentials* grpc_tls_server_credentials_create(
GRPCAPI grpc_channel_credentials* grpc_xds_credentials_create(
grpc_channel_credentials* fallback_credentials);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_GRPC_SECURITY_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_GRPC_SECURITY_H */
diff --git a/contrib/libs/grpc/include/grpc/grpc_security_constants.h b/contrib/libs/grpc/include/grpc/grpc_security_constants.h
index 32753ceeea..a62f76753b 100644
--- a/contrib/libs/grpc/include/grpc/grpc_security_constants.h
+++ b/contrib/libs/grpc/include/grpc/grpc_security_constants.h
@@ -1,59 +1,59 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_GRPC_SECURITY_CONSTANTS_H
-#define GRPC_GRPC_SECURITY_CONSTANTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type"
-#define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl"
-
-#define GRPC_X509_CN_PROPERTY_NAME "x509_common_name"
-#define GRPC_X509_SAN_PROPERTY_NAME "x509_subject_alternative_name"
-#define GRPC_X509_PEM_CERT_PROPERTY_NAME "x509_pem_cert"
+ *
+ */
+
+#ifndef GRPC_GRPC_SECURITY_CONSTANTS_H
+#define GRPC_GRPC_SECURITY_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type"
+#define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl"
+
+#define GRPC_X509_CN_PROPERTY_NAME "x509_common_name"
+#define GRPC_X509_SAN_PROPERTY_NAME "x509_subject_alternative_name"
+#define GRPC_X509_PEM_CERT_PROPERTY_NAME "x509_pem_cert"
#define GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME "x509_pem_cert_chain"
#define GRPC_SSL_SESSION_REUSED_PROPERTY "ssl_session_reused"
#define GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME "security_level"
#define GRPC_PEER_SPIFFE_ID_PROPERTY_NAME "peer_spiffe_id"
-
+
/** Environment variable that points to the default SSL roots file. This file
- must be a PEM encoded file with all the roots such as the one that can be
- downloaded from https://pki.google.com/roots.pem. */
-#define GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR \
- "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
-
+ must be a PEM encoded file with all the roots such as the one that can be
+ downloaded from https://pki.google.com/roots.pem. */
+#define GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR \
+ "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
+
/** Environment variable that points to the google default application
- credentials json key or refresh token. Used in the
- grpc_google_default_credentials_create function. */
-#define GRPC_GOOGLE_CREDENTIALS_ENV_VAR "GOOGLE_APPLICATION_CREDENTIALS"
-
+ credentials json key or refresh token. Used in the
+ grpc_google_default_credentials_create function. */
+#define GRPC_GOOGLE_CREDENTIALS_ENV_VAR "GOOGLE_APPLICATION_CREDENTIALS"
+
/** Results for the SSL roots override callback. */
-typedef enum {
- GRPC_SSL_ROOTS_OVERRIDE_OK,
+typedef enum {
+ GRPC_SSL_ROOTS_OVERRIDE_OK,
GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY, /** Do not try fallback options. */
- GRPC_SSL_ROOTS_OVERRIDE_FAIL
-} grpc_ssl_roots_override_result;
-
+ GRPC_SSL_ROOTS_OVERRIDE_FAIL
+} grpc_ssl_roots_override_result;
+
/** Callback results for dynamically loading a SSL certificate config. */
-typedef enum {
+typedef enum {
GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED,
GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW,
GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL
@@ -64,50 +64,50 @@ typedef enum {
The certificate presented by the client is not checked by the server at
all. (A client may present a self signed or signed certificate or not
present a certificate at all and any of those option would be accepted) */
- GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
+ GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
/** Server requests client certificate but does not enforce that the client
- presents a certificate.
-
- If the client presents a certificate, the client authentication is left to
+ presents a certificate.
+
+ If the client presents a certificate, the client authentication is left to
the application (the necessary metadata will be available to the
application via authentication context properties, see grpc_auth_context).
-
+
The client's key certificate pair must be valid for the SSL connection to
be established. */
- GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
+ GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
/** Server requests client certificate but does not enforce that the client
- presents a certificate.
-
- If the client presents a certificate, the client authentication is done by
+ presents a certificate.
+
+ If the client presents a certificate, the client authentication is done by
the gRPC framework. (For a successful connection the client needs to either
present a certificate that can be verified against the root certificate
configured by the server or not present a certificate at all)
-
+
The client's key certificate pair must be valid for the SSL connection to
be established. */
- GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY,
+ GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY,
/** Server requests client certificate and enforces that the client presents a
- certificate.
-
- If the client presents a certificate, the client authentication is left to
+ certificate.
+
+ If the client presents a certificate, the client authentication is left to
the application (the necessary metadata will be available to the
application via authentication context properties, see grpc_auth_context).
-
+
The client's key certificate pair must be valid for the SSL connection to
be established. */
- GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
+ GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
/** Server requests client certificate and enforces that the client presents a
- certificate.
-
+ certificate.
+
The certificate presented by the client is verified by the gRPC framework.
(For a successful connection the client needs to present a certificate that
can be verified against the root certificate configured by the server)
-
+
The client's key certificate pair must be valid for the SSL connection to
be established. */
- GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
-} grpc_ssl_client_certificate_request_type;
-
+ GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
+} grpc_ssl_client_certificate_request_type;
+
/* Security levels of grpc transport security. It represents an inherent
* property of a backend connection and is determined by a channel credential
* used to create the connection. */
@@ -142,8 +142,8 @@ typedef enum { UDS = 0, LOCAL_TCP } grpc_local_connect_type;
/** The TLS versions that are supported by the SSL stack. **/
typedef enum { TLS1_2, TLS1_3 } grpc_tls_version;
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_GRPC_SECURITY_CONSTANTS_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_GRPC_SECURITY_CONSTANTS_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/atm.h b/contrib/libs/grpc/include/grpc/impl/codegen/atm.h
index 2f4bbdcae3..00d83f0604 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/atm.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/atm.h
@@ -1,84 +1,84 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_ATM_H
-#define GRPC_IMPL_CODEGEN_ATM_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_ATM_H
+#define GRPC_IMPL_CODEGEN_ATM_H
+
/** This interface provides atomic operations and barriers.
- It is internal to gpr support code and should not be used outside it.
-
- If an operation with acquire semantics precedes another memory access by the
- same thread, the operation will precede that other access as seen by other
- threads.
-
- If an operation with release semantics follows another memory access by the
- same thread, the operation will follow that other access as seen by other
- threads.
-
- Routines with "acq" or "full" in the name have acquire semantics. Routines
- with "rel" or "full" in the name have release semantics. Routines with
- "no_barrier" in the name have neither acquire not release semantics.
-
- The routines may be implemented as macros.
-
- // Atomic operations act on an intergral_type gpr_atm that is guaranteed to
- // be the same size as a pointer.
- typedef intptr_t gpr_atm;
-
- // A memory barrier, providing both acquire and release semantics, but not
- // otherwise acting on memory.
- void gpr_atm_full_barrier(void);
-
- // Atomically return *p, with acquire semantics.
- gpr_atm gpr_atm_acq_load(gpr_atm *p);
+ It is internal to gpr support code and should not be used outside it.
+
+ If an operation with acquire semantics precedes another memory access by the
+ same thread, the operation will precede that other access as seen by other
+ threads.
+
+ If an operation with release semantics follows another memory access by the
+ same thread, the operation will follow that other access as seen by other
+ threads.
+
+ Routines with "acq" or "full" in the name have acquire semantics. Routines
+ with "rel" or "full" in the name have release semantics. Routines with
+ "no_barrier" in the name have neither acquire not release semantics.
+
+ The routines may be implemented as macros.
+
+ // Atomic operations act on an intergral_type gpr_atm that is guaranteed to
+ // be the same size as a pointer.
+ typedef intptr_t gpr_atm;
+
+ // A memory barrier, providing both acquire and release semantics, but not
+ // otherwise acting on memory.
+ void gpr_atm_full_barrier(void);
+
+ // Atomically return *p, with acquire semantics.
+ gpr_atm gpr_atm_acq_load(gpr_atm *p);
gpr_atm gpr_atm_no_barrier_load(gpr_atm *p);
-
- // Atomically set *p = value, with release semantics.
- void gpr_atm_rel_store(gpr_atm *p, gpr_atm value);
-
- // Atomically add delta to *p, and return the old value of *p, with
- // the barriers specified.
- gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p, gpr_atm delta);
- gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta);
-
- // Atomically, if *p==o, set *p=n and return non-zero otherwise return 0,
- // with the barriers specified if the operation succeeds.
- int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
- int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
- int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
+
+ // Atomically set *p = value, with release semantics.
+ void gpr_atm_rel_store(gpr_atm *p, gpr_atm value);
+
+ // Atomically add delta to *p, and return the old value of *p, with
+ // the barriers specified.
+ gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p, gpr_atm delta);
+ gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta);
+
+ // Atomically, if *p==o, set *p=n and return non-zero otherwise return 0,
+ // with the barriers specified if the operation succeeds.
+ int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
+ int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
+ int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
int gpr_atm_full_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
-
- // Atomically, set *p=n and return the old value of *p
- gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n);
-*/
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#if defined(GPR_GCC_ATOMIC)
-#include <grpc/impl/codegen/atm_gcc_atomic.h>
-#elif defined(GPR_GCC_SYNC)
-#include <grpc/impl/codegen/atm_gcc_sync.h>
-#elif defined(GPR_WINDOWS_ATOMIC)
-#include <grpc/impl/codegen/atm_windows.h>
-#else
-#error could not determine platform for atm
-#endif
-
+
+ // Atomically, set *p=n and return the old value of *p
+ gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n);
+*/
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#if defined(GPR_GCC_ATOMIC)
+#include <grpc/impl/codegen/atm_gcc_atomic.h>
+#elif defined(GPR_GCC_SYNC)
+#include <grpc/impl/codegen/atm_gcc_sync.h>
+#elif defined(GPR_WINDOWS_ATOMIC)
+#include <grpc/impl/codegen/atm_windows.h>
+#else
+#error could not determine platform for atm
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -92,4 +92,4 @@ gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta,
}
#endif
-#endif /* GRPC_IMPL_CODEGEN_ATM_H */
+#endif /* GRPC_IMPL_CODEGEN_ATM_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_atomic.h b/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_atomic.h
index 4d55238386..5879708548 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_atomic.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_atomic.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
-#define GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
-
-/* atm_platform.h for gcc and gcc-like compilers with the
- __atomic_* interface. */
-#include <grpc/impl/codegen/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
+#define GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H
+
+/* atm_platform.h for gcc and gcc-like compilers with the
+ __atomic_* interface. */
+#include <grpc/impl/codegen/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef intptr_t gpr_atm;
+typedef intptr_t gpr_atm;
#define GPR_ATM_MAX INTPTR_MAX
#define GPR_ATM_MIN INTPTR_MIN
-
+
#ifdef GPR_LOW_LEVEL_COUNTERS
extern gpr_atm gpr_counter_atm_cas;
extern gpr_atm gpr_counter_atm_add;
@@ -45,42 +45,42 @@ extern gpr_atm gpr_counter_atm_add;
#define GPR_ATM_INC_ADD_THEN(blah) blah
#endif
-#define gpr_atm_full_barrier() (__atomic_thread_fence(__ATOMIC_SEQ_CST))
-
-#define gpr_atm_acq_load(p) (__atomic_load_n((p), __ATOMIC_ACQUIRE))
-#define gpr_atm_no_barrier_load(p) (__atomic_load_n((p), __ATOMIC_RELAXED))
-#define gpr_atm_rel_store(p, value) \
- (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELEASE))
-#define gpr_atm_no_barrier_store(p, value) \
- (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELAXED))
-
-#define gpr_atm_no_barrier_fetch_add(p, delta) \
+#define gpr_atm_full_barrier() (__atomic_thread_fence(__ATOMIC_SEQ_CST))
+
+#define gpr_atm_acq_load(p) (__atomic_load_n((p), __ATOMIC_ACQUIRE))
+#define gpr_atm_no_barrier_load(p) (__atomic_load_n((p), __ATOMIC_RELAXED))
+#define gpr_atm_rel_store(p, value) \
+ (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELEASE))
+#define gpr_atm_no_barrier_store(p, value) \
+ (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELAXED))
+
+#define gpr_atm_no_barrier_fetch_add(p, delta) \
GPR_ATM_INC_ADD_THEN( \
__atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_RELAXED))
-#define gpr_atm_full_fetch_add(p, delta) \
+#define gpr_atm_full_fetch_add(p, delta) \
GPR_ATM_INC_ADD_THEN( \
__atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_ACQ_REL))
-
+
static __inline int gpr_atm_no_barrier_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
return GPR_ATM_INC_CAS_THEN(__atomic_compare_exchange_n(
p, &o, n, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED));
-}
-
+}
+
static __inline int gpr_atm_acq_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
return GPR_ATM_INC_CAS_THEN(__atomic_compare_exchange_n(
p, &o, n, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED));
-}
-
+}
+
static __inline int gpr_atm_rel_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
return GPR_ATM_INC_CAS_THEN(__atomic_compare_exchange_n(
p, &o, n, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED));
-}
-
+}
+
static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
return GPR_ATM_INC_CAS_THEN(__atomic_compare_exchange_n(
p, &o, n, 0, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED));
}
-
+
#define gpr_atm_full_xchg(p, n) \
GPR_ATM_INC_CAS_THEN(__atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL))
@@ -88,4 +88,4 @@ static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
}
#endif
-#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */
+#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_sync.h b/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_sync.h
index 9167164fda..728c3d5412 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_sync.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/atm_gcc_sync.h
@@ -1,85 +1,85 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H
-#define GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H
-
-/* variant of atm_platform.h for gcc and gcc-like compiers with __sync_*
- interface */
-#include <grpc/impl/codegen/port_platform.h>
-
-typedef intptr_t gpr_atm;
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H
+#define GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H
+
+/* variant of atm_platform.h for gcc and gcc-like compiers with __sync_*
+ interface */
+#include <grpc/impl/codegen/port_platform.h>
+
+typedef intptr_t gpr_atm;
#define GPR_ATM_MAX INTPTR_MAX
#define GPR_ATM_MIN INTPTR_MIN
#define GPR_ATM_INC_CAS_THEN(blah) blah
#define GPR_ATM_INC_ADD_THEN(blah) blah
-
-#define GPR_ATM_COMPILE_BARRIER_() __asm__ __volatile__("" : : : "memory")
-
-#if defined(__i386) || defined(__x86_64__)
-/* All loads are acquire loads and all stores are release stores. */
-#define GPR_ATM_LS_BARRIER_() GPR_ATM_COMPILE_BARRIER_()
-#else
-#define GPR_ATM_LS_BARRIER_() gpr_atm_full_barrier()
-#endif
-
-#define gpr_atm_full_barrier() (__sync_synchronize())
-
+
+#define GPR_ATM_COMPILE_BARRIER_() __asm__ __volatile__("" : : : "memory")
+
+#if defined(__i386) || defined(__x86_64__)
+/* All loads are acquire loads and all stores are release stores. */
+#define GPR_ATM_LS_BARRIER_() GPR_ATM_COMPILE_BARRIER_()
+#else
+#define GPR_ATM_LS_BARRIER_() gpr_atm_full_barrier()
+#endif
+
+#define gpr_atm_full_barrier() (__sync_synchronize())
+
static __inline gpr_atm gpr_atm_acq_load(const gpr_atm* p) {
- gpr_atm value = *p;
- GPR_ATM_LS_BARRIER_();
- return value;
-}
-
+ gpr_atm value = *p;
+ GPR_ATM_LS_BARRIER_();
+ return value;
+}
+
static __inline gpr_atm gpr_atm_no_barrier_load(const gpr_atm* p) {
- gpr_atm value = *p;
- GPR_ATM_COMPILE_BARRIER_();
- return value;
-}
-
+ gpr_atm value = *p;
+ GPR_ATM_COMPILE_BARRIER_();
+ return value;
+}
+
static __inline void gpr_atm_rel_store(gpr_atm* p, gpr_atm value) {
- GPR_ATM_LS_BARRIER_();
- *p = value;
-}
-
+ GPR_ATM_LS_BARRIER_();
+ *p = value;
+}
+
static __inline void gpr_atm_no_barrier_store(gpr_atm* p, gpr_atm value) {
- GPR_ATM_COMPILE_BARRIER_();
- *p = value;
-}
-
-#undef GPR_ATM_LS_BARRIER_
-#undef GPR_ATM_COMPILE_BARRIER_
-
-#define gpr_atm_no_barrier_fetch_add(p, delta) \
- gpr_atm_full_fetch_add((p), (delta))
-#define gpr_atm_full_fetch_add(p, delta) (__sync_fetch_and_add((p), (delta)))
-
-#define gpr_atm_no_barrier_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
-#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
-#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
+ GPR_ATM_COMPILE_BARRIER_();
+ *p = value;
+}
+
+#undef GPR_ATM_LS_BARRIER_
+#undef GPR_ATM_COMPILE_BARRIER_
+
+#define gpr_atm_no_barrier_fetch_add(p, delta) \
+ gpr_atm_full_fetch_add((p), (delta))
+#define gpr_atm_full_fetch_add(p, delta) (__sync_fetch_and_add((p), (delta)))
+
+#define gpr_atm_no_barrier_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
+#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
+#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
#define gpr_atm_full_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
-
+
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm* p, gpr_atm n) {
- gpr_atm cur;
- do {
- cur = gpr_atm_acq_load(p);
- } while (!gpr_atm_rel_cas(p, cur, n));
- return cur;
-}
-
-#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H */
+ gpr_atm cur;
+ do {
+ cur = gpr_atm_acq_load(p);
+ } while (!gpr_atm_rel_cas(p, cur, n));
+ return cur;
+}
+
+#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/atm_windows.h b/contrib/libs/grpc/include/grpc/impl/codegen/atm_windows.h
index 70a86783be..c016b90095 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/atm_windows.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/atm_windows.h
@@ -1,88 +1,88 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
-#define GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
+#define GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
+
/** Win32 variant of atm_platform.h */
-#include <grpc/impl/codegen/port_platform.h>
-
-typedef intptr_t gpr_atm;
+#include <grpc/impl/codegen/port_platform.h>
+
+typedef intptr_t gpr_atm;
#define GPR_ATM_MAX INTPTR_MAX
#define GPR_ATM_MIN INTPTR_MIN
#define GPR_ATM_INC_CAS_THEN(blah) blah
#define GPR_ATM_INC_ADD_THEN(blah) blah
-
-#define gpr_atm_full_barrier MemoryBarrier
-
+
+#define gpr_atm_full_barrier MemoryBarrier
+
static __inline gpr_atm gpr_atm_acq_load(const gpr_atm* p) {
- gpr_atm result = *p;
- gpr_atm_full_barrier();
- return result;
-}
-
+ gpr_atm result = *p;
+ gpr_atm_full_barrier();
+ return result;
+}
+
static __inline gpr_atm gpr_atm_no_barrier_load(const gpr_atm* p) {
- /* TODO(dklempner): Can we implement something better here? */
- return gpr_atm_acq_load(p);
-}
-
+ /* TODO(dklempner): Can we implement something better here? */
+ return gpr_atm_acq_load(p);
+}
+
static __inline void gpr_atm_rel_store(gpr_atm* p, gpr_atm value) {
- gpr_atm_full_barrier();
- *p = value;
-}
-
+ gpr_atm_full_barrier();
+ *p = value;
+}
+
static __inline void gpr_atm_no_barrier_store(gpr_atm* p, gpr_atm value) {
- /* TODO(ctiller): Can we implement something better here? */
- gpr_atm_rel_store(p, value);
-}
-
+ /* TODO(ctiller): Can we implement something better here? */
+ gpr_atm_rel_store(p, value);
+}
+
static __inline int gpr_atm_no_barrier_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
/** InterlockedCompareExchangePointerNoFence() not available on vista or
- windows7 */
-#ifdef GPR_ARCH_64
- return o == (gpr_atm)InterlockedCompareExchangeAcquire64(
+ windows7 */
+#ifdef GPR_ARCH_64
+ return o == (gpr_atm)InterlockedCompareExchangeAcquire64(
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
-#else
+#else
return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG*)p,
- (LONG)n, (LONG)o);
-#endif
-}
-
+ (LONG)n, (LONG)o);
+#endif
+}
+
static __inline int gpr_atm_acq_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
-#ifdef GPR_ARCH_64
- return o == (gpr_atm)InterlockedCompareExchangeAcquire64(
+#ifdef GPR_ARCH_64
+ return o == (gpr_atm)InterlockedCompareExchangeAcquire64(
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
-#else
+#else
return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG*)p,
- (LONG)n, (LONG)o);
-#endif
-}
-
+ (LONG)n, (LONG)o);
+#endif
+}
+
static __inline int gpr_atm_rel_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
-#ifdef GPR_ARCH_64
- return o == (gpr_atm)InterlockedCompareExchangeRelease64(
+#ifdef GPR_ARCH_64
+ return o == (gpr_atm)InterlockedCompareExchangeRelease64(
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
-#else
+#else
return o == (gpr_atm)InterlockedCompareExchangeRelease((volatile LONG*)p,
- (LONG)n, (LONG)o);
-#endif
-}
-
+ (LONG)n, (LONG)o);
+#endif
+}
+
static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
#ifdef GPR_ARCH_64
return o == (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG*)p,
@@ -94,35 +94,35 @@ static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
}
static __inline gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm* p,
- gpr_atm delta) {
+ gpr_atm delta) {
/** Use the CAS operation to get pointer-sized fetch and add */
- gpr_atm old;
- do {
- old = *p;
- } while (!gpr_atm_no_barrier_cas(p, old, old + delta));
- return old;
-}
-
+ gpr_atm old;
+ do {
+ old = *p;
+ } while (!gpr_atm_no_barrier_cas(p, old, old + delta));
+ return old;
+}
+
static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm* p, gpr_atm delta) {
/** Use a CAS operation to get pointer-sized fetch and add */
- gpr_atm old;
-#ifdef GPR_ARCH_64
- do {
- old = *p;
+ gpr_atm old;
+#ifdef GPR_ARCH_64
+ do {
+ old = *p;
} while (old != (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG*)p,
- (LONGLONG)old + delta,
- (LONGLONG)old));
-#else
- do {
- old = *p;
- } while (old != (gpr_atm)InterlockedCompareExchange(
+ (LONGLONG)old + delta,
+ (LONGLONG)old));
+#else
+ do {
+ old = *p;
+ } while (old != (gpr_atm)InterlockedCompareExchange(
(volatile LONG*)p, (LONG)old + delta, (LONG)old));
-#endif
- return old;
-}
-
+#endif
+ return old;
+}
+
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm* p, gpr_atm n) {
return (gpr_atm)InterlockedExchangePointer((PVOID*)p, (PVOID)n);
-}
-
-#endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */
+}
+
+#endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/byte_buffer_reader.h b/contrib/libs/grpc/include/grpc/impl/codegen/byte_buffer_reader.h
index 5ac7b0cab5..e06e19558a 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/byte_buffer_reader.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/byte_buffer_reader.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
-#define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct grpc_byte_buffer;
-
-struct grpc_byte_buffer_reader {
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
+#define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_byte_buffer;
+
+struct grpc_byte_buffer_reader {
struct grpc_byte_buffer* buffer_in;
struct grpc_byte_buffer* buffer_out;
/** Different current objects correspond to different types of byte buffers */
union grpc_byte_buffer_reader_current {
/** Index into a slice buffer's array of slices */
- unsigned index;
- } current;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H */
+ unsigned index;
+ } current;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/compression_types.h b/contrib/libs/grpc/include/grpc/impl/codegen/compression_types.h
index 0d97f62128..f778b005b9 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/compression_types.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/compression_types.h
@@ -1,108 +1,108 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
-#define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
+#define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
+
#include <grpc/impl/codegen/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** To be used as initial metadata key for the request of a concrete compression
- * algorithm */
-#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
- "grpc-internal-encoding-request"
-
-/** To be used in channel arguments.
- *
- * \addtogroup grpc_arg_keys
- * \{ */
-/** Default compression algorithm for the channel.
- * Its value is an int from the \a grpc_compression_algorithm enum. */
-#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
- "grpc.default_compression_algorithm"
-/** Default compression level for the channel.
- * Its value is an int from the \a grpc_compression_level enum. */
-#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
-/** Compression algorithms supported by the channel.
- * Its value is a bitset (an int). Bits correspond to algorithms in \a
- * grpc_compression_algorithm. For example, its LSB corresponds to
- * GRPC_COMPRESS_NONE, the next bit to GRPC_COMPRESS_DEFLATE, etc.
- * Unset bits disable support for the algorithm. By default all algorithms are
- * supported. It's not possible to disable GRPC_COMPRESS_NONE (the attempt will
- * be ignored). */
-#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
- "grpc.compression_enabled_algorithms_bitset"
-/** \} */
-
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** To be used as initial metadata key for the request of a concrete compression
+ * algorithm */
+#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
+ "grpc-internal-encoding-request"
+
+/** To be used in channel arguments.
+ *
+ * \addtogroup grpc_arg_keys
+ * \{ */
+/** Default compression algorithm for the channel.
+ * Its value is an int from the \a grpc_compression_algorithm enum. */
+#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
+ "grpc.default_compression_algorithm"
+/** Default compression level for the channel.
+ * Its value is an int from the \a grpc_compression_level enum. */
+#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
+/** Compression algorithms supported by the channel.
+ * Its value is a bitset (an int). Bits correspond to algorithms in \a
+ * grpc_compression_algorithm. For example, its LSB corresponds to
+ * GRPC_COMPRESS_NONE, the next bit to GRPC_COMPRESS_DEFLATE, etc.
+ * Unset bits disable support for the algorithm. By default all algorithms are
+ * supported. It's not possible to disable GRPC_COMPRESS_NONE (the attempt will
+ * be ignored). */
+#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
+ "grpc.compression_enabled_algorithms_bitset"
+/** \} */
+
/** The various compression algorithms supported by gRPC (not sorted by
* compression level) */
-typedef enum {
- GRPC_COMPRESS_NONE = 0,
- GRPC_COMPRESS_DEFLATE,
- GRPC_COMPRESS_GZIP,
+typedef enum {
+ GRPC_COMPRESS_NONE = 0,
+ GRPC_COMPRESS_DEFLATE,
+ GRPC_COMPRESS_GZIP,
/* EXPERIMENTAL: Stream compression is currently experimental. */
GRPC_COMPRESS_STREAM_GZIP,
- /* TODO(ctiller): snappy */
- GRPC_COMPRESS_ALGORITHMS_COUNT
-} grpc_compression_algorithm;
-
-/** Compression levels allow a party with knowledge of its peer's accepted
- * encodings to request compression in an abstract way. The level-algorithm
- * mapping is performed internally and depends on the peer's supported
- * compression algorithms. */
-typedef enum {
- GRPC_COMPRESS_LEVEL_NONE = 0,
- GRPC_COMPRESS_LEVEL_LOW,
- GRPC_COMPRESS_LEVEL_MED,
- GRPC_COMPRESS_LEVEL_HIGH,
- GRPC_COMPRESS_LEVEL_COUNT
-} grpc_compression_level;
-
-typedef struct grpc_compression_options {
- /** All algs are enabled by default. This option corresponds to the channel
- * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
- */
- uint32_t enabled_algorithms_bitset;
-
+ /* TODO(ctiller): snappy */
+ GRPC_COMPRESS_ALGORITHMS_COUNT
+} grpc_compression_algorithm;
+
+/** Compression levels allow a party with knowledge of its peer's accepted
+ * encodings to request compression in an abstract way. The level-algorithm
+ * mapping is performed internally and depends on the peer's supported
+ * compression algorithms. */
+typedef enum {
+ GRPC_COMPRESS_LEVEL_NONE = 0,
+ GRPC_COMPRESS_LEVEL_LOW,
+ GRPC_COMPRESS_LEVEL_MED,
+ GRPC_COMPRESS_LEVEL_HIGH,
+ GRPC_COMPRESS_LEVEL_COUNT
+} grpc_compression_level;
+
+typedef struct grpc_compression_options {
+ /** All algs are enabled by default. This option corresponds to the channel
+ * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
+ */
+ uint32_t enabled_algorithms_bitset;
+
/** The default compression level. It'll be used in the absence of call
* specific settings. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present,
* takes precedence over \a default_algorithm.
- * TODO(dgq): currently only available for server channels. */
+ * TODO(dgq): currently only available for server channels. */
struct grpc_compression_options_default_level {
int is_set;
- grpc_compression_level level;
- } default_level;
-
+ grpc_compression_level level;
+ } default_level;
+
/** The default message compression algorithm. It'll be used in the absence of
- * call specific settings. This option corresponds to the channel argument key
- * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
+ * call specific settings. This option corresponds to the channel argument key
+ * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
struct grpc_compression_options_default_algorithm {
int is_set;
- grpc_compression_algorithm algorithm;
- } default_algorithm;
-} grpc_compression_options;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H */
+ grpc_compression_algorithm algorithm;
+ } default_algorithm;
+} grpc_compression_options;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/connectivity_state.h b/contrib/libs/grpc/include/grpc/impl/codegen/connectivity_state.h
index 081fce1cfd..b70dbef356 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/connectivity_state.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/connectivity_state.h
@@ -1,44 +1,44 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H
-#define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Connectivity state of a channel. */
-typedef enum {
- /** channel is idle */
- GRPC_CHANNEL_IDLE,
- /** channel is connecting */
- GRPC_CHANNEL_CONNECTING,
- /** channel is ready for work */
- GRPC_CHANNEL_READY,
- /** channel has seen a failure but expects to recover */
- GRPC_CHANNEL_TRANSIENT_FAILURE,
- /** channel has seen a failure that it cannot recover from */
- GRPC_CHANNEL_SHUTDOWN
-} grpc_connectivity_state;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H */
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H
+#define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Connectivity state of a channel. */
+typedef enum {
+ /** channel is idle */
+ GRPC_CHANNEL_IDLE,
+ /** channel is connecting */
+ GRPC_CHANNEL_CONNECTING,
+ /** channel is ready for work */
+ GRPC_CHANNEL_READY,
+ /** channel has seen a failure but expects to recover */
+ GRPC_CHANNEL_TRANSIENT_FAILURE,
+ /** channel has seen a failure that it cannot recover from */
+ GRPC_CHANNEL_SHUTDOWN
+} grpc_connectivity_state;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/gpr_slice.h b/contrib/libs/grpc/include/grpc/impl/codegen/gpr_slice.h
index 75aa759126..89fa72d5fc 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/gpr_slice.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/gpr_slice.h
@@ -1,69 +1,69 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-#ifndef GRPC_IMPL_CODEGEN_GPR_SLICE_H
-#define GRPC_IMPL_CODEGEN_GPR_SLICE_H
-
+ *
+ */
+#ifndef GRPC_IMPL_CODEGEN_GPR_SLICE_H
+#define GRPC_IMPL_CODEGEN_GPR_SLICE_H
+
/** WARNING: Please do not use this header. This was added as a temporary
* measure to not break some of the external projects that depend on
* gpr_slice_* functions. We are actively working on moving all the
* gpr_slice_* references to grpc_slice_* and this file will be removed
*/
-
-/* TODO (sreek) - Allowed by default but will be very soon turned off */
-#define GRPC_ALLOW_GPR_SLICE_FUNCTIONS 1
-
-#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
-
-#define gpr_slice_refcount grpc_slice_refcount
-#define gpr_slice grpc_slice
-#define gpr_slice_buffer grpc_slice_buffer
-
-#define gpr_slice_ref grpc_slice_ref
-#define gpr_slice_unref grpc_slice_unref
-#define gpr_slice_new grpc_slice_new
-#define gpr_slice_new_with_user_data grpc_slice_new_with_user_data
-#define gpr_slice_new_with_len grpc_slice_new_with_len
-#define gpr_slice_malloc grpc_slice_malloc
-#define gpr_slice_from_copied_string grpc_slice_from_copied_string
-#define gpr_slice_from_copied_buffer grpc_slice_from_copied_buffer
-#define gpr_slice_from_static_string grpc_slice_from_static_string
-#define gpr_slice_sub grpc_slice_sub
-#define gpr_slice_sub_no_ref grpc_slice_sub_no_ref
-#define gpr_slice_split_tail grpc_slice_split_tail
-#define gpr_slice_split_head grpc_slice_split_head
-#define gpr_slice_cmp grpc_slice_cmp
-#define gpr_slice_str_cmp grpc_slice_str_cmp
-
-#define gpr_slice_buffer grpc_slice_buffer
-#define gpr_slice_buffer_init grpc_slice_buffer_init
-#define gpr_slice_buffer_destroy grpc_slice_buffer_destroy
-#define gpr_slice_buffer_add grpc_slice_buffer_add
-#define gpr_slice_buffer_add_indexed grpc_slice_buffer_add_indexed
-#define gpr_slice_buffer_addn grpc_slice_buffer_addn
-#define gpr_slice_buffer_tiny_add grpc_slice_buffer_tiny_add
-#define gpr_slice_buffer_pop grpc_slice_buffer_pop
-#define gpr_slice_buffer_reset_and_unref grpc_slice_buffer_reset_and_unref
-#define gpr_slice_buffer_swap grpc_slice_buffer_swap
-#define gpr_slice_buffer_move_into grpc_slice_buffer_move_into
-#define gpr_slice_buffer_trim_end grpc_slice_buffer_trim_end
-#define gpr_slice_buffer_move_first grpc_slice_buffer_move_first
-#define gpr_slice_buffer_take_first grpc_slice_buffer_take_first
-
-#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
-
-#endif /* GRPC_IMPL_CODEGEN_GPR_SLICE_H */
+
+/* TODO (sreek) - Allowed by default but will be very soon turned off */
+#define GRPC_ALLOW_GPR_SLICE_FUNCTIONS 1
+
+#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
+
+#define gpr_slice_refcount grpc_slice_refcount
+#define gpr_slice grpc_slice
+#define gpr_slice_buffer grpc_slice_buffer
+
+#define gpr_slice_ref grpc_slice_ref
+#define gpr_slice_unref grpc_slice_unref
+#define gpr_slice_new grpc_slice_new
+#define gpr_slice_new_with_user_data grpc_slice_new_with_user_data
+#define gpr_slice_new_with_len grpc_slice_new_with_len
+#define gpr_slice_malloc grpc_slice_malloc
+#define gpr_slice_from_copied_string grpc_slice_from_copied_string
+#define gpr_slice_from_copied_buffer grpc_slice_from_copied_buffer
+#define gpr_slice_from_static_string grpc_slice_from_static_string
+#define gpr_slice_sub grpc_slice_sub
+#define gpr_slice_sub_no_ref grpc_slice_sub_no_ref
+#define gpr_slice_split_tail grpc_slice_split_tail
+#define gpr_slice_split_head grpc_slice_split_head
+#define gpr_slice_cmp grpc_slice_cmp
+#define gpr_slice_str_cmp grpc_slice_str_cmp
+
+#define gpr_slice_buffer grpc_slice_buffer
+#define gpr_slice_buffer_init grpc_slice_buffer_init
+#define gpr_slice_buffer_destroy grpc_slice_buffer_destroy
+#define gpr_slice_buffer_add grpc_slice_buffer_add
+#define gpr_slice_buffer_add_indexed grpc_slice_buffer_add_indexed
+#define gpr_slice_buffer_addn grpc_slice_buffer_addn
+#define gpr_slice_buffer_tiny_add grpc_slice_buffer_tiny_add
+#define gpr_slice_buffer_pop grpc_slice_buffer_pop
+#define gpr_slice_buffer_reset_and_unref grpc_slice_buffer_reset_and_unref
+#define gpr_slice_buffer_swap grpc_slice_buffer_swap
+#define gpr_slice_buffer_move_into grpc_slice_buffer_move_into
+#define gpr_slice_buffer_trim_end grpc_slice_buffer_trim_end
+#define gpr_slice_buffer_move_first grpc_slice_buffer_move_first
+#define gpr_slice_buffer_take_first grpc_slice_buffer_take_first
+
+#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
+
+#endif /* GRPC_IMPL_CODEGEN_GPR_SLICE_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/gpr_types.h b/contrib/libs/grpc/include/grpc/impl/codegen/gpr_types.h
index 784bad6f26..6daf339861 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/gpr_types.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/gpr_types.h
@@ -1,59 +1,59 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_GPR_TYPES_H
-#define GRPC_IMPL_CODEGEN_GPR_TYPES_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_GPR_TYPES_H
+#define GRPC_IMPL_CODEGEN_GPR_TYPES_H
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** The clocks we support. */
-typedef enum {
+typedef enum {
/** Monotonic clock. Epoch undefined. Always moves forwards. */
- GPR_CLOCK_MONOTONIC = 0,
+ GPR_CLOCK_MONOTONIC = 0,
/** Realtime clock. May jump forwards or backwards. Settable by
- the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */
- GPR_CLOCK_REALTIME,
+ the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */
+ GPR_CLOCK_REALTIME,
/** CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch
- undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */
- GPR_CLOCK_PRECISE,
+ undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */
+ GPR_CLOCK_PRECISE,
/** Unmeasurable clock type: no base, created by taking the difference
- between two times */
- GPR_TIMESPAN
-} gpr_clock_type;
-
+ between two times */
+ GPR_TIMESPAN
+} gpr_clock_type;
+
/** Analogous to struct timespec. On some machines, absolute times may be in
- * local time. */
-typedef struct gpr_timespec {
- int64_t tv_sec;
- int32_t tv_nsec;
- /** Against which clock was this time measured? (or GPR_TIMESPAN if
+ * local time. */
+typedef struct gpr_timespec {
+ int64_t tv_sec;
+ int32_t tv_nsec;
+ /** Against which clock was this time measured? (or GPR_TIMESPAN if
this is a relative time measure) */
- gpr_clock_type clock_type;
-} gpr_timespec;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_GPR_TYPES_H */
+ gpr_clock_type clock_type;
+} gpr_timespec;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_GPR_TYPES_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/grpc_types.h b/contrib/libs/grpc/include/grpc/impl/codegen/grpc_types.h
index 0504214f25..07066f0e1d 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/grpc_types.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/grpc_types.h
@@ -1,162 +1,162 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H
-#define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H
+#define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
+
#include <grpc/impl/codegen/port_platform.h>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/slice.h>
-#include <grpc/impl/codegen/status.h>
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- GRPC_BB_RAW
+#include <grpc/impl/codegen/compression_types.h>
+#include <grpc/impl/codegen/gpr_types.h>
+#include <grpc/impl/codegen/slice.h>
+#include <grpc/impl/codegen/status.h>
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ GRPC_BB_RAW
/** Future types may include GRPC_BB_PROTOBUF, etc. */
-} grpc_byte_buffer_type;
-
-typedef struct grpc_byte_buffer {
+} grpc_byte_buffer_type;
+
+typedef struct grpc_byte_buffer {
void* reserved;
- grpc_byte_buffer_type type;
+ grpc_byte_buffer_type type;
union grpc_byte_buffer_data {
struct /* internal */ {
void* reserved[8];
- } reserved;
+ } reserved;
struct grpc_compressed_buffer {
- grpc_compression_algorithm compression;
- grpc_slice_buffer slice_buffer;
- } raw;
- } data;
-} grpc_byte_buffer;
-
+ grpc_compression_algorithm compression;
+ grpc_slice_buffer slice_buffer;
+ } raw;
+ } data;
+} grpc_byte_buffer;
+
/** Completion Queues enable notification of the completion of
* asynchronous actions. */
-typedef struct grpc_completion_queue grpc_completion_queue;
-
-/** An alarm associated with a completion queue. */
-typedef struct grpc_alarm grpc_alarm;
-
-/** The Channel interface allows creation of Call objects. */
-typedef struct grpc_channel grpc_channel;
-
-/** A server listens to some port and responds to request calls */
-typedef struct grpc_server grpc_server;
-
-/** A Call represents an RPC. When created, it is in a configuration state
- allowing properties to be set until it is invoked. After invoke, the Call
- can have messages written to it and read from it. */
-typedef struct grpc_call grpc_call;
-
-/** The Socket Mutator interface allows changes on socket options */
-typedef struct grpc_socket_mutator grpc_socket_mutator;
-
+typedef struct grpc_completion_queue grpc_completion_queue;
+
+/** An alarm associated with a completion queue. */
+typedef struct grpc_alarm grpc_alarm;
+
+/** The Channel interface allows creation of Call objects. */
+typedef struct grpc_channel grpc_channel;
+
+/** A server listens to some port and responds to request calls */
+typedef struct grpc_server grpc_server;
+
+/** A Call represents an RPC. When created, it is in a configuration state
+ allowing properties to be set until it is invoked. After invoke, the Call
+ can have messages written to it and read from it. */
+typedef struct grpc_call grpc_call;
+
+/** The Socket Mutator interface allows changes on socket options */
+typedef struct grpc_socket_mutator grpc_socket_mutator;
+
/** The Socket Factory interface creates and binds sockets */
typedef struct grpc_socket_factory grpc_socket_factory;
-/** Type specifier for grpc_arg */
-typedef enum {
- GRPC_ARG_STRING,
- GRPC_ARG_INTEGER,
- GRPC_ARG_POINTER
-} grpc_arg_type;
-
-typedef struct grpc_arg_pointer_vtable {
+/** Type specifier for grpc_arg */
+typedef enum {
+ GRPC_ARG_STRING,
+ GRPC_ARG_INTEGER,
+ GRPC_ARG_POINTER
+} grpc_arg_type;
+
+typedef struct grpc_arg_pointer_vtable {
void* (*copy)(void* p);
void (*destroy)(void* p);
int (*cmp)(void* p, void* q);
-} grpc_arg_pointer_vtable;
-
-/** A single argument... each argument has a key and a value
-
- A note on naming keys:
- Keys are namespaced into groups, usually grouped by library, and are
- keys for module XYZ are named XYZ.key1, XYZ.key2, etc. Module names must
- be restricted to the regex [A-Za-z][_A-Za-z0-9]{,15}.
- Key names must be restricted to the regex [A-Za-z][_A-Za-z0-9]{,47}.
-
- GRPC core library keys are prefixed by grpc.
-
- Library authors are strongly encouraged to \#define symbolic constants for
- their keys so that it's possible to change them in the future. */
-typedef struct {
- grpc_arg_type type;
+} grpc_arg_pointer_vtable;
+
+/** A single argument... each argument has a key and a value
+
+ A note on naming keys:
+ Keys are namespaced into groups, usually grouped by library, and are
+ keys for module XYZ are named XYZ.key1, XYZ.key2, etc. Module names must
+ be restricted to the regex [A-Za-z][_A-Za-z0-9]{,15}.
+ Key names must be restricted to the regex [A-Za-z][_A-Za-z0-9]{,47}.
+
+ GRPC core library keys are prefixed by grpc.
+
+ Library authors are strongly encouraged to \#define symbolic constants for
+ their keys so that it's possible to change them in the future. */
+typedef struct {
+ grpc_arg_type type;
char* key;
union grpc_arg_value {
char* string;
- int integer;
+ int integer;
struct grpc_arg_pointer {
void* p;
const grpc_arg_pointer_vtable* vtable;
- } pointer;
- } value;
-} grpc_arg;
-
-/** An array of arguments that can be passed around.
-
- Used to set optional channel-level configuration.
- These configuration options are modelled as key-value pairs as defined
- by grpc_arg; keys are strings to allow easy backwards-compatible extension
+ } pointer;
+ } value;
+} grpc_arg;
+
+/** An array of arguments that can be passed around.
+
+ Used to set optional channel-level configuration.
+ These configuration options are modelled as key-value pairs as defined
+ by grpc_arg; keys are strings to allow easy backwards-compatible extension
by arbitrary parties. All evaluation is performed at channel creation
time (i.e. the keys and values in this structure need only live through the
creation invocation).
-
+
However, if one of the args has grpc_arg_type==GRPC_ARG_POINTER, then the
grpc_arg_pointer_vtable must live until the channel args are done being
used by core (i.e. when the object for use with which they were passed
is destroyed).
- See the description of the \ref grpc_arg_keys "available args" for more
- details. */
-typedef struct {
- size_t num_args;
+ See the description of the \ref grpc_arg_keys "available args" for more
+ details. */
+typedef struct {
+ size_t num_args;
grpc_arg* args;
-} grpc_channel_args;
-
-/** \defgroup grpc_arg_keys
- * Channel argument keys.
- * \{
- */
-/** If non-zero, enable census for tracing and stats collection. */
-#define GRPC_ARG_ENABLE_CENSUS "grpc.census"
-/** If non-zero, enable load reporting. */
-#define GRPC_ARG_ENABLE_LOAD_REPORTING "grpc.loadreporting"
+} grpc_channel_args;
+
+/** \defgroup grpc_arg_keys
+ * Channel argument keys.
+ * \{
+ */
+/** If non-zero, enable census for tracing and stats collection. */
+#define GRPC_ARG_ENABLE_CENSUS "grpc.census"
+/** If non-zero, enable load reporting. */
+#define GRPC_ARG_ENABLE_LOAD_REPORTING "grpc.loadreporting"
/** Request that optional features default to off (regardless of what they
usually default to) - to enable tight control over what gets enabled */
#define GRPC_ARG_MINIMAL_STACK "grpc.minimal_stack"
-/** Maximum number of concurrent incoming streams to allow on a http2
- connection. Int valued. */
-#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
-/** Maximum message length that the channel can receive. Int valued, bytes.
- -1 means unlimited. */
-#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length"
+/** Maximum number of concurrent incoming streams to allow on a http2
+ connection. Int valued. */
+#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
+/** Maximum message length that the channel can receive. Int valued, bytes.
+ -1 means unlimited. */
+#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length"
/** \deprecated For backward compatibility.
* Use GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH instead. */
-#define GRPC_ARG_MAX_MESSAGE_LENGTH GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
-/** Maximum message length that the channel can send. Int valued, bytes.
- -1 means unlimited. */
-#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
+#define GRPC_ARG_MAX_MESSAGE_LENGTH GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
+/** Maximum message length that the channel can send. Int valued, bytes.
+ -1 means unlimited. */
+#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
/** Maximum time that a channel may have no outstanding rpcs, after which the
* server will close the connection. Int valued, milliseconds. INT_MAX means
* unlimited. */
@@ -183,23 +183,23 @@ typedef struct {
GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0 */
#define GRPC_ARG_ENABLE_DEADLINE_CHECKS "grpc.enable_deadline_checking"
/** Initial stream ID for http2 transports. Int valued. */
-#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \
- "grpc.http2.initial_sequence_number"
-/** Amount to read ahead on individual streams. Defaults to 64kb, larger
- values can help throughput on high-latency connections.
- NOTE: at some point we'd like to auto-tune this, and this parameter
- will become a no-op. Int valued, bytes. */
-#define GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES "grpc.http2.lookahead_bytes"
-/** How much memory to use for hpack decoding. Int valued, bytes. */
-#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER \
- "grpc.http2.hpack_table_size.decoder"
-/** How much memory to use for hpack encoding. Int valued, bytes. */
-#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
- "grpc.http2.hpack_table_size.encoder"
-/** How big a frame are we willing to receive via HTTP2.
+#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \
+ "grpc.http2.initial_sequence_number"
+/** Amount to read ahead on individual streams. Defaults to 64kb, larger
+ values can help throughput on high-latency connections.
+ NOTE: at some point we'd like to auto-tune this, and this parameter
+ will become a no-op. Int valued, bytes. */
+#define GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES "grpc.http2.lookahead_bytes"
+/** How much memory to use for hpack decoding. Int valued, bytes. */
+#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER \
+ "grpc.http2.hpack_table_size.decoder"
+/** How much memory to use for hpack encoding. Int valued, bytes. */
+#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
+ "grpc.http2.hpack_table_size.encoder"
+/** How big a frame are we willing to receive via HTTP2.
Min 16384, max 16777215. Larger values give lower CPU usage for large
messages, but more head of line blocking for small messages. */
-#define GRPC_ARG_HTTP2_MAX_FRAME_SIZE "grpc.http2.max_frame_size"
+#define GRPC_ARG_HTTP2_MAX_FRAME_SIZE "grpc.http2.max_frame_size"
/** Should BDP probing be performed? */
#define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
/** Minimum time between sending successive ping frames without receiving any
@@ -222,9 +222,9 @@ typedef struct {
closing the transport? (0 indicates that the server can bear an infinite
number of misbehaving pings) */
#define GRPC_ARG_HTTP2_MAX_PING_STRIKES "grpc.http2.max_ping_strikes"
-/** How much data are we willing to queue up per stream if
- GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */
-#define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size"
+/** How much data are we willing to queue up per stream if
+ GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */
+#define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size"
/** Should we allow receipt of true-binary data on http2 connections?
Defaults to on (1) */
#define GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY "grpc.http2.true_binary"
@@ -239,22 +239,22 @@ typedef struct {
Int valued, 0(false)/1(true). */
#define GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS \
"grpc.keepalive_permit_without_calls"
-/** Default authority to pass if none specified on call construction. A string.
- * */
-#define GRPC_ARG_DEFAULT_AUTHORITY "grpc.default_authority"
-/** Primary user agent: goes at the start of the user-agent metadata
- sent on each request. A string. */
-#define GRPC_ARG_PRIMARY_USER_AGENT_STRING "grpc.primary_user_agent"
-/** Secondary user agent: goes at the end of the user-agent metadata
- sent on each request. A string. */
-#define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
+/** Default authority to pass if none specified on call construction. A string.
+ * */
+#define GRPC_ARG_DEFAULT_AUTHORITY "grpc.default_authority"
+/** Primary user agent: goes at the start of the user-agent metadata
+ sent on each request. A string. */
+#define GRPC_ARG_PRIMARY_USER_AGENT_STRING "grpc.primary_user_agent"
+/** Secondary user agent: goes at the end of the user-agent metadata
+ sent on each request. A string. */
+#define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
/** The minimum time between subsequent connection attempts, in ms */
#define GRPC_ARG_MIN_RECONNECT_BACKOFF_MS "grpc.min_reconnect_backoff_ms"
-/** The maximum time between subsequent connection attempts, in ms */
-#define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
-/** The time between the first and second connection attempts, in ms */
-#define GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS \
- "grpc.initial_reconnect_backoff_ms"
+/** The maximum time between subsequent connection attempts, in ms */
+#define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
+/** The time between the first and second connection attempts, in ms */
+#define GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS \
+ "grpc.initial_reconnect_backoff_ms"
/** Minimum amount of time between DNS resolutions, in ms */
#define GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS \
"grpc.dns_min_time_between_resolutions_ms"
@@ -268,7 +268,7 @@ typedef struct {
for SSL host name checking will be the target parameter (assuming that the
secure channel is an SSL channel). If this parameter is specified and the
underlying is not an SSL channel, it will just be ignored. */
-#define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override"
+#define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override"
/** If non-zero, a pointer to a session cache (a pointer of type
grpc_ssl_session_cache*). (use grpc_ssl_session_cache_arg_vtable() to fetch
an appropriate pointer arg vtable) */
@@ -283,25 +283,25 @@ typedef struct {
#define GRPC_ARG_TSI_MAX_FRAME_SIZE "grpc.tsi.max_frame_size"
/** Maximum metadata size, in bytes. Note this limit applies to the max sum of
all metadata key-value entries in a batch of headers. */
-#define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
-/** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */
-#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
+#define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
+/** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */
+#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
/** If non-zero, a pointer to a buffer pool (a pointer of type
* grpc_resource_quota*). (use grpc_resource_quota_arg_vtable() to fetch an
* appropriate pointer arg vtable) */
-#define GRPC_ARG_RESOURCE_QUOTA "grpc.resource_quota"
+#define GRPC_ARG_RESOURCE_QUOTA "grpc.resource_quota"
/** If non-zero, expand wildcard addresses to a list of local addresses. */
#define GRPC_ARG_EXPAND_WILDCARD_ADDRS "grpc.expand_wildcard_addrs"
/** Service config data in JSON form.
This value will be ignored if the name resolver returns a service config. */
-#define GRPC_ARG_SERVICE_CONFIG "grpc.service_config"
+#define GRPC_ARG_SERVICE_CONFIG "grpc.service_config"
/** Disable looking up the service config via the name resolver. */
#define GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION \
"grpc.service_config_disable_resolution"
-/** LB policy name. */
-#define GRPC_ARG_LB_POLICY_NAME "grpc.lb_policy_name"
-/** The grpc_socket_mutator instance that set the socket options. A pointer. */
-#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
+/** LB policy name. */
+#define GRPC_ARG_LB_POLICY_NAME "grpc.lb_policy_name"
+/** The grpc_socket_mutator instance that set the socket options. A pointer. */
+#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
/** The grpc_socket_factory instance to create and bind sockets. A pointer. */
#define GRPC_ARG_SOCKET_FACTORY "grpc.socket_factory"
/** The maximum amount of memory used by trace events per channel trace node.
@@ -410,217 +410,217 @@ typedef struct {
#define GRPC_ARG_CHANNEL_POOL_DOMAIN "grpc.channel_pooling_domain"
/** gRPC Objective-C channel pooling id. */
#define GRPC_ARG_CHANNEL_ID "grpc.channel_id"
-/** \} */
-
-/** Result of a grpc call. If the caller satisfies the prerequisites of a
- particular operation, the grpc_call_error returned will be GRPC_CALL_OK.
- Receiving any other value listed here is an indication of a bug in the
- caller. */
-typedef enum grpc_call_error {
- /** everything went ok */
- GRPC_CALL_OK = 0,
- /** something failed, we don't know what */
- GRPC_CALL_ERROR,
- /** this method is not available on the server */
- GRPC_CALL_ERROR_NOT_ON_SERVER,
- /** this method is not available on the client */
- GRPC_CALL_ERROR_NOT_ON_CLIENT,
- /** this method must be called before server_accept */
- GRPC_CALL_ERROR_ALREADY_ACCEPTED,
- /** this method must be called before invoke */
- GRPC_CALL_ERROR_ALREADY_INVOKED,
- /** this method must be called after invoke */
- GRPC_CALL_ERROR_NOT_INVOKED,
- /** this call is already finished
- (writes_done or write_status has already been called) */
- GRPC_CALL_ERROR_ALREADY_FINISHED,
- /** there is already an outstanding read/write operation on the call */
- GRPC_CALL_ERROR_TOO_MANY_OPERATIONS,
- /** the flags value was illegal for this call */
- GRPC_CALL_ERROR_INVALID_FLAGS,
- /** invalid metadata was passed to this call */
- GRPC_CALL_ERROR_INVALID_METADATA,
- /** invalid message was passed to this call */
- GRPC_CALL_ERROR_INVALID_MESSAGE,
+/** \} */
+
+/** Result of a grpc call. If the caller satisfies the prerequisites of a
+ particular operation, the grpc_call_error returned will be GRPC_CALL_OK.
+ Receiving any other value listed here is an indication of a bug in the
+ caller. */
+typedef enum grpc_call_error {
+ /** everything went ok */
+ GRPC_CALL_OK = 0,
+ /** something failed, we don't know what */
+ GRPC_CALL_ERROR,
+ /** this method is not available on the server */
+ GRPC_CALL_ERROR_NOT_ON_SERVER,
+ /** this method is not available on the client */
+ GRPC_CALL_ERROR_NOT_ON_CLIENT,
+ /** this method must be called before server_accept */
+ GRPC_CALL_ERROR_ALREADY_ACCEPTED,
+ /** this method must be called before invoke */
+ GRPC_CALL_ERROR_ALREADY_INVOKED,
+ /** this method must be called after invoke */
+ GRPC_CALL_ERROR_NOT_INVOKED,
+ /** this call is already finished
+ (writes_done or write_status has already been called) */
+ GRPC_CALL_ERROR_ALREADY_FINISHED,
+ /** there is already an outstanding read/write operation on the call */
+ GRPC_CALL_ERROR_TOO_MANY_OPERATIONS,
+ /** the flags value was illegal for this call */
+ GRPC_CALL_ERROR_INVALID_FLAGS,
+ /** invalid metadata was passed to this call */
+ GRPC_CALL_ERROR_INVALID_METADATA,
+ /** invalid message was passed to this call */
+ GRPC_CALL_ERROR_INVALID_MESSAGE,
/** completion queue for notification has not been registered
* with the server */
- GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE,
- /** this batch of operations leads to more operations than allowed */
- GRPC_CALL_ERROR_BATCH_TOO_BIG,
- /** payload type requested is not the type registered */
+ GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE,
+ /** this batch of operations leads to more operations than allowed */
+ GRPC_CALL_ERROR_BATCH_TOO_BIG,
+ /** payload type requested is not the type registered */
GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH,
/** completion queue has been shutdown */
GRPC_CALL_ERROR_COMPLETION_QUEUE_SHUTDOWN
-} grpc_call_error;
-
+} grpc_call_error;
+
/** Default send/receive message size limits in bytes. -1 for unlimited. */
/** TODO(roth) Make this match the default receive limit after next release */
-#define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH -1
-#define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024)
-
+#define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH -1
+#define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024)
+
/** Write Flags: */
-/** Hint that the write may be buffered and need not go out on the wire
- immediately. GRPC is free to buffer the message until the next non-buffered
- write, or until writes_done, but it need not buffer completely or at all. */
-#define GRPC_WRITE_BUFFER_HINT (0x00000001u)
-/** Force compression to be disabled for a particular write
- (start_write/add_metadata). Illegal on invoke/accept. */
-#define GRPC_WRITE_NO_COMPRESS (0x00000002u)
+/** Hint that the write may be buffered and need not go out on the wire
+ immediately. GRPC is free to buffer the message until the next non-buffered
+ write, or until writes_done, but it need not buffer completely or at all. */
+#define GRPC_WRITE_BUFFER_HINT (0x00000001u)
+/** Force compression to be disabled for a particular write
+ (start_write/add_metadata). Illegal on invoke/accept. */
+#define GRPC_WRITE_NO_COMPRESS (0x00000002u)
/** Force this message to be written to the socket before completing it */
#define GRPC_WRITE_THROUGH (0x00000004u)
-/** Mask of all valid flags. */
+/** Mask of all valid flags. */
#define GRPC_WRITE_USED_MASK \
(GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_THROUGH)
-
+
/** Initial metadata flags */
-/** Signal that the call is idempotent */
-#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u)
-/** Signal that the call should not return UNAVAILABLE before it has started */
-#define GRPC_INITIAL_METADATA_WAIT_FOR_READY (0x00000020u)
-/** Signal that the call is cacheable. GRPC is free to use GET verb */
-#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST (0x00000040u)
-/** Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set
- by the calling application. */
-#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET (0x00000080u)
+/** Signal that the call is idempotent */
+#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u)
+/** Signal that the call should not return UNAVAILABLE before it has started */
+#define GRPC_INITIAL_METADATA_WAIT_FOR_READY (0x00000020u)
+/** Signal that the call is cacheable. GRPC is free to use GET verb */
+#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST (0x00000040u)
+/** Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set
+ by the calling application. */
+#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET (0x00000080u)
/** Signal that the initial metadata should be corked */
#define GRPC_INITIAL_METADATA_CORKED (0x00000100u)
-
-/** Mask of all valid flags */
+
+/** Mask of all valid flags */
#define GRPC_INITIAL_METADATA_USED_MASK \
(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST | \
GRPC_INITIAL_METADATA_WAIT_FOR_READY | \
GRPC_INITIAL_METADATA_CACHEABLE_REQUEST | \
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET | \
GRPC_INITIAL_METADATA_CORKED | GRPC_WRITE_THROUGH)
-
-/** A single metadata element */
-typedef struct grpc_metadata {
+
+/** A single metadata element */
+typedef struct grpc_metadata {
/** the key, value values are expected to line up with grpc_mdelem: if
changing them, update metadata.h at the same time. */
grpc_slice key;
grpc_slice value;
- uint32_t flags;
-
- /** The following fields are reserved for grpc internal use.
- There is no need to initialize them, and they will be set to garbage
- during calls to grpc. */
+ uint32_t flags;
+
+ /** The following fields are reserved for grpc internal use.
+ There is no need to initialize them, and they will be set to garbage
+ during calls to grpc. */
struct /* internal */ {
void* obfuscated[4];
- } internal_data;
-} grpc_metadata;
-
-/** The type of completion (for grpc_event) */
-typedef enum grpc_completion_type {
- /** Shutting down */
- GRPC_QUEUE_SHUTDOWN,
- /** No event before timeout */
- GRPC_QUEUE_TIMEOUT,
- /** Operation completion */
- GRPC_OP_COMPLETE
-} grpc_completion_type;
-
-/** The result of an operation.
-
- Returned by a completion queue when the operation started with tag. */
-typedef struct grpc_event {
- /** The type of the completion. */
- grpc_completion_type type;
+ } internal_data;
+} grpc_metadata;
+
+/** The type of completion (for grpc_event) */
+typedef enum grpc_completion_type {
+ /** Shutting down */
+ GRPC_QUEUE_SHUTDOWN,
+ /** No event before timeout */
+ GRPC_QUEUE_TIMEOUT,
+ /** Operation completion */
+ GRPC_OP_COMPLETE
+} grpc_completion_type;
+
+/** The result of an operation.
+
+ Returned by a completion queue when the operation started with tag. */
+typedef struct grpc_event {
+ /** The type of the completion. */
+ grpc_completion_type type;
/** If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates
whether the operation was successful or not; 0 in case of failure and
non-zero in case of success.
If grpc_completion_type is GRPC_QUEUE_SHUTDOWN or GRPC_QUEUE_TIMEOUT, this
field is guaranteed to be 0 */
- int success;
- /** The tag passed to grpc_call_start_batch etc to start this operation.
+ int success;
+ /** The tag passed to grpc_call_start_batch etc to start this operation.
*Only* GRPC_OP_COMPLETE has a tag. For all other grpc_completion_type
values, tag is uninitialized. */
void* tag;
-} grpc_event;
-
-typedef struct {
- size_t count;
- size_t capacity;
+} grpc_event;
+
+typedef struct {
+ size_t count;
+ size_t capacity;
grpc_metadata* metadata;
-} grpc_metadata_array;
-
-typedef struct {
+} grpc_metadata_array;
+
+typedef struct {
grpc_slice method;
grpc_slice host;
- gpr_timespec deadline;
- uint32_t flags;
+ gpr_timespec deadline;
+ uint32_t flags;
void* reserved;
-} grpc_call_details;
-
-typedef enum {
- /** Send initial metadata: one and only one instance MUST be sent for each
- call, unless the call was cancelled - in which case this can be skipped.
- This op completes after all bytes of metadata have been accepted by
- outgoing flow control. */
- GRPC_OP_SEND_INITIAL_METADATA = 0,
- /** Send a message: 0 or more of these operations can occur for each call.
- This op completes after all bytes for the message have been accepted by
- outgoing flow control. */
- GRPC_OP_SEND_MESSAGE,
- /** Send a close from the client: one and only one instance MUST be sent from
- the client, unless the call was cancelled - in which case this can be
+} grpc_call_details;
+
+typedef enum {
+ /** Send initial metadata: one and only one instance MUST be sent for each
+ call, unless the call was cancelled - in which case this can be skipped.
+ This op completes after all bytes of metadata have been accepted by
+ outgoing flow control. */
+ GRPC_OP_SEND_INITIAL_METADATA = 0,
+ /** Send a message: 0 or more of these operations can occur for each call.
+ This op completes after all bytes for the message have been accepted by
+ outgoing flow control. */
+ GRPC_OP_SEND_MESSAGE,
+ /** Send a close from the client: one and only one instance MUST be sent from
+ the client, unless the call was cancelled - in which case this can be
skipped. This op completes after all bytes for the call
(including the close) have passed outgoing flow control. */
- GRPC_OP_SEND_CLOSE_FROM_CLIENT,
- /** Send status from the server: one and only one instance MUST be sent from
- the server unless the call was cancelled - in which case this can be
+ GRPC_OP_SEND_CLOSE_FROM_CLIENT,
+ /** Send status from the server: one and only one instance MUST be sent from
+ the server unless the call was cancelled - in which case this can be
skipped. This op completes after all bytes for the call
(including the status) have passed outgoing flow control. */
- GRPC_OP_SEND_STATUS_FROM_SERVER,
- /** Receive initial metadata: one and only one MUST be made on the client,
- must not be made on the server.
- This op completes after all initial metadata has been read from the
- peer. */
- GRPC_OP_RECV_INITIAL_METADATA,
- /** Receive a message: 0 or more of these operations can occur for each call.
- This op completes after all bytes of the received message have been
- read, or after a half-close has been received on this call. */
- GRPC_OP_RECV_MESSAGE,
- /** Receive status on the client: one and only one must be made on the client.
- This operation always succeeds, meaning ops paired with this operation
- will also appear to succeed, even though they may not have. In that case
- the status will indicate some failure.
- This op completes after all activity on the call has completed. */
- GRPC_OP_RECV_STATUS_ON_CLIENT,
- /** Receive close on the server: one and only one must be made on the
+ GRPC_OP_SEND_STATUS_FROM_SERVER,
+ /** Receive initial metadata: one and only one MUST be made on the client,
+ must not be made on the server.
+ This op completes after all initial metadata has been read from the
+ peer. */
+ GRPC_OP_RECV_INITIAL_METADATA,
+ /** Receive a message: 0 or more of these operations can occur for each call.
+ This op completes after all bytes of the received message have been
+ read, or after a half-close has been received on this call. */
+ GRPC_OP_RECV_MESSAGE,
+ /** Receive status on the client: one and only one must be made on the client.
+ This operation always succeeds, meaning ops paired with this operation
+ will also appear to succeed, even though they may not have. In that case
+ the status will indicate some failure.
+ This op completes after all activity on the call has completed. */
+ GRPC_OP_RECV_STATUS_ON_CLIENT,
+ /** Receive close on the server: one and only one must be made on the
server. This op completes after the close has been received by the
server. This operation always succeeds, meaning ops paired with
this operation will also appear to succeed, even though they may not
have. */
- GRPC_OP_RECV_CLOSE_ON_SERVER
-} grpc_op_type;
-
-struct grpc_byte_buffer;
-
-/** Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT
- which has no arguments) */
-typedef struct grpc_op {
- /** Operation type, as defined by grpc_op_type */
- grpc_op_type op;
- /** Write flags bitset for grpc_begin_messages */
- uint32_t flags;
- /** Reserved for future usage */
+ GRPC_OP_RECV_CLOSE_ON_SERVER
+} grpc_op_type;
+
+struct grpc_byte_buffer;
+
+/** Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT
+ which has no arguments) */
+typedef struct grpc_op {
+ /** Operation type, as defined by grpc_op_type */
+ grpc_op_type op;
+ /** Write flags bitset for grpc_begin_messages */
+ uint32_t flags;
+ /** Reserved for future usage */
void* reserved;
union grpc_op_data {
- /** Reserved for future usage */
+ /** Reserved for future usage */
struct /* internal */ {
void* reserved[8];
- } reserved;
+ } reserved;
struct grpc_op_send_initial_metadata {
- size_t count;
+ size_t count;
grpc_metadata* metadata;
- /** If \a is_set, \a compression_level will be used for the call.
- * Otherwise, \a compression_level won't be considered */
+ /** If \a is_set, \a compression_level will be used for the call.
+ * Otherwise, \a compression_level won't be considered */
struct grpc_op_send_initial_metadata_maybe_compression_level {
- uint8_t is_set;
- grpc_compression_level level;
- } maybe_compression_level;
- } send_initial_metadata;
+ uint8_t is_set;
+ grpc_compression_level level;
+ } maybe_compression_level;
+ } send_initial_metadata;
struct grpc_op_send_message {
/** This op takes ownership of the slices in send_message. After
* a call completes, the contents of send_message are not guaranteed
@@ -628,37 +628,37 @@ typedef struct grpc_op {
* grpc_byte_buffer_destroy() on this object however.
*/
struct grpc_byte_buffer* send_message;
- } send_message;
+ } send_message;
struct grpc_op_send_status_from_server {
- size_t trailing_metadata_count;
+ size_t trailing_metadata_count;
grpc_metadata* trailing_metadata;
- grpc_status_code status;
+ grpc_status_code status;
/** optional: set to NULL if no details need sending, non-NULL if they do
* pointer will not be retained past the start_batch call
*/
grpc_slice* status_details;
- } send_status_from_server;
- /** ownership of the array is with the caller, but ownership of the elements
- stays with the call object (ie key, value members are owned by the call
- object, recv_initial_metadata->array is owned by the caller).
- After the operation completes, call grpc_metadata_array_destroy on this
- value, or reuse it in a future op. */
+ } send_status_from_server;
+ /** ownership of the array is with the caller, but ownership of the elements
+ stays with the call object (ie key, value members are owned by the call
+ object, recv_initial_metadata->array is owned by the caller).
+ After the operation completes, call grpc_metadata_array_destroy on this
+ value, or reuse it in a future op. */
struct grpc_op_recv_initial_metadata {
grpc_metadata_array* recv_initial_metadata;
- } recv_initial_metadata;
- /** ownership of the byte buffer is moved to the caller; the caller must
- call grpc_byte_buffer_destroy on this value, or reuse it in a future op.
+ } recv_initial_metadata;
+ /** ownership of the byte buffer is moved to the caller; the caller must
+ call grpc_byte_buffer_destroy on this value, or reuse it in a future op.
The returned byte buffer will be NULL if trailing metadata was
received instead of a message.
- */
+ */
struct grpc_op_recv_message {
struct grpc_byte_buffer** recv_message;
- } recv_message;
+ } recv_message;
struct grpc_op_recv_status_on_client {
- /** ownership of the array is with the caller, but ownership of the
- elements stays with the call object (ie key, value members are owned
- by the call object, trailing_metadata->array is owned by the caller).
- After the operation completes, call grpc_metadata_array_destroy on
+ /** ownership of the array is with the caller, but ownership of the
+ elements stays with the call object (ie key, value members are owned
+ by the call object, trailing_metadata->array is owned by the caller).
+ After the operation completes, call grpc_metadata_array_destroy on
this value, or reuse it in a future op. */
grpc_metadata_array* trailing_metadata;
grpc_status_code* status;
@@ -667,29 +667,29 @@ typedef struct grpc_op {
* error string for debugging purposes. The application is responsible
* for freeing the data by using gpr_free(). */
const char** error_string;
- } recv_status_on_client;
+ } recv_status_on_client;
struct grpc_op_recv_close_on_server {
/** out argument, set to 1 if the call failed at the server for
a reason other than a non-OK status (cancel, deadline
exceeded, network failure, etc.), 0 otherwise (RPC processing ran to
completion and was able to provide any status from the server) */
int* cancelled;
- } recv_close_on_server;
- } data;
-} grpc_op;
-
-/** Information requested from the channel. */
-typedef struct {
+ } recv_close_on_server;
+ } data;
+} grpc_op;
+
+/** Information requested from the channel. */
+typedef struct {
/** If non-NULL, will be set to point to a string indicating the LB
- * policy name. Caller takes ownership. */
+ * policy name. Caller takes ownership. */
char** lb_policy_name;
/** If non-NULL, will be set to point to a string containing the
- * service config used by the channel in JSON form. */
+ * service config used by the channel in JSON form. */
char** service_config_json;
-} grpc_channel_info;
-
-typedef struct grpc_resource_quota grpc_resource_quota;
-
+} grpc_channel_info;
+
+typedef struct grpc_resource_quota grpc_resource_quota;
+
/** Completion queues internally MAY maintain a set of file descriptors in a
structure called 'pollset'. This enum specifies if a completion queue has an
associated pollset and any restrictions on the type of file descriptors that
@@ -775,8 +775,8 @@ typedef struct grpc_completion_queue_attributes {
/** The completion queue factory structure is opaque to the callers of grpc */
typedef struct grpc_completion_queue_factory grpc_completion_queue_factory;
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_GRPC_TYPES_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_GRPC_TYPES_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/port_platform.h b/contrib/libs/grpc/include/grpc/impl/codegen/port_platform.h
index 3a5b938b64..35419f017b 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/port_platform.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/port_platform.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_PORT_PLATFORM_H
-#define GRPC_IMPL_CODEGEN_PORT_PLATFORM_H
-
-/*
- * Define GPR_BACKWARDS_COMPATIBILITY_MODE to try harder to be ABI
- * compatible with older platforms (currently only on Linux)
- * Causes:
- * - some libc calls to be gotten via dlsym
- * - some syscalls to be made directly
- */
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_PORT_PLATFORM_H
+#define GRPC_IMPL_CODEGEN_PORT_PLATFORM_H
+
+/*
+ * Define GPR_BACKWARDS_COMPATIBILITY_MODE to try harder to be ABI
+ * compatible with older platforms (currently only on Linux)
+ * Causes:
+ * - some libc calls to be gotten via dlsym
+ * - some syscalls to be made directly
+ */
+
/*
* Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
*/
@@ -39,133 +39,133 @@
#endif
#endif // GPR_ABSEIL_SYNC
-/* Get windows.h included everywhere (we need it) */
-#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
-#ifndef WIN32_LEAN_AND_MEAN
-#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
-#define WIN32_LEAN_AND_MEAN
-#endif /* WIN32_LEAN_AND_MEAN */
-
-#ifndef NOMINMAX
-#define GRPC_NOMINMX_WAS_NOT_DEFINED
-#define NOMINMAX
-#endif /* NOMINMAX */
-
+/* Get windows.h included everywhere (we need it) */
+#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
+#ifndef WIN32_LEAN_AND_MEAN
+#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
+#define WIN32_LEAN_AND_MEAN
+#endif /* WIN32_LEAN_AND_MEAN */
+
+#ifndef NOMINMAX
+#define GRPC_NOMINMX_WAS_NOT_DEFINED
+#define NOMINMAX
+#endif /* NOMINMAX */
+
#include <util/system/winint.h>
-#ifndef _WIN32_WINNT
-#error \
- "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
-#else /* !defined(_WIN32_WINNT) */
-#if (_WIN32_WINNT < 0x0600)
-#error \
- "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
-#endif /* _WIN32_WINNT < 0x0600 */
-#endif /* defined(_WIN32_WINNT) */
-
-#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
-#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
-#undef WIN32_LEAN_AND_MEAN
-#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
-
-#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED
-#undef GRPC_NOMINMAX_WAS_NOT_DEFINED
-#undef NOMINMAX
-#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
-#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \
- defined(WIN32) */
-
-/* Override this file with one for your platform if you need to redefine
- things. */
-
-#if !defined(GPR_NO_AUTODETECT_PLATFORM)
-#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
-#if defined(_WIN64) || defined(WIN64)
-#define GPR_ARCH_64 1
-#else
-#define GPR_ARCH_32 1
-#endif
-#define GPR_PLATFORM_STRING "windows"
-#define GPR_WINDOWS 1
-#define GPR_WINDOWS_SUBPROCESS 1
-#define GPR_WINDOWS_ENV
-#ifdef __MSYS__
-#define GPR_GETPID_IN_UNISTD_H 1
-#define GPR_MSYS_TMPFILE
-#define GPR_POSIX_LOG
-#define GPR_POSIX_STRING
-#define GPR_POSIX_TIME
-#else
-#define GPR_GETPID_IN_PROCESS_H 1
-#define GPR_WINDOWS_TMPFILE
-#define GPR_WINDOWS_LOG
-#define GPR_WINDOWS_CRASH_HANDLER 1
-#define GPR_WINDOWS_STRING
-#define GPR_WINDOWS_TIME
-#endif
-#ifdef __GNUC__
-#define GPR_GCC_ATOMIC 1
-#define GPR_GCC_TLS 1
-#else
-#define GPR_WINDOWS_ATOMIC 1
-#define GPR_MSVC_TLS 1
-#endif
-#elif defined(ANDROID) || defined(__ANDROID__)
-#define GPR_PLATFORM_STRING "android"
-#define GPR_ANDROID 1
+#ifndef _WIN32_WINNT
+#error \
+ "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
+#else /* !defined(_WIN32_WINNT) */
+#if (_WIN32_WINNT < 0x0600)
+#error \
+ "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
+#endif /* _WIN32_WINNT < 0x0600 */
+#endif /* defined(_WIN32_WINNT) */
+
+#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
+#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
+#undef WIN32_LEAN_AND_MEAN
+#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
+
+#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED
+#undef GRPC_NOMINMAX_WAS_NOT_DEFINED
+#undef NOMINMAX
+#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
+#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \
+ defined(WIN32) */
+
+/* Override this file with one for your platform if you need to redefine
+ things. */
+
+#if !defined(GPR_NO_AUTODETECT_PLATFORM)
+#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
+#if defined(_WIN64) || defined(WIN64)
+#define GPR_ARCH_64 1
+#else
+#define GPR_ARCH_32 1
+#endif
+#define GPR_PLATFORM_STRING "windows"
+#define GPR_WINDOWS 1
+#define GPR_WINDOWS_SUBPROCESS 1
+#define GPR_WINDOWS_ENV
+#ifdef __MSYS__
+#define GPR_GETPID_IN_UNISTD_H 1
+#define GPR_MSYS_TMPFILE
+#define GPR_POSIX_LOG
+#define GPR_POSIX_STRING
+#define GPR_POSIX_TIME
+#else
+#define GPR_GETPID_IN_PROCESS_H 1
+#define GPR_WINDOWS_TMPFILE
+#define GPR_WINDOWS_LOG
+#define GPR_WINDOWS_CRASH_HANDLER 1
+#define GPR_WINDOWS_STRING
+#define GPR_WINDOWS_TIME
+#endif
+#ifdef __GNUC__
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#else
+#define GPR_WINDOWS_ATOMIC 1
+#define GPR_MSVC_TLS 1
+#endif
+#elif defined(ANDROID) || defined(__ANDROID__)
+#define GPR_PLATFORM_STRING "android"
+#define GPR_ANDROID 1
// TODO(apolcyn): re-evaluate support for c-ares
// on android after upgrading our c-ares dependency.
// See https://github.com/grpc/grpc/issues/18038.
#define GRPC_ARES 0
-#ifdef _LP64
-#define GPR_ARCH_64 1
-#else /* _LP64 */
-#define GPR_ARCH_32 1
-#endif /* _LP64 */
-#define GPR_CPU_POSIX 1
-#define GPR_GCC_SYNC 1
-#define GPR_GCC_TLS 1
-#define GPR_POSIX_ENV 1
-#define GPR_POSIX_TMPFILE 1
-#define GPR_ANDROID_LOG 1
-#define GPR_POSIX_STRING 1
-#define GPR_POSIX_SUBPROCESS 1
-#define GPR_POSIX_SYNC 1
-#define GPR_POSIX_TIME 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
+#define GPR_CPU_POSIX 1
+#define GPR_GCC_SYNC 1
+#define GPR_GCC_TLS 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_ANDROID_LOG 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
-#define GPR_GETPID_IN_UNISTD_H 1
-#define GPR_SUPPORT_CHANNELS_FROM_FD 1
-#elif defined(__linux__)
-#define GPR_PLATFORM_STRING "linux"
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#ifndef _DEFAULT_SOURCE
-#define _DEFAULT_SOURCE
-#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <features.h>
-#define GPR_CPU_LINUX 1
-#define GPR_GCC_ATOMIC 1
-#define GPR_GCC_TLS 1
-#define GPR_LINUX 1
-#define GPR_LINUX_LOG
-#define GPR_SUPPORT_CHANNELS_FROM_FD 1
-#define GPR_LINUX_ENV 1
-#define GPR_POSIX_TMPFILE 1
-#define GPR_POSIX_STRING 1
-#define GPR_POSIX_SUBPROCESS 1
-#define GPR_POSIX_SYNC 1
-#define GPR_POSIX_TIME 1
+#define GPR_GETPID_IN_UNISTD_H 1
+#define GPR_SUPPORT_CHANNELS_FROM_FD 1
+#elif defined(__linux__)
+#define GPR_PLATFORM_STRING "linux"
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE
+#endif
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <features.h>
+#define GPR_CPU_LINUX 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#define GPR_LINUX 1
+#define GPR_LINUX_LOG
+#define GPR_SUPPORT_CHANNELS_FROM_FD 1
+#define GPR_LINUX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
-#define GPR_GETPID_IN_UNISTD_H 1
-#ifdef _LP64
-#define GPR_ARCH_64 1
-#else /* _LP64 */
-#define GPR_ARCH_32 1
-#endif /* _LP64 */
+#define GPR_GETPID_IN_UNISTD_H 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
#ifdef __GLIBC__
#define GPR_POSIX_CRASH_HANDLER 1
#define GPR_LINUX_PTHREAD_NAME 1
@@ -193,92 +193,92 @@
#define GRPC_POSIX_WAKEUP_FD 1
#define GRPC_ARES 0
#define GPR_NO_AUTODETECT_PLATFORM 1
-#elif defined(__APPLE__)
-#include <Availability.h>
-#include <TargetConditionals.h>
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#if TARGET_OS_IPHONE
-#define GPR_PLATFORM_STRING "ios"
-#define GPR_CPU_IPHONE 1
-#define GPR_PTHREAD_TLS 1
+#elif defined(__APPLE__)
+#include <Availability.h>
+#include <TargetConditionals.h>
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#if TARGET_OS_IPHONE
+#define GPR_PLATFORM_STRING "ios"
+#define GPR_CPU_IPHONE 1
+#define GPR_PTHREAD_TLS 1
#define GRPC_CFSTREAM 1
/* the c-ares resolver isn't safe to enable on iOS */
#define GRPC_ARES 0
-#else /* TARGET_OS_IPHONE */
-#define GPR_PLATFORM_STRING "osx"
-#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
-#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7
-#define GPR_CPU_IPHONE 1
-#define GPR_PTHREAD_TLS 1
-#else /* __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 */
-#define GPR_CPU_POSIX 1
+#else /* TARGET_OS_IPHONE */
+#define GPR_PLATFORM_STRING "osx"
+#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7
+#define GPR_CPU_IPHONE 1
+#define GPR_PTHREAD_TLS 1
+#else /* __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 */
+#define GPR_CPU_POSIX 1
/* TODO(vjpai): there is a reported issue in bazel build for Mac where __thread
in a header is currently not working (bazelbuild/bazel#4341). Remove
the following conditional and use GPR_GCC_TLS when that is fixed */
#ifndef GRPC_BAZEL_BUILD
-#define GPR_GCC_TLS 1
+#define GPR_GCC_TLS 1
#else /* GRPC_BAZEL_BUILD */
#define GPR_PTHREAD_TLS 1
#endif /* GRPC_BAZEL_BUILD */
#define GPR_APPLE_PTHREAD_NAME 1
-#endif
-#else /* __MAC_OS_X_VERSION_MIN_REQUIRED */
-#define GPR_CPU_POSIX 1
+#endif
+#else /* __MAC_OS_X_VERSION_MIN_REQUIRED */
+#define GPR_CPU_POSIX 1
/* TODO(vjpai): Remove the following conditional and use only GPR_GCC_TLS
when bazelbuild/bazel#4341 is fixed */
#ifndef GRPC_BAZEL_BUILD
-#define GPR_GCC_TLS 1
+#define GPR_GCC_TLS 1
#else /* GRPC_BAZEL_BUILD */
#define GPR_PTHREAD_TLS 1
#endif /* GRPC_BAZEL_BUILD */
-#endif
-#define GPR_POSIX_CRASH_HANDLER 1
-#endif
-#define GPR_APPLE 1
-#define GPR_GCC_ATOMIC 1
-#define GPR_POSIX_LOG 1
-#define GPR_POSIX_ENV 1
-#define GPR_POSIX_TMPFILE 1
-#define GPR_POSIX_STRING 1
-#define GPR_POSIX_SUBPROCESS 1
-#define GPR_POSIX_SYNC 1
-#define GPR_POSIX_TIME 1
+#endif
+#define GPR_POSIX_CRASH_HANDLER 1
+#endif
+#define GPR_APPLE 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_POSIX_LOG 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
-#define GPR_GETPID_IN_UNISTD_H 1
+#define GPR_GETPID_IN_UNISTD_H 1
#ifndef GRPC_CFSTREAM
-#define GPR_SUPPORT_CHANNELS_FROM_FD 1
-#endif
-#ifdef _LP64
-#define GPR_ARCH_64 1
-#else /* _LP64 */
-#define GPR_ARCH_32 1
-#endif /* _LP64 */
-#elif defined(__FreeBSD__)
-#define GPR_PLATFORM_STRING "freebsd"
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#define GPR_FREEBSD 1
-#define GPR_CPU_POSIX 1
-#define GPR_GCC_ATOMIC 1
-#define GPR_GCC_TLS 1
-#define GPR_POSIX_LOG 1
-#define GPR_POSIX_ENV 1
-#define GPR_POSIX_TMPFILE 1
-#define GPR_POSIX_STRING 1
-#define GPR_POSIX_SUBPROCESS 1
-#define GPR_POSIX_SYNC 1
-#define GPR_POSIX_TIME 1
+#define GPR_SUPPORT_CHANNELS_FROM_FD 1
+#endif
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
+#elif defined(__FreeBSD__)
+#define GPR_PLATFORM_STRING "freebsd"
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#define GPR_FREEBSD 1
+#define GPR_CPU_POSIX 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#define GPR_POSIX_LOG 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
-#define GPR_GETPID_IN_UNISTD_H 1
-#define GPR_SUPPORT_CHANNELS_FROM_FD 1
-#ifdef _LP64
-#define GPR_ARCH_64 1
-#else /* _LP64 */
-#define GPR_ARCH_32 1
-#endif /* _LP64 */
+#define GPR_GETPID_IN_UNISTD_H 1
+#define GPR_SUPPORT_CHANNELS_FROM_FD 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
#elif defined(__OpenBSD__)
#define GPR_PLATFORM_STRING "openbsd"
#ifndef _BSD_SOURCE
@@ -346,35 +346,35 @@
#else /* _LP64 */
#define GPR_ARCH_32 1
#endif /* _LP64 */
-#elif defined(__native_client__)
-#define GPR_PLATFORM_STRING "nacl"
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#ifndef _DEFAULT_SOURCE
-#define _DEFAULT_SOURCE
-#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#define GPR_NACL 1
-#define GPR_CPU_POSIX 1
-#define GPR_GCC_ATOMIC 1
-#define GPR_GCC_TLS 1
-#define GPR_POSIX_LOG 1
-#define GPR_POSIX_ENV 1
-#define GPR_POSIX_TMPFILE 1
-#define GPR_POSIX_STRING 1
-#define GPR_POSIX_SUBPROCESS 1
-#define GPR_POSIX_SYNC 1
-#define GPR_POSIX_TIME 1
+#elif defined(__native_client__)
+#define GPR_PLATFORM_STRING "nacl"
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE
+#endif
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#define GPR_NACL 1
+#define GPR_CPU_POSIX 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#define GPR_POSIX_LOG 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
-#define GPR_GETPID_IN_UNISTD_H 1
-#ifdef _LP64
-#define GPR_ARCH_64 1
-#else /* _LP64 */
-#define GPR_ARCH_32 1
-#endif /* _LP64 */
+#define GPR_GETPID_IN_UNISTD_H 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
#elif defined(__Fuchsia__)
#define GPR_FUCHSIA 1
#define GPR_ARCH_64 1
@@ -396,11 +396,11 @@
#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
#define GPR_GETPID_IN_UNISTD_H 1
-#else
-#error "Could not auto-detect platform"
-#endif
-#endif /* GPR_NO_AUTODETECT_PLATFORM */
-
+#else
+#error "Could not auto-detect platform"
+#endif
+#endif /* GPR_NO_AUTODETECT_PLATFORM */
+
#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
/*
* For backward compatibility mode, reset _FORTIFY_SOURCE to prevent
@@ -443,33 +443,33 @@
#endif /* __has_include(<atomic>) */
#endif /* defined(__has_include) */
-#ifndef GPR_PLATFORM_STRING
-#warning "GPR_PLATFORM_STRING not auto-detected"
-#define GPR_PLATFORM_STRING "unknown"
-#endif
-
-#ifdef GPR_GCOV
-#undef GPR_FORBID_UNREACHABLE_CODE
-#define GPR_FORBID_UNREACHABLE_CODE 1
-#endif
-
-#ifdef _MSC_VER
-#if _MSC_VER < 1700
-typedef __int8 int8_t;
-typedef __int16 int16_t;
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-#else
-#include <stdint.h>
-#endif /* _MSC_VER < 1700 */
-#else
-#include <stdint.h>
-#endif /* _MSC_VER */
-
+#ifndef GPR_PLATFORM_STRING
+#warning "GPR_PLATFORM_STRING not auto-detected"
+#define GPR_PLATFORM_STRING "unknown"
+#endif
+
+#ifdef GPR_GCOV
+#undef GPR_FORBID_UNREACHABLE_CODE
+#define GPR_FORBID_UNREACHABLE_CODE 1
+#endif
+
+#ifdef _MSC_VER
+#if _MSC_VER < 1700
+typedef __int8 int8_t;
+typedef __int16 int16_t;
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <stdint.h>
+#endif /* _MSC_VER < 1700 */
+#else
+#include <stdint.h>
+#endif /* _MSC_VER */
+
/* Type of cycle clock implementation */
#ifdef GPR_LINUX
/* Disable cycle clock by default.
@@ -487,53 +487,53 @@ typedef unsigned __int64 uint64_t;
#define GPR_CYCLE_COUNTER_FALLBACK 1
#endif /* GPR_LINUX */
-/* Cache line alignment */
-#ifndef GPR_CACHELINE_SIZE_LOG
-#if defined(__i386__) || defined(__x86_64__)
-#define GPR_CACHELINE_SIZE_LOG 6
-#endif
-#ifndef GPR_CACHELINE_SIZE_LOG
-/* A reasonable default guess. Note that overestimates tend to waste more
- space, while underestimates tend to waste more time. */
-#define GPR_CACHELINE_SIZE_LOG 6
-#endif /* GPR_CACHELINE_SIZE_LOG */
-#endif /* GPR_CACHELINE_SIZE_LOG */
-
-#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG)
-
-/* scrub GCC_ATOMIC if it's not available on this compiler */
-#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED)
-#undef GPR_GCC_ATOMIC
-#define GPR_GCC_SYNC 1
-#endif
-
-/* Validate platform combinations */
-#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
- defined(GPR_WINDOWS_ATOMIC) != \
- 1
-#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
-#endif
-
-#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
-#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
-#endif
-
-#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
- defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
- 1
-#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
-#endif
-
-#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \
- defined(GPR_CUSTOM_TLS) != \
- 1
-#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS
-#endif
-
-/* maximum alignment needed for any type on this platform, rounded up to a
- power of two */
-#define GPR_MAX_ALIGNMENT 16
-
+/* Cache line alignment */
+#ifndef GPR_CACHELINE_SIZE_LOG
+#if defined(__i386__) || defined(__x86_64__)
+#define GPR_CACHELINE_SIZE_LOG 6
+#endif
+#ifndef GPR_CACHELINE_SIZE_LOG
+/* A reasonable default guess. Note that overestimates tend to waste more
+ space, while underestimates tend to waste more time. */
+#define GPR_CACHELINE_SIZE_LOG 6
+#endif /* GPR_CACHELINE_SIZE_LOG */
+#endif /* GPR_CACHELINE_SIZE_LOG */
+
+#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG)
+
+/* scrub GCC_ATOMIC if it's not available on this compiler */
+#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED)
+#undef GPR_GCC_ATOMIC
+#define GPR_GCC_SYNC 1
+#endif
+
+/* Validate platform combinations */
+#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
+ defined(GPR_WINDOWS_ATOMIC) != \
+ 1
+#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
+#endif
+
+#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
+#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
+#endif
+
+#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
+ defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
+ 1
+#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
+#endif
+
+#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \
+ defined(GPR_CUSTOM_TLS) != \
+ 1
+#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS
+#endif
+
+/* maximum alignment needed for any type on this platform, rounded up to a
+ power of two */
+#define GPR_MAX_ALIGNMENT 16
+
#ifndef GRPC_ARES
#define GRPC_ARES 1
#endif
@@ -542,16 +542,16 @@ typedef unsigned __int64 uint64_t;
#define GRPC_IF_NAMETOINDEX 1
#endif
-#ifndef GRPC_MUST_USE_RESULT
-#if defined(__GNUC__) && !defined(__MINGW32__)
-#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
+#ifndef GRPC_MUST_USE_RESULT
+#if defined(__GNUC__) && !defined(__MINGW32__)
+#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
#define GPR_ALIGN_STRUCT(n) __attribute__((aligned(n)))
-#else
-#define GRPC_MUST_USE_RESULT
+#else
+#define GRPC_MUST_USE_RESULT
#define GPR_ALIGN_STRUCT(n)
-#endif
-#endif
-
+#endif
+#endif
+
#ifndef GRPC_UNUSED
#if defined(__GNUC__) && !defined(__MINGW32__)
#define GRPC_UNUSED __attribute__((unused))
@@ -560,38 +560,38 @@ typedef unsigned __int64 uint64_t;
#endif
#endif
-#ifndef GPR_PRINT_FORMAT_CHECK
-#ifdef __GNUC__
-#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
- __attribute__((format(printf, FORMAT_STR, ARGS)))
-#else
-#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
-#endif
-#endif /* GPR_PRINT_FORMAT_CHECK */
-
-#if GPR_FORBID_UNREACHABLE_CODE
-#define GPR_UNREACHABLE_CODE(STATEMENT)
-#else
-#define GPR_UNREACHABLE_CODE(STATEMENT) \
- do { \
- gpr_log(GPR_ERROR, "Should never reach here."); \
- abort(); \
- STATEMENT; \
- } while (0)
-#endif /* GPR_FORBID_UNREACHABLE_CODE */
-
-#ifndef GPRAPI
-#define GPRAPI
-#endif
-
-#ifndef GRPCAPI
-#define GRPCAPI GPRAPI
-#endif
-
-#ifndef CENSUSAPI
-#define CENSUSAPI GRPCAPI
-#endif
-
+#ifndef GPR_PRINT_FORMAT_CHECK
+#ifdef __GNUC__
+#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
+ __attribute__((format(printf, FORMAT_STR, ARGS)))
+#else
+#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
+#endif
+#endif /* GPR_PRINT_FORMAT_CHECK */
+
+#if GPR_FORBID_UNREACHABLE_CODE
+#define GPR_UNREACHABLE_CODE(STATEMENT)
+#else
+#define GPR_UNREACHABLE_CODE(STATEMENT) \
+ do { \
+ gpr_log(GPR_ERROR, "Should never reach here."); \
+ abort(); \
+ STATEMENT; \
+ } while (0)
+#endif /* GPR_FORBID_UNREACHABLE_CODE */
+
+#ifndef GPRAPI
+#define GPRAPI
+#endif
+
+#ifndef GRPCAPI
+#define GRPCAPI GPRAPI
+#endif
+
+#ifndef CENSUSAPI
+#define CENSUSAPI GRPCAPI
+#endif
+
#ifndef GPR_HAS_ATTRIBUTE
#ifdef __has_attribute
#define GPR_HAS_ATTRIBUTE(a) __has_attribute(a)
@@ -690,4 +690,4 @@ typedef unsigned __int64 uint64_t;
#define __STDC_FORMAT_MACROS
#endif
-#endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */
+#endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/propagation_bits.h b/contrib/libs/grpc/include/grpc/impl/codegen/propagation_bits.h
index 487139a499..824bdbd8c9 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/propagation_bits.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/propagation_bits.h
@@ -1,52 +1,52 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
-#define GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
+#define GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Propagation bits: this can be bitwise or-ed to form propagation_mask for
- * grpc_call */
-/** Propagate deadline */
-#define GRPC_PROPAGATE_DEADLINE ((uint32_t)1)
-/** Propagate census context */
-#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT ((uint32_t)2)
-#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT ((uint32_t)4)
-/** Propagate cancellation */
-#define GRPC_PROPAGATE_CANCELLATION ((uint32_t)8)
-
+ * grpc_call */
+/** Propagate deadline */
+#define GRPC_PROPAGATE_DEADLINE ((uint32_t)1)
+/** Propagate census context */
+#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT ((uint32_t)2)
+#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT ((uint32_t)4)
+/** Propagate cancellation */
+#define GRPC_PROPAGATE_CANCELLATION ((uint32_t)8)
+
/** Default propagation mask: clients of the core API are encouraged to encode
- deltas from this in their implementations... ie write:
- GRPC_PROPAGATE_DEFAULTS & ~GRPC_PROPAGATE_DEADLINE to disable deadline
- propagation. Doing so gives flexibility in the future to define new
- propagation types that are default inherited or not. */
-#define GRPC_PROPAGATE_DEFAULTS \
- ((uint32_t)(( \
- 0xffff | GRPC_PROPAGATE_DEADLINE | GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \
- GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT | GRPC_PROPAGATE_CANCELLATION)))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H */
+ deltas from this in their implementations... ie write:
+ GRPC_PROPAGATE_DEFAULTS & ~GRPC_PROPAGATE_DEADLINE to disable deadline
+ propagation. Doing so gives flexibility in the future to define new
+ propagation types that are default inherited or not. */
+#define GRPC_PROPAGATE_DEFAULTS \
+ ((uint32_t)(( \
+ 0xffff | GRPC_PROPAGATE_DEADLINE | GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \
+ GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT | GRPC_PROPAGATE_CANCELLATION)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/slice.h b/contrib/libs/grpc/include/grpc/impl/codegen/slice.h
index 8da3d7713c..3567b1e88b 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/slice.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/slice.h
@@ -1,80 +1,80 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_SLICE_H
-#define GRPC_IMPL_CODEGEN_SLICE_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_SLICE_H
+#define GRPC_IMPL_CODEGEN_SLICE_H
+
#include <grpc/impl/codegen/port_platform.h>
-#include <stddef.h>
-
-#include <grpc/impl/codegen/gpr_slice.h>
-
+#include <stddef.h>
+
+#include <grpc/impl/codegen/gpr_slice.h>
+
typedef struct grpc_slice grpc_slice;
-
+
/** Slice API
- A slice represents a contiguous reference counted array of bytes.
- It is cheap to take references to a slice, and it is cheap to create a
- slice pointing to a subset of another slice.
-
- The data-structure for slices is exposed here to allow non-gpr code to
- build slices from whatever data they have available.
-
- When defining interfaces that handle slices, care should be taken to define
- reference ownership semantics (who should call unref?) and mutability
- constraints (is the callee allowed to modify the slice?) */
-
+ A slice represents a contiguous reference counted array of bytes.
+ It is cheap to take references to a slice, and it is cheap to create a
+ slice pointing to a subset of another slice.
+
+ The data-structure for slices is exposed here to allow non-gpr code to
+ build slices from whatever data they have available.
+
+ When defining interfaces that handle slices, care should be taken to define
+ reference ownership semantics (who should call unref?) and mutability
+ constraints (is the callee allowed to modify the slice?) */
+
/* Inlined half of grpc_slice is allowed to expand the size of the overall type
by this many bytes */
#define GRPC_SLICE_INLINE_EXTRA_SIZE sizeof(void*)
-
+
#define GRPC_SLICE_INLINED_SIZE \
(sizeof(size_t) + sizeof(uint8_t*) - 1 + GRPC_SLICE_INLINE_EXTRA_SIZE)
struct grpc_slice_refcount;
/** A grpc_slice s, if initialized, represents the byte range
- s.bytes[0..s.length-1].
-
- It can have an associated ref count which has a destruction routine to be run
- when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref()).
- Multiple grpc_slice values may share a ref count.
-
- If the slice does not have a refcount, it represents an inlined small piece
- of data that is copied by value. */
+ s.bytes[0..s.length-1].
+
+ It can have an associated ref count which has a destruction routine to be run
+ when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref()).
+ Multiple grpc_slice values may share a ref count.
+
+ If the slice does not have a refcount, it represents an inlined small piece
+ of data that is copied by value. */
struct grpc_slice {
struct grpc_slice_refcount* refcount;
union grpc_slice_data {
struct grpc_slice_refcounted {
size_t length;
uint8_t* bytes;
- } refcounted;
+ } refcounted;
struct grpc_slice_inlined {
- uint8_t length;
- uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
- } inlined;
- } data;
+ uint8_t length;
+ uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
+ } inlined;
+ } data;
};
-
-#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
-
+
+#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
+
/** Represents an expandable array of slices, to be interpreted as a
- single item. */
+ single item. */
typedef struct grpc_slice_buffer {
/** This is for internal use only. External users (i.e any code outside grpc
* core) MUST NOT use this field */
@@ -83,45 +83,45 @@ typedef struct grpc_slice_buffer {
/** slices in the array (Points to the first valid grpc_slice in the array) */
grpc_slice* slices;
/** the number of slices in the array */
- size_t count;
+ size_t count;
/** the number of slices allocated in the array. External users (i.e any code
* outside grpc core) MUST NOT use this field */
- size_t capacity;
+ size_t capacity;
/** the combined length of all slices in the array */
- size_t length;
+ size_t length;
/** inlined elements to avoid allocations */
- grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
-} grpc_slice_buffer;
-
-#define GRPC_SLICE_START_PTR(slice) \
- ((slice).refcount ? (slice).data.refcounted.bytes \
- : (slice).data.inlined.bytes)
-#define GRPC_SLICE_LENGTH(slice) \
- ((slice).refcount ? (slice).data.refcounted.length \
- : (slice).data.inlined.length)
-#define GRPC_SLICE_SET_LENGTH(slice, newlen) \
- ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
- : ((slice).data.inlined.length = (uint8_t)(newlen)))
-#define GRPC_SLICE_END_PTR(slice) \
- GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
-#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
-
-#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
-
-/* Duplicate GPR_* definitions */
-#define GPR_SLICE_START_PTR(slice) \
- ((slice).refcount ? (slice).data.refcounted.bytes \
- : (slice).data.inlined.bytes)
-#define GPR_SLICE_LENGTH(slice) \
- ((slice).refcount ? (slice).data.refcounted.length \
- : (slice).data.inlined.length)
-#define GPR_SLICE_SET_LENGTH(slice, newlen) \
- ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
- : ((slice).data.inlined.length = (uint8_t)(newlen)))
-#define GPR_SLICE_END_PTR(slice) \
- GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
-#define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
-
-#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
-
-#endif /* GRPC_IMPL_CODEGEN_SLICE_H */
+ grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
+} grpc_slice_buffer;
+
+#define GRPC_SLICE_START_PTR(slice) \
+ ((slice).refcount ? (slice).data.refcounted.bytes \
+ : (slice).data.inlined.bytes)
+#define GRPC_SLICE_LENGTH(slice) \
+ ((slice).refcount ? (slice).data.refcounted.length \
+ : (slice).data.inlined.length)
+#define GRPC_SLICE_SET_LENGTH(slice, newlen) \
+ ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
+ : ((slice).data.inlined.length = (uint8_t)(newlen)))
+#define GRPC_SLICE_END_PTR(slice) \
+ GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
+#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
+
+#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
+
+/* Duplicate GPR_* definitions */
+#define GPR_SLICE_START_PTR(slice) \
+ ((slice).refcount ? (slice).data.refcounted.bytes \
+ : (slice).data.inlined.bytes)
+#define GPR_SLICE_LENGTH(slice) \
+ ((slice).refcount ? (slice).data.refcounted.length \
+ : (slice).data.inlined.length)
+#define GPR_SLICE_SET_LENGTH(slice, newlen) \
+ ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
+ : ((slice).data.inlined.length = (uint8_t)(newlen)))
+#define GPR_SLICE_END_PTR(slice) \
+ GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
+#define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
+
+#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
+
+#endif /* GRPC_IMPL_CODEGEN_SLICE_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/status.h b/contrib/libs/grpc/include/grpc/impl/codegen/status.h
index 0cf4041bed..dec3b8f340 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/status.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/status.h
@@ -1,154 +1,154 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_STATUS_H
-#define GRPC_IMPL_CODEGEN_STATUS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_STATUS_H
+#define GRPC_IMPL_CODEGEN_STATUS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
/** Not an error; returned on success */
- GRPC_STATUS_OK = 0,
-
+ GRPC_STATUS_OK = 0,
+
/** The operation was cancelled (typically by the caller). */
- GRPC_STATUS_CANCELLED = 1,
-
+ GRPC_STATUS_CANCELLED = 1,
+
/** Unknown error. An example of where this error may be returned is
- if a Status value received from another address space belongs to
- an error-space that is not known in this address space. Also
- errors raised by APIs that do not return enough error information
- may be converted to this error. */
- GRPC_STATUS_UNKNOWN = 2,
-
+ if a Status value received from another address space belongs to
+ an error-space that is not known in this address space. Also
+ errors raised by APIs that do not return enough error information
+ may be converted to this error. */
+ GRPC_STATUS_UNKNOWN = 2,
+
/** Client specified an invalid argument. Note that this differs
- from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
- that are problematic regardless of the state of the system
- (e.g., a malformed file name). */
- GRPC_STATUS_INVALID_ARGUMENT = 3,
-
+ from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
+ that are problematic regardless of the state of the system
+ (e.g., a malformed file name). */
+ GRPC_STATUS_INVALID_ARGUMENT = 3,
+
/** Deadline expired before operation could complete. For operations
- that change the state of the system, this error may be returned
- even if the operation has completed successfully. For example, a
- successful response from a server could have been delayed long
- enough for the deadline to expire. */
- GRPC_STATUS_DEADLINE_EXCEEDED = 4,
-
+ that change the state of the system, this error may be returned
+ even if the operation has completed successfully. For example, a
+ successful response from a server could have been delayed long
+ enough for the deadline to expire. */
+ GRPC_STATUS_DEADLINE_EXCEEDED = 4,
+
/** Some requested entity (e.g., file or directory) was not found. */
- GRPC_STATUS_NOT_FOUND = 5,
-
+ GRPC_STATUS_NOT_FOUND = 5,
+
/** Some entity that we attempted to create (e.g., file or directory)
- already exists. */
- GRPC_STATUS_ALREADY_EXISTS = 6,
-
+ already exists. */
+ GRPC_STATUS_ALREADY_EXISTS = 6,
+
/** The caller does not have permission to execute the specified
- operation. PERMISSION_DENIED must not be used for rejections
- caused by exhausting some resource (use RESOURCE_EXHAUSTED
- instead for those errors). PERMISSION_DENIED must not be
- used if the caller can not be identified (use UNAUTHENTICATED
- instead for those errors). */
- GRPC_STATUS_PERMISSION_DENIED = 7,
-
+ operation. PERMISSION_DENIED must not be used for rejections
+ caused by exhausting some resource (use RESOURCE_EXHAUSTED
+ instead for those errors). PERMISSION_DENIED must not be
+ used if the caller can not be identified (use UNAUTHENTICATED
+ instead for those errors). */
+ GRPC_STATUS_PERMISSION_DENIED = 7,
+
/** The request does not have valid authentication credentials for the
- operation. */
- GRPC_STATUS_UNAUTHENTICATED = 16,
-
+ operation. */
+ GRPC_STATUS_UNAUTHENTICATED = 16,
+
/** Some resource has been exhausted, perhaps a per-user quota, or
- perhaps the entire file system is out of space. */
- GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
-
+ perhaps the entire file system is out of space. */
+ GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
+
/** Operation was rejected because the system is not in a state
- required for the operation's execution. For example, directory
- to be deleted may be non-empty, an rmdir operation is applied to
- a non-directory, etc.
-
- A litmus test that may help a service implementor in deciding
- between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
- (a) Use UNAVAILABLE if the client can retry just the failing call.
- (b) Use ABORTED if the client should retry at a higher-level
- (e.g., restarting a read-modify-write sequence).
- (c) Use FAILED_PRECONDITION if the client should not retry until
- the system state has been explicitly fixed. E.g., if an "rmdir"
- fails because the directory is non-empty, FAILED_PRECONDITION
- should be returned since the client should not retry unless
- they have first fixed up the directory by deleting files from it.
- (d) Use FAILED_PRECONDITION if the client performs conditional
- REST Get/Update/Delete on a resource and the resource on the
- server does not match the condition. E.g., conflicting
- read-modify-write on the same resource. */
- GRPC_STATUS_FAILED_PRECONDITION = 9,
-
+ required for the operation's execution. For example, directory
+ to be deleted may be non-empty, an rmdir operation is applied to
+ a non-directory, etc.
+
+ A litmus test that may help a service implementor in deciding
+ between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
+ (a) Use UNAVAILABLE if the client can retry just the failing call.
+ (b) Use ABORTED if the client should retry at a higher-level
+ (e.g., restarting a read-modify-write sequence).
+ (c) Use FAILED_PRECONDITION if the client should not retry until
+ the system state has been explicitly fixed. E.g., if an "rmdir"
+ fails because the directory is non-empty, FAILED_PRECONDITION
+ should be returned since the client should not retry unless
+ they have first fixed up the directory by deleting files from it.
+ (d) Use FAILED_PRECONDITION if the client performs conditional
+ REST Get/Update/Delete on a resource and the resource on the
+ server does not match the condition. E.g., conflicting
+ read-modify-write on the same resource. */
+ GRPC_STATUS_FAILED_PRECONDITION = 9,
+
/** The operation was aborted, typically due to a concurrency issue
- like sequencer check failures, transaction aborts, etc.
-
- See litmus test above for deciding between FAILED_PRECONDITION,
- ABORTED, and UNAVAILABLE. */
- GRPC_STATUS_ABORTED = 10,
-
+ like sequencer check failures, transaction aborts, etc.
+
+ See litmus test above for deciding between FAILED_PRECONDITION,
+ ABORTED, and UNAVAILABLE. */
+ GRPC_STATUS_ABORTED = 10,
+
/** Operation was attempted past the valid range. E.g., seeking or
- reading past end of file.
-
- Unlike INVALID_ARGUMENT, this error indicates a problem that may
- be fixed if the system state changes. For example, a 32-bit file
- system will generate INVALID_ARGUMENT if asked to read at an
- offset that is not in the range [0,2^32-1], but it will generate
- OUT_OF_RANGE if asked to read from an offset past the current
- file size.
-
- There is a fair bit of overlap between FAILED_PRECONDITION and
- OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
- error) when it applies so that callers who are iterating through
- a space can easily look for an OUT_OF_RANGE error to detect when
- they are done. */
- GRPC_STATUS_OUT_OF_RANGE = 11,
-
+ reading past end of file.
+
+ Unlike INVALID_ARGUMENT, this error indicates a problem that may
+ be fixed if the system state changes. For example, a 32-bit file
+ system will generate INVALID_ARGUMENT if asked to read at an
+ offset that is not in the range [0,2^32-1], but it will generate
+ OUT_OF_RANGE if asked to read from an offset past the current
+ file size.
+
+ There is a fair bit of overlap between FAILED_PRECONDITION and
+ OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
+ error) when it applies so that callers who are iterating through
+ a space can easily look for an OUT_OF_RANGE error to detect when
+ they are done. */
+ GRPC_STATUS_OUT_OF_RANGE = 11,
+
/** Operation is not implemented or not supported/enabled in this service. */
- GRPC_STATUS_UNIMPLEMENTED = 12,
-
+ GRPC_STATUS_UNIMPLEMENTED = 12,
+
/** Internal errors. Means some invariants expected by underlying
- system has been broken. If you see one of these errors,
- something is very broken. */
- GRPC_STATUS_INTERNAL = 13,
-
+ system has been broken. If you see one of these errors,
+ something is very broken. */
+ GRPC_STATUS_INTERNAL = 13,
+
/** The service is currently unavailable. This is a most likely a
- transient condition and may be corrected by retrying with
+ transient condition and may be corrected by retrying with
a backoff. Note that it is not always safe to retry non-idempotent
operations.
-
+
WARNING: Although data MIGHT not have been transmitted when this
status occurs, there is NOT A GUARANTEE that the server has not seen
anything. So in general it is unsafe to retry on this status code
if the call is non-idempotent.
- See litmus test above for deciding between FAILED_PRECONDITION,
- ABORTED, and UNAVAILABLE. */
- GRPC_STATUS_UNAVAILABLE = 14,
-
+ See litmus test above for deciding between FAILED_PRECONDITION,
+ ABORTED, and UNAVAILABLE. */
+ GRPC_STATUS_UNAVAILABLE = 14,
+
/** Unrecoverable data loss or corruption. */
- GRPC_STATUS_DATA_LOSS = 15,
-
+ GRPC_STATUS_DATA_LOSS = 15,
+
/** Force users to include a default branch: */
- GRPC_STATUS__DO_NOT_USE = -1
-} grpc_status_code;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_IMPL_CODEGEN_STATUS_H */
+ GRPC_STATUS__DO_NOT_USE = -1
+} grpc_status_code;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_IMPL_CODEGEN_STATUS_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/sync.h b/contrib/libs/grpc/include/grpc/impl/codegen/sync.h
index a52f35cbf4..49e3194748 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/sync.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/sync.h
@@ -1,65 +1,65 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_SYNC_H
-#define GRPC_IMPL_CODEGEN_SYNC_H
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_SYNC_H
+#define GRPC_IMPL_CODEGEN_SYNC_H
/** Synchronization primitives for GPR.
-
- The type gpr_mu provides a non-reentrant mutex (lock).
-
- The type gpr_cv provides a condition variable.
-
- The type gpr_once provides for one-time initialization.
-
- The type gpr_event provides one-time-setting, reading, and
- waiting of a void*, with memory barriers.
-
- The type gpr_refcount provides an object reference counter,
- with memory barriers suitable to control
- object lifetimes.
-
- The type gpr_stats_counter provides an atomic statistics counter. It
- provides no memory barriers.
- */
-
+
+ The type gpr_mu provides a non-reentrant mutex (lock).
+
+ The type gpr_cv provides a condition variable.
+
+ The type gpr_once provides for one-time initialization.
+
+ The type gpr_event provides one-time-setting, reading, and
+ waiting of a void*, with memory barriers.
+
+ The type gpr_refcount provides an object reference counter,
+ with memory barriers suitable to control
+ object lifetimes.
+
+ The type gpr_stats_counter provides an atomic statistics counter. It
+ provides no memory barriers.
+ */
+
#ifdef __cplusplus
extern "C" {
#endif
-/* Platform-specific type declarations of gpr_mu and gpr_cv. */
-#include <grpc/impl/codegen/port_platform.h>
+/* Platform-specific type declarations of gpr_mu and gpr_cv. */
+#include <grpc/impl/codegen/port_platform.h>
+
+#include <grpc/impl/codegen/sync_generic.h>
-#include <grpc/impl/codegen/sync_generic.h>
-
#if defined(GPR_CUSTOM_SYNC)
#include <grpc/impl/codegen/sync_custom.h>
#elif defined(GPR_ABSEIL_SYNC)
#include <grpc/impl/codegen/sync_abseil.h>
#elif defined(GPR_POSIX_SYNC)
-#include <grpc/impl/codegen/sync_posix.h>
-#elif defined(GPR_WINDOWS)
-#include <grpc/impl/codegen/sync_windows.h>
+#include <grpc/impl/codegen/sync_posix.h>
+#elif defined(GPR_WINDOWS)
+#include <grpc/impl/codegen/sync_windows.h>
#else
-#error Unable to determine platform for sync
-#endif
-
+#error Unable to determine platform for sync
+#endif
+
#ifdef __cplusplus
}
#endif
-#endif /* GRPC_IMPL_CODEGEN_SYNC_H */
+#endif /* GRPC_IMPL_CODEGEN_SYNC_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/sync_generic.h b/contrib/libs/grpc/include/grpc/impl/codegen/sync_generic.h
index 8a860ad560..eabdc513f4 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/sync_generic.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/sync_generic.h
@@ -1,48 +1,48 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_SYNC_GENERIC_H
-#define GRPC_IMPL_CODEGEN_SYNC_GENERIC_H
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_SYNC_GENERIC_H
+#define GRPC_IMPL_CODEGEN_SYNC_GENERIC_H
/* Generic type definitions for gpr_sync. */
-
+
#include <grpc/impl/codegen/port_platform.h>
-#include <grpc/impl/codegen/atm.h>
-
-/* gpr_event */
+#include <grpc/impl/codegen/atm.h>
+
+/* gpr_event */
typedef struct {
gpr_atm state;
} gpr_event;
-
-#define GPR_EVENT_INIT \
- { 0 }
-
-/* gpr_refcount */
+
+#define GPR_EVENT_INIT \
+ { 0 }
+
+/* gpr_refcount */
typedef struct {
gpr_atm count;
} gpr_refcount;
-
-/* gpr_stats_counter */
+
+/* gpr_stats_counter */
typedef struct {
gpr_atm value;
} gpr_stats_counter;
-
-#define GPR_STATS_INIT \
- { 0 }
-
-#endif /* GRPC_IMPL_CODEGEN_SYNC_GENERIC_H */
+
+#define GPR_STATS_INIT \
+ { 0 }
+
+#endif /* GRPC_IMPL_CODEGEN_SYNC_GENERIC_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/sync_posix.h b/contrib/libs/grpc/include/grpc/impl/codegen/sync_posix.h
index bf1ceb9f14..2aec3a3f8d 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/sync_posix.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/sync_posix.h
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_SYNC_POSIX_H
-#define GRPC_IMPL_CODEGEN_SYNC_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_SYNC_POSIX_H
+#define GRPC_IMPL_CODEGEN_SYNC_POSIX_H
+
#include <grpc/impl/codegen/port_platform.h>
-#include <grpc/impl/codegen/sync_generic.h>
-
-#include <pthread.h>
-
+#include <grpc/impl/codegen/sync_generic.h>
+
+#include <pthread.h>
+
#ifdef GRPC_ASAN_ENABLED
/* The member |leak_checker| is used to check whether there is a memory leak
* caused by upper layer logic that's missing the |gpr_xx_destroy| call
@@ -42,11 +42,11 @@ typedef struct {
int* leak_checker;
} gpr_cv;
#else
-typedef pthread_mutex_t gpr_mu;
-typedef pthread_cond_t gpr_cv;
+typedef pthread_mutex_t gpr_mu;
+typedef pthread_cond_t gpr_cv;
#endif
-typedef pthread_once_t gpr_once;
-
-#define GPR_ONCE_INIT PTHREAD_ONCE_INIT
-
-#endif /* GRPC_IMPL_CODEGEN_SYNC_POSIX_H */
+typedef pthread_once_t gpr_once;
+
+#define GPR_ONCE_INIT PTHREAD_ONCE_INIT
+
+#endif /* GRPC_IMPL_CODEGEN_SYNC_POSIX_H */
diff --git a/contrib/libs/grpc/include/grpc/impl/codegen/sync_windows.h b/contrib/libs/grpc/include/grpc/impl/codegen/sync_windows.h
index 817a118ef0..ba5d5aede0 100644
--- a/contrib/libs/grpc/include/grpc/impl/codegen/sync_windows.h
+++ b/contrib/libs/grpc/include/grpc/impl/codegen/sync_windows.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
-#define GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
+#define GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
+
#include <grpc/impl/codegen/port_platform.h>
-#include <grpc/impl/codegen/sync_generic.h>
-
-typedef struct {
- CRITICAL_SECTION cs; /* Not an SRWLock until Vista is unsupported */
- int locked;
-} gpr_mu;
-
-typedef CONDITION_VARIABLE gpr_cv;
-
-typedef INIT_ONCE gpr_once;
-#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
-
-#endif /* GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H */
+#include <grpc/impl/codegen/sync_generic.h>
+
+typedef struct {
+ CRITICAL_SECTION cs; /* Not an SRWLock until Vista is unsupported */
+ int locked;
+} gpr_mu;
+
+typedef CONDITION_VARIABLE gpr_cv;
+
+typedef INIT_ONCE gpr_once;
+#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
+
+#endif /* GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H */
diff --git a/contrib/libs/grpc/include/grpc/module.modulemap b/contrib/libs/grpc/include/grpc/module.modulemap
index 9d32de389d..06c1e97736 100644
--- a/contrib/libs/grpc/include/grpc/module.modulemap
+++ b/contrib/libs/grpc/include/grpc/module.modulemap
@@ -1,7 +1,7 @@
-framework module grpc {
- umbrella header "grpc.h"
-
+framework module grpc {
+ umbrella header "grpc.h"
+
header "impl/codegen/atm.h"
header "impl/codegen/byte_buffer.h"
header "impl/codegen/byte_buffer_reader.h"
@@ -45,7 +45,7 @@ framework module grpc {
header "slice_buffer.h"
header "status.h"
header "support/workaround_list.h"
-
+
textual header "impl/codegen/atm_gcc_atomic.h"
textual header "impl/codegen/atm_gcc_sync.h"
textual header "impl/codegen/atm_windows.h"
@@ -59,6 +59,6 @@ framework module grpc {
textual header "support/sync_posix.h"
textual header "support/sync_windows.h"
- export *
- module * { export * }
-}
+ export *
+ module * { export * }
+}
diff --git a/contrib/libs/grpc/include/grpc/slice.h b/contrib/libs/grpc/include/grpc/slice.h
index fbe8f338b4..51fc62b44d 100644
--- a/contrib/libs/grpc/include/grpc/slice.h
+++ b/contrib/libs/grpc/include/grpc/slice.h
@@ -1,72 +1,72 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SLICE_H
-#define GRPC_SLICE_H
-
+ *
+ */
+
+#ifndef GRPC_SLICE_H
+#define GRPC_SLICE_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/slice.h>
-#include <grpc/support/sync.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/impl/codegen/slice.h>
+#include <grpc/support/sync.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Increment the refcount of s. Requires slice is initialized.
- Returns s. */
-GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
-
+ Returns s. */
+GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
+
/** Decrement the ref count of s. If the ref count of s reaches zero, all
- slices sharing the ref count are destroyed, and considered no longer
- initialized. If s is ultimately derived from a call to grpc_slice_new(start,
- len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
- ultimately derived from a call to grpc_slice_new_with_len(start, len, dest)
- where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
-GPRAPI void grpc_slice_unref(grpc_slice s);
-
+ slices sharing the ref count are destroyed, and considered no longer
+ initialized. If s is ultimately derived from a call to grpc_slice_new(start,
+ len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
+ ultimately derived from a call to grpc_slice_new_with_len(start, len, dest)
+ where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
+GPRAPI void grpc_slice_unref(grpc_slice s);
+
/** Copy slice - create a new slice that contains the same data as s */
GPRAPI grpc_slice grpc_slice_copy(grpc_slice s);
/** Create a slice pointing at some data. Calls malloc to allocate a refcount
- for the object, and arranges that destroy will be called with the pointer
- passed in at destruction. */
+ for the object, and arranges that destroy will be called with the pointer
+ passed in at destruction. */
GPRAPI grpc_slice grpc_slice_new(void* p, size_t len, void (*destroy)(void*));
-
+
/** Equivalent to grpc_slice_new, but with a separate pointer that is
- passed to the destroy function. This function can be useful when
- the data is part of a larger structure that must be destroyed when
- the data is no longer needed. */
+ passed to the destroy function. This function can be useful when
+ the data is part of a larger structure that must be destroyed when
+ the data is no longer needed. */
GPRAPI grpc_slice grpc_slice_new_with_user_data(void* p, size_t len,
void (*destroy)(void*),
void* user_data);
-
+
/** Equivalent to grpc_slice_new, but with a two argument destroy function that
- also takes the slice length. */
+ also takes the slice length. */
GPRAPI grpc_slice grpc_slice_new_with_len(void* p, size_t len,
void (*destroy)(void*, size_t));
-
+
/** Equivalent to grpc_slice_new(malloc(len), len, free), but saves one malloc()
- call.
- Aborts if malloc() fails. */
-GPRAPI grpc_slice grpc_slice_malloc(size_t length);
+ call.
+ Aborts if malloc() fails. */
+GPRAPI grpc_slice grpc_slice_malloc(size_t length);
GPRAPI grpc_slice grpc_slice_malloc_large(size_t length);
-
+
#define GRPC_SLICE_MALLOC(len) grpc_slice_malloc(len)
/** Intern a slice:
@@ -76,40 +76,40 @@ GPRAPI grpc_slice grpc_slice_malloc_large(size_t length);
GPRAPI grpc_slice grpc_slice_intern(grpc_slice slice);
/** Create a slice by copying a string.
- Does not preserve null terminators.
- Equivalent to:
- size_t len = strlen(source);
- grpc_slice slice = grpc_slice_malloc(len);
- memcpy(slice->data, source, len); */
+ Does not preserve null terminators.
+ Equivalent to:
+ size_t len = strlen(source);
+ grpc_slice slice = grpc_slice_malloc(len);
+ memcpy(slice->data, source, len); */
GPRAPI grpc_slice grpc_slice_from_copied_string(const char* source);
-
+
/** Create a slice by copying a buffer.
- Equivalent to:
- grpc_slice slice = grpc_slice_malloc(len);
- memcpy(slice->data, source, len); */
+ Equivalent to:
+ grpc_slice slice = grpc_slice_malloc(len);
+ memcpy(slice->data, source, len); */
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char* source, size_t len);
-
+
/** Create a slice pointing to constant memory */
GPRAPI grpc_slice grpc_slice_from_static_string(const char* source);
-
+
/** Create a slice pointing to constant memory */
GPRAPI grpc_slice grpc_slice_from_static_buffer(const void* source, size_t len);
/** Return a result slice derived from s, which shares a ref count with \a s,
where result.data==s.data+begin, and result.length==end-begin. The ref count
of \a s is increased by one. Do not assign result back to \a s.
- Requires s initialized, begin <= end, begin <= s.length, and
- end <= source->length. */
-GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
-
+ Requires s initialized, begin <= end, begin <= s.length, and
+ end <= source->length. */
+GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
+
/** The same as grpc_slice_sub, but without altering the ref count */
-GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end);
-
+GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end);
+
/** Splits s into two: modifies s to be s[0:split], and returns a new slice,
- sharing a refcount with s, that contains s[split:s.length].
+ sharing a refcount with s, that contains s[split:s.length].
Requires s initialized, split <= s.length */
GPRAPI grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split);
-
+
typedef enum {
GRPC_SLICE_REF_TAIL = 1,
GRPC_SLICE_REF_HEAD = 2,
@@ -123,23 +123,23 @@ GPRAPI grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice* s, size_t split,
grpc_slice_ref_whom ref_whom);
/** Splits s into two: modifies s to be s[split:s.length], and returns a new
- slice, sharing a refcount with s, that contains s[0:split].
+ slice, sharing a refcount with s, that contains s[0:split].
Requires s initialized, split <= s.length */
GPRAPI grpc_slice grpc_slice_split_head(grpc_slice* s, size_t split);
-
+
GPRAPI grpc_slice grpc_empty_slice(void);
-
+
GPRAPI uint32_t grpc_slice_default_hash_impl(grpc_slice s);
GPRAPI int grpc_slice_default_eq_impl(grpc_slice a, grpc_slice b);
GPRAPI int grpc_slice_eq(grpc_slice a, grpc_slice b);
/** Returns <0 if a < b, ==0 if a == b, >0 if a > b
- The order is arbitrary, and is not guaranteed to be stable across different
- versions of the API. */
-GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b);
+ The order is arbitrary, and is not guaranteed to be stable across different
+ versions of the API. */
+GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b);
GPRAPI int grpc_slice_str_cmp(grpc_slice a, const char* b);
-
+
/** return non-zero if the first blen bytes of a are equal to b */
GPRAPI int grpc_slice_buf_start_eq(grpc_slice a, const void* b, size_t blen);
@@ -154,9 +154,9 @@ GPRAPI int grpc_slice_slice(grpc_slice haystack, grpc_slice needle);
GPRAPI uint32_t grpc_slice_hash(grpc_slice s);
/** Do two slices point at the same memory, with the same length
- If a or b is inlined, actually compares data */
-GPRAPI int grpc_slice_is_equivalent(grpc_slice a, grpc_slice b);
-
+ If a or b is inlined, actually compares data */
+GPRAPI int grpc_slice_is_equivalent(grpc_slice a, grpc_slice b);
+
/** Return a slice pointing to newly allocated memory that has the same contents
* as \a s */
GPRAPI grpc_slice grpc_slice_dup(grpc_slice a);
@@ -165,8 +165,8 @@ GPRAPI grpc_slice grpc_slice_dup(grpc_slice a);
NULL's. Returned string must be freed with gpr_free. */
GPRAPI char* grpc_slice_to_c_string(grpc_slice s);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SLICE_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SLICE_H */
diff --git a/contrib/libs/grpc/include/grpc/slice_buffer.h b/contrib/libs/grpc/include/grpc/slice_buffer.h
index 04f56b17f3..3260019ca7 100644
--- a/contrib/libs/grpc/include/grpc/slice_buffer.h
+++ b/contrib/libs/grpc/include/grpc/slice_buffer.h
@@ -1,53 +1,53 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SLICE_BUFFER_H
-#define GRPC_SLICE_BUFFER_H
-
+ *
+ */
+
+#ifndef GRPC_SLICE_BUFFER_H
+#define GRPC_SLICE_BUFFER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/slice.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** initialize a slice buffer */
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer* sb);
/** destroy a slice buffer - unrefs any held elements */
GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer* sb);
/** Add an element to a slice buffer - takes ownership of the slice.
- This function is allowed to concatenate the passed in slice to the end of
- some other slice if desired by the slice buffer. */
+ This function is allowed to concatenate the passed in slice to the end of
+ some other slice if desired by the slice buffer. */
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice);
/** add an element to a slice buffer - takes ownership of the slice and returns
- the index of the slice.
- Guarantees that the slice will not be concatenated at the end of another
- slice (i.e. the data for this slice will begin at the first byte of the
- slice at the returned index in sb->slices)
- The implementation MAY decide to concatenate data at the end of a small
- slice added in this fashion. */
+ the index of the slice.
+ Guarantees that the slice will not be concatenated at the end of another
+ slice (i.e. the data for this slice will begin at the first byte of the
+ slice at the returned index in sb->slices)
+ The implementation MAY decide to concatenate data at the end of a small
+ slice added in this fashion. */
GPRAPI size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer* sb,
- grpc_slice slice);
+ grpc_slice slice);
GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer* sb, grpc_slice* slices,
- size_t n);
+ size_t n);
/** add a very small (less than 8 bytes) amount of data to the end of a slice
- buffer: returns a pointer into which to add the data */
+ buffer: returns a pointer into which to add the data */
GPRAPI uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t len);
/** pop the last buffer, but don't unref it */
GPRAPI void grpc_slice_buffer_pop(grpc_slice_buffer* sb);
@@ -76,9 +76,9 @@ GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer* src);
/** undo the above with (a possibly different) \a slice */
GPRAPI void grpc_slice_buffer_undo_take_first(grpc_slice_buffer* src,
grpc_slice slice);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SLICE_BUFFER_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SLICE_BUFFER_H */
diff --git a/contrib/libs/grpc/include/grpc/status.h b/contrib/libs/grpc/include/grpc/status.h
index c3eae7f3c1..ecb9668bbb 100644
--- a/contrib/libs/grpc/include/grpc/status.h
+++ b/contrib/libs/grpc/include/grpc/status.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_STATUS_H
-#define GRPC_STATUS_H
-
+ *
+ */
+
+#ifndef GRPC_STATUS_H
+#define GRPC_STATUS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/status.h>
-
-#endif /* GRPC_STATUS_H */
+#include <grpc/impl/codegen/status.h>
+
+#endif /* GRPC_STATUS_H */
diff --git a/contrib/libs/grpc/include/grpc/support/alloc.h b/contrib/libs/grpc/include/grpc/support/alloc.h
index cb9174247b..d440e4be8c 100644
--- a/contrib/libs/grpc/include/grpc/support/alloc.h
+++ b/contrib/libs/grpc/include/grpc/support/alloc.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_ALLOC_H
-#define GRPC_SUPPORT_ALLOC_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_ALLOC_H
+#define GRPC_SUPPORT_ALLOC_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** malloc.
- * If size==0, always returns NULL. Otherwise this function never returns NULL.
- * The pointer returned is suitably aligned for any kind of variable it could
- * contain.
- */
+ * If size==0, always returns NULL. Otherwise this function never returns NULL.
+ * The pointer returned is suitably aligned for any kind of variable it could
+ * contain.
+ */
GPRAPI void* gpr_malloc(size_t size);
/** like malloc, but zero all bytes before returning them */
GPRAPI void* gpr_zalloc(size_t size);
@@ -44,9 +44,9 @@ GPRAPI void* gpr_realloc(void* p, size_t size);
GPRAPI void* gpr_malloc_aligned(size_t size, size_t alignment);
/** free memory allocated by gpr_malloc_aligned */
GPRAPI void gpr_free_aligned(void* ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_ALLOC_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SUPPORT_ALLOC_H */
diff --git a/contrib/libs/grpc/include/grpc/support/atm.h b/contrib/libs/grpc/include/grpc/support/atm.h
index 3d80943bd8..073b0a6fcf 100644
--- a/contrib/libs/grpc/include/grpc/support/atm.h
+++ b/contrib/libs/grpc/include/grpc/support/atm.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_ATM_H
-#define GRPC_SUPPORT_ATM_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_ATM_H
+#define GRPC_SUPPORT_ATM_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/atm.h>
-
-#endif /* GRPC_SUPPORT_ATM_H */
+#include <grpc/impl/codegen/atm.h>
+
+#endif /* GRPC_SUPPORT_ATM_H */
diff --git a/contrib/libs/grpc/include/grpc/support/atm_gcc_atomic.h b/contrib/libs/grpc/include/grpc/support/atm_gcc_atomic.h
index 20584ca94d..ae603db497 100644
--- a/contrib/libs/grpc/include/grpc/support/atm_gcc_atomic.h
+++ b/contrib/libs/grpc/include/grpc/support/atm_gcc_atomic.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
-#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
+#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/atm_gcc_atomic.h>
-
-#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */
+#include <grpc/impl/codegen/atm_gcc_atomic.h>
+
+#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */
diff --git a/contrib/libs/grpc/include/grpc/support/atm_gcc_sync.h b/contrib/libs/grpc/include/grpc/support/atm_gcc_sync.h
index faae2273e6..6f51fdb1aa 100644
--- a/contrib/libs/grpc/include/grpc/support/atm_gcc_sync.h
+++ b/contrib/libs/grpc/include/grpc/support/atm_gcc_sync.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H
-#define GRPC_SUPPORT_ATM_GCC_SYNC_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H
+#define GRPC_SUPPORT_ATM_GCC_SYNC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/atm_gcc_sync.h>
-
-#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */
+#include <grpc/impl/codegen/atm_gcc_sync.h>
+
+#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */
diff --git a/contrib/libs/grpc/include/grpc/support/atm_windows.h b/contrib/libs/grpc/include/grpc/support/atm_windows.h
index c79e68eb68..36955e4dae 100644
--- a/contrib/libs/grpc/include/grpc/support/atm_windows.h
+++ b/contrib/libs/grpc/include/grpc/support/atm_windows.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_ATM_WINDOWS_H
-#define GRPC_SUPPORT_ATM_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_ATM_WINDOWS_H
+#define GRPC_SUPPORT_ATM_WINDOWS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/atm_windows.h>
-
-#endif /* GRPC_SUPPORT_ATM_WINDOWS_H */
+#include <grpc/impl/codegen/atm_windows.h>
+
+#endif /* GRPC_SUPPORT_ATM_WINDOWS_H */
diff --git a/contrib/libs/grpc/include/grpc/support/cpu.h b/contrib/libs/grpc/include/grpc/support/cpu.h
index 270c876fa7..f0e898e859 100644
--- a/contrib/libs/grpc/include/grpc/support/cpu.h
+++ b/contrib/libs/grpc/include/grpc/support/cpu.h
@@ -1,44 +1,44 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_CPU_H
-#define GRPC_SUPPORT_CPU_H
-
-#include <grpc/support/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_CPU_H
+#define GRPC_SUPPORT_CPU_H
+
+#include <grpc/support/port_platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Interface providing CPU information for currently running system */
-
+
/** Return the number of CPU cores on the current system. Will return 0 if
- the information is not available. */
-GPRAPI unsigned gpr_cpu_num_cores(void);
-
+ the information is not available. */
+GPRAPI unsigned gpr_cpu_num_cores(void);
+
/** Return the CPU on which the current thread is executing; N.B. This should
- be considered advisory only - it is possible that the thread is switched
- to a different CPU at any time. Returns a value in range
- [0, gpr_cpu_num_cores() - 1] */
-GPRAPI unsigned gpr_cpu_current_cpu(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* GRPC_SUPPORT_CPU_H */
+ be considered advisory only - it is possible that the thread is switched
+ to a different CPU at any time. Returns a value in range
+ [0, gpr_cpu_num_cores() - 1] */
+GPRAPI unsigned gpr_cpu_current_cpu(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* GRPC_SUPPORT_CPU_H */
diff --git a/contrib/libs/grpc/include/grpc/support/log.h b/contrib/libs/grpc/include/grpc/support/log.h
index c178daea0b..8d8742b95d 100644
--- a/contrib/libs/grpc/include/grpc/support/log.h
+++ b/contrib/libs/grpc/include/grpc/support/log.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_LOG_H
-#define GRPC_SUPPORT_LOG_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_LOG_H
+#define GRPC_SUPPORT_LOG_H
+
#include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/log.h>
-
-#endif /* GRPC_SUPPORT_LOG_H */
+
+#endif /* GRPC_SUPPORT_LOG_H */
diff --git a/contrib/libs/grpc/include/grpc/support/log_windows.h b/contrib/libs/grpc/include/grpc/support/log_windows.h
index a6ca4e4113..e833f9d9df 100644
--- a/contrib/libs/grpc/include/grpc/support/log_windows.h
+++ b/contrib/libs/grpc/include/grpc/support/log_windows.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_LOG_WINDOWS_H
-#define GRPC_SUPPORT_LOG_WINDOWS_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_LOG_WINDOWS_H
+#define GRPC_SUPPORT_LOG_WINDOWS_H
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Returns a string allocated with gpr_malloc that contains a UTF-8
- * formatted error message, corresponding to the error messageid.
- * Use in conjunction with GetLastError() et al.
- */
+ * formatted error message, corresponding to the error messageid.
+ * Use in conjunction with GetLastError() et al.
+ */
GPRAPI char* gpr_format_message(int messageid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_LOG_WINDOWS_H */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SUPPORT_LOG_WINDOWS_H */
diff --git a/contrib/libs/grpc/include/grpc/support/port_platform.h b/contrib/libs/grpc/include/grpc/support/port_platform.h
index a67c9b9569..26025dcd9d 100644
--- a/contrib/libs/grpc/include/grpc/support/port_platform.h
+++ b/contrib/libs/grpc/include/grpc/support/port_platform.h
@@ -1,24 +1,24 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_PORT_PLATFORM_H
-#define GRPC_SUPPORT_PORT_PLATFORM_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
+ *
+ */
+
+#ifndef GRPC_SUPPORT_PORT_PLATFORM_H
+#define GRPC_SUPPORT_PORT_PLATFORM_H
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
diff --git a/contrib/libs/grpc/include/grpc/support/string_util.h b/contrib/libs/grpc/include/grpc/support/string_util.h
index 9abac43d64..2679160c1b 100644
--- a/contrib/libs/grpc/include/grpc/support/string_util.h
+++ b/contrib/libs/grpc/include/grpc/support/string_util.h
@@ -1,51 +1,51 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_STRING_UTIL_H
-#define GRPC_SUPPORT_STRING_UTIL_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_STRING_UTIL_H
+#define GRPC_SUPPORT_STRING_UTIL_H
+
+#include <grpc/support/port_platform.h>
+
#include <grpc/impl/codegen/gpr_types.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** String utility functions */
-
+
/** Returns a copy of src that can be passed to gpr_free().
- If allocation fails or if src is NULL, returns NULL. */
+ If allocation fails or if src is NULL, returns NULL. */
GPRAPI char* gpr_strdup(const char* src);
-
+
/** printf to a newly-allocated string. The set of supported formats may vary
- between platforms.
-
- On success, returns the number of bytes printed (excluding the final '\0'),
- and *strp points to a string which must later be destroyed with gpr_free().
-
- On error, returns -1 and sets *strp to NULL. If the format string is bad,
- the result is undefined. */
+ between platforms.
+
+ On success, returns the number of bytes printed (excluding the final '\0'),
+ and *strp points to a string which must later be destroyed with gpr_free().
+
+ On error, returns -1 and sets *strp to NULL. If the format string is bad,
+ the result is undefined. */
GPRAPI int gpr_asprintf(char** strp, const char* format, ...)
- GPR_PRINT_FORMAT_CHECK(2, 3);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_STRING_UTIL_H */
+ GPR_PRINT_FORMAT_CHECK(2, 3);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SUPPORT_STRING_UTIL_H */
diff --git a/contrib/libs/grpc/include/grpc/support/sync.h b/contrib/libs/grpc/include/grpc/support/sync.h
index 0bbb6280e5..da820dece5 100644
--- a/contrib/libs/grpc/include/grpc/support/sync.h
+++ b/contrib/libs/grpc/include/grpc/support/sync.h
@@ -1,282 +1,282 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_SYNC_H
-#define GRPC_SUPPORT_SYNC_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_SYNC_H
+#define GRPC_SUPPORT_SYNC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/gpr_types.h> /* for gpr_timespec */
-#include <grpc/impl/codegen/sync.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/impl/codegen/gpr_types.h> /* for gpr_timespec */
+#include <grpc/impl/codegen/sync.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** --- Mutex interface ---
-
- At most one thread may hold an exclusive lock on a mutex at any given time.
- Actions taken by a thread that holds a mutex exclusively happen after
- actions taken by all previous holders of the mutex. Variables of type
- gpr_mu are uninitialized when first declared. */
-
+
+ At most one thread may hold an exclusive lock on a mutex at any given time.
+ Actions taken by a thread that holds a mutex exclusively happen after
+ actions taken by all previous holders of the mutex. Variables of type
+ gpr_mu are uninitialized when first declared. */
+
/** Initialize *mu. Requires: *mu uninitialized. */
GPRAPI void gpr_mu_init(gpr_mu* mu);
-
+
/** Cause *mu no longer to be initialized, freeing any memory in use. Requires:
*mu initialized; no other concurrent operation on *mu. */
GPRAPI void gpr_mu_destroy(gpr_mu* mu);
-
+
/** Wait until no thread has a lock on *mu, cause the calling thread to own an
- exclusive lock on *mu, then return. May block indefinitely or crash if the
- calling thread has a lock on *mu. Requires: *mu initialized. */
+ exclusive lock on *mu, then return. May block indefinitely or crash if the
+ calling thread has a lock on *mu. Requires: *mu initialized. */
GPRAPI void gpr_mu_lock(gpr_mu* mu);
-
+
/** Release an exclusive lock on *mu held by the calling thread. Requires: *mu
- initialized; the calling thread holds an exclusive lock on *mu. */
+ initialized; the calling thread holds an exclusive lock on *mu. */
GPRAPI void gpr_mu_unlock(gpr_mu* mu);
-
+
/** Without blocking, attempt to acquire an exclusive lock on *mu for the
- calling thread, then return non-zero iff success. Fail, if any thread holds
- the lock; succeeds with high probability if no thread holds the lock.
- Requires: *mu initialized. */
+ calling thread, then return non-zero iff success. Fail, if any thread holds
+ the lock; succeeds with high probability if no thread holds the lock.
+ Requires: *mu initialized. */
GPRAPI int gpr_mu_trylock(gpr_mu* mu);
-
+
/** --- Condition variable interface ---
-
- A while-loop should be used with gpr_cv_wait() when waiting for conditions
- to become true. See the example below. Variables of type gpr_cv are
- uninitialized when first declared. */
-
+
+ A while-loop should be used with gpr_cv_wait() when waiting for conditions
+ to become true. See the example below. Variables of type gpr_cv are
+ uninitialized when first declared. */
+
/** Initialize *cv. Requires: *cv uninitialized. */
GPRAPI void gpr_cv_init(gpr_cv* cv);
-
+
/** Cause *cv no longer to be initialized, freeing any memory in use. Requires:
*cv initialized; no other concurrent operation on *cv.*/
GPRAPI void gpr_cv_destroy(gpr_cv* cv);
-
+
/** Atomically release *mu and wait on *cv. When the calling thread is woken
- from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
- and return whether the deadline was exceeded. Use
- abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
- an absolute deadline, or a GPR_TIMESPAN. May return even when not
- woken explicitly. Requires: *mu and *cv initialized; the calling thread
- holds an exclusive lock on *mu. */
+ from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
+ and return whether the deadline was exceeded. Use
+ abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
+ an absolute deadline, or a GPR_TIMESPAN. May return even when not
+ woken explicitly. Requires: *mu and *cv initialized; the calling thread
+ holds an exclusive lock on *mu. */
GPRAPI int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline);
-
+
/** If any threads are waiting on *cv, wake at least one.
- Clients may treat this as an optimization of gpr_cv_broadcast()
- for use in the case where waking more than one waiter is not useful.
- Requires: *cv initialized. */
+ Clients may treat this as an optimization of gpr_cv_broadcast()
+ for use in the case where waking more than one waiter is not useful.
+ Requires: *cv initialized. */
GPRAPI void gpr_cv_signal(gpr_cv* cv);
-
+
/** Wake all threads waiting on *cv. Requires: *cv initialized. */
GPRAPI void gpr_cv_broadcast(gpr_cv* cv);
-
+
/** --- One-time initialization ---
-
- gpr_once must be declared with static storage class, and initialized with
- GPR_ONCE_INIT. e.g.,
- static gpr_once once_var = GPR_ONCE_INIT; */
-
+
+ gpr_once must be declared with static storage class, and initialized with
+ GPR_ONCE_INIT. e.g.,
+ static gpr_once once_var = GPR_ONCE_INIT; */
+
/** Ensure that (*init_routine)() has been called exactly once (for the
- specified gpr_once instance) and then return.
- If multiple threads call gpr_once() on the same gpr_once instance, one of
- them will call (*init_routine)(), and the others will block until that call
- finishes.*/
+ specified gpr_once instance) and then return.
+ If multiple threads call gpr_once() on the same gpr_once instance, one of
+ them will call (*init_routine)(), and the others will block until that call
+ finishes.*/
GPRAPI void gpr_once_init(gpr_once* once, void (*init_routine)(void));
-
+
/** --- One-time event notification ---
-
- These operations act on a gpr_event, which should be initialized with
- gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g.,
- static gpr_event event_var = GPR_EVENT_INIT;
- It requires no destruction. */
-
+
+ These operations act on a gpr_event, which should be initialized with
+ gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g.,
+ static gpr_event event_var = GPR_EVENT_INIT;
+ It requires no destruction. */
+
/** Initialize *ev. */
GPRAPI void gpr_event_init(gpr_event* ev);
-
+
/** Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
- Requires: *ev initialized; value != NULL; no prior or concurrent calls to
- gpr_event_set(ev, ...) since initialization. */
+ Requires: *ev initialized; value != NULL; no prior or concurrent calls to
+ gpr_event_set(ev, ...) since initialization. */
GPRAPI void gpr_event_set(gpr_event* ev, void* value);
-
+
/** Return the value set by gpr_event_set(ev, ...), or NULL if no such call has
- completed. If the result is non-NULL, all operations that occurred prior to
- the gpr_event_set(ev, ...) set will be visible after this call returns.
- Requires: *ev initialized. This operation is faster than acquiring a mutex
- on most platforms. */
+ completed. If the result is non-NULL, all operations that occurred prior to
+ the gpr_event_set(ev, ...) set will be visible after this call returns.
+ Requires: *ev initialized. This operation is faster than acquiring a mutex
+ on most platforms. */
GPRAPI void* gpr_event_get(gpr_event* ev);
-
+
/** Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is
- exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
- abs_deadline==gpr_inf_future for no deadline. When the event has been
- signalled before the call, this operation is faster than acquiring a mutex
- on most platforms. */
+ exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
+ abs_deadline==gpr_inf_future for no deadline. When the event has been
+ signalled before the call, this operation is faster than acquiring a mutex
+ on most platforms. */
GPRAPI void* gpr_event_wait(gpr_event* ev, gpr_timespec abs_deadline);
-
+
/** --- Reference counting ---
-
- These calls act on the type gpr_refcount. It requires no destruction. */
-
+
+ These calls act on the type gpr_refcount. It requires no destruction. */
+
/** Initialize *r to value n. */
GPRAPI void gpr_ref_init(gpr_refcount* r, int n);
-
+
/** Increment the reference count *r. Requires *r initialized. */
GPRAPI void gpr_ref(gpr_refcount* r);
-
+
/** Increment the reference count *r. Requires *r initialized.
- Crashes if refcount is zero */
+ Crashes if refcount is zero */
GPRAPI void gpr_ref_non_zero(gpr_refcount* r);
-
+
/** Increment the reference count *r by n. Requires *r initialized, n > 0. */
GPRAPI void gpr_refn(gpr_refcount* r, int n);
-
+
/** Decrement the reference count *r and return non-zero iff it has reached
- zero. . Requires *r initialized. */
+ zero. . Requires *r initialized. */
GPRAPI int gpr_unref(gpr_refcount* r);
-
+
/** Return non-zero iff the reference count of *r is one, and thus is owned
by exactly one object. */
GPRAPI int gpr_ref_is_unique(gpr_refcount* r);
-
+
/** --- Stats counters ---
- These calls act on the integral type gpr_stats_counter. It requires no
- destruction. Static instances may be initialized with
- gpr_stats_counter c = GPR_STATS_INIT;
- Beware: These operations do not imply memory barriers. Do not use them to
- synchronize other events. */
-
+ These calls act on the integral type gpr_stats_counter. It requires no
+ destruction. Static instances may be initialized with
+ gpr_stats_counter c = GPR_STATS_INIT;
+ Beware: These operations do not imply memory barriers. Do not use them to
+ synchronize other events. */
+
/** Initialize *c to the value n. */
GPRAPI void gpr_stats_init(gpr_stats_counter* c, intptr_t n);
-
+
/** *c += inc. Requires: *c initialized. */
GPRAPI void gpr_stats_inc(gpr_stats_counter* c, intptr_t inc);
-
+
/** Return *c. Requires: *c initialized. */
GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter* c);
-
+
/** ==================Example use of interface===================
- A producer-consumer queue of up to N integers,
- illustrating the use of the calls in this interface. */
-#if 0
-
-#define N 4
-
- typedef struct queue {
- gpr_cv non_empty; /* Signalled when length becomes non-zero. */
- gpr_cv non_full; /* Signalled when length becomes non-N. */
- gpr_mu mu; /* Protects all fields below.
- (That is, except during initialization or
- destruction, the fields below should be accessed
- only by a thread that holds mu.) */
- int head; /* Index of head of queue 0..N-1. */
- int length; /* Number of valid elements in queue 0..N. */
- int elem[N]; /* elem[head .. head+length-1] are queue elements. */
- } queue;
-
- /* Initialize *q. */
- void queue_init(queue *q) {
- gpr_mu_init(&q->mu);
- gpr_cv_init(&q->non_empty);
- gpr_cv_init(&q->non_full);
- q->head = 0;
- q->length = 0;
- }
-
- /* Free storage associated with *q. */
- void queue_destroy(queue *q) {
- gpr_mu_destroy(&q->mu);
- gpr_cv_destroy(&q->non_empty);
- gpr_cv_destroy(&q->non_full);
- }
-
- /* Wait until there is room in *q, then append x to *q. */
- void queue_append(queue *q, int x) {
- gpr_mu_lock(&q->mu);
- /* To wait for a predicate without a deadline, loop on the negation of the
- predicate, and use gpr_cv_wait(..., gpr_inf_future) inside the loop
- to release the lock, wait, and reacquire on each iteration. Code that
- makes the condition true should use gpr_cv_broadcast() on the
- corresponding condition variable. The predicate must be on state
- protected by the lock. */
- while (q->length == N) {
- gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future);
- }
- if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
- /* It's normal to use gpr_cv_broadcast() or gpr_signal() while
- holding the lock. */
- gpr_cv_broadcast(&q->non_empty);
- }
- q->elem[(q->head + q->length) % N] = x;
- q->length++;
- gpr_mu_unlock(&q->mu);
- }
-
- /* If it can be done without blocking, append x to *q and return non-zero.
- Otherwise return 0. */
- int queue_try_append(queue *q, int x) {
- int result = 0;
- if (gpr_mu_trylock(&q->mu)) {
- if (q->length != N) {
- if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
- gpr_cv_broadcast(&q->non_empty);
- }
- q->elem[(q->head + q->length) % N] = x;
- q->length++;
- result = 1;
- }
- gpr_mu_unlock(&q->mu);
- }
- return result;
- }
-
- /* Wait until the *q is non-empty or deadline abs_deadline passes. If the
- queue is non-empty, remove its head entry, place it in *head, and return
- non-zero. Otherwise return 0. */
- int queue_remove(queue *q, int *head, gpr_timespec abs_deadline) {
- int result = 0;
- gpr_mu_lock(&q->mu);
- /* To wait for a predicate with a deadline, loop on the negation of the
- predicate or until gpr_cv_wait() returns true. Code that makes
- the condition true should use gpr_cv_broadcast() on the corresponding
- condition variable. The predicate must be on state protected by the
- lock. */
- while (q->length == 0 &&
- !gpr_cv_wait(&q->non_empty, &q->mu, abs_deadline)) {
- }
- if (q->length != 0) { /* Queue is non-empty. */
- result = 1;
- if (q->length == N) { /* Wake threads blocked in queue_append(). */
- gpr_cv_broadcast(&q->non_full);
- }
- *head = q->elem[q->head];
- q->head = (q->head + 1) % N;
- q->length--;
- } /* else deadline exceeded */
- gpr_mu_unlock(&q->mu);
- return result;
- }
-#endif /* 0 */
-
-#ifdef __cplusplus
+ A producer-consumer queue of up to N integers,
+ illustrating the use of the calls in this interface. */
+#if 0
+
+#define N 4
+
+ typedef struct queue {
+ gpr_cv non_empty; /* Signalled when length becomes non-zero. */
+ gpr_cv non_full; /* Signalled when length becomes non-N. */
+ gpr_mu mu; /* Protects all fields below.
+ (That is, except during initialization or
+ destruction, the fields below should be accessed
+ only by a thread that holds mu.) */
+ int head; /* Index of head of queue 0..N-1. */
+ int length; /* Number of valid elements in queue 0..N. */
+ int elem[N]; /* elem[head .. head+length-1] are queue elements. */
+ } queue;
+
+ /* Initialize *q. */
+ void queue_init(queue *q) {
+ gpr_mu_init(&q->mu);
+ gpr_cv_init(&q->non_empty);
+ gpr_cv_init(&q->non_full);
+ q->head = 0;
+ q->length = 0;
+ }
+
+ /* Free storage associated with *q. */
+ void queue_destroy(queue *q) {
+ gpr_mu_destroy(&q->mu);
+ gpr_cv_destroy(&q->non_empty);
+ gpr_cv_destroy(&q->non_full);
+ }
+
+ /* Wait until there is room in *q, then append x to *q. */
+ void queue_append(queue *q, int x) {
+ gpr_mu_lock(&q->mu);
+ /* To wait for a predicate without a deadline, loop on the negation of the
+ predicate, and use gpr_cv_wait(..., gpr_inf_future) inside the loop
+ to release the lock, wait, and reacquire on each iteration. Code that
+ makes the condition true should use gpr_cv_broadcast() on the
+ corresponding condition variable. The predicate must be on state
+ protected by the lock. */
+ while (q->length == N) {
+ gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future);
+ }
+ if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
+ /* It's normal to use gpr_cv_broadcast() or gpr_signal() while
+ holding the lock. */
+ gpr_cv_broadcast(&q->non_empty);
+ }
+ q->elem[(q->head + q->length) % N] = x;
+ q->length++;
+ gpr_mu_unlock(&q->mu);
+ }
+
+ /* If it can be done without blocking, append x to *q and return non-zero.
+ Otherwise return 0. */
+ int queue_try_append(queue *q, int x) {
+ int result = 0;
+ if (gpr_mu_trylock(&q->mu)) {
+ if (q->length != N) {
+ if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
+ gpr_cv_broadcast(&q->non_empty);
+ }
+ q->elem[(q->head + q->length) % N] = x;
+ q->length++;
+ result = 1;
+ }
+ gpr_mu_unlock(&q->mu);
+ }
+ return result;
+ }
+
+ /* Wait until the *q is non-empty or deadline abs_deadline passes. If the
+ queue is non-empty, remove its head entry, place it in *head, and return
+ non-zero. Otherwise return 0. */
+ int queue_remove(queue *q, int *head, gpr_timespec abs_deadline) {
+ int result = 0;
+ gpr_mu_lock(&q->mu);
+ /* To wait for a predicate with a deadline, loop on the negation of the
+ predicate or until gpr_cv_wait() returns true. Code that makes
+ the condition true should use gpr_cv_broadcast() on the corresponding
+ condition variable. The predicate must be on state protected by the
+ lock. */
+ while (q->length == 0 &&
+ !gpr_cv_wait(&q->non_empty, &q->mu, abs_deadline)) {
+ }
+ if (q->length != 0) { /* Queue is non-empty. */
+ result = 1;
+ if (q->length == N) { /* Wake threads blocked in queue_append(). */
+ gpr_cv_broadcast(&q->non_full);
+ }
+ *head = q->elem[q->head];
+ q->head = (q->head + 1) % N;
+ q->length--;
+ } /* else deadline exceeded */
+ gpr_mu_unlock(&q->mu);
+ return result;
+ }
+#endif /* 0 */
+
+#ifdef __cplusplus
} // extern "C"
-#endif
-
-#endif /* GRPC_SUPPORT_SYNC_H */
+#endif
+
+#endif /* GRPC_SUPPORT_SYNC_H */
diff --git a/contrib/libs/grpc/include/grpc/support/sync_generic.h b/contrib/libs/grpc/include/grpc/support/sync_generic.h
index 4e87d94cfb..93028c4af0 100644
--- a/contrib/libs/grpc/include/grpc/support/sync_generic.h
+++ b/contrib/libs/grpc/include/grpc/support/sync_generic.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_SYNC_GENERIC_H
-#define GRPC_SUPPORT_SYNC_GENERIC_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_SYNC_GENERIC_H
+#define GRPC_SUPPORT_SYNC_GENERIC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/sync_generic.h>
-
-#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */
+#include <grpc/impl/codegen/sync_generic.h>
+
+#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */
diff --git a/contrib/libs/grpc/include/grpc/support/sync_posix.h b/contrib/libs/grpc/include/grpc/support/sync_posix.h
index 7a9903fe8d..3dce7ee48c 100644
--- a/contrib/libs/grpc/include/grpc/support/sync_posix.h
+++ b/contrib/libs/grpc/include/grpc/support/sync_posix.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_SYNC_POSIX_H
-#define GRPC_SUPPORT_SYNC_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_SYNC_POSIX_H
+#define GRPC_SUPPORT_SYNC_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/sync_posix.h>
-
-#endif /* GRPC_SUPPORT_SYNC_POSIX_H */
+#include <grpc/impl/codegen/sync_posix.h>
+
+#endif /* GRPC_SUPPORT_SYNC_POSIX_H */
diff --git a/contrib/libs/grpc/include/grpc/support/sync_windows.h b/contrib/libs/grpc/include/grpc/support/sync_windows.h
index caa248f8fa..a493c86422 100644
--- a/contrib/libs/grpc/include/grpc/support/sync_windows.h
+++ b/contrib/libs/grpc/include/grpc/support/sync_windows.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_SYNC_WINDOWS_H
-#define GRPC_SUPPORT_SYNC_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_SYNC_WINDOWS_H
+#define GRPC_SUPPORT_SYNC_WINDOWS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/sync_windows.h>
-
-#endif /* GRPC_SUPPORT_SYNC_WINDOWS_H */
+#include <grpc/impl/codegen/sync_windows.h>
+
+#endif /* GRPC_SUPPORT_SYNC_WINDOWS_H */
diff --git a/contrib/libs/grpc/include/grpc/support/time.h b/contrib/libs/grpc/include/grpc/support/time.h
index e8d3b28b80..550ffc2c20 100644
--- a/contrib/libs/grpc/include/grpc/support/time.h
+++ b/contrib/libs/grpc/include/grpc/support/time.h
@@ -1,92 +1,92 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_SUPPORT_TIME_H
-#define GRPC_SUPPORT_TIME_H
-
+ *
+ */
+
+#ifndef GRPC_SUPPORT_TIME_H
+#define GRPC_SUPPORT_TIME_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/gpr_types.h>
-
-#include <stddef.h>
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <grpc/impl/codegen/gpr_types.h>
+
+#include <stddef.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Time constants. */
-GPRAPI gpr_timespec
+GPRAPI gpr_timespec
gpr_time_0(gpr_clock_type type); /** The zero time interval. */
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type); /** The far future */
GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type); /** The far past. */
-
-#define GPR_MS_PER_SEC 1000
-#define GPR_US_PER_SEC 1000000
-#define GPR_NS_PER_SEC 1000000000
-#define GPR_NS_PER_MS 1000000
-#define GPR_NS_PER_US 1000
-#define GPR_US_PER_MS 1000
-
+
+#define GPR_MS_PER_SEC 1000
+#define GPR_US_PER_SEC 1000000
+#define GPR_NS_PER_SEC 1000000000
+#define GPR_NS_PER_MS 1000000
+#define GPR_NS_PER_US 1000
+#define GPR_US_PER_MS 1000
+
/** initialize time subsystem */
-GPRAPI void gpr_time_init(void);
-
+GPRAPI void gpr_time_init(void);
+
/** Return the current time measured from the given clocks epoch. */
-GPRAPI gpr_timespec gpr_now(gpr_clock_type clock);
-
+GPRAPI gpr_timespec gpr_now(gpr_clock_type clock);
+
/** Convert a timespec from one clock to another */
-GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t,
- gpr_clock_type target_clock);
-
+GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t,
+ gpr_clock_type target_clock);
+
/** Return -ve, 0, or +ve according to whether a < b, a == b, or a > b
- respectively. */
-GPRAPI int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
-
-GPRAPI gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
-GPRAPI gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
-
+ respectively. */
+GPRAPI int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
+
+GPRAPI gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
+GPRAPI gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
+
/** Add and subtract times. Calculations saturate at infinities. */
-GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
-GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
-
+GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
+GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
+
/** Return a timespec representing a given number of time units. INT64_MIN is
- interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
-GPRAPI gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type);
-GPRAPI gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type);
-GPRAPI gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type);
-GPRAPI gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type);
-GPRAPI gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type);
-GPRAPI gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type);
-
-GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec);
-
+ interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
+GPRAPI gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type);
+GPRAPI gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type);
+GPRAPI gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type);
+GPRAPI gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type);
+GPRAPI gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type);
+GPRAPI gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type);
+
+GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec);
+
/** Return 1 if two times are equal or within threshold of each other,
- 0 otherwise */
-GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b,
- gpr_timespec threshold);
-
+ 0 otherwise */
+GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b,
+ gpr_timespec threshold);
+
/** Sleep until at least 'until' - an absolute timeout */
-GPRAPI void gpr_sleep_until(gpr_timespec until);
-
-GPRAPI double gpr_timespec_to_micros(gpr_timespec t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_TIME_H */
+GPRAPI void gpr_sleep_until(gpr_timespec until);
+
+GPRAPI double gpr_timespec_to_micros(gpr_timespec t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_SUPPORT_TIME_H */
diff --git a/contrib/libs/grpc/src/compiler/README.md b/contrib/libs/grpc/src/compiler/README.md
index 20f2585af7..d5684af7ff 100644
--- a/contrib/libs/grpc/src/compiler/README.md
+++ b/contrib/libs/grpc/src/compiler/README.md
@@ -1,4 +1,4 @@
# Overview
-
-This directory contains source code for gRPC protocol buffer compiler (*protoc*) plugins. Along with `protoc`,
-these plugins are used to generate gRPC client and server stubs from `.proto` files.
+
+This directory contains source code for gRPC protocol buffer compiler (*protoc*) plugins. Along with `protoc`,
+these plugins are used to generate gRPC client and server stubs from `.proto` files.
diff --git a/contrib/libs/grpc/src/compiler/config.h b/contrib/libs/grpc/src/compiler/config.h
index fe09deed05..95213b0f04 100644
--- a/contrib/libs/grpc/src/compiler/config.h
+++ b/contrib/libs/grpc/src/compiler/config.h
@@ -1,62 +1,62 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef SRC_COMPILER_CONFIG_H
-#define SRC_COMPILER_CONFIG_H
-
+ *
+ */
+
+#ifndef SRC_COMPILER_CONFIG_H
+#define SRC_COMPILER_CONFIG_H
+
#include "src/compiler/config_protobuf.h"
-
+
#include <util/generic/string.h>
#ifdef GRPC_CUSTOM_STRING
#warning GRPC_CUSTOM_STRING is no longer supported. Please use TString.
-#endif
-
-namespace grpc {
-
+#endif
+
+namespace grpc {
+
// Using grpc::string and grpc::to_string is discouraged in favor of
// TString and ToString. This is only for legacy code using
// them explictly.
typedef TString string; // deprecated
-
-namespace protobuf {
-
-namespace compiler {
-typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator;
-typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext;
-static inline int PluginMain(int argc, char* argv[],
- const CodeGenerator* generator) {
- return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator);
-}
-static inline void ParseGeneratorParameter(
- const string& parameter, std::vector<std::pair<string, string> >* options) {
- GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options);
-}
-
-} // namespace compiler
-namespace io {
-typedef GRPC_CUSTOM_PRINTER Printer;
-typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
-typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
-} // namespace io
-} // namespace protobuf
-} // namespace grpc
-
+
+namespace protobuf {
+
+namespace compiler {
+typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator;
+typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext;
+static inline int PluginMain(int argc, char* argv[],
+ const CodeGenerator* generator) {
+ return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator);
+}
+static inline void ParseGeneratorParameter(
+ const string& parameter, std::vector<std::pair<string, string> >* options) {
+ GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options);
+}
+
+} // namespace compiler
+namespace io {
+typedef GRPC_CUSTOM_PRINTER Printer;
+typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
+typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
+} // namespace io
+} // namespace protobuf
+} // namespace grpc
+
namespace grpc_cpp_generator {
static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
@@ -64,4 +64,4 @@ static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
} // namespace grpc_cpp_generator
-#endif // SRC_COMPILER_CONFIG_H
+#endif // SRC_COMPILER_CONFIG_H
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator.cc b/contrib/libs/grpc/src/compiler/cpp_generator.cc
index e431614c0f..5759177474 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator.cc
+++ b/contrib/libs/grpc/src/compiler/cpp_generator.cc
@@ -1,39 +1,39 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <map>
-
-#include "src/compiler/cpp_generator.h"
-
-#include <sstream>
-
+ *
+ */
+
+#include <map>
+
+#include "src/compiler/cpp_generator.h"
+
+#include <sstream>
+
#include <util/string/cast.h>
-namespace grpc_cpp_generator {
-namespace {
-
-template <class T>
+namespace grpc_cpp_generator {
+namespace {
+
+template <class T>
TString as_string(T x) {
- std::ostringstream out;
- out << x;
+ std::ostringstream out;
+ out << x;
return out.str();
-}
-
+}
+
inline bool ClientOnlyStreaming(const grpc_generator::Method* method) {
return method->ClientStreaming() && !method->ServerStreaming();
}
@@ -44,85 +44,85 @@ inline bool ServerOnlyStreaming(const grpc_generator::Method* method) {
TString FilenameIdentifier(const TString& filename) {
TString result;
- for (unsigned i = 0; i < filename.size(); i++) {
- char c = filename[i];
- if (isalnum(c)) {
- result.push_back(c);
- } else {
- static char hex[] = "0123456789abcdef";
- result.push_back('_');
- result.push_back(hex[(c >> 4) & 0xf]);
- result.push_back(hex[c & 0xf]);
- }
- }
- return result;
-}
-} // namespace
-
-template <class T, size_t N>
+ for (unsigned i = 0; i < filename.size(); i++) {
+ char c = filename[i];
+ if (isalnum(c)) {
+ result.push_back(c);
+ } else {
+ static char hex[] = "0123456789abcdef";
+ result.push_back('_');
+ result.push_back(hex[(c >> 4) & 0xf]);
+ result.push_back(hex[c & 0xf]);
+ }
+ }
+ return result;
+}
+} // namespace
+
+template <class T, size_t N>
T* array_end(T (&array)[N]) {
- return array + N;
-}
-
+ return array + N;
+}
+
void PrintIncludes(grpc_generator::Printer* printer,
const std::vector<TString>& headers,
bool use_system_headers, const TString& search_path) {
std::map<TString, TString> vars;
-
+
vars["l"] = use_system_headers ? '<' : '"';
vars["r"] = use_system_headers ? '>' : '"';
-
+
if (!search_path.empty()) {
vars["l"] += search_path;
if (search_path[search_path.size() - 1] != '/') {
- vars["l"] += '/';
- }
- }
-
- for (auto i = headers.begin(); i != headers.end(); i++) {
- vars["h"] = *i;
- printer->Print(vars, "#include $l$$h$$r$\n");
- }
-}
-
+ vars["l"] += '/';
+ }
+ }
+
+ for (auto i = headers.begin(); i != headers.end(); i++) {
+ vars["h"] = *i;
+ printer->Print(vars, "#include $l$$h$$r$\n");
+ }
+}
+
TString GetHeaderPrologue(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
- vars["filename"] = file->filename();
- vars["filename_identifier"] = FilenameIdentifier(file->filename());
- vars["filename_base"] = file->filename_without_ext();
+
+ vars["filename"] = file->filename();
+ vars["filename_identifier"] = FilenameIdentifier(file->filename());
+ vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = params.message_header_extension.empty()
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
-
+
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
- printer->Print(vars,
- "// If you make any local change, they will be lost.\n");
- printer->Print(vars, "// source: $filename$\n");
+ printer->Print(vars,
+ "// If you make any local change, they will be lost.\n");
+ printer->Print(vars, "// source: $filename$\n");
TString leading_comments = file->GetLeadingComments("//");
- if (!leading_comments.empty()) {
- printer->Print(vars, "// Original file comments:\n");
+ if (!leading_comments.empty()) {
+ printer->Print(vars, "// Original file comments:\n");
printer->PrintRaw(leading_comments.c_str());
- }
- printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
- printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
- printer->Print(vars, "\n");
- printer->Print(vars, "#if defined(__GNUC__)\n");
- printer->Print(vars, "#pragma GCC system_header\n");
- printer->Print(vars, "#endif\n");
- printer->Print(vars, "\n");
- printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
+ }
+ printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
+ printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
+ printer->Print(vars, "\n");
+ printer->Print(vars, "#if defined(__GNUC__)\n");
+ printer->Print(vars, "#pragma GCC system_header\n");
+ printer->Print(vars, "#endif\n");
+ printer->Print(vars, "\n");
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, file->additional_headers().c_str());
- printer->Print(vars, "\n");
- }
- return output;
-}
-
+ printer->Print(vars, "\n");
+ }
+ return output;
+}
+
// Convert from "a/b/c.proto" to "#include \"a/b/c$message_header_ext$\"\n"
TString ImportInludeFromProtoName(const TString& proto_name) {
return TString("#include \"") +
@@ -133,11 +133,11 @@ TString ImportInludeFromProtoName(const TString& proto_name) {
TString GetHeaderIncludes(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
+
if (!params.additional_header_includes.empty()) {
PrintIncludes(printer.get(), params.additional_header_includes, false,
"");
@@ -169,8 +169,8 @@ TString GetHeaderIncludes(grpc_generator::File* file,
std::vector<TString> headers(headers_strs, array_end(headers_strs));
PrintIncludes(printer.get(), headers, params.use_system_headers,
params.grpc_search_path);
- printer->Print(vars, "\n");
-
+ printer->Print(vars, "\n");
+
vars["message_header_ext"] = params.message_header_extension.empty()
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
@@ -184,27 +184,27 @@ TString GetHeaderIncludes(grpc_generator::File* file,
printer->PrintRaw("\n");
}
- if (!file->package().empty()) {
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.begin(); part != parts.end(); part++) {
- vars["part"] = *part;
- printer->Print(vars, "namespace $part$ {\n");
- }
- printer->Print(vars, "\n");
- }
- }
- return output;
-}
-
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ vars["part"] = *part;
+ printer->Print(vars, "namespace $part$ {\n");
+ }
+ printer->Print(vars, "\n");
+ }
+ }
+ return output;
+}
+
void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars,
bool is_public) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
-
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+
struct {
TString prefix;
TString method_params; // extra arguments to method
@@ -212,12 +212,12 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
} async_prefixes[] = {{"Async", ", void* tag", ", tag"},
{"PrepareAsync", "", ""}};
- if (is_public) {
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
- "virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
- "const $Request$& request, $Response$* response) = 0;\n");
+ if (is_public) {
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
+ "virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, $Response$* response) = 0;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
printer->Print(
@@ -237,18 +237,18 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
printer->Print("}\n");
}
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientWriterInterface< $Request$>>"
- " $Method$("
- "::grpc::ClientContext* context, $Response$* response) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientWriterInterface< $Request$>>"
- "($Method$Raw(context, response));\n");
- printer->Outdent();
- printer->Print("}\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientWriterInterface< $Request$>>"
+ " $Method$("
+ "::grpc::ClientContext* context, $Response$* response) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< ::grpc::ClientWriterInterface< $Request$>>"
+ "($Method$Raw(context, response));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -270,18 +270,18 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
printer->Print("}\n");
}
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientReaderInterface< $Response$>>"
- " $Method$(::grpc::ClientContext* context, const $Request$& request)"
- " {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientReaderInterface< $Response$>>"
- "($Method$Raw(context, request));\n");
- printer->Outdent();
- printer->Print("}\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientReaderInterface< $Response$>>"
+ " $Method$(::grpc::ClientContext* context, const $Request$& request)"
+ " {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< ::grpc::ClientReaderInterface< $Response$>>"
+ "($Method$Raw(context, request));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto& async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -301,19 +301,19 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("}\n");
}
- } else if (method->BidiStreaming()) {
- printer->Print(*vars,
- "std::unique_ptr< ::grpc::ClientReaderWriterInterface< "
- "$Request$, $Response$>> "
- "$Method$(::grpc::ClientContext* context) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientReaderWriterInterface< $Request$, $Response$>>("
- "$Method$Raw(context));\n");
- printer->Outdent();
- printer->Print("}\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientReaderWriterInterface< "
+ "$Request$, $Response$>> "
+ "$Method$(::grpc::ClientContext* context) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientReaderWriterInterface< $Request$, $Response$>>("
+ "$Method$Raw(context));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -333,9 +333,9 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("}\n");
}
- }
- } else {
- if (method->NoStreaming()) {
+ }
+ } else {
+ if (method->NoStreaming()) {
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
printer->Print(
@@ -346,11 +346,11 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"::grpc::CompletionQueue* cq) = 0;\n");
}
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "virtual ::grpc::ClientWriterInterface< $Request$>*"
- " $Method$Raw("
- "::grpc::ClientContext* context, $Response$* response) = 0;\n");
+ printer->Print(
+ *vars,
+ "virtual ::grpc::ClientWriterInterface< $Request$>*"
+ " $Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response) = 0;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -362,11 +362,11 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
}
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
+ printer->Print(
+ *vars,
"virtual ::grpc::ClientReaderInterface< $Response$>* "
"$Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request) = 0;\n");
+ "::grpc::ClientContext* context, const $Request$& request) = 0;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -377,11 +377,11 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
}
- } else if (method->BidiStreaming()) {
- printer->Print(*vars,
- "virtual ::grpc::ClientReaderWriterInterface< $Request$, "
- "$Response$>* "
- "$Method$Raw(::grpc::ClientContext* context) = 0;\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(*vars,
+ "virtual ::grpc::ClientReaderWriterInterface< $Request$, "
+ "$Response$>* "
+ "$Method$Raw(::grpc::ClientContext* context) = 0;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -392,17 +392,17 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
}
- }
- }
-}
-
+ }
+ }
+}
+
void PrintHeaderClientMethod(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars,
- bool is_public) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
+ bool is_public) {
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
struct {
TString prefix;
TString method_params; // extra arguments to method
@@ -410,12 +410,12 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
} async_prefixes[] = {{"Async", ", void* tag", ", tag"},
{"PrepareAsync", "", ""}};
- if (is_public) {
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
- "::grpc::Status $Method$(::grpc::ClientContext* context, "
- "const $Request$& request, $Response$* response) override;\n");
+ if (is_public) {
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
+ "::grpc::Status $Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, $Response$* response) override;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
printer->Print(
@@ -433,17 +433,17 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
printer->Print("}\n");
}
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
- " $Method$("
- "::grpc::ClientContext* context, $Response$* response) {\n");
- printer->Indent();
- printer->Print(*vars,
- "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
- "($Method$Raw(context, response));\n");
- printer->Outdent();
- printer->Print("}\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
+ " $Method$("
+ "::grpc::ClientContext* context, $Response$* response) {\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
+ "($Method$Raw(context, response));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -463,18 +463,18 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
printer->Print("}\n");
}
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientReader< $Response$>>"
- " $Method$(::grpc::ClientContext* context, const $Request$& request)"
- " {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientReader< $Response$>>"
- "($Method$Raw(context, request));\n");
- printer->Outdent();
- printer->Print("}\n");
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientReader< $Response$>>"
+ " $Method$(::grpc::ClientContext* context, const $Request$& request)"
+ " {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< ::grpc::ClientReader< $Response$>>"
+ "($Method$Raw(context, request));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -493,18 +493,18 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("}\n");
}
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>>"
- " $Method$(::grpc::ClientContext* context) {\n");
- printer->Indent();
- printer->Print(*vars,
- "return std::unique_ptr< "
- "::grpc::ClientReaderWriter< $Request$, $Response$>>("
- "$Method$Raw(context));\n");
- printer->Outdent();
- printer->Print("}\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>>"
+ " $Method$(::grpc::ClientContext* context) {\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientReaderWriter< $Request$, $Response$>>("
+ "$Method$Raw(context));\n");
+ printer->Outdent();
+ printer->Print("}\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -523,9 +523,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("}\n");
}
- }
- } else {
- if (method->NoStreaming()) {
+ }
+ } else {
+ if (method->NoStreaming()) {
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
printer->Print(
@@ -536,10 +536,10 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"::grpc::CompletionQueue* cq) override;\n");
}
} else if (ClientOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::ClientWriter< $Request$>* $Method$Raw("
- "::grpc::ClientContext* context, $Response$* response) "
- "override;\n");
+ printer->Print(*vars,
+ "::grpc::ClientWriter< $Request$>* $Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response) "
+ "override;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -551,10 +551,10 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
}
} else if (ServerOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::ClientReader< $Response$>* $Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request)"
- " override;\n");
+ printer->Print(*vars,
+ "::grpc::ClientReader< $Response$>* $Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request)"
+ " override;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -565,10 +565,10 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
}
- } else if (method->BidiStreaming()) {
- printer->Print(*vars,
- "::grpc::ClientReaderWriter< $Request$, $Response$>* "
- "$Method$Raw(::grpc::ClientContext* context) override;\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(*vars,
+ "::grpc::ClientReaderWriter< $Request$, $Response$>* "
+ "$Method$Raw(::grpc::ClientContext* context) override;\n");
for (auto async_prefix : async_prefixes) {
(*vars)["AsyncPrefix"] = async_prefix.prefix;
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
@@ -579,10 +579,10 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
}
- }
- }
-}
-
+ }
+ }
+}
+
void PrintHeaderClientMethodCallbackInterfacesStart(
grpc_generator::Printer* printer,
std::map<TString, TString>* /*vars*/) {
@@ -783,141 +783,141 @@ void PrintHeaderClientMethodCallbackEnd(
void PrintHeaderClientMethodData(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
+ (*vars)["Method"] = method->name();
printer->Print(*vars,
"const ::grpc::internal::RpcMethod rpcmethod_$Method$_;\n");
-}
-
+}
+
void PrintHeaderServerMethodSync(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
printer->Print(method->GetLeadingComments("//").c_str());
- if (method->NoStreaming()) {
- printer->Print(*vars,
- "virtual ::grpc::Status $Method$("
- "::grpc::ServerContext* context, const $Request$* request, "
- "$Response$* response);\n");
+ if (method->NoStreaming()) {
+ printer->Print(*vars,
+ "virtual ::grpc::Status $Method$("
+ "::grpc::ServerContext* context, const $Request$* request, "
+ "$Response$* response);\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(*vars,
- "virtual ::grpc::Status $Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerReader< $Request$>* reader, "
- "$Response$* response);\n");
+ printer->Print(*vars,
+ "virtual ::grpc::Status $Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerReader< $Request$>* reader, "
+ "$Response$* response);\n");
} else if (ServerOnlyStreaming(method)) {
- printer->Print(*vars,
- "virtual ::grpc::Status $Method$("
- "::grpc::ServerContext* context, const $Request$* request, "
- "::grpc::ServerWriter< $Response$>* writer);\n");
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "virtual ::grpc::Status $Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerReaderWriter< $Response$, $Request$>* stream);"
- "\n");
- }
+ printer->Print(*vars,
+ "virtual ::grpc::Status $Method$("
+ "::grpc::ServerContext* context, const $Request$* request, "
+ "::grpc::ServerWriter< $Response$>* writer);\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "virtual ::grpc::Status $Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerReaderWriter< $Response$, $Request$>* stream);"
+ "\n");
+ }
printer->Print(method->GetTrailingComments("//").c_str());
-}
-
+}
+
// Helper generator. Disables the sync API for Request and Response, then adds
// in an async API for RealRequest and RealResponse types. This is to be used
// to generate async and raw async APIs.
void PrintHeaderServerAsyncMethodsHelper(
grpc_generator::Printer* printer, const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"$Response$* /*response*/) override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(
- *vars,
- "void Request$Method$("
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "void Request$Method$("
"::grpc::ServerContext* context, $RealRequest$* request, "
"::grpc::ServerAsyncResponseWriter< $RealResponse$>* response, "
- "::grpc::CompletionQueue* new_call_cq, "
- "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
- printer->Print(*vars,
- " ::grpc::Service::RequestAsyncUnary($Idx$, context, "
- "request, response, new_call_cq, notification_cq, tag);\n");
- printer->Print("}\n");
+ "::grpc::CompletionQueue* new_call_cq, "
+ "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
+ printer->Print(*vars,
+ " ::grpc::Service::RequestAsyncUnary($Idx$, context, "
+ "request, response, new_call_cq, notification_cq, tag);\n");
+ printer->Print("}\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, "
"::grpc::ServerReader< $Request$>* /*reader*/, "
"$Response$* /*response*/) override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(
- *vars,
- "void Request$Method$("
- "::grpc::ServerContext* context, "
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "void Request$Method$("
+ "::grpc::ServerContext* context, "
"::grpc::ServerAsyncReader< $RealResponse$, $RealRequest$>* reader, "
- "::grpc::CompletionQueue* new_call_cq, "
- "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
- printer->Print(*vars,
- " ::grpc::Service::RequestAsyncClientStreaming($Idx$, "
- "context, reader, new_call_cq, notification_cq, tag);\n");
- printer->Print("}\n");
+ "::grpc::CompletionQueue* new_call_cq, "
+ "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
+ printer->Print(*vars,
+ " ::grpc::Service::RequestAsyncClientStreaming($Idx$, "
+ "context, reader, new_call_cq, notification_cq, tag);\n");
+ printer->Print("}\n");
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"::grpc::ServerWriter< $Response$>* /*writer*/) override "
- "{\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(
- *vars,
- "void Request$Method$("
+ "{\n"
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "void Request$Method$("
"::grpc::ServerContext* context, $RealRequest$* request, "
"::grpc::ServerAsyncWriter< $RealResponse$>* writer, "
- "::grpc::CompletionQueue* new_call_cq, "
- "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
- printer->Print(
- *vars,
- " ::grpc::Service::RequestAsyncServerStreaming($Idx$, "
- "context, request, writer, new_call_cq, notification_cq, tag);\n");
- printer->Print("}\n");
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ "::grpc::CompletionQueue* new_call_cq, "
+ "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
+ printer->Print(
+ *vars,
+ " ::grpc::Service::RequestAsyncServerStreaming($Idx$, "
+ "context, request, writer, new_call_cq, notification_cq, tag);\n");
+ printer->Print("}\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, "
"::grpc::ServerReaderWriter< $Response$, $Request$>* /*stream*/) "
" override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(
- *vars,
- "void Request$Method$("
- "::grpc::ServerContext* context, "
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "void Request$Method$("
+ "::grpc::ServerContext* context, "
"::grpc::ServerAsyncReaderWriter< $RealResponse$, $RealRequest$>* "
"stream, "
- "::grpc::CompletionQueue* new_call_cq, "
- "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
- printer->Print(*vars,
- " ::grpc::Service::RequestAsyncBidiStreaming($Idx$, "
- "context, stream, new_call_cq, notification_cq, tag);\n");
- printer->Print("}\n");
- }
+ "::grpc::CompletionQueue* new_call_cq, "
+ "::grpc::ServerCompletionQueue* notification_cq, void *tag) {\n");
+ printer->Print(*vars,
+ " ::grpc::Service::RequestAsyncBidiStreaming($Idx$, "
+ "context, stream, new_call_cq, notification_cq, tag);\n");
+ printer->Print("}\n");
+ }
}
void PrintHeaderServerMethodAsync(grpc_generator::Printer* printer,
@@ -948,10 +948,10 @@ void PrintHeaderServerMethodAsync(grpc_generator::Printer* printer,
" BaseClassMustBeDerivedFromService(this);\n"
"}\n");
PrintHeaderServerAsyncMethodsHelper(printer, method, vars);
- printer->Outdent();
- printer->Print(*vars, "};\n");
-}
-
+ printer->Outdent();
+ printer->Print(*vars, "};\n");
+}
+
// Helper generator. Disables the sync API for Request and Response, then adds
// in a callback API for RealRequest and RealResponse types. This is to be used
// to generate callback and raw callback APIs.
@@ -1300,26 +1300,26 @@ void PrintHeaderServerMethodRawCallback(
printer->Print(*vars, "};\n");
}
-void PrintHeaderServerMethodStreamedUnary(
+void PrintHeaderServerMethodStreamedUnary(
grpc_generator::Printer* printer, const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
- if (method->NoStreaming()) {
- printer->Print(*vars, "template <class BaseClass>\n");
- printer->Print(*vars,
- "class WithStreamedUnaryMethod_$Method$ : "
- "public BaseClass {\n");
- printer->Print(
- " private:\n"
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+ if (method->NoStreaming()) {
+ printer->Print(*vars, "template <class BaseClass>\n");
+ printer->Print(*vars,
+ "class WithStreamedUnaryMethod_$Method$ : "
+ "public BaseClass {\n");
+ printer->Print(
+ " private:\n"
" void BaseClassMustBeDerivedFromService(const Service* /*service*/) "
- "{}\n");
- printer->Print(" public:\n");
- printer->Indent();
- printer->Print(*vars,
- "WithStreamedUnaryMethod_$Method$() {\n"
- " ::grpc::Service::MarkMethodStreamed($Idx$,\n"
+ "{}\n");
+ printer->Print(" public:\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "WithStreamedUnaryMethod_$Method$() {\n"
+ " ::grpc::Service::MarkMethodStreamed($Idx$,\n"
" new ::grpc::internal::StreamedUnaryHandler<\n"
" $Request$, $Response$>(\n"
" [this](::grpc::ServerContext* context,\n"
@@ -1328,50 +1328,50 @@ void PrintHeaderServerMethodStreamedUnary(
" return this->Streamed$Method$(context,\n"
" streamer);\n"
" }));\n"
- "}\n");
- printer->Print(*vars,
- "~WithStreamedUnaryMethod_$Method$() override {\n"
- " BaseClassMustBeDerivedFromService(this);\n"
- "}\n");
- printer->Print(
- *vars,
- "// disable regular version of this method\n"
- "::grpc::Status $Method$("
+ "}\n");
+ printer->Print(*vars,
+ "~WithStreamedUnaryMethod_$Method$() override {\n"
+ " BaseClassMustBeDerivedFromService(this);\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "// disable regular version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"$Response$* /*response*/) override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(*vars,
- "// replace default version of method with streamed unary\n"
- "virtual ::grpc::Status Streamed$Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerUnaryStreamer< "
- "$Request$,$Response$>* server_unary_streamer)"
- " = 0;\n");
- printer->Outdent();
- printer->Print(*vars, "};\n");
- }
-}
-
-void PrintHeaderServerMethodSplitStreaming(
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(*vars,
+ "// replace default version of method with streamed unary\n"
+ "virtual ::grpc::Status Streamed$Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerUnaryStreamer< "
+ "$Request$,$Response$>* server_unary_streamer)"
+ " = 0;\n");
+ printer->Outdent();
+ printer->Print(*vars, "};\n");
+ }
+}
+
+void PrintHeaderServerMethodSplitStreaming(
grpc_generator::Printer* printer, const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
if (ServerOnlyStreaming(method)) {
- printer->Print(*vars, "template <class BaseClass>\n");
- printer->Print(*vars,
- "class WithSplitStreamingMethod_$Method$ : "
- "public BaseClass {\n");
- printer->Print(
- " private:\n"
+ printer->Print(*vars, "template <class BaseClass>\n");
+ printer->Print(*vars,
+ "class WithSplitStreamingMethod_$Method$ : "
+ "public BaseClass {\n");
+ printer->Print(
+ " private:\n"
" void BaseClassMustBeDerivedFromService(const Service* /*service*/) "
- "{}\n");
- printer->Print(" public:\n");
- printer->Indent();
- printer->Print(*vars,
+ "{}\n");
+ printer->Print(" public:\n");
+ printer->Indent();
+ printer->Print(*vars,
"WithSplitStreamingMethod_$Method$() {\n"
" ::grpc::Service::MarkMethodStreamed($Idx$,\n"
" new ::grpc::internal::SplitServerStreamingHandler<\n"
@@ -1384,102 +1384,102 @@ void PrintHeaderServerMethodSplitStreaming(
" }));\n"
"}\n");
printer->Print(*vars,
- "~WithSplitStreamingMethod_$Method$() override {\n"
- " BaseClassMustBeDerivedFromService(this);\n"
- "}\n");
- printer->Print(
- *vars,
- "// disable regular version of this method\n"
- "::grpc::Status $Method$("
+ "~WithSplitStreamingMethod_$Method$() override {\n"
+ " BaseClassMustBeDerivedFromService(this);\n"
+ "}\n");
+ printer->Print(
+ *vars,
+ "// disable regular version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"::grpc::ServerWriter< $Response$>* /*writer*/) override "
- "{\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- printer->Print(*vars,
- "// replace default version of method with split streamed\n"
- "virtual ::grpc::Status Streamed$Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerSplitStreamer< "
- "$Request$,$Response$>* server_split_streamer)"
- " = 0;\n");
- printer->Outdent();
- printer->Print(*vars, "};\n");
- }
-}
-
+ "{\n"
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ printer->Print(*vars,
+ "// replace default version of method with split streamed\n"
+ "virtual ::grpc::Status Streamed$Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerSplitStreamer< "
+ "$Request$,$Response$>* server_split_streamer)"
+ " = 0;\n");
+ printer->Outdent();
+ printer->Print(*vars, "};\n");
+ }
+}
+
void PrintHeaderServerMethodGeneric(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
- printer->Print(*vars, "template <class BaseClass>\n");
- printer->Print(*vars,
- "class WithGenericMethod_$Method$ : public BaseClass {\n");
- printer->Print(
- " private:\n"
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+ printer->Print(*vars, "template <class BaseClass>\n");
+ printer->Print(*vars,
+ "class WithGenericMethod_$Method$ : public BaseClass {\n");
+ printer->Print(
+ " private:\n"
" void BaseClassMustBeDerivedFromService(const Service* /*service*/) "
"{}\n");
- printer->Print(" public:\n");
- printer->Indent();
- printer->Print(*vars,
- "WithGenericMethod_$Method$() {\n"
- " ::grpc::Service::MarkMethodGeneric($Idx$);\n"
- "}\n");
- printer->Print(*vars,
- "~WithGenericMethod_$Method$() override {\n"
- " BaseClassMustBeDerivedFromService(this);\n"
- "}\n");
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ printer->Print(" public:\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "WithGenericMethod_$Method$() {\n"
+ " ::grpc::Service::MarkMethodGeneric($Idx$);\n"
+ "}\n");
+ printer->Print(*vars,
+ "~WithGenericMethod_$Method$() override {\n"
+ " BaseClassMustBeDerivedFromService(this);\n"
+ "}\n");
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"$Response$* /*response*/) override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, "
"::grpc::ServerReader< $Request$>* /*reader*/, "
"$Response$* /*response*/) override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
} else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, const $Request$* /*request*/, "
"::grpc::ServerWriter< $Response$>* /*writer*/) override "
- "{\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "// disable synchronous version of this method\n"
- "::grpc::Status $Method$("
+ "{\n"
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "// disable synchronous version of this method\n"
+ "::grpc::Status $Method$("
"::grpc::ServerContext* /*context*/, "
"::grpc::ServerReaderWriter< $Response$, $Request$>* /*stream*/) "
" override {\n"
- " abort();\n"
- " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
- "}\n");
- }
- printer->Outdent();
- printer->Print(*vars, "};\n");
-}
-
+ " abort();\n"
+ " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
+ "}\n");
+ }
+ printer->Outdent();
+ printer->Print(*vars, "};\n");
+}
+
void PrintHeaderServerMethodRaw(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
@@ -1514,32 +1514,32 @@ void PrintHeaderServerMethodRaw(grpc_generator::Printer* printer,
void PrintHeaderService(grpc_generator::Printer* printer,
const grpc_generator::Service* service,
std::map<TString, TString>* vars) {
- (*vars)["Service"] = service->name();
-
+ (*vars)["Service"] = service->name();
+
printer->Print(service->GetLeadingComments("//").c_str());
- printer->Print(*vars,
- "class $Service$ final {\n"
- " public:\n");
- printer->Indent();
-
+ printer->Print(*vars,
+ "class $Service$ final {\n"
+ " public:\n");
+ printer->Indent();
+
// Service metadata
printer->Print(*vars,
"static constexpr char const* service_full_name() {\n"
" return \"$Package$$Service$\";\n"
"}\n");
- // Client side
- printer->Print(
- "class StubInterface {\n"
- " public:\n");
- printer->Indent();
- printer->Print("virtual ~StubInterface() {}\n");
- for (int i = 0; i < service->method_count(); ++i) {
+ // Client side
+ printer->Print(
+ "class StubInterface {\n"
+ " public:\n");
+ printer->Indent();
+ printer->Print("virtual ~StubInterface() {}\n");
+ for (int i = 0; i < service->method_count(); ++i) {
printer->Print(service->method(i)->GetLeadingComments("//").c_str());
- PrintHeaderClientMethodInterfaces(printer, service->method(i).get(), vars,
- true);
+ PrintHeaderClientMethodInterfaces(printer, service->method(i).get(), vars,
+ true);
printer->Print(service->method(i)->GetTrailingComments("//").c_str());
- }
+ }
PrintHeaderClientMethodCallbackInterfacesStart(printer, vars);
for (int i = 0; i < service->method_count(); ++i) {
printer->Print(service->method(i)->GetLeadingComments("//").c_str());
@@ -1548,81 +1548,81 @@ void PrintHeaderService(grpc_generator::Printer* printer,
printer->Print(service->method(i)->GetTrailingComments("//").c_str());
}
PrintHeaderClientMethodCallbackInterfacesEnd(printer, vars);
- printer->Outdent();
- printer->Print("private:\n");
- printer->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- PrintHeaderClientMethodInterfaces(printer, service->method(i).get(), vars,
- false);
- }
- printer->Outdent();
- printer->Print("};\n");
- printer->Print(
- "class Stub final : public StubInterface"
- " {\n public:\n");
- printer->Indent();
- printer->Print(
+ printer->Outdent();
+ printer->Print("private:\n");
+ printer->Indent();
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintHeaderClientMethodInterfaces(printer, service->method(i).get(), vars,
+ false);
+ }
+ printer->Outdent();
+ printer->Print("};\n");
+ printer->Print(
+ "class Stub final : public StubInterface"
+ " {\n public:\n");
+ printer->Indent();
+ printer->Print(
"Stub(const std::shared_ptr< ::grpc::ChannelInterface>& "
"channel);\n");
- for (int i = 0; i < service->method_count(); ++i) {
- PrintHeaderClientMethod(printer, service->method(i).get(), vars, true);
- }
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintHeaderClientMethod(printer, service->method(i).get(), vars, true);
+ }
PrintHeaderClientMethodCallbackStart(printer, vars);
for (int i = 0; i < service->method_count(); ++i) {
PrintHeaderClientMethodCallback(printer, service->method(i).get(), vars);
}
PrintHeaderClientMethodCallbackEnd(printer, vars);
- printer->Outdent();
- printer->Print("\n private:\n");
- printer->Indent();
- printer->Print("std::shared_ptr< ::grpc::ChannelInterface> channel_;\n");
+ printer->Outdent();
+ printer->Print("\n private:\n");
+ printer->Indent();
+ printer->Print("std::shared_ptr< ::grpc::ChannelInterface> channel_;\n");
printer->Print("class experimental_async async_stub_{this};\n");
- for (int i = 0; i < service->method_count(); ++i) {
- PrintHeaderClientMethod(printer, service->method(i).get(), vars, false);
- }
- for (int i = 0; i < service->method_count(); ++i) {
- PrintHeaderClientMethodData(printer, service->method(i).get(), vars);
- }
- printer->Outdent();
- printer->Print("};\n");
- printer->Print(
- "static std::unique_ptr<Stub> NewStub(const std::shared_ptr< "
- "::grpc::ChannelInterface>& channel, "
- "const ::grpc::StubOptions& options = ::grpc::StubOptions());\n");
-
- printer->Print("\n");
-
- // Server side - base
- printer->Print(
- "class Service : public ::grpc::Service {\n"
- " public:\n");
- printer->Indent();
- printer->Print("Service();\n");
- printer->Print("virtual ~Service();\n");
- for (int i = 0; i < service->method_count(); ++i) {
- PrintHeaderServerMethodSync(printer, service->method(i).get(), vars);
- }
- printer->Outdent();
- printer->Print("};\n");
-
- // Server side - Asynchronous
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintHeaderServerMethodAsync(printer, service->method(i).get(), vars);
- }
-
- printer->Print("typedef ");
-
- for (int i = 0; i < service->method_count(); ++i) {
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintHeaderClientMethod(printer, service->method(i).get(), vars, false);
+ }
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintHeaderClientMethodData(printer, service->method(i).get(), vars);
+ }
+ printer->Outdent();
+ printer->Print("};\n");
+ printer->Print(
+ "static std::unique_ptr<Stub> NewStub(const std::shared_ptr< "
+ "::grpc::ChannelInterface>& channel, "
+ "const ::grpc::StubOptions& options = ::grpc::StubOptions());\n");
+
+ printer->Print("\n");
+
+ // Server side - base
+ printer->Print(
+ "class Service : public ::grpc::Service {\n"
+ " public:\n");
+ printer->Indent();
+ printer->Print("Service();\n");
+ printer->Print("virtual ~Service();\n");
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintHeaderServerMethodSync(printer, service->method(i).get(), vars);
+ }
+ printer->Outdent();
+ printer->Print("};\n");
+
+ // Server side - Asynchronous
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintHeaderServerMethodAsync(printer, service->method(i).get(), vars);
+ }
+
+ printer->Print("typedef ");
+
+ for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
- printer->Print(*vars, "WithAsyncMethod_$method_name$<");
- }
- printer->Print("Service");
- for (int i = 0; i < service->method_count(); ++i) {
- printer->Print(" >");
- }
- printer->Print(" AsyncService;\n");
-
+ printer->Print(*vars, "WithAsyncMethod_$method_name$<");
+ }
+ printer->Print("Service");
+ for (int i = 0; i < service->method_count(); ++i) {
+ printer->Print(" >");
+ }
+ printer->Print(" AsyncService;\n");
+
// Server side - Callback
for (int i = 0; i < service->method_count(); ++i) {
(*vars)["Idx"] = as_string(i);
@@ -1655,12 +1655,12 @@ void PrintHeaderService(grpc_generator::Printer* printer,
}
printer->Print(" ExperimentalCallbackService;\n");
- // Server side - Generic
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintHeaderServerMethodGeneric(printer, service->method(i).get(), vars);
- }
-
+ // Server side - Generic
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintHeaderServerMethodGeneric(printer, service->method(i).get(), vars);
+ }
+
// Server side - Raw
for (int i = 0; i < service->method_count(); ++i) {
(*vars)["Idx"] = as_string(i);
@@ -1673,172 +1673,172 @@ void PrintHeaderService(grpc_generator::Printer* printer,
PrintHeaderServerMethodRawCallback(printer, service->method(i).get(), vars);
}
- // Server side - Streamed Unary
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintHeaderServerMethodStreamedUnary(printer, service->method(i).get(),
- vars);
- }
-
- printer->Print("typedef ");
- for (int i = 0; i < service->method_count(); ++i) {
+ // Server side - Streamed Unary
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintHeaderServerMethodStreamedUnary(printer, service->method(i).get(),
+ vars);
+ }
+
+ printer->Print("typedef ");
+ for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
- if (service->method(i)->NoStreaming()) {
- printer->Print(*vars, "WithStreamedUnaryMethod_$method_name$<");
- }
- }
- printer->Print("Service");
- for (int i = 0; i < service->method_count(); ++i) {
- if (service->method(i)->NoStreaming()) {
- printer->Print(" >");
- }
- }
- printer->Print(" StreamedUnaryService;\n");
-
- // Server side - controlled server-side streaming
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintHeaderServerMethodSplitStreaming(printer, service->method(i).get(),
- vars);
- }
-
- printer->Print("typedef ");
- for (int i = 0; i < service->method_count(); ++i) {
+ if (service->method(i)->NoStreaming()) {
+ printer->Print(*vars, "WithStreamedUnaryMethod_$method_name$<");
+ }
+ }
+ printer->Print("Service");
+ for (int i = 0; i < service->method_count(); ++i) {
+ if (service->method(i)->NoStreaming()) {
+ printer->Print(" >");
+ }
+ }
+ printer->Print(" StreamedUnaryService;\n");
+
+ // Server side - controlled server-side streaming
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintHeaderServerMethodSplitStreaming(printer, service->method(i).get(),
+ vars);
+ }
+
+ printer->Print("typedef ");
+ for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
auto method = service->method(i);
if (ServerOnlyStreaming(method.get())) {
- printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
- }
- }
- printer->Print("Service");
- for (int i = 0; i < service->method_count(); ++i) {
+ printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
+ }
+ }
+ printer->Print("Service");
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
if (ServerOnlyStreaming(method.get())) {
- printer->Print(" >");
- }
- }
- printer->Print(" SplitStreamedService;\n");
-
- // Server side - typedef for controlled both unary and server-side streaming
- printer->Print("typedef ");
- for (int i = 0; i < service->method_count(); ++i) {
+ printer->Print(" >");
+ }
+ }
+ printer->Print(" SplitStreamedService;\n");
+
+ // Server side - typedef for controlled both unary and server-side streaming
+ printer->Print("typedef ");
+ for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
auto method = service->method(i);
if (ServerOnlyStreaming(method.get())) {
- printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
- }
- if (service->method(i)->NoStreaming()) {
- printer->Print(*vars, "WithStreamedUnaryMethod_$method_name$<");
- }
- }
- printer->Print("Service");
- for (int i = 0; i < service->method_count(); ++i) {
+ printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
+ }
+ if (service->method(i)->NoStreaming()) {
+ printer->Print(*vars, "WithStreamedUnaryMethod_$method_name$<");
+ }
+ }
+ printer->Print("Service");
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
- if (service->method(i)->NoStreaming() ||
+ if (service->method(i)->NoStreaming() ||
ServerOnlyStreaming(method.get())) {
- printer->Print(" >");
- }
- }
- printer->Print(" StreamedService;\n");
-
- printer->Outdent();
- printer->Print("};\n");
+ printer->Print(" >");
+ }
+ }
+ printer->Print(" StreamedService;\n");
+
+ printer->Outdent();
+ printer->Print("};\n");
printer->Print(service->GetTrailingComments("//").c_str());
-}
-
+}
+
TString GetHeaderServices(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
- // Package string is empty or ends with a dot. It is used to fully qualify
- // method names.
- vars["Package"] = file->package();
- if (!file->package().empty()) {
- vars["Package"].append(".");
- }
-
- if (!params.services_namespace.empty()) {
- vars["services_namespace"] = params.services_namespace;
- printer->Print(vars, "\nnamespace $services_namespace$ {\n\n");
- }
-
- for (int i = 0; i < file->service_count(); ++i) {
- PrintHeaderService(printer.get(), file->service(i).get(), &vars);
- printer->Print("\n");
- }
-
- if (!params.services_namespace.empty()) {
- printer->Print(vars, "} // namespace $services_namespace$\n\n");
- }
- }
- return output;
-}
-
+ // Package string is empty or ends with a dot. It is used to fully qualify
+ // method names.
+ vars["Package"] = file->package();
+ if (!file->package().empty()) {
+ vars["Package"].append(".");
+ }
+
+ if (!params.services_namespace.empty()) {
+ vars["services_namespace"] = params.services_namespace;
+ printer->Print(vars, "\nnamespace $services_namespace$ {\n\n");
+ }
+
+ for (int i = 0; i < file->service_count(); ++i) {
+ PrintHeaderService(printer.get(), file->service(i).get(), &vars);
+ printer->Print("\n");
+ }
+
+ if (!params.services_namespace.empty()) {
+ printer->Print(vars, "} // namespace $services_namespace$\n\n");
+ }
+ }
+ return output;
+}
+
TString GetHeaderEpilogue(grpc_generator::File* file,
const Parameters& /*params*/) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
- vars["filename"] = file->filename();
- vars["filename_identifier"] = FilenameIdentifier(file->filename());
-
- if (!file->package().empty()) {
+
+ vars["filename"] = file->filename();
+ vars["filename_identifier"] = FilenameIdentifier(file->filename());
+
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.rbegin(); part != parts.rend(); part++) {
- vars["part"] = *part;
- printer->Print(vars, "} // namespace $part$\n");
- }
- printer->Print(vars, "\n");
- }
-
- printer->Print(vars, "\n");
- printer->Print(vars, "#endif // GRPC_$filename_identifier$__INCLUDED\n");
-
+
+ for (auto part = parts.rbegin(); part != parts.rend(); part++) {
+ vars["part"] = *part;
+ printer->Print(vars, "} // namespace $part$\n");
+ }
+ printer->Print(vars, "\n");
+ }
+
+ printer->Print(vars, "\n");
+ printer->Print(vars, "#endif // GRPC_$filename_identifier$__INCLUDED\n");
+
printer->Print(file->GetTrailingComments("//").c_str());
- }
- return output;
-}
-
+ }
+ return output;
+}
+
TString GetSourcePrologue(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
- vars["filename"] = file->filename();
- vars["filename_base"] = file->filename_without_ext();
+
+ vars["filename"] = file->filename();
+ vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = params.message_header_extension.empty()
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
-
+
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
- printer->Print(vars,
- "// If you make any local change, they will be lost.\n");
- printer->Print(vars, "// source: $filename$\n\n");
-
- printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
- printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
- printer->Print(vars, "\n");
- }
- return output;
-}
-
+ printer->Print(vars,
+ "// If you make any local change, they will be lost.\n");
+ printer->Print(vars, "// source: $filename$\n\n");
+
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
+ printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
+ printer->Print(vars, "\n");
+ }
+ return output;
+}
+
TString GetSourceIncludes(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
static const char* headers_strs[] = {
"functional",
@@ -1858,27 +1858,27 @@ TString GetSourceIncludes(grpc_generator::File* file,
std::vector<TString> headers(headers_strs, array_end(headers_strs));
PrintIncludes(printer.get(), headers, params.use_system_headers,
params.grpc_search_path);
-
- if (!file->package().empty()) {
+
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.begin(); part != parts.end(); part++) {
- vars["part"] = *part;
- printer->Print(vars, "namespace $part$ {\n");
- }
- }
-
- printer->Print(vars, "\n");
- }
- return output;
-}
-
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ vars["part"] = *part;
+ printer->Print(vars, "namespace $part$ {\n");
+ }
+ }
+
+ printer->Print(vars, "\n");
+ }
+ return output;
+}
+
void PrintSourceClientMethod(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
struct {
TString prefix;
TString start; // bool literal expressed as string
@@ -1886,12 +1886,12 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
TString create_args; // extra arguments to creator
} async_prefixes[] = {{"Async", "true", ", void* tag", ", tag"},
{"PrepareAsync", "false", "", ", nullptr"}};
- if (method->NoStreaming()) {
- printer->Print(*vars,
- "::grpc::Status $ns$$Service$::Stub::$Method$("
- "::grpc::ClientContext* context, "
- "const $Request$& request, $Response$* response) {\n");
- printer->Print(*vars,
+ if (method->NoStreaming()) {
+ printer->Print(*vars,
+ "::grpc::Status $ns$$Service$::Stub::$Method$("
+ "::grpc::ClientContext* context, "
+ "const $Request$& request, $Response$* response) {\n");
+ printer->Print(*vars,
" return ::grpc::internal::BlockingUnaryCall"
"(channel_.get(), rpcmethod_$Method$_, "
"context, request, response);\n}\n\n");
@@ -1942,10 +1942,10 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
" return result;\n"
"}\n\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::ClientWriter< $Request$>* "
- "$ns$$Service$::Stub::$Method$Raw("
- "::grpc::ClientContext* context, $Response$* response) {\n");
+ printer->Print(*vars,
+ "::grpc::ClientWriter< $Request$>* "
+ "$ns$$Service$::Stub::$Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response) {\n");
printer->Print(*vars,
" return ::grpc::internal::ClientWriterFactory< "
"$Request$>::Create("
@@ -1989,9 +1989,9 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
} else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
- "::grpc::ClientReader< $Response$>* "
- "$ns$$Service$::Stub::$Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request) {\n");
+ "::grpc::ClientReader< $Response$>* "
+ "$ns$$Service$::Stub::$Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request) {\n");
printer->Print(*vars,
" return ::grpc::internal::ClientReaderFactory< "
"$Response$>::Create("
@@ -2033,18 +2033,18 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"context, request, $AsyncStart$$AsyncCreateArgs$);\n"
"}\n\n");
}
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "::grpc::ClientReaderWriter< $Request$, $Response$>* "
- "$ns$$Service$::Stub::$Method$Raw(::grpc::ClientContext* context) {\n");
- printer->Print(*vars,
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "::grpc::ClientReaderWriter< $Request$, $Response$>* "
+ "$ns$$Service$::Stub::$Method$Raw(::grpc::ClientContext* context) {\n");
+ printer->Print(*vars,
" return ::grpc::internal::ClientReaderWriterFactory< "
"$Request$, $Response$>::Create("
- "channel_.get(), "
- "rpcmethod_$Method$_, "
- "context);\n"
- "}\n\n");
+ "channel_.get(), "
+ "rpcmethod_$Method$_, "
+ "context);\n"
+ "}\n\n");
printer->Print(
*vars,
@@ -2079,145 +2079,145 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"context, $AsyncStart$$AsyncCreateArgs$);\n"
"}\n\n");
}
- }
-}
-
+ }
+}
+
void PrintSourceServerMethod(grpc_generator::Printer* printer,
const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
- if (method->NoStreaming()) {
- printer->Print(*vars,
- "::grpc::Status $ns$$Service$::Service::$Method$("
- "::grpc::ServerContext* context, "
- "const $Request$* request, $Response$* response) {\n");
- printer->Print(" (void) context;\n");
- printer->Print(" (void) request;\n");
- printer->Print(" (void) response;\n");
- printer->Print(
- " return ::grpc::Status("
- "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
- printer->Print("}\n\n");
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+ if (method->NoStreaming()) {
+ printer->Print(*vars,
+ "::grpc::Status $ns$$Service$::Service::$Method$("
+ "::grpc::ServerContext* context, "
+ "const $Request$* request, $Response$* response) {\n");
+ printer->Print(" (void) context;\n");
+ printer->Print(" (void) request;\n");
+ printer->Print(" (void) response;\n");
+ printer->Print(
+ " return ::grpc::Status("
+ "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
+ printer->Print("}\n\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::Status $ns$$Service$::Service::$Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerReader< $Request$>* reader, "
- "$Response$* response) {\n");
- printer->Print(" (void) context;\n");
- printer->Print(" (void) reader;\n");
- printer->Print(" (void) response;\n");
- printer->Print(
- " return ::grpc::Status("
- "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
- printer->Print("}\n\n");
+ printer->Print(*vars,
+ "::grpc::Status $ns$$Service$::Service::$Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerReader< $Request$>* reader, "
+ "$Response$* response) {\n");
+ printer->Print(" (void) context;\n");
+ printer->Print(" (void) reader;\n");
+ printer->Print(" (void) response;\n");
+ printer->Print(
+ " return ::grpc::Status("
+ "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
+ printer->Print("}\n\n");
} else if (ServerOnlyStreaming(method)) {
- printer->Print(*vars,
- "::grpc::Status $ns$$Service$::Service::$Method$("
- "::grpc::ServerContext* context, "
- "const $Request$* request, "
- "::grpc::ServerWriter< $Response$>* writer) {\n");
- printer->Print(" (void) context;\n");
- printer->Print(" (void) request;\n");
- printer->Print(" (void) writer;\n");
- printer->Print(
- " return ::grpc::Status("
- "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
- printer->Print("}\n\n");
- } else if (method->BidiStreaming()) {
- printer->Print(*vars,
- "::grpc::Status $ns$$Service$::Service::$Method$("
- "::grpc::ServerContext* context, "
- "::grpc::ServerReaderWriter< $Response$, $Request$>* "
- "stream) {\n");
- printer->Print(" (void) context;\n");
- printer->Print(" (void) stream;\n");
- printer->Print(
- " return ::grpc::Status("
- "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
- printer->Print("}\n\n");
- }
-}
-
+ printer->Print(*vars,
+ "::grpc::Status $ns$$Service$::Service::$Method$("
+ "::grpc::ServerContext* context, "
+ "const $Request$* request, "
+ "::grpc::ServerWriter< $Response$>* writer) {\n");
+ printer->Print(" (void) context;\n");
+ printer->Print(" (void) request;\n");
+ printer->Print(" (void) writer;\n");
+ printer->Print(
+ " return ::grpc::Status("
+ "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
+ printer->Print("}\n\n");
+ } else if (method->BidiStreaming()) {
+ printer->Print(*vars,
+ "::grpc::Status $ns$$Service$::Service::$Method$("
+ "::grpc::ServerContext* context, "
+ "::grpc::ServerReaderWriter< $Response$, $Request$>* "
+ "stream) {\n");
+ printer->Print(" (void) context;\n");
+ printer->Print(" (void) stream;\n");
+ printer->Print(
+ " return ::grpc::Status("
+ "::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
+ printer->Print("}\n\n");
+ }
+}
+
void PrintSourceService(grpc_generator::Printer* printer,
const grpc_generator::Service* service,
std::map<TString, TString>* vars) {
- (*vars)["Service"] = service->name();
-
- if (service->method_count() > 0) {
- printer->Print(*vars,
- "static const char* $prefix$$Service$_method_names[] = {\n");
- for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Service"] = service->name();
+
+ if (service->method_count() > 0) {
+ printer->Print(*vars,
+ "static const char* $prefix$$Service$_method_names[] = {\n");
+ for (int i = 0; i < service->method_count(); ++i) {
(*vars)["Method"] = service->method(i)->name();
- printer->Print(*vars, " \"/$Package$$Service$/$Method$\",\n");
- }
- printer->Print(*vars, "};\n\n");
- }
-
- printer->Print(*vars,
- "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub("
- "const std::shared_ptr< ::grpc::ChannelInterface>& channel, "
+ printer->Print(*vars, " \"/$Package$$Service$/$Method$\",\n");
+ }
+ printer->Print(*vars, "};\n\n");
+ }
+
+ printer->Print(*vars,
+ "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub("
+ "const std::shared_ptr< ::grpc::ChannelInterface>& channel, "
"const ::grpc::StubOptions& options) {\n"
" (void)options;\n"
- " std::unique_ptr< $ns$$Service$::Stub> stub(new "
- "$ns$$Service$::Stub(channel));\n"
- " return stub;\n"
- "}\n\n");
- printer->Print(*vars,
- "$ns$$Service$::Stub::Stub(const std::shared_ptr< "
- "::grpc::ChannelInterface>& channel)\n");
- printer->Indent();
- printer->Print(": channel_(channel)");
- for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
- (*vars)["Method"] = method->name();
- (*vars)["Idx"] = as_string(i);
- if (method->NoStreaming()) {
- (*vars)["StreamingType"] = "NORMAL_RPC";
- // NOTE: There is no reason to consider streamed-unary as a separate
- // category here since this part is setting up the client-side stub
- // and this appears as a NORMAL_RPC from the client-side.
+ " std::unique_ptr< $ns$$Service$::Stub> stub(new "
+ "$ns$$Service$::Stub(channel));\n"
+ " return stub;\n"
+ "}\n\n");
+ printer->Print(*vars,
+ "$ns$$Service$::Stub::Stub(const std::shared_ptr< "
+ "::grpc::ChannelInterface>& channel)\n");
+ printer->Indent();
+ printer->Print(": channel_(channel)");
+ for (int i = 0; i < service->method_count(); ++i) {
+ auto method = service->method(i);
+ (*vars)["Method"] = method->name();
+ (*vars)["Idx"] = as_string(i);
+ if (method->NoStreaming()) {
+ (*vars)["StreamingType"] = "NORMAL_RPC";
+ // NOTE: There is no reason to consider streamed-unary as a separate
+ // category here since this part is setting up the client-side stub
+ // and this appears as a NORMAL_RPC from the client-side.
} else if (ClientOnlyStreaming(method.get())) {
- (*vars)["StreamingType"] = "CLIENT_STREAMING";
+ (*vars)["StreamingType"] = "CLIENT_STREAMING";
} else if (ServerOnlyStreaming(method.get())) {
- (*vars)["StreamingType"] = "SERVER_STREAMING";
- } else {
- (*vars)["StreamingType"] = "BIDI_STREAMING";
- }
- printer->Print(*vars,
- ", rpcmethod_$Method$_("
- "$prefix$$Service$_method_names[$Idx$], "
+ (*vars)["StreamingType"] = "SERVER_STREAMING";
+ } else {
+ (*vars)["StreamingType"] = "BIDI_STREAMING";
+ }
+ printer->Print(*vars,
+ ", rpcmethod_$Method$_("
+ "$prefix$$Service$_method_names[$Idx$], "
"::grpc::internal::RpcMethod::$StreamingType$, "
- "channel"
- ")\n");
- }
- printer->Print("{}\n\n");
- printer->Outdent();
-
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintSourceClientMethod(printer, service->method(i).get(), vars);
- }
-
- printer->Print(*vars, "$ns$$Service$::Service::Service() {\n");
- printer->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
- (*vars)["Idx"] = as_string(i);
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
+ "channel"
+ ")\n");
+ }
+ printer->Print("{}\n\n");
+ printer->Outdent();
+
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintSourceClientMethod(printer, service->method(i).get(), vars);
+ }
+
+ printer->Print(*vars, "$ns$$Service$::Service::Service() {\n");
+ printer->Indent();
+ for (int i = 0; i < service->method_count(); ++i) {
+ auto method = service->method(i);
+ (*vars)["Idx"] = as_string(i);
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
- " $prefix$$Service$_method_names[$Idx$],\n"
+ " $prefix$$Service$_method_names[$Idx$],\n"
" ::grpc::internal::RpcMethod::NORMAL_RPC,\n"
" new ::grpc::internal::RpcMethodHandler< $ns$$Service$::Service, "
- "$Request$, "
- "$Response$>(\n"
+ "$Request$, "
+ "$Response$>(\n"
" []($ns$$Service$::Service* service,\n"
" ::grpc::ServerContext* ctx,\n"
" const $Request$* req,\n"
@@ -2225,13 +2225,13 @@ void PrintSourceService(grpc_generator::Printer* printer,
" return service->$Method$(ctx, req, resp);\n"
" }, this)));\n");
} else if (ClientOnlyStreaming(method.get())) {
- printer->Print(
- *vars,
+ printer->Print(
+ *vars,
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
- " $prefix$$Service$_method_names[$Idx$],\n"
+ " $prefix$$Service$_method_names[$Idx$],\n"
" ::grpc::internal::RpcMethod::CLIENT_STREAMING,\n"
" new ::grpc::internal::ClientStreamingHandler< "
- "$ns$$Service$::Service, $Request$, $Response$>(\n"
+ "$ns$$Service$::Service, $Request$, $Response$>(\n"
" []($ns$$Service$::Service* service,\n"
" ::grpc::ServerContext* ctx,\n"
" ::grpc::ServerReader<$Request$>* reader,\n"
@@ -2239,20 +2239,20 @@ void PrintSourceService(grpc_generator::Printer* printer,
" return service->$Method$(ctx, reader, resp);\n"
" }, this)));\n");
} else if (ServerOnlyStreaming(method.get())) {
- printer->Print(
- *vars,
+ printer->Print(
+ *vars,
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
- " $prefix$$Service$_method_names[$Idx$],\n"
+ " $prefix$$Service$_method_names[$Idx$],\n"
" ::grpc::internal::RpcMethod::SERVER_STREAMING,\n"
" new ::grpc::internal::ServerStreamingHandler< "
- "$ns$$Service$::Service, $Request$, $Response$>(\n"
+ "$ns$$Service$::Service, $Request$, $Response$>(\n"
" []($ns$$Service$::Service* service,\n"
" ::grpc::ServerContext* ctx,\n"
" const $Request$* req,\n"
" ::grpc::ServerWriter<$Response$>* writer) {\n"
" return service->$Method$(ctx, req, writer);\n"
" }, this)));\n");
- } else if (method->BidiStreaming()) {
+ } else if (method->BidiStreaming()) {
printer->Print(*vars,
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
" $prefix$$Service$_method_names[$Idx$],\n"
@@ -2265,66 +2265,66 @@ void PrintSourceService(grpc_generator::Printer* printer,
" $Request$>* stream) {\n"
" return service->$Method$(ctx, stream);\n"
" }, this)));\n");
- }
- }
- printer->Outdent();
- printer->Print(*vars, "}\n\n");
- printer->Print(*vars,
- "$ns$$Service$::Service::~Service() {\n"
- "}\n\n");
- for (int i = 0; i < service->method_count(); ++i) {
- (*vars)["Idx"] = as_string(i);
- PrintSourceServerMethod(printer, service->method(i).get(), vars);
- }
-}
-
+ }
+ }
+ printer->Outdent();
+ printer->Print(*vars, "}\n\n");
+ printer->Print(*vars,
+ "$ns$$Service$::Service::~Service() {\n"
+ "}\n\n");
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintSourceServerMethod(printer, service->method(i).get(), vars);
+ }
+}
+
TString GetSourceServices(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
- // Package string is empty or ends with a dot. It is used to fully qualify
- // method names.
- vars["Package"] = file->package();
- if (!file->package().empty()) {
- vars["Package"].append(".");
- }
- if (!params.services_namespace.empty()) {
- vars["ns"] = params.services_namespace + "::";
- vars["prefix"] = params.services_namespace;
- } else {
- vars["ns"] = "";
- vars["prefix"] = "";
- }
-
- for (int i = 0; i < file->service_count(); ++i) {
- PrintSourceService(printer.get(), file->service(i).get(), &vars);
- printer->Print("\n");
- }
- }
- return output;
-}
-
+ // Package string is empty or ends with a dot. It is used to fully qualify
+ // method names.
+ vars["Package"] = file->package();
+ if (!file->package().empty()) {
+ vars["Package"].append(".");
+ }
+ if (!params.services_namespace.empty()) {
+ vars["ns"] = params.services_namespace + "::";
+ vars["prefix"] = params.services_namespace;
+ } else {
+ vars["ns"] = "";
+ vars["prefix"] = "";
+ }
+
+ for (int i = 0; i < file->service_count(); ++i) {
+ PrintSourceService(printer.get(), file->service(i).get(), &vars);
+ printer->Print("\n");
+ }
+ }
+ return output;
+}
+
TString GetSourceEpilogue(grpc_generator::File* file,
const Parameters& /*params*/) {
TString temp;
-
- if (!file->package().empty()) {
+
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.begin(); part != parts.end(); part++) {
- temp.append("} // namespace ");
- temp.append(*part);
- temp.append("\n");
- }
- temp.append("\n");
- }
-
- return temp;
-}
-
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ temp.append("} // namespace ");
+ temp.append(*part);
+ temp.append("\n");
+ }
+ temp.append("\n");
+ }
+
+ return temp;
+}
+
// TODO(mmukhi): Make sure we need parameters or not.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params) {
@@ -2554,4 +2554,4 @@ TString GetMockEpilogue(grpc_generator::File* file,
return temp;
}
-} // namespace grpc_cpp_generator
+} // namespace grpc_cpp_generator
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator.h b/contrib/libs/grpc/src/compiler/cpp_generator.h
index ead928ce41..606b850a87 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator.h
+++ b/contrib/libs/grpc/src/compiler/cpp_generator.h
@@ -1,57 +1,57 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
-
-// cpp_generator.h/.cc do not directly depend on GRPC/ProtoBuf, such that they
-// can be used to generate code for other serialization systems, such as
-// FlatBuffers.
-
-#include <memory>
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
+
+// cpp_generator.h/.cc do not directly depend on GRPC/ProtoBuf, such that they
+// can be used to generate code for other serialization systems, such as
+// FlatBuffers.
+
+#include <memory>
#include <util/generic/string.h>
-#include <vector>
-
-#include "src/compiler/config.h"
+#include <vector>
+
+#include "src/compiler/config.h"
#include "src/compiler/schema_interface.h"
-
+
#ifdef GRPC_CUSTOM_STRING
#warning GRPC_CUSTOM_STRING is no longer supported. Please use TString.
-#endif
-
-namespace grpc {
-
+#endif
+
+namespace grpc {
+
// Using grpc::string and grpc::to_string is discouraged in favor of
// TString and ToString. This is only for legacy code using
// them explictly.
typedef TString string; // deprecated
-
-} // namespace grpc
-
-namespace grpc_cpp_generator {
-
-// Contains all the parameters that are parsed from the command line.
-struct Parameters {
- // Puts the service into a namespace
+
+} // namespace grpc
+
+namespace grpc_cpp_generator {
+
+// Contains all the parameters that are parsed from the command line.
+struct Parameters {
+ // Puts the service into a namespace
TString services_namespace;
- // Use system includes (<>) or local includes ("")
- bool use_system_headers;
- // Prefix to any grpc include
+ // Use system includes (<>) or local includes ("")
+ bool use_system_headers;
+ // Prefix to any grpc include
TString grpc_search_path;
// Generate Google Mock code to facilitate unit testing.
bool generate_mock_code;
@@ -63,72 +63,72 @@ struct Parameters {
TString message_header_extension;
// Whether to include headers corresponding to imports in source file.
bool include_import_headers;
-};
-
+};
+
// Return the prologue of the generated header file.
TString GetHeaderPrologue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the includes needed for generated header file.
TString GetHeaderIncludes(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the includes needed for generated source file.
TString GetSourceIncludes(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the epilogue of the generated header file.
TString GetHeaderEpilogue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the prologue of the generated source file.
TString GetSourcePrologue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the services for generated header file.
TString GetHeaderServices(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the services for generated source file.
TString GetSourceServices(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the epilogue of the generated source file.
TString GetSourceEpilogue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the prologue of the generated mock file.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the includes needed for generated mock file.
TString GetMockIncludes(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the services for generated mock file.
TString GetMockServices(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the epilogue of generated mock file.
TString GetMockEpilogue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the prologue of the generated mock file.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the includes needed for generated mock file.
TString GetMockIncludes(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the services for generated mock file.
TString GetMockServices(grpc_generator::File* file,
const Parameters& params);
-
+
// Return the epilogue of generated mock file.
TString GetMockEpilogue(grpc_generator::File* file,
const Parameters& params);
-
-} // namespace grpc_cpp_generator
-
-#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
+
+} // namespace grpc_cpp_generator
+
+#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h b/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
index 98aa1c3805..2e34d53a65 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
@@ -1,63 +1,63 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
-
-#include <map>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-
-namespace grpc_cpp_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
+
+#include <map>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+
+namespace grpc_cpp_generator {
+
inline TString DotsToColons(const TString& name) {
- return grpc_generator::StringReplace(name, ".", "::");
-}
-
+ return grpc_generator::StringReplace(name, ".", "::");
+}
+
inline TString DotsToUnderscores(const TString& name) {
- return grpc_generator::StringReplace(name, ".", "_");
-}
-
+ return grpc_generator::StringReplace(name, ".", "_");
+}
+
inline TString ClassName(const grpc::protobuf::Descriptor* descriptor,
bool qualified) {
- // Find "outer", the descriptor of the top-level message in which
- // "descriptor" is embedded.
+ // Find "outer", the descriptor of the top-level message in which
+ // "descriptor" is embedded.
const grpc::protobuf::Descriptor* outer = descriptor;
- while (outer->containing_type() != NULL) outer = outer->containing_type();
-
+ while (outer->containing_type() != NULL) outer = outer->containing_type();
+
const TString& outer_name = outer->full_name();
TString inner_name = descriptor->full_name().substr(outer_name.size());
-
- if (qualified) {
- return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name);
- } else {
- return outer->name() + DotsToUnderscores(inner_name);
- }
-}
-
-// Get leading or trailing comments in a string. Comment lines start with "// ".
+
+ if (qualified) {
+ return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name);
+ } else {
+ return outer->name() + DotsToUnderscores(inner_name);
+ }
+}
+
+// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in front of leading comments.
-template <typename DescriptorType>
+template <typename DescriptorType>
inline TString GetCppComments(const DescriptorType* desc, bool leading) {
- return grpc_generator::GetPrefixedComments(desc, leading, "//");
-}
-
-} // namespace grpc_cpp_generator
-
-#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
+ return grpc_generator::GetPrefixedComments(desc, leading, "//");
+}
+
+} // namespace grpc_cpp_generator
+
+#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/cpp_plugin.cc b/contrib/libs/grpc/src/compiler/cpp_plugin.cc
index a35607ab79..2de2745445 100644
--- a/contrib/libs/grpc/src/compiler/cpp_plugin.cc
+++ b/contrib/libs/grpc/src/compiler/cpp_plugin.cc
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-// Generates cpp gRPC service interface out of Protobuf IDL.
-//
+ *
+ */
+
+// Generates cpp gRPC service interface out of Protobuf IDL.
+//
#include "src/compiler/cpp_plugin.h"
-
+
int main(int argc, char* argv[]) {
- CppGrpcGenerator generator;
- return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
-}
+ CppGrpcGenerator generator;
+ return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
+}
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator.cc b/contrib/libs/grpc/src/compiler/csharp_generator.cc
index 3a2797a846..3b7107c4c4 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator.cc
+++ b/contrib/libs/grpc/src/compiler/csharp_generator.cc
@@ -1,204 +1,204 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <cctype>
-#include <map>
-#include <sstream>
-#include <vector>
-
-#include "src/compiler/config.h"
-#include "src/compiler/csharp_generator.h"
-#include "src/compiler/csharp_generator_helpers.h"
-
+ *
+ */
+
+#include <cctype>
+#include <map>
+#include <sstream>
+#include <vector>
+
+#include "src/compiler/config.h"
+#include "src/compiler/csharp_generator.h"
+#include "src/compiler/csharp_generator_helpers.h"
+
using google::protobuf::compiler::csharp::GetClassName;
-using google::protobuf::compiler::csharp::GetFileNamespace;
-using google::protobuf::compiler::csharp::GetReflectionClassName;
+using google::protobuf::compiler::csharp::GetFileNamespace;
+using google::protobuf::compiler::csharp::GetReflectionClassName;
using grpc::protobuf::Descriptor;
-using grpc::protobuf::FileDescriptor;
+using grpc::protobuf::FileDescriptor;
using grpc::protobuf::MethodDescriptor;
-using grpc::protobuf::ServiceDescriptor;
-using grpc::protobuf::io::Printer;
-using grpc::protobuf::io::StringOutputStream;
-using grpc_generator::GetMethodType;
+using grpc::protobuf::ServiceDescriptor;
+using grpc::protobuf::io::Printer;
+using grpc::protobuf::io::StringOutputStream;
+using grpc_generator::GetMethodType;
using grpc_generator::MethodType;
using grpc_generator::METHODTYPE_BIDI_STREAMING;
using grpc_generator::METHODTYPE_CLIENT_STREAMING;
-using grpc_generator::METHODTYPE_NO_STREAMING;
-using grpc_generator::METHODTYPE_SERVER_STREAMING;
-using grpc_generator::StringReplace;
-using std::map;
-using std::vector;
-
-namespace grpc_csharp_generator {
-namespace {
-
-// This function is a massaged version of
-// https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
-// Currently, we cannot easily reuse the functionality as
-// google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header.
-// TODO(jtattermusch): reuse the functionality from google/protobuf.
+using grpc_generator::METHODTYPE_NO_STREAMING;
+using grpc_generator::METHODTYPE_SERVER_STREAMING;
+using grpc_generator::StringReplace;
+using std::map;
+using std::vector;
+
+namespace grpc_csharp_generator {
+namespace {
+
+// This function is a massaged version of
+// https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
+// Currently, we cannot easily reuse the functionality as
+// google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header.
+// TODO(jtattermusch): reuse the functionality from google/protobuf.
bool GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer* printer,
- grpc::protobuf::SourceLocation location) {
+ grpc::protobuf::SourceLocation location) {
TString comments = location.leading_comments.empty()
? location.trailing_comments
: location.leading_comments;
- if (comments.empty()) {
- return false;
- }
- // XML escaping... no need for apostrophes etc as the whole text is going to
- // be a child
- // node of a summary element, not part of an attribute.
- comments = grpc_generator::StringReplace(comments, "&", "&amp;", true);
- comments = grpc_generator::StringReplace(comments, "<", "&lt;", true);
-
+ if (comments.empty()) {
+ return false;
+ }
+ // XML escaping... no need for apostrophes etc as the whole text is going to
+ // be a child
+ // node of a summary element, not part of an attribute.
+ comments = grpc_generator::StringReplace(comments, "&", "&amp;", true);
+ comments = grpc_generator::StringReplace(comments, "<", "&lt;", true);
+
std::vector<TString> lines;
- grpc_generator::Split(comments, '\n', &lines);
- // TODO: We really should work out which part to put in the summary and which
- // to put in the remarks...
- // but that needs to be part of a bigger effort to understand the markdown
- // better anyway.
- printer->Print("/// <summary>\n");
- bool last_was_empty = false;
- // We squash multiple blank lines down to one, and remove any trailing blank
- // lines. We need
- // to preserve the blank lines themselves, as this is relevant in the
- // markdown.
- // Note that we can't remove leading or trailing whitespace as *that's*
- // relevant in markdown too.
- // (We don't skip "just whitespace" lines, either.)
+ grpc_generator::Split(comments, '\n', &lines);
+ // TODO: We really should work out which part to put in the summary and which
+ // to put in the remarks...
+ // but that needs to be part of a bigger effort to understand the markdown
+ // better anyway.
+ printer->Print("/// <summary>\n");
+ bool last_was_empty = false;
+ // We squash multiple blank lines down to one, and remove any trailing blank
+ // lines. We need
+ // to preserve the blank lines themselves, as this is relevant in the
+ // markdown.
+ // Note that we can't remove leading or trailing whitespace as *that's*
+ // relevant in markdown too.
+ // (We don't skip "just whitespace" lines, either.)
for (std::vector<TString>::iterator it = lines.begin(); it != lines.end();
++it) {
TString line = *it;
- if (line.empty()) {
- last_was_empty = true;
- } else {
- if (last_was_empty) {
- printer->Print("///\n");
- }
- last_was_empty = false;
- printer->Print("///$line$\n", "line", *it);
- }
- }
- printer->Print("/// </summary>\n");
- return true;
-}
-
-template <typename DescriptorType>
+ if (line.empty()) {
+ last_was_empty = true;
+ } else {
+ if (last_was_empty) {
+ printer->Print("///\n");
+ }
+ last_was_empty = false;
+ printer->Print("///$line$\n", "line", *it);
+ }
+ }
+ printer->Print("/// </summary>\n");
+ return true;
+}
+
+template <typename DescriptorType>
bool GenerateDocCommentBody(grpc::protobuf::io::Printer* printer,
const DescriptorType* descriptor) {
- grpc::protobuf::SourceLocation location;
- if (!descriptor->GetSourceLocation(&location)) {
- return false;
- }
- return GenerateDocCommentBodyImpl(printer, location);
-}
-
+ grpc::protobuf::SourceLocation location;
+ if (!descriptor->GetSourceLocation(&location)) {
+ return false;
+ }
+ return GenerateDocCommentBodyImpl(printer, location);
+}
+
void GenerateDocCommentServerMethod(grpc::protobuf::io::Printer* printer,
const MethodDescriptor* method) {
- if (GenerateDocCommentBody(printer, method)) {
- if (method->client_streaming()) {
- printer->Print(
- "/// <param name=\"requestStream\">Used for reading requests from "
- "the client.</param>\n");
- } else {
- printer->Print(
- "/// <param name=\"request\">The request received from the "
- "client.</param>\n");
- }
- if (method->server_streaming()) {
- printer->Print(
- "/// <param name=\"responseStream\">Used for sending responses back "
- "to the client.</param>\n");
- }
- printer->Print(
- "/// <param name=\"context\">The context of the server-side call "
- "handler being invoked.</param>\n");
- if (method->server_streaming()) {
- printer->Print(
- "/// <returns>A task indicating completion of the "
- "handler.</returns>\n");
- } else {
- printer->Print(
- "/// <returns>The response to send back to the client (wrapped by a "
- "task).</returns>\n");
- }
- }
-}
-
+ if (GenerateDocCommentBody(printer, method)) {
+ if (method->client_streaming()) {
+ printer->Print(
+ "/// <param name=\"requestStream\">Used for reading requests from "
+ "the client.</param>\n");
+ } else {
+ printer->Print(
+ "/// <param name=\"request\">The request received from the "
+ "client.</param>\n");
+ }
+ if (method->server_streaming()) {
+ printer->Print(
+ "/// <param name=\"responseStream\">Used for sending responses back "
+ "to the client.</param>\n");
+ }
+ printer->Print(
+ "/// <param name=\"context\">The context of the server-side call "
+ "handler being invoked.</param>\n");
+ if (method->server_streaming()) {
+ printer->Print(
+ "/// <returns>A task indicating completion of the "
+ "handler.</returns>\n");
+ } else {
+ printer->Print(
+ "/// <returns>The response to send back to the client (wrapped by a "
+ "task).</returns>\n");
+ }
+ }
+}
+
void GenerateDocCommentClientMethod(grpc::protobuf::io::Printer* printer,
const MethodDescriptor* method,
- bool is_sync, bool use_call_options) {
- if (GenerateDocCommentBody(printer, method)) {
- if (!method->client_streaming()) {
- printer->Print(
- "/// <param name=\"request\">The request to send to the "
- "server.</param>\n");
- }
- if (!use_call_options) {
- printer->Print(
- "/// <param name=\"headers\">The initial metadata to send with the "
- "call. This parameter is optional.</param>\n");
- printer->Print(
- "/// <param name=\"deadline\">An optional deadline for the call. The "
- "call will be cancelled if deadline is hit.</param>\n");
- printer->Print(
- "/// <param name=\"cancellationToken\">An optional token for "
- "canceling the call.</param>\n");
- } else {
- printer->Print(
- "/// <param name=\"options\">The options for the call.</param>\n");
- }
- if (is_sync) {
- printer->Print(
- "/// <returns>The response received from the server.</returns>\n");
- } else {
- printer->Print("/// <returns>The call object.</returns>\n");
- }
- }
-}
-
+ bool is_sync, bool use_call_options) {
+ if (GenerateDocCommentBody(printer, method)) {
+ if (!method->client_streaming()) {
+ printer->Print(
+ "/// <param name=\"request\">The request to send to the "
+ "server.</param>\n");
+ }
+ if (!use_call_options) {
+ printer->Print(
+ "/// <param name=\"headers\">The initial metadata to send with the "
+ "call. This parameter is optional.</param>\n");
+ printer->Print(
+ "/// <param name=\"deadline\">An optional deadline for the call. The "
+ "call will be cancelled if deadline is hit.</param>\n");
+ printer->Print(
+ "/// <param name=\"cancellationToken\">An optional token for "
+ "canceling the call.</param>\n");
+ } else {
+ printer->Print(
+ "/// <param name=\"options\">The options for the call.</param>\n");
+ }
+ if (is_sync) {
+ printer->Print(
+ "/// <returns>The response received from the server.</returns>\n");
+ } else {
+ printer->Print("/// <returns>The call object.</returns>\n");
+ }
+ }
+}
+
TString GetServiceClassName(const ServiceDescriptor* service) {
- return service->name();
-}
-
+ return service->name();
+}
+
TString GetClientClassName(const ServiceDescriptor* service) {
- return service->name() + "Client";
-}
-
+ return service->name() + "Client";
+}
+
TString GetServerClassName(const ServiceDescriptor* service) {
- return service->name() + "Base";
-}
-
+ return service->name() + "Base";
+}
+
TString GetCSharpMethodType(MethodType method_type) {
- switch (method_type) {
- case METHODTYPE_NO_STREAMING:
+ switch (method_type) {
+ case METHODTYPE_NO_STREAMING:
return "grpc::MethodType.Unary";
- case METHODTYPE_CLIENT_STREAMING:
+ case METHODTYPE_CLIENT_STREAMING:
return "grpc::MethodType.ClientStreaming";
- case METHODTYPE_SERVER_STREAMING:
+ case METHODTYPE_SERVER_STREAMING:
return "grpc::MethodType.ServerStreaming";
- case METHODTYPE_BIDI_STREAMING:
+ case METHODTYPE_BIDI_STREAMING:
return "grpc::MethodType.DuplexStreaming";
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return "";
-}
-
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
TString GetCSharpServerMethodType(MethodType method_type) {
switch (method_type) {
case METHODTYPE_NO_STREAMING:
@@ -215,114 +215,114 @@ TString GetCSharpServerMethodType(MethodType method_type) {
}
TString GetServiceNameFieldName() { return "__ServiceName"; }
-
+
TString GetMarshallerFieldName(const Descriptor* message) {
return "__Marshaller_" +
grpc_generator::StringReplace(message->full_name(), ".", "_", true);
-}
-
+}
+
TString GetMethodFieldName(const MethodDescriptor* method) {
- return "__Method_" + method->name();
-}
-
+ return "__Method_" + method->name();
+}
+
TString GetMethodRequestParamMaybe(const MethodDescriptor* method,
- bool invocation_param = false) {
- if (method->client_streaming()) {
- return "";
- }
- if (invocation_param) {
- return "request, ";
- }
- return GetClassName(method->input_type()) + " request, ";
-}
-
+ bool invocation_param = false) {
+ if (method->client_streaming()) {
+ return "";
+ }
+ if (invocation_param) {
+ return "request, ";
+ }
+ return GetClassName(method->input_type()) + " request, ";
+}
+
TString GetAccessLevel(bool internal_access) {
- return internal_access ? "internal" : "public";
-}
-
+ return internal_access ? "internal" : "public";
+}
+
TString GetMethodReturnTypeClient(const MethodDescriptor* method) {
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
+ switch (GetMethodType(method)) {
+ case METHODTYPE_NO_STREAMING:
return "grpc::AsyncUnaryCall<" + GetClassName(method->output_type()) +
">";
- case METHODTYPE_CLIENT_STREAMING:
+ case METHODTYPE_CLIENT_STREAMING:
return "grpc::AsyncClientStreamingCall<" +
GetClassName(method->input_type()) + ", " +
GetClassName(method->output_type()) + ">";
- case METHODTYPE_SERVER_STREAMING:
+ case METHODTYPE_SERVER_STREAMING:
return "grpc::AsyncServerStreamingCall<" +
GetClassName(method->output_type()) + ">";
- case METHODTYPE_BIDI_STREAMING:
+ case METHODTYPE_BIDI_STREAMING:
return "grpc::AsyncDuplexStreamingCall<" +
GetClassName(method->input_type()) + ", " +
GetClassName(method->output_type()) + ">";
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return "";
-}
-
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
TString GetMethodRequestParamServer(const MethodDescriptor* method) {
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
- case METHODTYPE_SERVER_STREAMING:
- return GetClassName(method->input_type()) + " request";
- case METHODTYPE_CLIENT_STREAMING:
- case METHODTYPE_BIDI_STREAMING:
+ switch (GetMethodType(method)) {
+ case METHODTYPE_NO_STREAMING:
+ case METHODTYPE_SERVER_STREAMING:
+ return GetClassName(method->input_type()) + " request";
+ case METHODTYPE_CLIENT_STREAMING:
+ case METHODTYPE_BIDI_STREAMING:
return "grpc::IAsyncStreamReader<" + GetClassName(method->input_type()) +
- "> requestStream";
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return "";
-}
-
+ "> requestStream";
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
TString GetMethodReturnTypeServer(const MethodDescriptor* method) {
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
- case METHODTYPE_CLIENT_STREAMING:
- return "global::System.Threading.Tasks.Task<" +
- GetClassName(method->output_type()) + ">";
- case METHODTYPE_SERVER_STREAMING:
- case METHODTYPE_BIDI_STREAMING:
- return "global::System.Threading.Tasks.Task";
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return "";
-}
-
+ switch (GetMethodType(method)) {
+ case METHODTYPE_NO_STREAMING:
+ case METHODTYPE_CLIENT_STREAMING:
+ return "global::System.Threading.Tasks.Task<" +
+ GetClassName(method->output_type()) + ">";
+ case METHODTYPE_SERVER_STREAMING:
+ case METHODTYPE_BIDI_STREAMING:
+ return "global::System.Threading.Tasks.Task";
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
TString GetMethodResponseStreamMaybe(const MethodDescriptor* method) {
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
- case METHODTYPE_CLIENT_STREAMING:
- return "";
- case METHODTYPE_SERVER_STREAMING:
- case METHODTYPE_BIDI_STREAMING:
+ switch (GetMethodType(method)) {
+ case METHODTYPE_NO_STREAMING:
+ case METHODTYPE_CLIENT_STREAMING:
+ return "";
+ case METHODTYPE_SERVER_STREAMING:
+ case METHODTYPE_BIDI_STREAMING:
return ", grpc::IServerStreamWriter<" +
GetClassName(method->output_type()) + "> responseStream";
- }
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return "";
-}
-
-// Gets vector of all messages used as input or output types.
+ }
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return "";
+}
+
+// Gets vector of all messages used as input or output types.
std::vector<const Descriptor*> GetUsedMessages(
const ServiceDescriptor* service) {
std::set<const Descriptor*> descriptor_set;
std::vector<const Descriptor*>
- result; // vector is to maintain stable ordering
- for (int i = 0; i < service->method_count(); i++) {
+ result; // vector is to maintain stable ordering
+ for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor* method = service->method(i);
- if (descriptor_set.find(method->input_type()) == descriptor_set.end()) {
- descriptor_set.insert(method->input_type());
- result.push_back(method->input_type());
- }
- if (descriptor_set.find(method->output_type()) == descriptor_set.end()) {
- descriptor_set.insert(method->output_type());
- result.push_back(method->output_type());
- }
- }
- return result;
-}
-
+ if (descriptor_set.find(method->input_type()) == descriptor_set.end()) {
+ descriptor_set.insert(method->input_type());
+ result.push_back(method->input_type());
+ }
+ if (descriptor_set.find(method->output_type()) == descriptor_set.end()) {
+ descriptor_set.insert(method->output_type());
+ result.push_back(method->output_type());
+ }
+ }
+ return result;
+}
+
void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
std::vector<const Descriptor*> used_messages = GetUsedMessages(service);
if (used_messages.size() != 0) {
@@ -389,308 +389,308 @@ void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
out->Print("}\n\n");
}
- for (size_t i = 0; i < used_messages.size(); i++) {
+ for (size_t i = 0; i < used_messages.size(); i++) {
const Descriptor* message = used_messages[i];
- out->Print(
+ out->Print(
"static readonly grpc::Marshaller<$type$> $fieldname$ = "
"grpc::Marshallers.Create(__Helper_SerializeMessage, "
"context => __Helper_DeserializeMessage(context, $type$.Parser));\n",
- "fieldname", GetMarshallerFieldName(message), "type",
- GetClassName(message));
- }
- out->Print("\n");
-}
-
+ "fieldname", GetMarshallerFieldName(message), "type",
+ GetClassName(message));
+ }
+ out->Print("\n");
+}
+
void GenerateStaticMethodField(Printer* out, const MethodDescriptor* method) {
- out->Print(
+ out->Print(
"static readonly grpc::Method<$request$, $response$> $fieldname$ = new "
"grpc::Method<$request$, $response$>(\n",
- "fieldname", GetMethodFieldName(method), "request",
- GetClassName(method->input_type()), "response",
- GetClassName(method->output_type()));
- out->Indent();
- out->Indent();
- out->Print("$methodtype$,\n", "methodtype",
- GetCSharpMethodType(GetMethodType(method)));
- out->Print("$servicenamefield$,\n", "servicenamefield",
- GetServiceNameFieldName());
- out->Print("\"$methodname$\",\n", "methodname", method->name());
- out->Print("$requestmarshaller$,\n", "requestmarshaller",
- GetMarshallerFieldName(method->input_type()));
- out->Print("$responsemarshaller$);\n", "responsemarshaller",
- GetMarshallerFieldName(method->output_type()));
- out->Print("\n");
- out->Outdent();
- out->Outdent();
-}
-
+ "fieldname", GetMethodFieldName(method), "request",
+ GetClassName(method->input_type()), "response",
+ GetClassName(method->output_type()));
+ out->Indent();
+ out->Indent();
+ out->Print("$methodtype$,\n", "methodtype",
+ GetCSharpMethodType(GetMethodType(method)));
+ out->Print("$servicenamefield$,\n", "servicenamefield",
+ GetServiceNameFieldName());
+ out->Print("\"$methodname$\",\n", "methodname", method->name());
+ out->Print("$requestmarshaller$,\n", "requestmarshaller",
+ GetMarshallerFieldName(method->input_type()));
+ out->Print("$responsemarshaller$);\n", "responsemarshaller",
+ GetMarshallerFieldName(method->output_type()));
+ out->Print("\n");
+ out->Outdent();
+ out->Outdent();
+}
+
void GenerateServiceDescriptorProperty(Printer* out,
const ServiceDescriptor* service) {
- std::ostringstream index;
- index << service->index();
- out->Print("/// <summary>Service descriptor</summary>\n");
- out->Print(
- "public static global::Google.Protobuf.Reflection.ServiceDescriptor "
- "Descriptor\n");
- out->Print("{\n");
- out->Print(" get { return $umbrella$.Descriptor.Services[$index$]; }\n",
- "umbrella", GetReflectionClassName(service->file()), "index",
- index.str());
- out->Print("}\n");
- out->Print("\n");
-}
-
+ std::ostringstream index;
+ index << service->index();
+ out->Print("/// <summary>Service descriptor</summary>\n");
+ out->Print(
+ "public static global::Google.Protobuf.Reflection.ServiceDescriptor "
+ "Descriptor\n");
+ out->Print("{\n");
+ out->Print(" get { return $umbrella$.Descriptor.Services[$index$]; }\n",
+ "umbrella", GetReflectionClassName(service->file()), "index",
+ index.str());
+ out->Print("}\n");
+ out->Print("\n");
+}
+
void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
- out->Print(
- "/// <summary>Base class for server-side implementations of "
- "$servicename$</summary>\n",
- "servicename", GetServiceClassName(service));
+ out->Print(
+ "/// <summary>Base class for server-side implementations of "
+ "$servicename$</summary>\n",
+ "servicename", GetServiceClassName(service));
out->Print(
"[grpc::BindServiceMethod(typeof($classname$), "
"\"BindService\")]\n",
"classname", GetServiceClassName(service));
- out->Print("public abstract partial class $name$\n", "name",
- GetServerClassName(service));
- out->Print("{\n");
- out->Indent();
- for (int i = 0; i < service->method_count(); i++) {
+ out->Print("public abstract partial class $name$\n", "name",
+ GetServerClassName(service));
+ out->Print("{\n");
+ out->Indent();
+ for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor* method = service->method(i);
- GenerateDocCommentServerMethod(out, method);
- out->Print(
- "public virtual $returntype$ "
- "$methodname$($request$$response_stream_maybe$, "
+ GenerateDocCommentServerMethod(out, method);
+ out->Print(
+ "public virtual $returntype$ "
+ "$methodname$($request$$response_stream_maybe$, "
"grpc::ServerCallContext context)\n",
- "methodname", method->name(), "returntype",
- GetMethodReturnTypeServer(method), "request",
- GetMethodRequestParamServer(method), "response_stream_maybe",
- GetMethodResponseStreamMaybe(method));
- out->Print("{\n");
- out->Indent();
- out->Print(
+ "methodname", method->name(), "returntype",
+ GetMethodReturnTypeServer(method), "request",
+ GetMethodRequestParamServer(method), "response_stream_maybe",
+ GetMethodResponseStreamMaybe(method));
+ out->Print("{\n");
+ out->Indent();
+ out->Print(
"throw new grpc::RpcException("
"new grpc::Status(grpc::StatusCode.Unimplemented, \"\"));\n");
- out->Outdent();
- out->Print("}\n\n");
- }
- out->Outdent();
- out->Print("}\n");
- out->Print("\n");
-}
-
+ out->Outdent();
+ out->Print("}\n\n");
+ }
+ out->Outdent();
+ out->Print("}\n");
+ out->Print("\n");
+}
+
void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
- out->Print("/// <summary>Client for $servicename$</summary>\n", "servicename",
- GetServiceClassName(service));
+ out->Print("/// <summary>Client for $servicename$</summary>\n", "servicename",
+ GetServiceClassName(service));
out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", "name",
- GetClientClassName(service));
- out->Print("{\n");
- out->Indent();
-
- // constructors
- out->Print(
- "/// <summary>Creates a new client for $servicename$</summary>\n"
- "/// <param name=\"channel\">The channel to use to make remote "
- "calls.</param>\n",
- "servicename", GetServiceClassName(service));
+ GetClientClassName(service));
+ out->Print("{\n");
+ out->Indent();
+
+ // constructors
+ out->Print(
+ "/// <summary>Creates a new client for $servicename$</summary>\n"
+ "/// <param name=\"channel\">The channel to use to make remote "
+ "calls.</param>\n",
+ "servicename", GetServiceClassName(service));
out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n",
"name", GetClientClassName(service));
- out->Print("{\n");
- out->Print("}\n");
- out->Print(
- "/// <summary>Creates a new client for $servicename$ that uses a custom "
- "<c>CallInvoker</c>.</summary>\n"
- "/// <param name=\"callInvoker\">The callInvoker to use to make remote "
- "calls.</param>\n",
- "servicename", GetServiceClassName(service));
+ out->Print("{\n");
+ out->Print("}\n");
+ out->Print(
+ "/// <summary>Creates a new client for $servicename$ that uses a custom "
+ "<c>CallInvoker</c>.</summary>\n"
+ "/// <param name=\"callInvoker\">The callInvoker to use to make remote "
+ "calls.</param>\n",
+ "servicename", GetServiceClassName(service));
out->Print(
"public $name$(grpc::CallInvoker callInvoker) : base(callInvoker)\n",
"name", GetClientClassName(service));
- out->Print("{\n");
- out->Print("}\n");
- out->Print(
- "/// <summary>Protected parameterless constructor to allow creation"
- " of test doubles.</summary>\n");
- out->Print("protected $name$() : base()\n", "name",
- GetClientClassName(service));
- out->Print("{\n");
- out->Print("}\n");
- out->Print(
- "/// <summary>Protected constructor to allow creation of configured "
- "clients.</summary>\n"
- "/// <param name=\"configuration\">The client configuration.</param>\n");
- out->Print(
- "protected $name$(ClientBaseConfiguration configuration)"
- " : base(configuration)\n",
- "name", GetClientClassName(service));
- out->Print("{\n");
- out->Print("}\n\n");
-
- for (int i = 0; i < service->method_count(); i++) {
+ out->Print("{\n");
+ out->Print("}\n");
+ out->Print(
+ "/// <summary>Protected parameterless constructor to allow creation"
+ " of test doubles.</summary>\n");
+ out->Print("protected $name$() : base()\n", "name",
+ GetClientClassName(service));
+ out->Print("{\n");
+ out->Print("}\n");
+ out->Print(
+ "/// <summary>Protected constructor to allow creation of configured "
+ "clients.</summary>\n"
+ "/// <param name=\"configuration\">The client configuration.</param>\n");
+ out->Print(
+ "protected $name$(ClientBaseConfiguration configuration)"
+ " : base(configuration)\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Print("}\n\n");
+
+ for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor* method = service->method(i);
- MethodType method_type = GetMethodType(method);
-
- if (method_type == METHODTYPE_NO_STREAMING) {
- // unary calls have an extra synchronous stub method
- GenerateDocCommentClientMethod(out, method, true, false);
- out->Print(
+ MethodType method_type = GetMethodType(method);
+
+ if (method_type == METHODTYPE_NO_STREAMING) {
+ // unary calls have an extra synchronous stub method
+ GenerateDocCommentClientMethod(out, method, true, false);
+ out->Print(
"public virtual $response$ $methodname$($request$ request, "
"grpc::Metadata "
"headers = null, global::System.DateTime? deadline = null, "
"global::System.Threading.CancellationToken "
"cancellationToken = "
"default(global::System.Threading.CancellationToken))\n",
- "methodname", method->name(), "request",
- GetClassName(method->input_type()), "response",
- GetClassName(method->output_type()));
- out->Print("{\n");
- out->Indent();
- out->Print(
+ "methodname", method->name(), "request",
+ GetClassName(method->input_type()), "response",
+ GetClassName(method->output_type()));
+ out->Print("{\n");
+ out->Indent();
+ out->Print(
"return $methodname$(request, new grpc::CallOptions(headers, "
"deadline, "
- "cancellationToken));\n",
- "methodname", method->name());
- out->Outdent();
- out->Print("}\n");
-
- // overload taking CallOptions as a param
- GenerateDocCommentClientMethod(out, method, true, true);
- out->Print(
- "public virtual $response$ $methodname$($request$ request, "
+ "cancellationToken));\n",
+ "methodname", method->name());
+ out->Outdent();
+ out->Print("}\n");
+
+ // overload taking CallOptions as a param
+ GenerateDocCommentClientMethod(out, method, true, true);
+ out->Print(
+ "public virtual $response$ $methodname$($request$ request, "
"grpc::CallOptions options)\n",
- "methodname", method->name(), "request",
- GetClassName(method->input_type()), "response",
- GetClassName(method->output_type()));
- out->Print("{\n");
- out->Indent();
- out->Print(
- "return CallInvoker.BlockingUnaryCall($methodfield$, null, options, "
- "request);\n",
- "methodfield", GetMethodFieldName(method));
- out->Outdent();
- out->Print("}\n");
- }
-
+ "methodname", method->name(), "request",
+ GetClassName(method->input_type()), "response",
+ GetClassName(method->output_type()));
+ out->Print("{\n");
+ out->Indent();
+ out->Print(
+ "return CallInvoker.BlockingUnaryCall($methodfield$, null, options, "
+ "request);\n",
+ "methodfield", GetMethodFieldName(method));
+ out->Outdent();
+ out->Print("}\n");
+ }
+
TString method_name = method->name();
- if (method_type == METHODTYPE_NO_STREAMING) {
- method_name += "Async"; // prevent name clash with synchronous method.
- }
- GenerateDocCommentClientMethod(out, method, false, false);
- out->Print(
+ if (method_type == METHODTYPE_NO_STREAMING) {
+ method_name += "Async"; // prevent name clash with synchronous method.
+ }
+ GenerateDocCommentClientMethod(out, method, false, false);
+ out->Print(
"public virtual $returntype$ "
"$methodname$($request_maybe$grpc::Metadata "
"headers = null, global::System.DateTime? deadline = null, "
"global::System.Threading.CancellationToken "
"cancellationToken = "
"default(global::System.Threading.CancellationToken))\n",
- "methodname", method_name, "request_maybe",
- GetMethodRequestParamMaybe(method), "returntype",
- GetMethodReturnTypeClient(method));
- out->Print("{\n");
- out->Indent();
-
- out->Print(
+ "methodname", method_name, "request_maybe",
+ GetMethodRequestParamMaybe(method), "returntype",
+ GetMethodReturnTypeClient(method));
+ out->Print("{\n");
+ out->Indent();
+
+ out->Print(
"return $methodname$($request_maybe$new grpc::CallOptions(headers, "
"deadline, "
- "cancellationToken));\n",
- "methodname", method_name, "request_maybe",
- GetMethodRequestParamMaybe(method, true));
- out->Outdent();
- out->Print("}\n");
-
- // overload taking CallOptions as a param
- GenerateDocCommentClientMethod(out, method, false, true);
- out->Print(
+ "cancellationToken));\n",
+ "methodname", method_name, "request_maybe",
+ GetMethodRequestParamMaybe(method, true));
+ out->Outdent();
+ out->Print("}\n");
+
+ // overload taking CallOptions as a param
+ GenerateDocCommentClientMethod(out, method, false, true);
+ out->Print(
"public virtual $returntype$ "
"$methodname$($request_maybe$grpc::CallOptions "
- "options)\n",
- "methodname", method_name, "request_maybe",
- GetMethodRequestParamMaybe(method), "returntype",
- GetMethodReturnTypeClient(method));
- out->Print("{\n");
- out->Indent();
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
- out->Print(
- "return CallInvoker.AsyncUnaryCall($methodfield$, null, options, "
- "request);\n",
- "methodfield", GetMethodFieldName(method));
- break;
- case METHODTYPE_CLIENT_STREAMING:
- out->Print(
- "return CallInvoker.AsyncClientStreamingCall($methodfield$, null, "
- "options);\n",
- "methodfield", GetMethodFieldName(method));
- break;
- case METHODTYPE_SERVER_STREAMING:
- out->Print(
- "return CallInvoker.AsyncServerStreamingCall($methodfield$, null, "
- "options, request);\n",
- "methodfield", GetMethodFieldName(method));
- break;
- case METHODTYPE_BIDI_STREAMING:
- out->Print(
- "return CallInvoker.AsyncDuplexStreamingCall($methodfield$, null, "
- "options);\n",
- "methodfield", GetMethodFieldName(method));
- break;
- default:
- GOOGLE_LOG(FATAL) << "Can't get here.";
- }
- out->Outdent();
- out->Print("}\n");
- }
-
- // override NewInstance method
- out->Print(
- "/// <summary>Creates a new instance of client from given "
- "<c>ClientBaseConfiguration</c>.</summary>\n");
- out->Print(
- "protected override $name$ NewInstance(ClientBaseConfiguration "
- "configuration)\n",
- "name", GetClientClassName(service));
- out->Print("{\n");
- out->Indent();
- out->Print("return new $name$(configuration);\n", "name",
- GetClientClassName(service));
- out->Outdent();
- out->Print("}\n");
-
- out->Outdent();
- out->Print("}\n");
- out->Print("\n");
-}
-
+ "options)\n",
+ "methodname", method_name, "request_maybe",
+ GetMethodRequestParamMaybe(method), "returntype",
+ GetMethodReturnTypeClient(method));
+ out->Print("{\n");
+ out->Indent();
+ switch (GetMethodType(method)) {
+ case METHODTYPE_NO_STREAMING:
+ out->Print(
+ "return CallInvoker.AsyncUnaryCall($methodfield$, null, options, "
+ "request);\n",
+ "methodfield", GetMethodFieldName(method));
+ break;
+ case METHODTYPE_CLIENT_STREAMING:
+ out->Print(
+ "return CallInvoker.AsyncClientStreamingCall($methodfield$, null, "
+ "options);\n",
+ "methodfield", GetMethodFieldName(method));
+ break;
+ case METHODTYPE_SERVER_STREAMING:
+ out->Print(
+ "return CallInvoker.AsyncServerStreamingCall($methodfield$, null, "
+ "options, request);\n",
+ "methodfield", GetMethodFieldName(method));
+ break;
+ case METHODTYPE_BIDI_STREAMING:
+ out->Print(
+ "return CallInvoker.AsyncDuplexStreamingCall($methodfield$, null, "
+ "options);\n",
+ "methodfield", GetMethodFieldName(method));
+ break;
+ default:
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ }
+ out->Outdent();
+ out->Print("}\n");
+ }
+
+ // override NewInstance method
+ out->Print(
+ "/// <summary>Creates a new instance of client from given "
+ "<c>ClientBaseConfiguration</c>.</summary>\n");
+ out->Print(
+ "protected override $name$ NewInstance(ClientBaseConfiguration "
+ "configuration)\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Indent();
+ out->Print("return new $name$(configuration);\n", "name",
+ GetClientClassName(service));
+ out->Outdent();
+ out->Print("}\n");
+
+ out->Outdent();
+ out->Print("}\n");
+ out->Print("\n");
+}
+
void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) {
- out->Print(
- "/// <summary>Creates service definition that can be registered with a "
- "server</summary>\n");
- out->Print(
- "/// <param name=\"serviceImpl\">An object implementing the server-side"
- " handling logic.</param>\n");
- out->Print(
+ out->Print(
+ "/// <summary>Creates service definition that can be registered with a "
+ "server</summary>\n");
+ out->Print(
+ "/// <param name=\"serviceImpl\">An object implementing the server-side"
+ " handling logic.</param>\n");
+ out->Print(
"public static grpc::ServerServiceDefinition BindService($implclass$ "
- "serviceImpl)\n",
- "implclass", GetServerClassName(service));
- out->Print("{\n");
- out->Indent();
-
+ "serviceImpl)\n",
+ "implclass", GetServerClassName(service));
+ out->Print("{\n");
+ out->Indent();
+
out->Print("return grpc::ServerServiceDefinition.CreateBuilder()");
- out->Indent();
- out->Indent();
- for (int i = 0; i < service->method_count(); i++) {
+ out->Indent();
+ out->Indent();
+ for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor* method = service->method(i);
out->Print("\n.AddMethod($methodfield$, serviceImpl.$methodname$)",
- "methodfield", GetMethodFieldName(method), "methodname",
- method->name());
- }
+ "methodfield", GetMethodFieldName(method), "methodname",
+ method->name());
+ }
out->Print(".Build();\n");
- out->Outdent();
- out->Outdent();
-
- out->Outdent();
- out->Print("}\n");
- out->Print("\n");
-}
-
+ out->Outdent();
+ out->Outdent();
+
+ out->Outdent();
+ out->Print("}\n");
+ out->Print("\n");
+}
+
void GenerateBindServiceWithBinderMethod(Printer* out,
const ServiceDescriptor* service) {
out->Print(
@@ -733,94 +733,94 @@ void GenerateBindServiceWithBinderMethod(Printer* out,
}
void GenerateService(Printer* out, const ServiceDescriptor* service,
- bool generate_client, bool generate_server,
- bool internal_access) {
- GenerateDocCommentBody(out, service);
- out->Print("$access_level$ static partial class $classname$\n",
- "access_level", GetAccessLevel(internal_access), "classname",
- GetServiceClassName(service));
- out->Print("{\n");
- out->Indent();
- out->Print("static readonly string $servicenamefield$ = \"$servicename$\";\n",
- "servicenamefield", GetServiceNameFieldName(), "servicename",
- service->full_name());
- out->Print("\n");
-
- GenerateMarshallerFields(out, service);
- for (int i = 0; i < service->method_count(); i++) {
- GenerateStaticMethodField(out, service->method(i));
- }
- GenerateServiceDescriptorProperty(out, service);
-
- if (generate_server) {
- GenerateServerClass(out, service);
- }
- if (generate_client) {
- GenerateClientStub(out, service);
- }
- if (generate_server) {
- GenerateBindServiceMethod(out, service);
+ bool generate_client, bool generate_server,
+ bool internal_access) {
+ GenerateDocCommentBody(out, service);
+ out->Print("$access_level$ static partial class $classname$\n",
+ "access_level", GetAccessLevel(internal_access), "classname",
+ GetServiceClassName(service));
+ out->Print("{\n");
+ out->Indent();
+ out->Print("static readonly string $servicenamefield$ = \"$servicename$\";\n",
+ "servicenamefield", GetServiceNameFieldName(), "servicename",
+ service->full_name());
+ out->Print("\n");
+
+ GenerateMarshallerFields(out, service);
+ for (int i = 0; i < service->method_count(); i++) {
+ GenerateStaticMethodField(out, service->method(i));
+ }
+ GenerateServiceDescriptorProperty(out, service);
+
+ if (generate_server) {
+ GenerateServerClass(out, service);
+ }
+ if (generate_client) {
+ GenerateClientStub(out, service);
+ }
+ if (generate_server) {
+ GenerateBindServiceMethod(out, service);
GenerateBindServiceWithBinderMethod(out, service);
- }
-
- out->Outdent();
- out->Print("}\n");
-}
-
-} // anonymous namespace
-
+ }
+
+ out->Outdent();
+ out->Print("}\n");
+}
+
+} // anonymous namespace
+
TString GetServices(const FileDescriptor* file, bool generate_client,
bool generate_server, bool internal_access) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
-
- StringOutputStream output_stream(&output);
- Printer out(&output_stream, '$');
-
- // Don't write out any output if there no services, to avoid empty service
- // files being generated for proto files that don't declare any.
- if (file->service_count() == 0) {
- return output;
- }
-
- // Write out a file header.
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+
+ StringOutputStream output_stream(&output);
+ Printer out(&output_stream, '$');
+
+ // Don't write out any output if there no services, to avoid empty service
+ // files being generated for proto files that don't declare any.
+ if (file->service_count() == 0) {
+ return output;
+ }
+
+ // Write out a file header.
out.Print("// <auto-generated>\n");
out.Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
out.Print("// source: $filename$\n", "filename", file->name());
out.Print("// </auto-generated>\n");
-
- // use C++ style as there are no file-level XML comments in .NET
+
+ // use C++ style as there are no file-level XML comments in .NET
TString leading_comments = GetCsharpComments(file, true);
- if (!leading_comments.empty()) {
- out.Print("// Original file comments:\n");
+ if (!leading_comments.empty()) {
+ out.Print("// Original file comments:\n");
out.PrintRaw(leading_comments.c_str());
- }
-
+ }
+
out.Print("#pragma warning disable 0414, 1591\n");
- out.Print("#region Designer generated code\n");
- out.Print("\n");
+ out.Print("#region Designer generated code\n");
+ out.Print("\n");
out.Print("using grpc = global::Grpc.Core;\n");
- out.Print("\n");
-
+ out.Print("\n");
+
TString file_namespace = GetFileNamespace(file);
if (file_namespace != "") {
out.Print("namespace $namespace$ {\n", "namespace", file_namespace);
out.Indent();
}
- for (int i = 0; i < file->service_count(); i++) {
- GenerateService(&out, file->service(i), generate_client, generate_server,
- internal_access);
- }
+ for (int i = 0; i < file->service_count(); i++) {
+ GenerateService(&out, file->service(i), generate_client, generate_server,
+ internal_access);
+ }
if (file_namespace != "") {
out.Outdent();
out.Print("}\n");
}
- out.Print("#endregion\n");
- }
- return output;
-}
-
-} // namespace grpc_csharp_generator
+ out.Print("#endregion\n");
+ }
+ return output;
+}
+
+} // namespace grpc_csharp_generator
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator.h b/contrib/libs/grpc/src/compiler/csharp_generator.h
index 9ff81bff4b..c13da4657f 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator.h
+++ b/contrib/libs/grpc/src/compiler/csharp_generator.h
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
-
-#include "src/compiler/config.h"
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
+
+#include "src/compiler/config.h"
+
#include <google/protobuf/compiler/csharp/csharp_names.h>
-
-namespace grpc_csharp_generator {
-
+
+namespace grpc_csharp_generator {
+
TString GetServices(const grpc::protobuf::FileDescriptor* file,
bool generate_client, bool generate_server,
bool internal_access);
-
-} // namespace grpc_csharp_generator
-
-#endif // GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
+
+} // namespace grpc_csharp_generator
+
+#endif // GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h b/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
index 5c189b7340..a8af7f3ccd 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-
-namespace grpc_csharp_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+
+namespace grpc_csharp_generator {
+
inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
TString* file_name_or_error) {
- *file_name_or_error =
- grpc_generator::FileNameInUpperCamel(file, false) + "Grpc.cs";
- return true;
-}
-
-// Get leading or trailing comments in a string. Comment lines start with "// ".
+ *file_name_or_error =
+ grpc_generator::FileNameInUpperCamel(file, false) + "Grpc.cs";
+ return true;
+}
+
+// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in front of leading comments.
-template <typename DescriptorType>
+template <typename DescriptorType>
inline TString GetCsharpComments(const DescriptorType* desc, bool leading) {
- return grpc_generator::GetPrefixedComments(desc, leading, "//");
-}
-
-} // namespace grpc_csharp_generator
-
-#endif // GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
+ return grpc_generator::GetPrefixedComments(desc, leading, "//");
+}
+
+} // namespace grpc_csharp_generator
+
+#endif // GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/generator_helpers.h b/contrib/libs/grpc/src/compiler/generator_helpers.h
index 39e68b334b..265713a16b 100644
--- a/contrib/libs/grpc/src/compiler/generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/generator_helpers.h
@@ -1,291 +1,291 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
-
-#include <iostream>
-#include <map>
-#include <sstream>
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
+
+#include <iostream>
+#include <map>
+#include <sstream>
#include <util/generic/string.h>
-#include <vector>
-
+#include <vector>
+
#include <util/generic/string.h>
#include <util/string/split.h>
-#include <util/stream/str.h>
-
+#include <util/stream/str.h>
+
#include "src/compiler/config.h"
-namespace grpc_generator {
-
+namespace grpc_generator {
+
inline bool StripSuffix(TString* filename, const TString& suffix) {
- if (filename->length() >= suffix.length()) {
- size_t suffix_pos = filename->length() - suffix.length();
+ if (filename->length() >= suffix.length()) {
+ size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, TString::npos, suffix) == 0) {
- filename->resize(filename->size() - suffix.size());
- return true;
- }
- }
-
- return false;
-}
-
+ filename->resize(filename->size() - suffix.size());
+ return true;
+ }
+ }
+
+ return false;
+}
+
inline bool StripPrefix(TString* name, const TString& prefix) {
- if (name->length() >= prefix.length()) {
- if (name->substr(0, prefix.size()) == prefix) {
- *name = name->substr(prefix.size());
- return true;
- }
- }
- return false;
-}
-
+ if (name->length() >= prefix.length()) {
+ if (name->substr(0, prefix.size()) == prefix) {
+ *name = name->substr(prefix.size());
+ return true;
+ }
+ }
+ return false;
+}
+
inline TString StripProto(TString filename) {
- if (!StripSuffix(&filename, ".protodevel")) {
- StripSuffix(&filename, ".proto");
- }
- return filename;
-}
-
+ if (!StripSuffix(&filename, ".protodevel")) {
+ StripSuffix(&filename, ".proto");
+ }
+ return filename;
+}
+
inline TString StringReplace(TString str, const TString& from,
const TString& to, bool replace_all) {
- size_t pos = 0;
-
- do {
- pos = str.find(from, pos);
+ size_t pos = 0;
+
+ do {
+ pos = str.find(from, pos);
if (pos == TString::npos) {
- break;
- }
- str.replace(pos, from.length(), to);
- pos += to.length();
- } while (replace_all);
-
- return str;
-}
-
+ break;
+ }
+ str.replace(pos, from.length(), to);
+ pos += to.length();
+ } while (replace_all);
+
+ return str;
+}
+
inline TString StringReplace(TString str, const TString& from,
const TString& to) {
- return StringReplace(str, from, to, true);
-}
-
+ return StringReplace(str, from, to, true);
+}
+
inline std::vector<TString> tokenize(const TString& input,
const TString& delimiters) {
std::vector<TString> tokens;
- size_t pos, last_pos = 0;
-
- for (;;) {
- bool done = false;
- pos = input.find_first_of(delimiters, last_pos);
+ size_t pos, last_pos = 0;
+
+ for (;;) {
+ bool done = false;
+ pos = input.find_first_of(delimiters, last_pos);
if (pos == TString::npos) {
- done = true;
- pos = input.length();
- }
-
- tokens.push_back(input.substr(last_pos, pos - last_pos));
- if (done) return tokens;
-
- last_pos = pos + 1;
- }
-}
-
+ done = true;
+ pos = input.length();
+ }
+
+ tokens.push_back(input.substr(last_pos, pos - last_pos));
+ if (done) return tokens;
+
+ last_pos = pos + 1;
+ }
+}
+
inline TString CapitalizeFirstLetter(TString s) {
- if (s.empty()) {
- return s;
- }
- s[0] = ::toupper(s[0]);
- return s;
-}
-
+ if (s.empty()) {
+ return s;
+ }
+ s[0] = ::toupper(s[0]);
+ return s;
+}
+
inline TString LowercaseFirstLetter(TString s) {
- if (s.empty()) {
- return s;
- }
- s[0] = ::tolower(s[0]);
- return s;
-}
-
+ if (s.empty()) {
+ return s;
+ }
+ s[0] = ::tolower(s[0]);
+ return s;
+}
+
inline TString LowerUnderscoreToUpperCamel(TString str) {
std::vector<TString> tokens = tokenize(str, "_");
TString result = "";
- for (unsigned int i = 0; i < tokens.size(); i++) {
- result += CapitalizeFirstLetter(tokens[i]);
- }
- return result;
-}
-
+ for (unsigned int i = 0; i < tokens.size(); i++) {
+ result += CapitalizeFirstLetter(tokens[i]);
+ }
+ return result;
+}
+
inline TString FileNameInUpperCamel(
const grpc::protobuf::FileDescriptor* file, bool include_package_path) {
std::vector<TString> tokens = tokenize(StripProto(file->name()), "/");
TString result = "";
- if (include_package_path) {
- for (unsigned int i = 0; i < tokens.size() - 1; i++) {
- result += tokens[i] + "/";
- }
- }
- result += LowerUnderscoreToUpperCamel(tokens.back());
- return result;
-}
-
+ if (include_package_path) {
+ for (unsigned int i = 0; i < tokens.size() - 1; i++) {
+ result += tokens[i] + "/";
+ }
+ }
+ result += LowerUnderscoreToUpperCamel(tokens.back());
+ return result;
+}
+
inline TString FileNameInUpperCamel(
const grpc::protobuf::FileDescriptor* file) {
- return FileNameInUpperCamel(file, true);
-}
-
-enum MethodType {
- METHODTYPE_NO_STREAMING,
- METHODTYPE_CLIENT_STREAMING,
- METHODTYPE_SERVER_STREAMING,
- METHODTYPE_BIDI_STREAMING
-};
-
-inline MethodType GetMethodType(
+ return FileNameInUpperCamel(file, true);
+}
+
+enum MethodType {
+ METHODTYPE_NO_STREAMING,
+ METHODTYPE_CLIENT_STREAMING,
+ METHODTYPE_SERVER_STREAMING,
+ METHODTYPE_BIDI_STREAMING
+};
+
+inline MethodType GetMethodType(
const grpc::protobuf::MethodDescriptor* method) {
- if (method->client_streaming()) {
- if (method->server_streaming()) {
- return METHODTYPE_BIDI_STREAMING;
- } else {
- return METHODTYPE_CLIENT_STREAMING;
- }
- } else {
- if (method->server_streaming()) {
- return METHODTYPE_SERVER_STREAMING;
- } else {
- return METHODTYPE_NO_STREAMING;
- }
- }
-}
-
-template <typename TStringType>
+ if (method->client_streaming()) {
+ if (method->server_streaming()) {
+ return METHODTYPE_BIDI_STREAMING;
+ } else {
+ return METHODTYPE_CLIENT_STREAMING;
+ }
+ } else {
+ if (method->server_streaming()) {
+ return METHODTYPE_SERVER_STREAMING;
+ } else {
+ return METHODTYPE_NO_STREAMING;
+ }
+ }
+}
+
+template <typename TStringType>
inline void Split(const TStringType& s, char /*delim*/,
std::vector<TStringType>* append_to) {
- std::istringstream iss(s);
- TStringType piece;
+ std::istringstream iss(s);
+ TStringType piece;
while (std::getline(iss, piece)) {
- append_to->push_back(piece);
- }
-}
-
-template <>
+ append_to->push_back(piece);
+ }
+}
+
+template <>
inline void Split(const TString &s, char delim,
std::vector<TString> *append_to) {
TVector<TString> parts;
Split(s, TString(1, delim), parts);
for (auto& p : parts) {
append_to->push_back(std::move(p));
- }
-}
-
-enum CommentType {
- COMMENTTYPE_LEADING,
- COMMENTTYPE_TRAILING,
- COMMENTTYPE_LEADING_DETACHED
-};
-
-// Get all the raw comments and append each line without newline to out.
-template <typename DescriptorType>
+ }
+}
+
+enum CommentType {
+ COMMENTTYPE_LEADING,
+ COMMENTTYPE_TRAILING,
+ COMMENTTYPE_LEADING_DETACHED
+};
+
+// Get all the raw comments and append each line without newline to out.
+template <typename DescriptorType>
inline void GetComment(const DescriptorType* desc, CommentType type,
std::vector<TString>* out) {
- grpc::protobuf::SourceLocation location;
- if (!desc->GetSourceLocation(&location)) {
- return;
- }
- if (type == COMMENTTYPE_LEADING || type == COMMENTTYPE_TRAILING) {
+ grpc::protobuf::SourceLocation location;
+ if (!desc->GetSourceLocation(&location)) {
+ return;
+ }
+ if (type == COMMENTTYPE_LEADING || type == COMMENTTYPE_TRAILING) {
const TString& comments = type == COMMENTTYPE_LEADING
? location.leading_comments
: location.trailing_comments;
- Split(comments, '\n', out);
- } else if (type == COMMENTTYPE_LEADING_DETACHED) {
- for (unsigned int i = 0; i < location.leading_detached_comments.size();
- i++) {
- Split(location.leading_detached_comments[i], '\n', out);
- out->push_back("");
- }
- } else {
- std::cerr << "Unknown comment type " << type << std::endl;
- abort();
- }
-}
-
-// Each raw comment line without newline is appended to out.
-// For file level leading and detached leading comments, we return comments
-// above syntax line. Return nothing for trailing comments.
-template <>
+ Split(comments, '\n', out);
+ } else if (type == COMMENTTYPE_LEADING_DETACHED) {
+ for (unsigned int i = 0; i < location.leading_detached_comments.size();
+ i++) {
+ Split(location.leading_detached_comments[i], '\n', out);
+ out->push_back("");
+ }
+ } else {
+ std::cerr << "Unknown comment type " << type << std::endl;
+ abort();
+ }
+}
+
+// Each raw comment line without newline is appended to out.
+// For file level leading and detached leading comments, we return comments
+// above syntax line. Return nothing for trailing comments.
+template <>
inline void GetComment(const grpc::protobuf::FileDescriptor* desc,
CommentType type, std::vector<TString>* out) {
- if (type == COMMENTTYPE_TRAILING) {
- return;
- }
- grpc::protobuf::SourceLocation location;
- std::vector<int> path;
- path.push_back(grpc::protobuf::FileDescriptorProto::kSyntaxFieldNumber);
- if (!desc->GetSourceLocation(path, &location)) {
- return;
- }
- if (type == COMMENTTYPE_LEADING) {
- Split(location.leading_comments, '\n', out);
- } else if (type == COMMENTTYPE_LEADING_DETACHED) {
- for (unsigned int i = 0; i < location.leading_detached_comments.size();
- i++) {
- Split(location.leading_detached_comments[i], '\n', out);
- out->push_back("");
- }
- } else {
- std::cerr << "Unknown comment type " << type << std::endl;
- abort();
- }
-}
-
-// Add prefix and newline to each comment line and concatenate them together.
-// Make sure there is a space after the prefix unless the line is empty.
+ if (type == COMMENTTYPE_TRAILING) {
+ return;
+ }
+ grpc::protobuf::SourceLocation location;
+ std::vector<int> path;
+ path.push_back(grpc::protobuf::FileDescriptorProto::kSyntaxFieldNumber);
+ if (!desc->GetSourceLocation(path, &location)) {
+ return;
+ }
+ if (type == COMMENTTYPE_LEADING) {
+ Split(location.leading_comments, '\n', out);
+ } else if (type == COMMENTTYPE_LEADING_DETACHED) {
+ for (unsigned int i = 0; i < location.leading_detached_comments.size();
+ i++) {
+ Split(location.leading_detached_comments[i], '\n', out);
+ out->push_back("");
+ }
+ } else {
+ std::cerr << "Unknown comment type " << type << std::endl;
+ abort();
+ }
+}
+
+// Add prefix and newline to each comment line and concatenate them together.
+// Make sure there is a space after the prefix unless the line is empty.
inline TString GenerateCommentsWithPrefix(
const std::vector<TString>& in, const TString& prefix) {
- std::ostringstream oss;
- for (auto it = in.begin(); it != in.end(); it++) {
+ std::ostringstream oss;
+ for (auto it = in.begin(); it != in.end(); it++) {
const TString& elem = *it;
- if (elem.empty()) {
- oss << prefix << "\n";
- } else if (elem[0] == ' ') {
- oss << prefix << elem << "\n";
- } else {
- oss << prefix << " " << elem << "\n";
- }
- }
+ if (elem.empty()) {
+ oss << prefix << "\n";
+ } else if (elem[0] == ' ') {
+ oss << prefix << elem << "\n";
+ } else {
+ oss << prefix << " " << elem << "\n";
+ }
+ }
return oss.str();
-}
-
-template <typename DescriptorType>
+}
+
+template <typename DescriptorType>
inline TString GetPrefixedComments(const DescriptorType* desc, bool leading,
const TString& prefix) {
std::vector<TString> out;
- if (leading) {
- grpc_generator::GetComment(
- desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED, &out);
+ if (leading) {
+ grpc_generator::GetComment(
+ desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED, &out);
std::vector<TString> leading;
- grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING,
- &leading);
- out.insert(out.end(), leading.begin(), leading.end());
- } else {
- grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
- &out);
- }
- return GenerateCommentsWithPrefix(out, prefix);
-}
-
-} // namespace grpc_generator
-
-#endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
+ grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING,
+ &leading);
+ out.insert(out.end(), leading.begin(), leading.end());
+ } else {
+ grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
+ &out);
+ }
+ return GenerateCommentsWithPrefix(out, prefix);
+}
+
+} // namespace grpc_generator
+
+#endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/node_generator.cc b/contrib/libs/grpc/src/compiler/node_generator.cc
index 7865705ab4..89e4871a66 100644
--- a/contrib/libs/grpc/src/compiler/node_generator.cc
+++ b/contrib/libs/grpc/src/compiler/node_generator.cc
@@ -1,275 +1,275 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <map>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
+ *
+ */
+
+#include <map>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
#include "src/compiler/node_generator.h"
-#include "src/compiler/node_generator_helpers.h"
-
+#include "src/compiler/node_generator_helpers.h"
+
using grpc::protobuf::Descriptor;
-using grpc::protobuf::FileDescriptor;
+using grpc::protobuf::FileDescriptor;
using grpc::protobuf::MethodDescriptor;
-using grpc::protobuf::ServiceDescriptor;
-using grpc::protobuf::io::Printer;
-using grpc::protobuf::io::StringOutputStream;
-using std::map;
-
-namespace grpc_node_generator {
-namespace {
-
-// Returns the alias we assign to the module of the given .proto filename
-// when importing. Copied entirely from
-// github:google/protobuf/src/google/protobuf/compiler/js/js_generator.cc#L154
+using grpc::protobuf::ServiceDescriptor;
+using grpc::protobuf::io::Printer;
+using grpc::protobuf::io::StringOutputStream;
+using std::map;
+
+namespace grpc_node_generator {
+namespace {
+
+// Returns the alias we assign to the module of the given .proto filename
+// when importing. Copied entirely from
+// github:google/protobuf/src/google/protobuf/compiler/js/js_generator.cc#L154
TString ModuleAlias(const TString filename) {
- // This scheme could technically cause problems if a file includes any 2 of:
- // foo/bar_baz.proto
- // foo_bar_baz.proto
- // foo_bar/baz.proto
- //
- // We'll worry about this problem if/when we actually see it. This name isn't
- // exposed to users so we can change it later if we need to.
+ // This scheme could technically cause problems if a file includes any 2 of:
+ // foo/bar_baz.proto
+ // foo_bar_baz.proto
+ // foo_bar/baz.proto
+ //
+ // We'll worry about this problem if/when we actually see it. This name isn't
+ // exposed to users so we can change it later if we need to.
TString basename = grpc_generator::StripProto(filename);
- basename = grpc_generator::StringReplace(basename, "-", "$");
- basename = grpc_generator::StringReplace(basename, "/", "_");
+ basename = grpc_generator::StringReplace(basename, "-", "$");
+ basename = grpc_generator::StringReplace(basename, "/", "_");
basename = grpc_generator::StringReplace(basename, ".", "_");
- return basename + "_pb";
-}
-
-// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
-// message file foo/bar/baz.js
+ return basename + "_pb";
+}
+
+// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
+// message file foo/bar/baz.js
TString GetJSMessageFilename(const TString& filename) {
TString name = filename;
- return grpc_generator::StripProto(name) + "_pb.js";
-}
-
-// Given a filename like foo/bar/baz.proto, returns the root directory
-// path ../../
+ return grpc_generator::StripProto(name) + "_pb.js";
+}
+
+// Given a filename like foo/bar/baz.proto, returns the root directory
+// path ../../
TString GetRootPath(const TString& from_filename,
const TString& to_filename) {
- if (to_filename.find("google/protobuf") == 0) {
- // Well-known types (.proto files in the google/protobuf directory) are
- // assumed to come from the 'google-protobuf' npm package. We may want to
- // generalize this exception later by letting others put generated code in
- // their own npm packages.
- return "google-protobuf/";
- }
- size_t slashes = std::count(from_filename.begin(), from_filename.end(), '/');
- if (slashes == 0) {
- return "./";
- }
+ if (to_filename.find("google/protobuf") == 0) {
+ // Well-known types (.proto files in the google/protobuf directory) are
+ // assumed to come from the 'google-protobuf' npm package. We may want to
+ // generalize this exception later by letting others put generated code in
+ // their own npm packages.
+ return "google-protobuf/";
+ }
+ size_t slashes = std::count(from_filename.begin(), from_filename.end(), '/');
+ if (slashes == 0) {
+ return "./";
+ }
TString result = "";
- for (size_t i = 0; i < slashes; i++) {
- result += "../";
- }
- return result;
-}
-
-// Return the relative path to load to_file from the directory containing
-// from_file, assuming that both paths are relative to the same directory
+ for (size_t i = 0; i < slashes; i++) {
+ result += "../";
+ }
+ return result;
+}
+
+// Return the relative path to load to_file from the directory containing
+// from_file, assuming that both paths are relative to the same directory
TString GetRelativePath(const TString& from_file,
const TString& to_file) {
- return GetRootPath(from_file, to_file) + to_file;
-}
-
-/* Finds all message types used in all services in the file, and returns them
- * as a map of fully qualified message type name to message descriptor */
+ return GetRootPath(from_file, to_file) + to_file;
+}
+
+/* Finds all message types used in all services in the file, and returns them
+ * as a map of fully qualified message type name to message descriptor */
map<TString, const Descriptor*> GetAllMessages(const FileDescriptor* file) {
map<TString, const Descriptor*> message_types;
- for (int service_num = 0; service_num < file->service_count();
- service_num++) {
+ for (int service_num = 0; service_num < file->service_count();
+ service_num++) {
const ServiceDescriptor* service = file->service(service_num);
- for (int method_num = 0; method_num < service->method_count();
- method_num++) {
+ for (int method_num = 0; method_num < service->method_count();
+ method_num++) {
const MethodDescriptor* method = service->method(method_num);
const Descriptor* input_type = method->input_type();
const Descriptor* output_type = method->output_type();
- message_types[input_type->full_name()] = input_type;
- message_types[output_type->full_name()] = output_type;
- }
- }
- return message_types;
-}
-
+ message_types[input_type->full_name()] = input_type;
+ message_types[output_type->full_name()] = output_type;
+ }
+ }
+ return message_types;
+}
+
TString MessageIdentifierName(const TString& name) {
- return grpc_generator::StringReplace(name, ".", "_");
-}
-
+ return grpc_generator::StringReplace(name, ".", "_");
+}
+
TString NodeObjectPath(const Descriptor* descriptor) {
TString module_alias = ModuleAlias(descriptor->file()->name());
TString name = descriptor->full_name();
- grpc_generator::StripPrefix(&name, descriptor->file()->package() + ".");
- return module_alias + "." + name;
-}
-
-// Prints out the message serializer and deserializer functions
+ grpc_generator::StripPrefix(&name, descriptor->file()->package() + ".");
+ return module_alias + "." + name;
+}
+
+// Prints out the message serializer and deserializer functions
void PrintMessageTransformer(const Descriptor* descriptor, Printer* out,
const Parameters& params) {
map<TString, TString> template_vars;
TString full_name = descriptor->full_name();
- template_vars["identifier_name"] = MessageIdentifierName(full_name);
- template_vars["name"] = full_name;
- template_vars["node_name"] = NodeObjectPath(descriptor);
- // Print the serializer
- out->Print(template_vars, "function serialize_$identifier_name$(arg) {\n");
- out->Indent();
- out->Print(template_vars, "if (!(arg instanceof $node_name$)) {\n");
- out->Indent();
- out->Print(template_vars,
- "throw new Error('Expected argument of type $name$');\n");
- out->Outdent();
- out->Print("}\n");
+ template_vars["identifier_name"] = MessageIdentifierName(full_name);
+ template_vars["name"] = full_name;
+ template_vars["node_name"] = NodeObjectPath(descriptor);
+ // Print the serializer
+ out->Print(template_vars, "function serialize_$identifier_name$(arg) {\n");
+ out->Indent();
+ out->Print(template_vars, "if (!(arg instanceof $node_name$)) {\n");
+ out->Indent();
+ out->Print(template_vars,
+ "throw new Error('Expected argument of type $name$');\n");
+ out->Outdent();
+ out->Print("}\n");
if (params.minimum_node_version > 5) {
// Node version is > 5, we should use Buffer.from
out->Print("return Buffer.from(arg.serializeBinary());\n");
} else {
out->Print("return new Buffer(arg.serializeBinary());\n");
}
- out->Outdent();
- out->Print("}\n\n");
-
- // Print the deserializer
- out->Print(template_vars,
- "function deserialize_$identifier_name$(buffer_arg) {\n");
- out->Indent();
- out->Print(
- template_vars,
- "return $node_name$.deserializeBinary(new Uint8Array(buffer_arg));\n");
- out->Outdent();
- out->Print("}\n\n");
-}
-
+ out->Outdent();
+ out->Print("}\n\n");
+
+ // Print the deserializer
+ out->Print(template_vars,
+ "function deserialize_$identifier_name$(buffer_arg) {\n");
+ out->Indent();
+ out->Print(
+ template_vars,
+ "return $node_name$.deserializeBinary(new Uint8Array(buffer_arg));\n");
+ out->Outdent();
+ out->Print("}\n\n");
+}
+
void PrintMethod(const MethodDescriptor* method, Printer* out) {
const Descriptor* input_type = method->input_type();
const Descriptor* output_type = method->output_type();
map<TString, TString> vars;
- vars["service_name"] = method->service()->full_name();
- vars["name"] = method->name();
- vars["input_type"] = NodeObjectPath(input_type);
- vars["input_type_id"] = MessageIdentifierName(input_type->full_name());
- vars["output_type"] = NodeObjectPath(output_type);
- vars["output_type_id"] = MessageIdentifierName(output_type->full_name());
- vars["client_stream"] = method->client_streaming() ? "true" : "false";
- vars["server_stream"] = method->server_streaming() ? "true" : "false";
- out->Print("{\n");
- out->Indent();
- out->Print(vars, "path: '/$service_name$/$name$',\n");
- out->Print(vars, "requestStream: $client_stream$,\n");
- out->Print(vars, "responseStream: $server_stream$,\n");
- out->Print(vars, "requestType: $input_type$,\n");
- out->Print(vars, "responseType: $output_type$,\n");
- out->Print(vars, "requestSerialize: serialize_$input_type_id$,\n");
- out->Print(vars, "requestDeserialize: deserialize_$input_type_id$,\n");
- out->Print(vars, "responseSerialize: serialize_$output_type_id$,\n");
- out->Print(vars, "responseDeserialize: deserialize_$output_type_id$,\n");
- out->Outdent();
- out->Print("}");
-}
-
-// Prints out the service descriptor object
+ vars["service_name"] = method->service()->full_name();
+ vars["name"] = method->name();
+ vars["input_type"] = NodeObjectPath(input_type);
+ vars["input_type_id"] = MessageIdentifierName(input_type->full_name());
+ vars["output_type"] = NodeObjectPath(output_type);
+ vars["output_type_id"] = MessageIdentifierName(output_type->full_name());
+ vars["client_stream"] = method->client_streaming() ? "true" : "false";
+ vars["server_stream"] = method->server_streaming() ? "true" : "false";
+ out->Print("{\n");
+ out->Indent();
+ out->Print(vars, "path: '/$service_name$/$name$',\n");
+ out->Print(vars, "requestStream: $client_stream$,\n");
+ out->Print(vars, "responseStream: $server_stream$,\n");
+ out->Print(vars, "requestType: $input_type$,\n");
+ out->Print(vars, "responseType: $output_type$,\n");
+ out->Print(vars, "requestSerialize: serialize_$input_type_id$,\n");
+ out->Print(vars, "requestDeserialize: deserialize_$input_type_id$,\n");
+ out->Print(vars, "responseSerialize: serialize_$output_type_id$,\n");
+ out->Print(vars, "responseDeserialize: deserialize_$output_type_id$,\n");
+ out->Outdent();
+ out->Print("}");
+}
+
+// Prints out the service descriptor object
void PrintService(const ServiceDescriptor* service, Printer* out) {
map<TString, TString> template_vars;
- out->Print(GetNodeComments(service, true).c_str());
- template_vars["name"] = service->name();
- out->Print(template_vars, "var $name$Service = exports.$name$Service = {\n");
- out->Indent();
- for (int i = 0; i < service->method_count(); i++) {
+ out->Print(GetNodeComments(service, true).c_str());
+ template_vars["name"] = service->name();
+ out->Print(template_vars, "var $name$Service = exports.$name$Service = {\n");
+ out->Indent();
+ for (int i = 0; i < service->method_count(); i++) {
TString method_name =
- grpc_generator::LowercaseFirstLetter(service->method(i)->name());
- out->Print(GetNodeComments(service->method(i), true).c_str());
- out->Print("$method_name$: ", "method_name", method_name);
- PrintMethod(service->method(i), out);
- out->Print(",\n");
- out->Print(GetNodeComments(service->method(i), false).c_str());
- }
- out->Outdent();
- out->Print("};\n\n");
- out->Print(template_vars,
- "exports.$name$Client = "
- "grpc.makeGenericClientConstructor($name$Service);\n");
- out->Print(GetNodeComments(service, false).c_str());
-}
-
+ grpc_generator::LowercaseFirstLetter(service->method(i)->name());
+ out->Print(GetNodeComments(service->method(i), true).c_str());
+ out->Print("$method_name$: ", "method_name", method_name);
+ PrintMethod(service->method(i), out);
+ out->Print(",\n");
+ out->Print(GetNodeComments(service->method(i), false).c_str());
+ }
+ out->Outdent();
+ out->Print("};\n\n");
+ out->Print(template_vars,
+ "exports.$name$Client = "
+ "grpc.makeGenericClientConstructor($name$Service);\n");
+ out->Print(GetNodeComments(service, false).c_str());
+}
+
void PrintImports(const FileDescriptor* file, Printer* out) {
- out->Print("var grpc = require('grpc');\n");
- if (file->message_type_count() > 0) {
+ out->Print("var grpc = require('grpc');\n");
+ if (file->message_type_count() > 0) {
TString file_path =
- GetRelativePath(file->name(), GetJSMessageFilename(file->name()));
- out->Print("var $module_alias$ = require('$file_path$');\n", "module_alias",
- ModuleAlias(file->name()), "file_path", file_path);
- }
-
- for (int i = 0; i < file->dependency_count(); i++) {
+ GetRelativePath(file->name(), GetJSMessageFilename(file->name()));
+ out->Print("var $module_alias$ = require('$file_path$');\n", "module_alias",
+ ModuleAlias(file->name()), "file_path", file_path);
+ }
+
+ for (int i = 0; i < file->dependency_count(); i++) {
TString file_path = GetRelativePath(
- file->name(), GetJSMessageFilename(file->dependency(i)->name()));
- out->Print("var $module_alias$ = require('$file_path$');\n", "module_alias",
- ModuleAlias(file->dependency(i)->name()), "file_path",
- file_path);
- }
- out->Print("\n");
-}
-
+ file->name(), GetJSMessageFilename(file->dependency(i)->name()));
+ out->Print("var $module_alias$ = require('$file_path$');\n", "module_alias",
+ ModuleAlias(file->dependency(i)->name()), "file_path",
+ file_path);
+ }
+ out->Print("\n");
+}
+
void PrintTransformers(const FileDescriptor* file, Printer* out,
const Parameters& params) {
map<TString, const Descriptor*> messages = GetAllMessages(file);
for (std::map<TString, const Descriptor*>::iterator it = messages.begin();
- it != messages.end(); it++) {
+ it != messages.end(); it++) {
PrintMessageTransformer(it->second, out, params);
- }
- out->Print("\n");
-}
-
+ }
+ out->Print("\n");
+}
+
void PrintServices(const FileDescriptor* file, Printer* out) {
- for (int i = 0; i < file->service_count(); i++) {
- PrintService(file->service(i), out);
- }
-}
+ for (int i = 0; i < file->service_count(); i++) {
+ PrintService(file->service(i), out);
+ }
+}
} // namespace
-
+
TString GenerateFile(const FileDescriptor* file, const Parameters& params) {
TString output;
- {
- StringOutputStream output_stream(&output);
- Printer out(&output_stream, '$');
-
- if (file->service_count() == 0) {
- return output;
- }
- out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
-
+ {
+ StringOutputStream output_stream(&output);
+ Printer out(&output_stream, '$');
+
+ if (file->service_count() == 0) {
+ return output;
+ }
+ out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
+
TString leading_comments = GetNodeComments(file, true);
- if (!leading_comments.empty()) {
- out.Print("// Original file comments:\n");
+ if (!leading_comments.empty()) {
+ out.Print("// Original file comments:\n");
out.PrintRaw(leading_comments.c_str());
- }
-
- out.Print("'use strict';\n");
-
- PrintImports(file, &out);
-
+ }
+
+ out.Print("'use strict';\n");
+
+ PrintImports(file, &out);
+
PrintTransformers(file, &out, params);
-
- PrintServices(file, &out);
-
- out.Print(GetNodeComments(file, false).c_str());
- }
- return output;
-}
-
-} // namespace grpc_node_generator
+
+ PrintServices(file, &out);
+
+ out.Print(GetNodeComments(file, false).c_str());
+ }
+ return output;
+}
+
+} // namespace grpc_node_generator
diff --git a/contrib/libs/grpc/src/compiler/node_generator.h b/contrib/libs/grpc/src/compiler/node_generator.h
index f964a1e479..959df436ea 100644
--- a/contrib/libs/grpc/src/compiler/node_generator.h
+++ b/contrib/libs/grpc/src/compiler/node_generator.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
-
-#include "src/compiler/config.h"
-
-namespace grpc_node_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
+
+#include "src/compiler/config.h"
+
+namespace grpc_node_generator {
+
// Contains all the parameters that are parsed from the command line.
struct Parameters {
// Sets the earliest version of nodejs that needs to be supported.
int minimum_node_version;
};
-
+
TString GenerateFile(const grpc::protobuf::FileDescriptor* file,
const Parameters& params);
-} // namespace grpc_node_generator
-
-#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
+} // namespace grpc_node_generator
+
+#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/node_generator_helpers.h b/contrib/libs/grpc/src/compiler/node_generator_helpers.h
index 1ab0e2eaf8..ccf57ec8a6 100644
--- a/contrib/libs/grpc/src/compiler/node_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/node_generator_helpers.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
-
-#include <algorithm>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-
-namespace grpc_node_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
+
+#include <algorithm>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+
+namespace grpc_node_generator {
+
inline TString GetJSServiceFilename(const TString& filename) {
- return grpc_generator::StripProto(filename) + "_grpc_pb.js";
-}
-
-// Get leading or trailing comments in a string. Comment lines start with "// ".
+ return grpc_generator::StripProto(filename) + "_grpc_pb.js";
+}
+
+// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in front of leading comments.
-template <typename DescriptorType>
+template <typename DescriptorType>
inline TString GetNodeComments(const DescriptorType* desc, bool leading) {
- return grpc_generator::GetPrefixedComments(desc, leading, "//");
-}
-
-} // namespace grpc_node_generator
-
-#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
+ return grpc_generator::GetPrefixedComments(desc, leading, "//");
+}
+
+} // namespace grpc_node_generator
+
+#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator.cc b/contrib/libs/grpc/src/compiler/objective_c_generator.cc
index 80b58ee13c..07826b6a8d 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator.cc
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator.cc
@@ -1,75 +1,75 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <map>
+ *
+ */
+
+#include <map>
#include <set>
-#include <sstream>
-
-#include "src/compiler/config.h"
-#include "src/compiler/objective_c_generator.h"
-#include "src/compiler/objective_c_generator_helpers.h"
-
+#include <sstream>
+
+#include "src/compiler/config.h"
+#include "src/compiler/objective_c_generator.h"
+#include "src/compiler/objective_c_generator_helpers.h"
+
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
-
-using ::google::protobuf::compiler::objectivec::ClassName;
+
+using ::google::protobuf::compiler::objectivec::ClassName;
using ::grpc::protobuf::FileDescriptor;
-using ::grpc::protobuf::MethodDescriptor;
-using ::grpc::protobuf::ServiceDescriptor;
+using ::grpc::protobuf::MethodDescriptor;
+using ::grpc::protobuf::ServiceDescriptor;
using ::grpc::protobuf::io::Printer;
-using ::std::map;
+using ::std::map;
using ::std::set;
-
-namespace grpc_objective_c_generator {
-namespace {
-
+
+namespace grpc_objective_c_generator {
+namespace {
+
void PrintProtoRpcDeclarationAsPragma(Printer* printer,
const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
- vars["client_stream"] = method->client_streaming() ? "stream " : "";
- vars["server_stream"] = method->server_streaming() ? "stream " : "";
-
- printer->Print(vars,
- "#pragma mark $method_name$($client_stream$$request_type$)"
- " returns ($server_stream$$response_type$)\n\n");
-}
-
-template <typename DescriptorType>
+ vars["client_stream"] = method->client_streaming() ? "stream " : "";
+ vars["server_stream"] = method->server_streaming() ? "stream " : "";
+
+ printer->Print(vars,
+ "#pragma mark $method_name$($client_stream$$request_type$)"
+ " returns ($server_stream$$response_type$)\n\n");
+}
+
+template <typename DescriptorType>
static void PrintAllComments(const DescriptorType* desc, Printer* printer,
bool deprecated = false) {
std::vector<TString> comments;
- grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED,
- &comments);
- grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING,
- &comments);
- grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
- &comments);
- if (comments.empty()) {
- return;
- }
- printer->Print("/**\n");
- for (auto it = comments.begin(); it != comments.end(); ++it) {
- printer->Print(" * ");
- size_t start_pos = it->find_first_not_of(' ');
+ grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED,
+ &comments);
+ grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING,
+ &comments);
+ grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
+ &comments);
+ if (comments.empty()) {
+ return;
+ }
+ printer->Print("/**\n");
+ for (auto it = comments.begin(); it != comments.end(); ++it) {
+ printer->Print(" * ");
+ size_t start_pos = it->find_first_not_of(' ');
if (start_pos != TString::npos) {
printer->PrintRaw(it->c_str() + start_pos);
- }
- printer->Print("\n");
- }
+ }
+ printer->Print("\n");
+ }
if (deprecated) {
printer->Print(" *\n");
printer->Print(
@@ -77,49 +77,49 @@ static void PrintAllComments(const DescriptorType* desc, Printer* printer,
"Using"
" the v2 API is recommended.\n");
}
- printer->Print(" */\n");
-}
-
+ printer->Print(" */\n");
+}
+
void PrintMethodSignature(Printer* printer, const MethodDescriptor* method,
const map< ::TString, ::TString>& vars) {
- // Print comment
+ // Print comment
PrintAllComments(method, printer, true);
-
- printer->Print(vars, "- ($return_type$)$method_name$With");
- if (method->client_streaming()) {
- printer->Print("RequestsWriter:(GRXWriter *)requestWriter");
- } else {
- printer->Print(vars, "Request:($request_class$ *)request");
- }
-
- // TODO(jcanizales): Put this on a new line and align colons.
- if (method->server_streaming()) {
- printer->Print(vars,
- " eventHandler:(void(^)(BOOL done, "
- "$response_class$ *_Nullable response, NSError *_Nullable "
- "error))eventHandler");
- } else {
- printer->Print(vars,
- " handler:(void(^)($response_class$ *_Nullable response, "
- "NSError *_Nullable error))handler");
- }
-}
-
+
+ printer->Print(vars, "- ($return_type$)$method_name$With");
+ if (method->client_streaming()) {
+ printer->Print("RequestsWriter:(GRXWriter *)requestWriter");
+ } else {
+ printer->Print(vars, "Request:($request_class$ *)request");
+ }
+
+ // TODO(jcanizales): Put this on a new line and align colons.
+ if (method->server_streaming()) {
+ printer->Print(vars,
+ " eventHandler:(void(^)(BOOL done, "
+ "$response_class$ *_Nullable response, NSError *_Nullable "
+ "error))eventHandler");
+ } else {
+ printer->Print(vars,
+ " handler:(void(^)($response_class$ *_Nullable response, "
+ "NSError *_Nullable error))handler");
+ }
+}
+
void PrintSimpleSignature(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
- vars["method_name"] =
- grpc_generator::LowercaseFirstLetter(vars["method_name"]);
- vars["return_type"] = "void";
- PrintMethodSignature(printer, method, vars);
-}
-
+ vars["method_name"] =
+ grpc_generator::LowercaseFirstLetter(vars["method_name"]);
+ vars["return_type"] = "void";
+ PrintMethodSignature(printer, method, vars);
+}
+
void PrintAdvancedSignature(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
- vars["method_name"] = "RPCTo" + vars["method_name"];
- vars["return_type"] = "GRPCProtoCall *";
- PrintMethodSignature(printer, method, vars);
-}
-
+ vars["method_name"] = "RPCTo" + vars["method_name"];
+ vars["return_type"] = "GRPCProtoCall *";
+ PrintMethodSignature(printer, method, vars);
+}
+
void PrintV2Signature(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
if (method->client_streaming()) {
@@ -146,25 +146,25 @@ void PrintV2Signature(Printer* printer, const MethodDescriptor* method,
inline map< ::TString, ::TString> GetMethodVars(
const MethodDescriptor* method) {
map< ::TString, ::TString> res;
- res["method_name"] = method->name();
- res["request_type"] = method->input_type()->name();
- res["response_type"] = method->output_type()->name();
- res["request_class"] = ClassName(method->input_type());
- res["response_class"] = ClassName(method->output_type());
- return res;
-}
-
+ res["method_name"] = method->name();
+ res["request_type"] = method->input_type()->name();
+ res["response_type"] = method->output_type()->name();
+ res["request_class"] = ClassName(method->input_type());
+ res["response_class"] = ClassName(method->output_type());
+ return res;
+}
+
void PrintMethodDeclarations(Printer* printer, const MethodDescriptor* method) {
map< ::TString, ::TString> vars = GetMethodVars(method);
-
- PrintProtoRpcDeclarationAsPragma(printer, method, vars);
-
- PrintSimpleSignature(printer, method, vars);
- printer->Print(";\n\n");
- PrintAdvancedSignature(printer, method, vars);
- printer->Print(";\n\n\n");
-}
-
+
+ PrintProtoRpcDeclarationAsPragma(printer, method, vars);
+
+ PrintSimpleSignature(printer, method, vars);
+ printer->Print(";\n\n");
+ PrintAdvancedSignature(printer, method, vars);
+ printer->Print(";\n\n\n");
+}
+
void PrintV2MethodDeclarations(Printer* printer,
const MethodDescriptor* method) {
map< ::TString, ::TString> vars = GetMethodVars(method);
@@ -177,46 +177,46 @@ void PrintV2MethodDeclarations(Printer* printer,
void PrintSimpleImplementation(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
- printer->Print("{\n");
- printer->Print(vars, " [[self RPCTo$method_name$With");
- if (method->client_streaming()) {
- printer->Print("RequestsWriter:requestWriter");
- } else {
- printer->Print("Request:request");
- }
- if (method->server_streaming()) {
- printer->Print(" eventHandler:eventHandler] start];\n");
- } else {
- printer->Print(" handler:handler] start];\n");
- }
- printer->Print("}\n");
-}
-
+ printer->Print("{\n");
+ printer->Print(vars, " [[self RPCTo$method_name$With");
+ if (method->client_streaming()) {
+ printer->Print("RequestsWriter:requestWriter");
+ } else {
+ printer->Print("Request:request");
+ }
+ if (method->server_streaming()) {
+ printer->Print(" eventHandler:eventHandler] start];\n");
+ } else {
+ printer->Print(" handler:handler] start];\n");
+ }
+ printer->Print("}\n");
+}
+
void PrintAdvancedImplementation(Printer* printer,
const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
- printer->Print("{\n");
- printer->Print(vars, " return [self RPCToMethod:@\"$method_name$\"\n");
-
- printer->Print(" requestsWriter:");
- if (method->client_streaming()) {
- printer->Print("requestWriter\n");
- } else {
- printer->Print("[GRXWriter writerWithValue:request]\n");
- }
-
- printer->Print(vars, " responseClass:[$response_class$ class]\n");
-
- printer->Print(" responsesWriteable:[GRXWriteable ");
- if (method->server_streaming()) {
- printer->Print("writeableWithEventHandler:eventHandler]];\n");
- } else {
- printer->Print("writeableWithSingleHandler:handler]];\n");
- }
-
- printer->Print("}\n");
-}
-
+ printer->Print("{\n");
+ printer->Print(vars, " return [self RPCToMethod:@\"$method_name$\"\n");
+
+ printer->Print(" requestsWriter:");
+ if (method->client_streaming()) {
+ printer->Print("requestWriter\n");
+ } else {
+ printer->Print("[GRXWriter writerWithValue:request]\n");
+ }
+
+ printer->Print(vars, " responseClass:[$response_class$ class]\n");
+
+ printer->Print(" responsesWriteable:[GRXWriteable ");
+ if (method->server_streaming()) {
+ printer->Print("writeableWithEventHandler:eventHandler]];\n");
+ } else {
+ printer->Print("writeableWithSingleHandler:handler]];\n");
+ }
+
+ printer->Print("}\n");
+}
+
void PrintV2Implementation(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
printer->Print(" {\n");
@@ -240,14 +240,14 @@ void PrintMethodImplementations(Printer* printer,
const MethodDescriptor* method,
const Parameters& generator_params) {
map< ::TString, ::TString> vars = GetMethodVars(method);
-
- PrintProtoRpcDeclarationAsPragma(printer, method, vars);
-
+
+ PrintProtoRpcDeclarationAsPragma(printer, method, vars);
+
if (!generator_params.no_v1_compatibility) {
// TODO(jcanizales): Print documentation from the method.
PrintSimpleSignature(printer, method, vars);
PrintSimpleImplementation(printer, method, vars);
-
+
printer->Print("// Returns a not-yet-started RPC object.\n");
PrintAdvancedSignature(printer, method, vars);
PrintAdvancedImplementation(printer, method, vars);
@@ -255,10 +255,10 @@ void PrintMethodImplementations(Printer* printer,
PrintV2Signature(printer, method, vars);
PrintV2Implementation(printer, method, vars);
-}
-
-} // namespace
-
+}
+
+} // namespace
+
::TString GetAllMessageClasses(const FileDescriptor* file) {
::TString output;
set< ::TString> classes;
@@ -273,20 +273,20 @@ void PrintMethodImplementations(Printer* printer,
for (auto one_class : classes) {
output += "@class " + one_class + ";\n";
}
-
+
return output;
}
-
+
::TString GetProtocol(const ServiceDescriptor* service,
const Parameters& generator_params) {
::TString output;
-
+
if (generator_params.no_v1_compatibility) return output;
// Scope the output stream so it closes and finalizes output to the string.
grpc::protobuf::io::StringOutputStream output_stream(&output);
Printer printer(&output_stream, '$');
-
+
map< ::TString, ::TString> vars = {
{"service_class", ServiceClassName(service)}};
@@ -300,12 +300,12 @@ void PrintMethodImplementations(Printer* printer,
printer.Print(vars, "@protocol $service_class$ <NSObject>\n\n");
for (int i = 0; i < service->method_count(); i++) {
PrintMethodDeclarations(&printer, service->method(i));
- }
+ }
printer.Print("@end\n\n");
- return output;
-}
-
+ return output;
+}
+
::TString GetV2Protocol(const ServiceDescriptor* service) {
::TString output;
@@ -371,16 +371,16 @@ void PrintMethodImplementations(Printer* printer,
::TString GetSource(const ServiceDescriptor* service,
const Parameters& generator_params) {
::TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- grpc::protobuf::io::StringOutputStream output_stream(&output);
- Printer printer(&output_stream, '$');
-
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ grpc::protobuf::io::StringOutputStream output_stream(&output);
+ Printer printer(&output_stream, '$');
+
map< ::TString, ::TString> vars = {
- {"service_name", service->name()},
- {"service_class", ServiceClassName(service)},
- {"package", service->file()->package()}};
-
+ {"service_name", service->name()},
+ {"service_class", ServiceClassName(service)},
+ {"package", service->file()->package()}};
+
printer.Print(vars,
"@implementation $service_class$\n\n"
"#pragma clang diagnostic push\n"
@@ -403,7 +403,7 @@ void PrintMethodImplementations(Printer* printer,
"}\n\n");
}
printer.Print("#pragma clang diagnostic pop\n\n");
-
+
if (!generator_params.no_v1_compatibility) {
printer.Print(
"// Override superclass initializer to disallow different"
@@ -414,14 +414,14 @@ void PrintMethodImplementations(Printer* printer,
" return [self initWithHost:host];\n"
"}\n\n");
}
- printer.Print(
+ printer.Print(
"- (instancetype)initWithHost:(NSString *)host\n"
" packageName:(NSString *)packageName\n"
" serviceName:(NSString *)serviceName\n"
" callOptions:(GRPCCallOptions *)callOptions {\n"
" return [self initWithHost:host callOptions:callOptions];\n"
"}\n\n");
-
+
printer.Print("#pragma mark - Class Methods\n\n");
if (!generator_params.no_v1_compatibility) {
printer.Print(
@@ -437,14 +437,14 @@ void PrintMethodImplementations(Printer* printer,
printer.Print("#pragma mark - Method Implementations\n\n");
- for (int i = 0; i < service->method_count(); i++) {
+ for (int i = 0; i < service->method_count(); i++) {
PrintMethodImplementations(&printer, service->method(i),
generator_params);
- }
-
- printer.Print("@end\n");
- }
- return output;
-}
-
-} // namespace grpc_objective_c_generator
+ }
+
+ printer.Print("@end\n");
+ }
+ return output;
+}
+
+} // namespace grpc_objective_c_generator
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator.h b/contrib/libs/grpc/src/compiler/objective_c_generator.h
index 0f3eb63566..9770f65436 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator.h
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator.h
@@ -1,40 +1,40 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
-
-#include "src/compiler/config.h"
-
-namespace grpc_objective_c_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
+
+#include "src/compiler/config.h"
+
+namespace grpc_objective_c_generator {
+
struct Parameters {
// Do not generate V1 interface and implementation
bool no_v1_compatibility;
};
using ::grpc::protobuf::FileDescriptor;
-using ::grpc::protobuf::ServiceDescriptor;
+using ::grpc::protobuf::ServiceDescriptor;
using ::TString;
-
+
// Returns forward declaration of classes in the generated header file.
string GetAllMessageClasses(const FileDescriptor* file);
-
+
// Returns the content to be included defining the @protocol segment at the
// insertion point of the generated implementation file. This interface is
// legacy and for backwards compatibility.
@@ -50,11 +50,11 @@ string GetV2Protocol(const ServiceDescriptor* service);
string GetInterface(const ServiceDescriptor* service,
const Parameters& generator_params);
-// Returns the content to be included in the "global_scope" insertion point of
-// the generated implementation file.
+// Returns the content to be included in the "global_scope" insertion point of
+// the generated implementation file.
string GetSource(const ServiceDescriptor* service,
const Parameters& generator_params);
-
-} // namespace grpc_objective_c_generator
-
-#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
+
+} // namespace grpc_objective_c_generator
+
+#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h b/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
index ee42afe62b..ae296741ce 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
@@ -1,49 +1,49 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
-
-#include <map>
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
+
+#include <map>
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
-namespace grpc_objective_c_generator {
-
-using ::grpc::protobuf::FileDescriptor;
-using ::grpc::protobuf::ServiceDescriptor;
+namespace grpc_objective_c_generator {
+
+using ::grpc::protobuf::FileDescriptor;
+using ::grpc::protobuf::ServiceDescriptor;
using ::TString;
-
+
inline string MessageHeaderName(const FileDescriptor* file) {
return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
-}
-
+}
+
inline string ServiceClassName(const ServiceDescriptor* service) {
const FileDescriptor* file = service->file();
- string prefix = file->options().objc_class_prefix();
- return prefix + service->name();
-}
+ string prefix = file->options().objc_class_prefix();
+ return prefix + service->name();
+}
inline ::TString LocalImport(const ::TString& import) {
return ::TString("#import \"" + import + "\"\n");
-}
+}
inline ::TString FrameworkImport(const ::TString& import,
const ::TString& framework) {
@@ -91,4 +91,4 @@ inline ::TString PreprocIfNotElse(const ::TString& symbol,
}
} // namespace grpc_objective_c_generator
-#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
+#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/php_generator.cc b/contrib/libs/grpc/src/compiler/php_generator.cc
index a4a5f5aa80..b35d3f2a02 100644
--- a/contrib/libs/grpc/src/compiler/php_generator.cc
+++ b/contrib/libs/grpc/src/compiler/php_generator.cc
@@ -1,50 +1,50 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <map>
-
+ *
+ */
+
+#include <map>
+
#include <google/protobuf/compiler/php/php_generator.h>
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-#include "src/compiler/php_generator_helpers.h"
-
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+#include "src/compiler/php_generator_helpers.h"
+
using google::protobuf::compiler::php::GeneratedClassName;
using grpc::protobuf::Descriptor;
-using grpc::protobuf::FileDescriptor;
+using grpc::protobuf::FileDescriptor;
using grpc::protobuf::MethodDescriptor;
-using grpc::protobuf::ServiceDescriptor;
-using grpc::protobuf::io::Printer;
-using grpc::protobuf::io::StringOutputStream;
-using std::map;
-
-namespace grpc_php_generator {
-namespace {
-
+using grpc::protobuf::ServiceDescriptor;
+using grpc::protobuf::io::Printer;
+using grpc::protobuf::io::StringOutputStream;
+using std::map;
+
+namespace grpc_php_generator {
+namespace {
+
TString ConvertToPhpNamespace(const TString& name) {
std::vector<TString> tokens = grpc_generator::tokenize(name, ".");
- std::ostringstream oss;
- for (unsigned int i = 0; i < tokens.size(); i++) {
- oss << (i == 0 ? "" : "\\")
- << grpc_generator::CapitalizeFirstLetter(tokens[i]);
- }
- return oss.str();
-}
-
+ std::ostringstream oss;
+ for (unsigned int i = 0; i < tokens.size(); i++) {
+ oss << (i == 0 ? "" : "\\")
+ << grpc_generator::CapitalizeFirstLetter(tokens[i]);
+ }
+ return oss.str();
+}
+
TString PackageName(const FileDescriptor* file) {
if (file->options().has_php_namespace()) {
return file->options().php_namespace();
@@ -68,70 +68,70 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
const Descriptor* input_type = method->input_type();
const Descriptor* output_type = method->output_type();
map<TString, TString> vars;
- vars["service_name"] = method->service()->full_name();
- vars["name"] = method->name();
+ vars["service_name"] = method->service()->full_name();
+ vars["name"] = method->name();
vars["input_type_id"] =
MessageIdentifierName(GeneratedClassName(input_type), input_type->file());
vars["output_type_id"] = MessageIdentifierName(
GeneratedClassName(output_type), output_type->file());
-
- out->Print("/**\n");
- out->Print(GetPHPComments(method, " *").c_str());
- if (method->client_streaming()) {
+
+ out->Print("/**\n");
+ out->Print(GetPHPComments(method, " *").c_str());
+ if (method->client_streaming()) {
if (method->server_streaming()) {
vars["return_type_id"] = "\\Grpc\\BidiStreamingCall";
} else {
vars["return_type_id"] = "\\Grpc\\ClientStreamingCall";
}
- out->Print(vars,
- " * @param array $$metadata metadata\n"
+ out->Print(vars,
+ " * @param array $$metadata metadata\n"
" * @param array $$options call options\n"
" * @return $return_type_id$\n */\n"
- "public function $name$($$metadata = [], "
- "$$options = []) {\n");
- out->Indent();
+ "public function $name$($$metadata = [], "
+ "$$options = []) {\n");
+ out->Indent();
out->Indent();
- if (method->server_streaming()) {
- out->Print("return $$this->_bidiRequest(");
- } else {
- out->Print("return $$this->_clientStreamRequest(");
- }
- out->Print(vars,
- "'/$service_name$/$name$',\n"
- "['\\$output_type_id$','decode'],\n"
- "$$metadata, $$options);\n");
- } else {
+ if (method->server_streaming()) {
+ out->Print("return $$this->_bidiRequest(");
+ } else {
+ out->Print("return $$this->_clientStreamRequest(");
+ }
+ out->Print(vars,
+ "'/$service_name$/$name$',\n"
+ "['\\$output_type_id$','decode'],\n"
+ "$$metadata, $$options);\n");
+ } else {
if (method->server_streaming()) {
vars["return_type_id"] = "\\Grpc\\ServerStreamingCall";
} else {
vars["return_type_id"] = "\\Grpc\\UnaryCall";
}
- out->Print(vars,
- " * @param \\$input_type_id$ $$argument input argument\n"
- " * @param array $$metadata metadata\n"
+ out->Print(vars,
+ " * @param \\$input_type_id$ $$argument input argument\n"
+ " * @param array $$metadata metadata\n"
" * @param array $$options call options\n"
" * @return $return_type_id$\n */\n"
- "public function $name$(\\$input_type_id$ $$argument,\n"
- " $$metadata = [], $$options = []) {\n");
- out->Indent();
+ "public function $name$(\\$input_type_id$ $$argument,\n"
+ " $$metadata = [], $$options = []) {\n");
+ out->Indent();
out->Indent();
- if (method->server_streaming()) {
- out->Print("return $$this->_serverStreamRequest(");
- } else {
- out->Print("return $$this->_simpleRequest(");
- }
- out->Print(vars,
- "'/$service_name$/$name$',\n"
- "$$argument,\n"
- "['\\$output_type_id$', 'decode'],\n"
- "$$metadata, $$options);\n");
- }
- out->Outdent();
+ if (method->server_streaming()) {
+ out->Print("return $$this->_serverStreamRequest(");
+ } else {
+ out->Print("return $$this->_simpleRequest(");
+ }
+ out->Print(vars,
+ "'/$service_name$/$name$',\n"
+ "$$argument,\n"
+ "['\\$output_type_id$', 'decode'],\n"
+ "$$metadata, $$options);\n");
+ }
+ out->Outdent();
out->Outdent();
- out->Print("}\n\n");
-}
-
-// Prints out the service descriptor object
+ out->Print("}\n\n");
+}
+
+// Prints out the service descriptor object
void PrintService(const ServiceDescriptor* service,
const TString& class_suffix, Printer* out) {
map<TString, TString> vars;
@@ -140,57 +140,57 @@ void PrintService(const ServiceDescriptor* service,
out->Print(" */\n");
vars["name"] = GetPHPServiceClassname(service, class_suffix);
out->Print(vars, "class $name$ extends \\Grpc\\BaseStub {\n\n");
- out->Indent();
out->Indent();
- out->Print(
- "/**\n * @param string $$hostname hostname\n"
- " * @param array $$opts channel options\n"
+ out->Indent();
+ out->Print(
+ "/**\n * @param string $$hostname hostname\n"
+ " * @param array $$opts channel options\n"
" * @param \\Grpc\\Channel $$channel (optional) re-use channel "
- "object\n */\n"
- "public function __construct($$hostname, $$opts, "
- "$$channel = null) {\n");
- out->Indent();
+ "object\n */\n"
+ "public function __construct($$hostname, $$opts, "
+ "$$channel = null) {\n");
+ out->Indent();
out->Indent();
- out->Print("parent::__construct($$hostname, $$opts, $$channel);\n");
- out->Outdent();
+ out->Print("parent::__construct($$hostname, $$opts, $$channel);\n");
+ out->Outdent();
out->Outdent();
- out->Print("}\n\n");
- for (int i = 0; i < service->method_count(); i++) {
+ out->Print("}\n\n");
+ for (int i = 0; i < service->method_count(); i++) {
TString method_name =
- grpc_generator::LowercaseFirstLetter(service->method(i)->name());
- PrintMethod(service->method(i), out);
- }
- out->Outdent();
- out->Outdent();
- out->Print("}\n");
-}
+ grpc_generator::LowercaseFirstLetter(service->method(i)->name());
+ PrintMethod(service->method(i), out);
+ }
+ out->Outdent();
+ out->Outdent();
+ out->Print("}\n");
+}
} // namespace
-
+
TString GenerateFile(const FileDescriptor* file,
const ServiceDescriptor* service,
const TString& class_suffix) {
TString output;
- {
- StringOutputStream output_stream(&output);
- Printer out(&output_stream, '$');
-
- out.Print("<?php\n");
- out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
-
+ {
+ StringOutputStream output_stream(&output);
+ Printer out(&output_stream, '$');
+
+ out.Print("<?php\n");
+ out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
+
TString leading_comments = GetPHPComments(file, "//");
- if (!leading_comments.empty()) {
- out.Print("// Original file comments:\n");
+ if (!leading_comments.empty()) {
+ out.Print("// Original file comments:\n");
out.PrintRaw(leading_comments.c_str());
- }
-
+ }
+
map<TString, TString> vars;
TString php_namespace = PackageName(file);
vars["package"] = php_namespace;
out.Print(vars, "namespace $package$;\n\n");
PrintService(service, class_suffix, &out);
- }
- return output;
-}
-
-} // namespace grpc_php_generator
+ }
+ return output;
+}
+
+} // namespace grpc_php_generator
diff --git a/contrib/libs/grpc/src/compiler/php_generator_helpers.h b/contrib/libs/grpc/src/compiler/php_generator_helpers.h
index ba642e2ecd..70a31eaf75 100644
--- a/contrib/libs/grpc/src/compiler/php_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/php_generator_helpers.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
-
-#include <algorithm>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-
-namespace grpc_php_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
+
+#include <algorithm>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+
+namespace grpc_php_generator {
+
inline TString GetPHPServiceClassname(
const grpc::protobuf::ServiceDescriptor* service,
const TString& class_suffix) {
return service->name() + (class_suffix == "" ? "Client" : class_suffix);
-}
-
+}
+
// ReplaceAll replaces all instances of search with replace in s.
inline TString ReplaceAll(TString s, const TString& search,
const TString& replace) {
@@ -62,15 +62,15 @@ inline TString GetPHPServiceFilename(
".php";
}
-// Get leading or trailing comments in a string. Comment lines start with "// ".
+// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in front of leading comments.
-template <typename DescriptorType>
+template <typename DescriptorType>
inline TString GetPHPComments(const DescriptorType* desc,
TString prefix) {
return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix),
"*/", "&#42;/");
-}
-
-} // namespace grpc_php_generator
-
-#endif // GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
+}
+
+} // namespace grpc_php_generator
+
+#endif // GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/python_generator.cc b/contrib/libs/grpc/src/compiler/python_generator.cc
index 31fe39dbf7..d083d19f0b 100644
--- a/contrib/libs/grpc/src/compiler/python_generator.cc
+++ b/contrib/libs/grpc/src/compiler/python_generator.cc
@@ -1,97 +1,97 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <algorithm>
-#include <cassert>
-#include <cctype>
-#include <cstring>
-#include <fstream>
-#include <iostream>
-#include <map>
-#include <memory>
-#include <ostream>
-#include <set>
-#include <sstream>
-#include <tuple>
-#include <vector>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
+ *
+ */
+
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <cstring>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <memory>
+#include <ostream>
+#include <set>
+#include <sstream>
+#include <tuple>
+#include <vector>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
#include "src/compiler/protobuf_plugin.h"
-#include "src/compiler/python_generator.h"
+#include "src/compiler/python_generator.h"
#include "src/compiler/python_generator_helpers.h"
#include "src/compiler/python_private_generator.h"
-
-using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::compiler::GeneratorContext;
-using grpc::protobuf::io::CodedOutputStream;
-using grpc::protobuf::io::ZeroCopyOutputStream;
-using std::make_pair;
-using std::map;
-using std::pair;
-using std::replace;
+
+using grpc::protobuf::FileDescriptor;
+using grpc::protobuf::compiler::GeneratorContext;
+using grpc::protobuf::io::CodedOutputStream;
+using grpc::protobuf::io::ZeroCopyOutputStream;
+using std::make_pair;
+using std::map;
+using std::pair;
+using std::replace;
using std::set;
-using std::tuple;
-using std::vector;
-
-namespace grpc_python_generator {
-
+using std::tuple;
+using std::vector;
+
+namespace grpc_python_generator {
+
TString generator_file_name;
-namespace {
-
+namespace {
+
typedef map<TString, TString> StringMap;
typedef vector<TString> StringVector;
typedef tuple<TString, TString> StringPair;
-typedef set<StringPair> StringPairSet;
-
-// Provides RAII indentation handling. Use as:
-// {
-// IndentScope raii_my_indent_var_name_here(my_py_printer);
-// // constructor indented my_py_printer
-// ...
-// // destructor called at end of scope, un-indenting my_py_printer
-// }
-class IndentScope {
- public:
+typedef set<StringPair> StringPairSet;
+
+// Provides RAII indentation handling. Use as:
+// {
+// IndentScope raii_my_indent_var_name_here(my_py_printer);
+// // constructor indented my_py_printer
+// ...
+// // destructor called at end of scope, un-indenting my_py_printer
+// }
+class IndentScope {
+ public:
explicit IndentScope(grpc_generator::Printer* printer) : printer_(printer) {
// NOTE(rbellevi): Two-space tabs are hard-coded in the protocol compiler.
// Doubling our indents and outdents guarantees compliance with PEP8.
- printer_->Indent();
printer_->Indent();
- }
-
+ printer_->Indent();
+ }
+
~IndentScope() {
printer_->Outdent();
printer_->Outdent();
}
-
- private:
+
+ private:
grpc_generator::Printer* printer_;
-};
-
-PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config,
+};
+
+PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config,
const grpc_generator::File* file)
- : config(config), file(file) {}
-
+ : config(config), file(file) {}
+
void PrivateGenerator::PrintAllComments(StringVector comments,
grpc_generator::Printer* out) {
- if (comments.empty()) {
+ if (comments.empty()) {
// Python requires code structures like class and def to have
// a body, even if it is just "pass" or a docstring. We need
// to ensure not to generate empty bodies. We could do something
@@ -101,38 +101,38 @@ void PrivateGenerator::PrintAllComments(StringVector comments,
out->Print(
"\"\"\"Missing associated documentation comment in .proto "
"file.\"\"\"\n");
- return;
- }
- out->Print("\"\"\"");
- for (StringVector::iterator it = comments.begin(); it != comments.end();
- ++it) {
- size_t start_pos = it->find_first_not_of(' ');
+ return;
+ }
+ out->Print("\"\"\"");
+ for (StringVector::iterator it = comments.begin(); it != comments.end();
+ ++it) {
+ size_t start_pos = it->find_first_not_of(' ');
if (start_pos != TString::npos) {
out->PrintRaw(it->c_str() + start_pos);
- }
- out->Print("\n");
- }
- out->Print("\"\"\"\n");
-}
-
+ }
+ out->Print("\n");
+ }
+ out->Print("\"\"\"\n");
+}
+
bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
grpc_generator::Printer* out) {
StringMap service_dict;
service_dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(service_dict, "class Beta$Service$Servicer(object):\n");
- {
- IndentScope raii_class_indent(out);
- out->Print(
- "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
- "\nIt is recommended to use the GA API (classes and functions in this\n"
- "file not marked beta) for all further purposes. This class was "
- "generated\n"
- "only to ease transition from grpcio<0.15.0 to "
- "grpcio>=0.15.0.\"\"\"\n");
+ {
+ IndentScope raii_class_indent(out);
+ out->Print(
+ "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
+ "\nIt is recommended to use the GA API (classes and functions in this\n"
+ "file not marked beta) for all further purposes. This class was "
+ "generated\n"
+ "only to ease transition from grpcio<0.15.0 to "
+ "grpcio>=0.15.0.\"\"\"\n");
StringVector service_comments = service->GetAllComments();
PrintAllComments(service_comments, out);
- for (int i = 0; i < service->method_count(); ++i) {
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
TString arg_name =
method->ClientStreaming() ? "request_iterator" : "request";
@@ -140,188 +140,188 @@ bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
method_dict["Method"] = method->name();
method_dict["ArgName"] = arg_name;
out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
- {
- IndentScope raii_method_indent(out);
+ {
+ IndentScope raii_method_indent(out);
StringVector method_comments = method->GetAllComments();
PrintAllComments(method_comments, out);
- out->Print("context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)\n");
- }
- }
- }
- return true;
-}
-
+ out->Print("context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)\n");
+ }
+ }
+ }
+ return true;
+}
+
bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
grpc_generator::Printer* out) {
StringMap service_dict;
service_dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(service_dict, "class Beta$Service$Stub(object):\n");
- {
- IndentScope raii_class_indent(out);
- out->Print(
- "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
- "\nIt is recommended to use the GA API (classes and functions in this\n"
- "file not marked beta) for all further purposes. This class was "
- "generated\n"
- "only to ease transition from grpcio<0.15.0 to "
- "grpcio>=0.15.0.\"\"\"\n");
+ {
+ IndentScope raii_class_indent(out);
+ out->Print(
+ "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
+ "\nIt is recommended to use the GA API (classes and functions in this\n"
+ "file not marked beta) for all further purposes. This class was "
+ "generated\n"
+ "only to ease transition from grpcio<0.15.0 to "
+ "grpcio>=0.15.0.\"\"\"\n");
StringVector service_comments = service->GetAllComments();
PrintAllComments(service_comments, out);
- for (int i = 0; i < service->method_count(); ++i) {
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
TString arg_name =
method->ClientStreaming() ? "request_iterator" : "request";
- StringMap method_dict;
- method_dict["Method"] = method->name();
- method_dict["ArgName"] = arg_name;
- out->Print(method_dict,
- "def $Method$(self, $ArgName$, timeout, metadata=None, "
- "with_call=False, protocol_options=None):\n");
- {
- IndentScope raii_method_indent(out);
+ StringMap method_dict;
+ method_dict["Method"] = method->name();
+ method_dict["ArgName"] = arg_name;
+ out->Print(method_dict,
+ "def $Method$(self, $ArgName$, timeout, metadata=None, "
+ "with_call=False, protocol_options=None):\n");
+ {
+ IndentScope raii_method_indent(out);
StringVector method_comments = method->GetAllComments();
PrintAllComments(method_comments, out);
- out->Print("raise NotImplementedError()\n");
- }
+ out->Print("raise NotImplementedError()\n");
+ }
if (!method->ServerStreaming()) {
- out->Print(method_dict, "$Method$.future = None\n");
- }
- }
- }
- return true;
-}
-
-bool PrivateGenerator::PrintBetaServerFactory(
+ out->Print(method_dict, "$Method$.future = None\n");
+ }
+ }
+ }
+ return true;
+}
+
+bool PrivateGenerator::PrintBetaServerFactory(
const TString& package_qualified_service_name,
const grpc_generator::Service* service, grpc_generator::Printer* out) {
StringMap service_dict;
service_dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(service_dict,
"def beta_create_$Service$_server(servicer, pool=None, "
"pool_size=None, default_timeout=None, maximum_timeout=None):\n");
- {
- IndentScope raii_create_server_indent(out);
- out->Print(
- "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
- "\nIt is recommended to use the GA API (classes and functions in this\n"
- "file not marked beta) for all further purposes. This function was\n"
- "generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"
- "\"\"\"\n");
- StringMap method_implementation_constructors;
- StringMap input_message_modules_and_classes;
- StringMap output_message_modules_and_classes;
- for (int i = 0; i < service->method_count(); ++i) {
+ {
+ IndentScope raii_create_server_indent(out);
+ out->Print(
+ "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
+ "\nIt is recommended to use the GA API (classes and functions in this\n"
+ "file not marked beta) for all further purposes. This function was\n"
+ "generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"
+ "\"\"\"\n");
+ StringMap method_implementation_constructors;
+ StringMap input_message_modules_and_classes;
+ StringMap output_message_modules_and_classes;
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
const TString method_implementation_constructor =
TString(method->ClientStreaming() ? "stream_" : "unary_") +
TString(method->ServerStreaming() ? "stream_" : "unary_") +
- "inline";
+ "inline";
TString input_message_module_and_class;
if (!method->get_module_and_message_path_input(
&input_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
TString output_message_module_and_class;
if (!method->get_module_and_message_path_output(
&output_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
- method_implementation_constructors.insert(
- make_pair(method->name(), method_implementation_constructor));
- input_message_modules_and_classes.insert(
- make_pair(method->name(), input_message_module_and_class));
- output_message_modules_and_classes.insert(
- make_pair(method->name(), output_message_module_and_class));
- }
+ return false;
+ }
+ method_implementation_constructors.insert(
+ make_pair(method->name(), method_implementation_constructor));
+ input_message_modules_and_classes.insert(
+ make_pair(method->name(), input_message_module_and_class));
+ output_message_modules_and_classes.insert(
+ make_pair(method->name(), output_message_module_and_class));
+ }
StringMap method_dict;
method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
- out->Print("request_deserializers = {\n");
- for (StringMap::iterator name_and_input_module_class_pair =
- input_message_modules_and_classes.begin();
- name_and_input_module_class_pair !=
- input_message_modules_and_classes.end();
- name_and_input_module_class_pair++) {
+ out->Print("request_deserializers = {\n");
+ for (StringMap::iterator name_and_input_module_class_pair =
+ input_message_modules_and_classes.begin();
+ name_and_input_module_class_pair !=
+ input_message_modules_and_classes.end();
+ name_and_input_module_class_pair++) {
method_dict["MethodName"] = name_and_input_module_class_pair->first;
method_dict["InputTypeModuleAndClass"] =
name_and_input_module_class_pair->second;
- IndentScope raii_indent(out);
+ IndentScope raii_indent(out);
out->Print(method_dict,
"(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
"$InputTypeModuleAndClass$.FromString,\n");
- }
- out->Print("}\n");
- out->Print("response_serializers = {\n");
- for (StringMap::iterator name_and_output_module_class_pair =
- output_message_modules_and_classes.begin();
- name_and_output_module_class_pair !=
- output_message_modules_and_classes.end();
- name_and_output_module_class_pair++) {
+ }
+ out->Print("}\n");
+ out->Print("response_serializers = {\n");
+ for (StringMap::iterator name_and_output_module_class_pair =
+ output_message_modules_and_classes.begin();
+ name_and_output_module_class_pair !=
+ output_message_modules_and_classes.end();
+ name_and_output_module_class_pair++) {
method_dict["MethodName"] = name_and_output_module_class_pair->first;
method_dict["OutputTypeModuleAndClass"] =
name_and_output_module_class_pair->second;
- IndentScope raii_indent(out);
+ IndentScope raii_indent(out);
out->Print(method_dict,
"(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
"$OutputTypeModuleAndClass$.SerializeToString,\n");
- }
- out->Print("}\n");
- out->Print("method_implementations = {\n");
- for (StringMap::iterator name_and_implementation_constructor =
- method_implementation_constructors.begin();
- name_and_implementation_constructor !=
- method_implementation_constructors.end();
- name_and_implementation_constructor++) {
+ }
+ out->Print("}\n");
+ out->Print("method_implementations = {\n");
+ for (StringMap::iterator name_and_implementation_constructor =
+ method_implementation_constructors.begin();
+ name_and_implementation_constructor !=
+ method_implementation_constructors.end();
+ name_and_implementation_constructor++) {
method_dict["Method"] = name_and_implementation_constructor->first;
method_dict["Constructor"] = name_and_implementation_constructor->second;
- IndentScope raii_descriptions_indent(out);
+ IndentScope raii_descriptions_indent(out);
const TString method_name =
- name_and_implementation_constructor->first;
+ name_and_implementation_constructor->first;
out->Print(method_dict,
"(\'$PackageQualifiedServiceName$\', \'$Method$\'): "
"face_utilities.$Constructor$(servicer.$Method$),\n");
- }
- out->Print("}\n");
- out->Print(
- "server_options = beta_implementations.server_options("
- "request_deserializers=request_deserializers, "
- "response_serializers=response_serializers, "
- "thread_pool=pool, thread_pool_size=pool_size, "
- "default_timeout=default_timeout, "
- "maximum_timeout=maximum_timeout)\n");
- out->Print(
- "return beta_implementations.server(method_implementations, "
- "options=server_options)\n");
- }
- return true;
-}
-
-bool PrivateGenerator::PrintBetaStubFactory(
+ }
+ out->Print("}\n");
+ out->Print(
+ "server_options = beta_implementations.server_options("
+ "request_deserializers=request_deserializers, "
+ "response_serializers=response_serializers, "
+ "thread_pool=pool, thread_pool_size=pool_size, "
+ "default_timeout=default_timeout, "
+ "maximum_timeout=maximum_timeout)\n");
+ out->Print(
+ "return beta_implementations.server(method_implementations, "
+ "options=server_options)\n");
+ }
+ return true;
+}
+
+bool PrivateGenerator::PrintBetaStubFactory(
const TString& package_qualified_service_name,
const grpc_generator::Service* service, grpc_generator::Printer* out) {
- StringMap dict;
- dict["Service"] = service->name();
- out->Print("\n\n");
- out->Print(dict,
- "def beta_create_$Service$_stub(channel, host=None,"
- " metadata_transformer=None, pool=None, pool_size=None):\n");
- {
- IndentScope raii_create_server_indent(out);
- out->Print(
- "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
- "\nIt is recommended to use the GA API (classes and functions in this\n"
- "file not marked beta) for all further purposes. This function was\n"
- "generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"
- "\"\"\"\n");
- StringMap method_cardinalities;
- StringMap input_message_modules_and_classes;
- StringMap output_message_modules_and_classes;
- for (int i = 0; i < service->method_count(); ++i) {
+ StringMap dict;
+ dict["Service"] = service->name();
+ out->Print("\n\n");
+ out->Print(dict,
+ "def beta_create_$Service$_stub(channel, host=None,"
+ " metadata_transformer=None, pool=None, pool_size=None):\n");
+ {
+ IndentScope raii_create_server_indent(out);
+ out->Print(
+ "\"\"\"The Beta API is deprecated for 0.15.0 and later.\n"
+ "\nIt is recommended to use the GA API (classes and functions in this\n"
+ "file not marked beta) for all further purposes. This function was\n"
+ "generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"
+ "\"\"\"\n");
+ StringMap method_cardinalities;
+ StringMap input_message_modules_and_classes;
+ StringMap output_message_modules_and_classes;
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
const TString method_cardinality =
TString(method->ClientStreaming() ? "STREAM" : "UNARY") + "_" +
@@ -331,104 +331,104 @@ bool PrivateGenerator::PrintBetaStubFactory(
&input_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
TString output_message_module_and_class;
if (!method->get_module_and_message_path_output(
&output_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
- method_cardinalities.insert(
- make_pair(method->name(), method_cardinality));
- input_message_modules_and_classes.insert(
- make_pair(method->name(), input_message_module_and_class));
- output_message_modules_and_classes.insert(
- make_pair(method->name(), output_message_module_and_class));
- }
+ return false;
+ }
+ method_cardinalities.insert(
+ make_pair(method->name(), method_cardinality));
+ input_message_modules_and_classes.insert(
+ make_pair(method->name(), input_message_module_and_class));
+ output_message_modules_and_classes.insert(
+ make_pair(method->name(), output_message_module_and_class));
+ }
StringMap method_dict;
method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
- out->Print("request_serializers = {\n");
- for (StringMap::iterator name_and_input_module_class_pair =
- input_message_modules_and_classes.begin();
- name_and_input_module_class_pair !=
- input_message_modules_and_classes.end();
- name_and_input_module_class_pair++) {
+ out->Print("request_serializers = {\n");
+ for (StringMap::iterator name_and_input_module_class_pair =
+ input_message_modules_and_classes.begin();
+ name_and_input_module_class_pair !=
+ input_message_modules_and_classes.end();
+ name_and_input_module_class_pair++) {
method_dict["MethodName"] = name_and_input_module_class_pair->first;
method_dict["InputTypeModuleAndClass"] =
name_and_input_module_class_pair->second;
- IndentScope raii_indent(out);
+ IndentScope raii_indent(out);
out->Print(method_dict,
"(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
"$InputTypeModuleAndClass$.SerializeToString,\n");
- }
- out->Print("}\n");
- out->Print("response_deserializers = {\n");
- for (StringMap::iterator name_and_output_module_class_pair =
- output_message_modules_and_classes.begin();
- name_and_output_module_class_pair !=
- output_message_modules_and_classes.end();
- name_and_output_module_class_pair++) {
+ }
+ out->Print("}\n");
+ out->Print("response_deserializers = {\n");
+ for (StringMap::iterator name_and_output_module_class_pair =
+ output_message_modules_and_classes.begin();
+ name_and_output_module_class_pair !=
+ output_message_modules_and_classes.end();
+ name_and_output_module_class_pair++) {
method_dict["MethodName"] = name_and_output_module_class_pair->first;
method_dict["OutputTypeModuleAndClass"] =
name_and_output_module_class_pair->second;
- IndentScope raii_indent(out);
+ IndentScope raii_indent(out);
out->Print(method_dict,
"(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
"$OutputTypeModuleAndClass$.FromString,\n");
- }
- out->Print("}\n");
- out->Print("cardinalities = {\n");
- for (StringMap::iterator name_and_cardinality =
- method_cardinalities.begin();
- name_and_cardinality != method_cardinalities.end();
- name_and_cardinality++) {
+ }
+ out->Print("}\n");
+ out->Print("cardinalities = {\n");
+ for (StringMap::iterator name_and_cardinality =
+ method_cardinalities.begin();
+ name_and_cardinality != method_cardinalities.end();
+ name_and_cardinality++) {
method_dict["Method"] = name_and_cardinality->first;
method_dict["Cardinality"] = name_and_cardinality->second;
- IndentScope raii_descriptions_indent(out);
+ IndentScope raii_descriptions_indent(out);
out->Print(method_dict,
"\'$Method$\': cardinality.Cardinality.$Cardinality$,\n");
- }
- out->Print("}\n");
- out->Print(
- "stub_options = beta_implementations.stub_options("
- "host=host, metadata_transformer=metadata_transformer, "
- "request_serializers=request_serializers, "
- "response_deserializers=response_deserializers, "
- "thread_pool=pool, thread_pool_size=pool_size)\n");
+ }
+ out->Print("}\n");
+ out->Print(
+ "stub_options = beta_implementations.stub_options("
+ "host=host, metadata_transformer=metadata_transformer, "
+ "request_serializers=request_serializers, "
+ "response_deserializers=response_deserializers, "
+ "thread_pool=pool, thread_pool_size=pool_size)\n");
out->Print(method_dict,
"return beta_implementations.dynamic_stub(channel, "
"\'$PackageQualifiedServiceName$\', "
"cardinalities, options=stub_options)\n");
- }
- return true;
-}
-
-bool PrivateGenerator::PrintStub(
+ }
+ return true;
+}
+
+bool PrivateGenerator::PrintStub(
const TString& package_qualified_service_name,
const grpc_generator::Service* service, grpc_generator::Printer* out) {
StringMap dict;
dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(dict, "class $Service$Stub(object):\n");
- {
- IndentScope raii_class_indent(out);
+ {
+ IndentScope raii_class_indent(out);
StringVector service_comments = service->GetAllComments();
PrintAllComments(service_comments, out);
- out->Print("\n");
- out->Print("def __init__(self, channel):\n");
- {
- IndentScope raii_init_indent(out);
- out->Print("\"\"\"Constructor.\n");
- out->Print("\n");
- out->Print("Args:\n");
- {
- IndentScope raii_args_indent(out);
- out->Print("channel: A grpc.Channel.\n");
- }
- out->Print("\"\"\"\n");
- for (int i = 0; i < service->method_count(); ++i) {
+ out->Print("\n");
+ out->Print("def __init__(self, channel):\n");
+ {
+ IndentScope raii_init_indent(out);
+ out->Print("\"\"\"Constructor.\n");
+ out->Print("\n");
+ out->Print("Args:\n");
+ {
+ IndentScope raii_args_indent(out);
+ out->Print("channel: A grpc.Channel.\n");
+ }
+ out->Print("\"\"\"\n");
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
TString multi_callable_constructor =
TString(method->ClientStreaming() ? "stream" : "unary") + "_" +
@@ -438,108 +438,108 @@ bool PrivateGenerator::PrintStub(
&request_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
TString response_module_and_class;
if (!method->get_module_and_message_path_output(
&response_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
StringMap method_dict;
method_dict["Method"] = method->name();
method_dict["MultiCallableConstructor"] = multi_callable_constructor;
out->Print(method_dict,
"self.$Method$ = channel.$MultiCallableConstructor$(\n");
- {
+ {
method_dict["PackageQualifiedService"] =
package_qualified_service_name;
method_dict["RequestModuleAndClass"] = request_module_and_class;
method_dict["ResponseModuleAndClass"] = response_module_and_class;
- IndentScope raii_first_attribute_indent(out);
- IndentScope raii_second_attribute_indent(out);
+ IndentScope raii_first_attribute_indent(out);
+ IndentScope raii_second_attribute_indent(out);
out->Print(method_dict, "'/$PackageQualifiedService$/$Method$',\n");
out->Print(method_dict,
"request_serializer=$RequestModuleAndClass$."
"SerializeToString,\n");
- out->Print(
+ out->Print(
method_dict,
"response_deserializer=$ResponseModuleAndClass$.FromString,\n");
- out->Print(")\n");
- }
- }
- }
- }
- return true;
-}
-
+ out->Print(")\n");
+ }
+ }
+ }
+ }
+ return true;
+}
+
bool PrivateGenerator::PrintServicer(const grpc_generator::Service* service,
grpc_generator::Printer* out) {
StringMap service_dict;
service_dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(service_dict, "class $Service$Servicer(object):\n");
- {
- IndentScope raii_class_indent(out);
+ {
+ IndentScope raii_class_indent(out);
StringVector service_comments = service->GetAllComments();
PrintAllComments(service_comments, out);
- for (int i = 0; i < service->method_count(); ++i) {
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
TString arg_name =
method->ClientStreaming() ? "request_iterator" : "request";
StringMap method_dict;
method_dict["Method"] = method->name();
method_dict["ArgName"] = arg_name;
- out->Print("\n");
+ out->Print("\n");
out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
- {
- IndentScope raii_method_indent(out);
+ {
+ IndentScope raii_method_indent(out);
StringVector method_comments = method->GetAllComments();
PrintAllComments(method_comments, out);
- out->Print("context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n");
- out->Print("context.set_details('Method not implemented!')\n");
- out->Print("raise NotImplementedError('Method not implemented!')\n");
- }
- }
- }
- return true;
-}
-
-bool PrivateGenerator::PrintAddServicerToServer(
+ out->Print("context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n");
+ out->Print("context.set_details('Method not implemented!')\n");
+ out->Print("raise NotImplementedError('Method not implemented!')\n");
+ }
+ }
+ }
+ return true;
+}
+
+bool PrivateGenerator::PrintAddServicerToServer(
const TString& package_qualified_service_name,
const grpc_generator::Service* service, grpc_generator::Printer* out) {
StringMap service_dict;
service_dict["Service"] = service->name();
- out->Print("\n\n");
+ out->Print("\n\n");
out->Print(service_dict,
"def add_$Service$Servicer_to_server(servicer, server):\n");
- {
- IndentScope raii_class_indent(out);
- out->Print("rpc_method_handlers = {\n");
- {
- IndentScope raii_dict_first_indent(out);
- IndentScope raii_dict_second_indent(out);
- for (int i = 0; i < service->method_count(); ++i) {
+ {
+ IndentScope raii_class_indent(out);
+ out->Print("rpc_method_handlers = {\n");
+ {
+ IndentScope raii_dict_first_indent(out);
+ IndentScope raii_dict_second_indent(out);
+ for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
TString method_handler_constructor =
TString(method->ClientStreaming() ? "stream" : "unary") + "_" +
TString(method->ServerStreaming() ? "stream" : "unary") +
- "_rpc_method_handler";
+ "_rpc_method_handler";
TString request_module_and_class;
if (!method->get_module_and_message_path_input(
&request_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
TString response_module_and_class;
if (!method->get_module_and_message_path_output(
&response_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
- return false;
- }
+ return false;
+ }
StringMap method_dict;
method_dict["Method"] = method->name();
method_dict["MethodHandlerConstructor"] = method_handler_constructor;
@@ -547,36 +547,36 @@ bool PrivateGenerator::PrintAddServicerToServer(
method_dict["ResponseModuleAndClass"] = response_module_and_class;
out->Print(method_dict,
"'$Method$': grpc.$MethodHandlerConstructor$(\n");
- {
- IndentScope raii_call_first_indent(out);
- IndentScope raii_call_second_indent(out);
+ {
+ IndentScope raii_call_first_indent(out);
+ IndentScope raii_call_second_indent(out);
out->Print(method_dict, "servicer.$Method$,\n");
- out->Print(
+ out->Print(
method_dict,
"request_deserializer=$RequestModuleAndClass$.FromString,\n");
- out->Print(
+ out->Print(
method_dict,
- "response_serializer=$ResponseModuleAndClass$.SerializeToString,"
+ "response_serializer=$ResponseModuleAndClass$.SerializeToString,"
"\n");
- }
- out->Print("),\n");
- }
- }
+ }
+ out->Print("),\n");
+ }
+ }
StringMap method_dict;
method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
- out->Print("}\n");
- out->Print("generic_handler = grpc.method_handlers_generic_handler(\n");
- {
- IndentScope raii_call_first_indent(out);
- IndentScope raii_call_second_indent(out);
+ out->Print("}\n");
+ out->Print("generic_handler = grpc.method_handlers_generic_handler(\n");
+ {
+ IndentScope raii_call_first_indent(out);
+ IndentScope raii_call_second_indent(out);
out->Print(method_dict,
"'$PackageQualifiedServiceName$', rpc_method_handlers)\n");
- }
- out->Print("server.add_generic_rpc_handlers((generic_handler,))\n");
- }
- return true;
-}
-
+ }
+ out->Print("server.add_generic_rpc_handlers((generic_handler,))\n");
+ }
+ return true;
+}
+
/* Prints out a service class used as a container for static methods pertaining
* to a class. This class has the exact name of service written in the ".proto"
* file, with no suffixes. Since this class merely acts as a namespace, it
@@ -671,10 +671,10 @@ bool PrivateGenerator::PrintBetaPreamble(grpc_generator::Printer* out) {
out->Print(var,
"from $Package$ import implementations as beta_implementations\n");
out->Print(var, "from $Package$ import interfaces as beta_interfaces\n");
- out->Print("from grpc.framework.common import cardinality\n");
- out->Print(
- "from grpc.framework.interfaces.face import utilities as "
- "face_utilities\n");
+ out->Print("from grpc.framework.common import cardinality\n");
+ out->Print(
+ "from grpc.framework.interfaces.face import utilities as "
+ "face_utilities\n");
return true;
}
@@ -682,12 +682,12 @@ bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
StringMap var;
var["Package"] = config.grpc_package_root;
out->Print(var, "import $Package$\n");
- if (generate_in_pb2_grpc) {
- out->Print("\n");
- StringPairSet imports_set;
- for (int i = 0; i < file->service_count(); ++i) {
+ if (generate_in_pb2_grpc) {
+ out->Print("\n");
+ StringPairSet imports_set;
+ for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
- for (int j = 0; j < service->method_count(); ++j) {
+ for (int j = 0; j < service->method_count(); ++j) {
auto method = service.get()->method(j);
TString input_type_file_name = method->get_input_type_name();
@@ -709,11 +709,11 @@ bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
config.prefixes_to_filter);
imports_set.insert(
std::make_tuple(output_module_name, output_module_alias));
- }
- }
+ }
+ }
- for (StringPairSet::iterator it = imports_set.begin();
- it != imports_set.end(); ++it) {
+ for (StringPairSet::iterator it = imports_set.begin();
+ it != imports_set.end(); ++it) {
auto module_name = std::get<0>(*it);
var["ModuleAlias"] = std::get<1>(*it);
const size_t last_dot_pos = module_name.rfind('.');
@@ -725,17 +725,17 @@ bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
module_name.substr(last_dot_pos + 1);
}
out->Print(var, "$ImportStatement$ as $ModuleAlias$\n");
- }
- }
- return true;
-}
-
+ }
+ }
+ return true;
+}
+
bool PrivateGenerator::PrintGAServices(grpc_generator::Printer* out) {
TString package = file->package();
- if (!package.empty()) {
- package = package.append(".");
- }
- for (int i = 0; i < file->service_count(); ++i) {
+ if (!package.empty()) {
+ package = package.append(".");
+ }
+ for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
TString package_qualified_service_name = package + service->name();
if (!(PrintStub(package_qualified_service_name, service.get(), out) &&
@@ -744,18 +744,18 @@ bool PrivateGenerator::PrintGAServices(grpc_generator::Printer* out) {
service.get(), out) &&
PrintServiceClass(package_qualified_service_name, service.get(),
out))) {
- return false;
- }
- }
- return true;
-}
-
+ return false;
+ }
+ }
+ return true;
+}
+
bool PrivateGenerator::PrintBetaServices(grpc_generator::Printer* out) {
TString package = file->package();
- if (!package.empty()) {
- package = package.append(".");
- }
- for (int i = 0; i < file->service_count(); ++i) {
+ if (!package.empty()) {
+ package = package.append(".");
+ }
+ for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
TString package_qualified_service_name = package + service->name();
if (!(PrintBetaServicer(service.get(), out) &&
@@ -764,97 +764,97 @@ bool PrivateGenerator::PrintBetaServices(grpc_generator::Printer* out) {
out) &&
PrintBetaStubFactory(package_qualified_service_name, service.get(),
out))) {
- return false;
- }
- }
- return true;
-}
-
+ return false;
+ }
+ }
+ return true;
+}
+
pair<bool, TString> PrivateGenerator::GetGrpcServices() {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
auto out = file->CreatePrinter(&output);
- if (generate_in_pb2_grpc) {
- out->Print(
- "# Generated by the gRPC Python protocol compiler plugin. "
+ if (generate_in_pb2_grpc) {
+ out->Print(
+ "# Generated by the gRPC Python protocol compiler plugin. "
"DO NOT EDIT!\n\"\"\""
"Client and server classes corresponding to protobuf-defined "
"services.\"\"\"\n");
if (!PrintPreamble(out.get())) {
- return make_pair(false, "");
- }
+ return make_pair(false, "");
+ }
if (!PrintGAServices(out.get())) {
- return make_pair(false, "");
- }
- } else {
- out->Print("try:\n");
- {
+ return make_pair(false, "");
+ }
+ } else {
+ out->Print("try:\n");
+ {
IndentScope raii_dict_try_indent(out.get());
- out->Print(
- "# THESE ELEMENTS WILL BE DEPRECATED.\n"
- "# Please use the generated *_pb2_grpc.py files instead.\n");
+ out->Print(
+ "# THESE ELEMENTS WILL BE DEPRECATED.\n"
+ "# Please use the generated *_pb2_grpc.py files instead.\n");
if (!PrintPreamble(out.get())) {
- return make_pair(false, "");
- }
+ return make_pair(false, "");
+ }
if (!PrintBetaPreamble(out.get())) {
- return make_pair(false, "");
- }
+ return make_pair(false, "");
+ }
if (!PrintGAServices(out.get())) {
- return make_pair(false, "");
- }
+ return make_pair(false, "");
+ }
if (!PrintBetaServices(out.get())) {
- return make_pair(false, "");
- }
- }
- out->Print("except ImportError:\n");
- {
+ return make_pair(false, "");
+ }
+ }
+ out->Print("except ImportError:\n");
+ {
IndentScope raii_dict_except_indent(out.get());
- out->Print("pass");
- }
- }
- }
- return make_pair(true, std::move(output));
-}
-
-} // namespace
-
-GeneratorConfiguration::GeneratorConfiguration()
+ out->Print("pass");
+ }
+ }
+ }
+ return make_pair(true, std::move(output));
+}
+
+} // namespace
+
+GeneratorConfiguration::GeneratorConfiguration()
: grpc_package_root("grpc"),
beta_package_root("grpc.beta"),
import_prefix("") {}
-
-PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config)
- : config_(config) {}
-
-PythonGrpcGenerator::~PythonGrpcGenerator() {}
-
-static bool GenerateGrpc(GeneratorContext* context, PrivateGenerator& generator,
+
+PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config)
+ : config_(config) {}
+
+PythonGrpcGenerator::~PythonGrpcGenerator() {}
+
+static bool GenerateGrpc(GeneratorContext* context, PrivateGenerator& generator,
TString file_name, bool generate_in_pb2_grpc) {
- bool success;
- std::unique_ptr<ZeroCopyOutputStream> output;
- std::unique_ptr<CodedOutputStream> coded_output;
+ bool success;
+ std::unique_ptr<ZeroCopyOutputStream> output;
+ std::unique_ptr<CodedOutputStream> coded_output;
TString grpc_code;
-
- if (generate_in_pb2_grpc) {
- output.reset(context->Open(file_name));
- generator.generate_in_pb2_grpc = true;
- } else {
- output.reset(context->OpenForInsert(file_name, "module_scope"));
- generator.generate_in_pb2_grpc = false;
- }
-
- coded_output.reset(new CodedOutputStream(output.get()));
+
+ if (generate_in_pb2_grpc) {
+ output.reset(context->Open(file_name));
+ generator.generate_in_pb2_grpc = true;
+ } else {
+ output.reset(context->OpenForInsert(file_name, "module_scope"));
+ generator.generate_in_pb2_grpc = false;
+ }
+
+ coded_output.reset(new CodedOutputStream(output.get()));
tie(success, grpc_code) = generator.GetGrpcServices();
-
- if (success) {
- coded_output->WriteRaw(grpc_code.data(), grpc_code.size());
- return true;
- } else {
- return false;
- }
-}
-
+
+ if (success) {
+ coded_output->WriteRaw(grpc_code.data(), grpc_code.size());
+ return true;
+ } else {
+ return false;
+ }
+}
+
static bool ParseParameters(const TString& parameter,
TString* grpc_version,
std::vector<TString>* strip_prefixes,
@@ -882,26 +882,26 @@ uint64_t PythonGrpcGenerator::GetSupportedFeatures() const {
return FEATURE_PROTO3_OPTIONAL;
}
-bool PythonGrpcGenerator::Generate(const FileDescriptor* file,
+bool PythonGrpcGenerator::Generate(const FileDescriptor* file,
const TString& parameter,
- GeneratorContext* context,
+ GeneratorContext* context,
TString* error) const {
- // Get output file name.
+ // Get output file name.
TString pb2_file_name;
TString pb2_grpc_file_name;
- static const int proto_suffix_length = strlen(".proto");
- if (file->name().size() > static_cast<size_t>(proto_suffix_length) &&
- file->name().find_last_of(".proto") == file->name().size() - 1) {
+ static const int proto_suffix_length = strlen(".proto");
+ if (file->name().size() > static_cast<size_t>(proto_suffix_length) &&
+ file->name().find_last_of(".proto") == file->name().size() - 1) {
TString base =
- file->name().substr(0, file->name().size() - proto_suffix_length);
- pb2_file_name = base + "_pb2.py";
- pb2_grpc_file_name = base + "_pb2_grpc.py";
- } else {
- *error = "Invalid proto file name. Proto file must end with .proto";
- return false;
- }
+ file->name().substr(0, file->name().size() - proto_suffix_length);
+ pb2_file_name = base + "_pb2.py";
+ pb2_grpc_file_name = base + "_pb2_grpc.py";
+ } else {
+ *error = "Invalid proto file name. Proto file must end with .proto";
+ return false;
+ }
generator_file_name = file->name();
-
+
ProtoBufFile pbfile(file);
TString grpc_version;
GeneratorConfiguration extended_config(config_);
@@ -910,14 +910,14 @@ bool PythonGrpcGenerator::Generate(const FileDescriptor* file,
PrivateGenerator generator(extended_config, &pbfile);
if (!success) return false;
if (grpc_version == "grpc_2_0") {
- return GenerateGrpc(context, generator, pb2_grpc_file_name, true);
+ return GenerateGrpc(context, generator, pb2_grpc_file_name, true);
} else if (grpc_version == "grpc_1_0") {
- return GenerateGrpc(context, generator, pb2_grpc_file_name, true) &&
- GenerateGrpc(context, generator, pb2_file_name, false);
- } else {
+ return GenerateGrpc(context, generator, pb2_grpc_file_name, true) &&
+ GenerateGrpc(context, generator, pb2_file_name, false);
+ } else {
*error = "Invalid grpc version '" + grpc_version + "'.";
- return false;
- }
-}
-
-} // namespace grpc_python_generator
+ return false;
+ }
+}
+
+} // namespace grpc_python_generator
diff --git a/contrib/libs/grpc/src/compiler/python_generator.h b/contrib/libs/grpc/src/compiler/python_generator.h
index 0239d13fcd..bcde0a5e35 100644
--- a/contrib/libs/grpc/src/compiler/python_generator.h
+++ b/contrib/libs/grpc/src/compiler/python_generator.h
@@ -1,60 +1,60 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
-
-#include <utility>
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
+
+#include <utility>
#include <vector>
-
-#include "src/compiler/config.h"
+
+#include "src/compiler/config.h"
#include "src/compiler/schema_interface.h"
-
-namespace grpc_python_generator {
-
-// Data pertaining to configuration of the generator with respect to anything
-// that may be used internally at Google.
-struct GeneratorConfiguration {
- GeneratorConfiguration();
+
+namespace grpc_python_generator {
+
+// Data pertaining to configuration of the generator with respect to anything
+// that may be used internally at Google.
+struct GeneratorConfiguration {
+ GeneratorConfiguration();
TString grpc_package_root;
// TODO(https://github.com/grpc/grpc/issues/8622): Drop this.
TString beta_package_root;
// TODO(https://github.com/google/protobuf/issues/888): Drop this.
TString import_prefix;
std::vector<TString> prefixes_to_filter;
-};
-
-class PythonGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
- public:
- PythonGrpcGenerator(const GeneratorConfiguration& config);
- ~PythonGrpcGenerator();
-
+};
+
+class PythonGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
+ public:
+ PythonGrpcGenerator(const GeneratorConfiguration& config);
+ ~PythonGrpcGenerator();
+
uint64_t GetSupportedFeatures() const override;
- bool Generate(const grpc::protobuf::FileDescriptor* file,
+ bool Generate(const grpc::protobuf::FileDescriptor* file,
const TString& parameter,
- grpc::protobuf::compiler::GeneratorContext* context,
+ grpc::protobuf::compiler::GeneratorContext* context,
TString* error) const override;
-
- private:
- GeneratorConfiguration config_;
-};
-
-} // namespace grpc_python_generator
-
-#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
+
+ private:
+ GeneratorConfiguration config_;
+};
+
+} // namespace grpc_python_generator
+
+#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/python_plugin.cc b/contrib/libs/grpc/src/compiler/python_plugin.cc
index 0f0c77fd3a..81eb1d4fc2 100644
--- a/contrib/libs/grpc/src/compiler/python_plugin.cc
+++ b/contrib/libs/grpc/src/compiler/python_plugin.cc
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-// Generates a Python gRPC service interface out of Protobuf IDL.
-
-#include "src/compiler/config.h"
+ *
+ */
+
+// Generates a Python gRPC service interface out of Protobuf IDL.
+
+#include "src/compiler/config.h"
#include "src/compiler/protobuf_plugin.h"
-#include "src/compiler/python_generator.h"
-
-int main(int argc, char* argv[]) {
- grpc_python_generator::GeneratorConfiguration config;
- grpc_python_generator::PythonGrpcGenerator generator(config);
- return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
-}
+#include "src/compiler/python_generator.h"
+
+int main(int argc, char* argv[]) {
+ grpc_python_generator::GeneratorConfiguration config;
+ grpc_python_generator::PythonGrpcGenerator generator(config);
+ return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
+}
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator.cc b/contrib/libs/grpc/src/compiler/ruby_generator.cc
index 6c7702ae6c..c82e78fd64 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator.cc
+++ b/contrib/libs/grpc/src/compiler/ruby_generator.cc
@@ -1,214 +1,214 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <cctype>
-#include <map>
-#include <vector>
-
-#include "src/compiler/config.h"
-#include "src/compiler/ruby_generator.h"
-#include "src/compiler/ruby_generator_helpers-inl.h"
-#include "src/compiler/ruby_generator_map-inl.h"
-#include "src/compiler/ruby_generator_string-inl.h"
-
-using grpc::protobuf::FileDescriptor;
+ *
+ */
+
+#include <cctype>
+#include <map>
+#include <vector>
+
+#include "src/compiler/config.h"
+#include "src/compiler/ruby_generator.h"
+#include "src/compiler/ruby_generator_helpers-inl.h"
+#include "src/compiler/ruby_generator_map-inl.h"
+#include "src/compiler/ruby_generator_string-inl.h"
+
+using grpc::protobuf::FileDescriptor;
using grpc::protobuf::MethodDescriptor;
-using grpc::protobuf::ServiceDescriptor;
-using grpc::protobuf::io::Printer;
-using grpc::protobuf::io::StringOutputStream;
-using std::map;
-using std::vector;
-
-namespace grpc_ruby_generator {
-namespace {
-
-// Prints out the method using the ruby gRPC DSL.
+using grpc::protobuf::ServiceDescriptor;
+using grpc::protobuf::io::Printer;
+using grpc::protobuf::io::StringOutputStream;
+using std::map;
+using std::vector;
+
+namespace grpc_ruby_generator {
+namespace {
+
+// Prints out the method using the ruby gRPC DSL.
void PrintMethod(const MethodDescriptor* method, Printer* out) {
TString input_type = RubyTypeOf(method->input_type());
- if (method->client_streaming()) {
- input_type = "stream(" + input_type + ")";
- }
+ if (method->client_streaming()) {
+ input_type = "stream(" + input_type + ")";
+ }
TString output_type = RubyTypeOf(method->output_type());
- if (method->server_streaming()) {
- output_type = "stream(" + output_type + ")";
- }
+ if (method->server_streaming()) {
+ output_type = "stream(" + output_type + ")";
+ }
std::map<TString, TString> method_vars = ListToDict({
"mth.name",
method->name(),
"input.type",
input_type,
"output.type",
- output_type,
- });
- out->Print(GetRubyComments(method, true).c_str());
- out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n");
- out->Print(GetRubyComments(method, false).c_str());
-}
-
-// Prints out the service using the ruby gRPC DSL.
+ output_type,
+ });
+ out->Print(GetRubyComments(method, true).c_str());
+ out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n");
+ out->Print(GetRubyComments(method, false).c_str());
+}
+
+// Prints out the service using the ruby gRPC DSL.
void PrintService(const ServiceDescriptor* service, Printer* out) {
- if (service->method_count() == 0) {
- return;
- }
-
- // Begin the service module
+ if (service->method_count() == 0) {
+ return;
+ }
+
+ // Begin the service module
std::map<TString, TString> module_vars = ListToDict({
"module.name",
Modularize(service->name()),
- });
- out->Print(module_vars, "module $module.name$\n");
- out->Indent();
-
- out->Print(GetRubyComments(service, true).c_str());
- out->Print("class Service\n");
-
- // Write the indented class body.
- out->Indent();
- out->Print("\n");
- out->Print("include GRPC::GenericService\n");
- out->Print("\n");
- out->Print("self.marshal_class_method = :encode\n");
- out->Print("self.unmarshal_class_method = :decode\n");
+ });
+ out->Print(module_vars, "module $module.name$\n");
+ out->Indent();
+
+ out->Print(GetRubyComments(service, true).c_str());
+ out->Print("class Service\n");
+
+ // Write the indented class body.
+ out->Indent();
+ out->Print("\n");
+ out->Print("include GRPC::GenericService\n");
+ out->Print("\n");
+ out->Print("self.marshal_class_method = :encode\n");
+ out->Print("self.unmarshal_class_method = :decode\n");
std::map<TString, TString> pkg_vars =
- ListToDict({"service_full_name", service->full_name()});
- out->Print(pkg_vars, "self.service_name = '$service_full_name$'\n");
- out->Print("\n");
- for (int i = 0; i < service->method_count(); ++i) {
+ ListToDict({"service_full_name", service->full_name()});
+ out->Print(pkg_vars, "self.service_name = '$service_full_name$'\n");
+ out->Print("\n");
+ for (int i = 0; i < service->method_count(); ++i) {
PrintMethod(service->method(i), out);
- }
- out->Outdent();
-
- out->Print("end\n");
- out->Print("\n");
- out->Print("Stub = Service.rpc_stub_class\n");
-
- // End the service module
- out->Outdent();
- out->Print("end\n");
- out->Print(GetRubyComments(service, false).c_str());
-}
-
-} // namespace
-
-// The following functions are copied directly from the source for the protoc
-// ruby generator
-// to ensure compatibility (with the exception of int and string type changes).
-// See
-// https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/ruby/ruby_generator.cc#L250
-// TODO: keep up to date with protoc code generation, though this behavior isn't
-// expected to change
-bool IsLower(char ch) { return ch >= 'a' && ch <= 'z'; }
-
-char ToUpper(char ch) { return IsLower(ch) ? (ch - 'a' + 'A') : ch; }
-
-// Package names in protobuf are snake_case by convention, but Ruby module
-// names must be PascalCased.
-//
-// foo_bar_baz -> FooBarBaz
+ }
+ out->Outdent();
+
+ out->Print("end\n");
+ out->Print("\n");
+ out->Print("Stub = Service.rpc_stub_class\n");
+
+ // End the service module
+ out->Outdent();
+ out->Print("end\n");
+ out->Print(GetRubyComments(service, false).c_str());
+}
+
+} // namespace
+
+// The following functions are copied directly from the source for the protoc
+// ruby generator
+// to ensure compatibility (with the exception of int and string type changes).
+// See
+// https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/ruby/ruby_generator.cc#L250
+// TODO: keep up to date with protoc code generation, though this behavior isn't
+// expected to change
+bool IsLower(char ch) { return ch >= 'a' && ch <= 'z'; }
+
+char ToUpper(char ch) { return IsLower(ch) ? (ch - 'a' + 'A') : ch; }
+
+// Package names in protobuf are snake_case by convention, but Ruby module
+// names must be PascalCased.
+//
+// foo_bar_baz -> FooBarBaz
TString PackageToModule(const TString& name) {
- bool next_upper = true;
+ bool next_upper = true;
TString result;
- result.reserve(name.size());
-
+ result.reserve(name.size());
+
for (TString::size_type i = 0; i < name.size(); i++) {
- if (name[i] == '_') {
- next_upper = true;
- } else {
- if (next_upper) {
- result.push_back(ToUpper(name[i]));
- } else {
- result.push_back(name[i]);
- }
- next_upper = false;
- }
- }
-
- return result;
-}
-// end copying of protoc generator for ruby code
-
+ if (name[i] == '_') {
+ next_upper = true;
+ } else {
+ if (next_upper) {
+ result.push_back(ToUpper(name[i]));
+ } else {
+ result.push_back(name[i]);
+ }
+ next_upper = false;
+ }
+ }
+
+ return result;
+}
+// end copying of protoc generator for ruby code
+
TString GetServices(const FileDescriptor* file) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
-
- StringOutputStream output_stream(&output);
- Printer out(&output_stream, '$');
-
- // Don't write out any output if there no services, to avoid empty service
- // files being generated for proto files that don't declare any.
- if (file->service_count() == 0) {
- return output;
- }
-
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+
+ StringOutputStream output_stream(&output);
+ Printer out(&output_stream, '$');
+
+ // Don't write out any output if there no services, to avoid empty service
+ // files being generated for proto files that don't declare any.
+ if (file->service_count() == 0) {
+ return output;
+ }
+
TString package_name = RubyPackage(file);
- // Write out a file header.
+ // Write out a file header.
std::map<TString, TString> header_comment_vars = ListToDict({
"file.name",
file->name(),
"file.package",
package_name,
- });
- out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
- out.Print(header_comment_vars,
- "# Source: $file.name$ for package '$file.package$'\n");
-
+ });
+ out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
+ out.Print(header_comment_vars,
+ "# Source: $file.name$ for package '$file.package$'\n");
+
TString leading_comments = GetRubyComments(file, true);
- if (!leading_comments.empty()) {
- out.Print("# Original file comments:\n");
+ if (!leading_comments.empty()) {
+ out.Print("# Original file comments:\n");
out.PrintRaw(leading_comments.c_str());
- }
-
- out.Print("\n");
- out.Print("require 'grpc'\n");
- // Write out require statemment to import the separately generated file
- // that defines the messages used by the service. This is generated by the
- // main ruby plugin.
+ }
+
+ out.Print("\n");
+ out.Print("require 'grpc'\n");
+ // Write out require statemment to import the separately generated file
+ // that defines the messages used by the service. This is generated by the
+ // main ruby plugin.
std::map<TString, TString> dep_vars = ListToDict({
"dep.name",
MessagesRequireName(file),
- });
- out.Print(dep_vars, "require '$dep.name$'\n");
-
- // Write out services within the modules
- out.Print("\n");
+ });
+ out.Print(dep_vars, "require '$dep.name$'\n");
+
+ // Write out services within the modules
+ out.Print("\n");
std::vector<TString> modules = Split(package_name, '.');
- for (size_t i = 0; i < modules.size(); ++i) {
+ for (size_t i = 0; i < modules.size(); ++i) {
std::map<TString, TString> module_vars = ListToDict({
"module.name",
PackageToModule(modules[i]),
- });
- out.Print(module_vars, "module $module.name$\n");
- out.Indent();
- }
- for (int i = 0; i < file->service_count(); ++i) {
- auto service = file->service(i);
+ });
+ out.Print(module_vars, "module $module.name$\n");
+ out.Indent();
+ }
+ for (int i = 0; i < file->service_count(); ++i) {
+ auto service = file->service(i);
PrintService(service, &out);
- }
- for (size_t i = 0; i < modules.size(); ++i) {
- out.Outdent();
- out.Print("end\n");
- }
-
- out.Print(GetRubyComments(file, false).c_str());
- }
- return output;
-}
-
-} // namespace grpc_ruby_generator
+ }
+ for (size_t i = 0; i < modules.size(); ++i) {
+ out.Outdent();
+ out.Print("end\n");
+ }
+
+ out.Print(GetRubyComments(file, false).c_str());
+ }
+ return output;
+}
+
+} // namespace grpc_ruby_generator
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator.h b/contrib/libs/grpc/src/compiler/ruby_generator.h
index 3a7766056d..325dc02294 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator.h
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
-
-#include "src/compiler/config.h"
-
-namespace grpc_ruby_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
+
+#include "src/compiler/config.h"
+
+namespace grpc_ruby_generator {
+
TString GetServices(const grpc::protobuf::FileDescriptor* file);
-
-} // namespace grpc_ruby_generator
-
-#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
+
+} // namespace grpc_ruby_generator
+
+#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
index c22c4be0d9..9a10976619 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
@@ -1,58 +1,58 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
-#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-#include "src/compiler/ruby_generator_string-inl.h"
-
-namespace grpc_ruby_generator {
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
+#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+#include "src/compiler/ruby_generator_string-inl.h"
+
+namespace grpc_ruby_generator {
+
inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
TString* file_name_or_error) {
- // Get output file name.
- static const unsigned proto_suffix_length = 6; // length of ".proto"
- if (file->name().size() > proto_suffix_length &&
- file->name().find_last_of(".proto") == file->name().size() - 1) {
- *file_name_or_error =
- file->name().substr(0, file->name().size() - proto_suffix_length) +
- "_services_pb.rb";
- return true;
- } else {
- *file_name_or_error = "Invalid proto file name: must end with .proto";
- return false;
- }
-}
-
+ // Get output file name.
+ static const unsigned proto_suffix_length = 6; // length of ".proto"
+ if (file->name().size() > proto_suffix_length &&
+ file->name().find_last_of(".proto") == file->name().size() - 1) {
+ *file_name_or_error =
+ file->name().substr(0, file->name().size() - proto_suffix_length) +
+ "_services_pb.rb";
+ return true;
+ } else {
+ *file_name_or_error = "Invalid proto file name: must end with .proto";
+ return false;
+ }
+}
+
inline TString MessagesRequireName(
const grpc::protobuf::FileDescriptor* file) {
- return Replace(file->name(), ".proto", "_pb");
-}
-
-// Get leading or trailing comments in a string. Comment lines start with "# ".
+ return Replace(file->name(), ".proto", "_pb");
+}
+
+// Get leading or trailing comments in a string. Comment lines start with "# ".
// Leading detached comments are put in front of leading comments.
-template <typename DescriptorType>
+template <typename DescriptorType>
inline TString GetRubyComments(const DescriptorType* desc, bool leading) {
- return grpc_generator::GetPrefixedComments(desc, leading, "#");
-}
-
-} // namespace grpc_ruby_generator
-
-#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
+ return grpc_generator::GetPrefixedComments(desc, leading, "#");
+}
+
+} // namespace grpc_ruby_generator
+
+#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
index 3b217cf7d2..4c75780b1a 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
@@ -1,57 +1,57 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
-#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
-
-#include "src/compiler/config.h"
-
-#include <initializer_list>
-#include <iostream>
-#include <map>
-#include <ostream> // NOLINT
-#include <vector>
-
-using std::initializer_list;
-using std::map;
-using std::vector;
-
-namespace grpc_ruby_generator {
-
-// Converts an initializer list of the form { key0, value0, key1, value1, ... }
-// into a map of key* to value*. Is merely a readability helper for later code.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
+#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
+
+#include "src/compiler/config.h"
+
+#include <initializer_list>
+#include <iostream>
+#include <map>
+#include <ostream> // NOLINT
+#include <vector>
+
+using std::initializer_list;
+using std::map;
+using std::vector;
+
+namespace grpc_ruby_generator {
+
+// Converts an initializer list of the form { key0, value0, key1, value1, ... }
+// into a map of key* to value*. Is merely a readability helper for later code.
inline std::map<TString, TString> ListToDict(
const initializer_list<TString>& values) {
- if (values.size() % 2 != 0) {
- std::cerr << "Not every 'key' has a value in `values`." << std::endl;
- }
+ if (values.size() % 2 != 0) {
+ std::cerr << "Not every 'key' has a value in `values`." << std::endl;
+ }
std::map<TString, TString> value_map;
- auto value_iter = values.begin();
- for (unsigned i = 0; i < values.size() / 2; ++i) {
+ auto value_iter = values.begin();
+ for (unsigned i = 0; i < values.size() / 2; ++i) {
TString key = *value_iter;
- ++value_iter;
+ ++value_iter;
TString value = *value_iter;
- value_map[key] = value;
- ++value_iter;
- }
- return value_map;
-}
-
-} // namespace grpc_ruby_generator
-
-#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
+ value_map[key] = value;
+ ++value_iter;
+ }
+ return value_map;
+}
+
+} // namespace grpc_ruby_generator
+
+#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
index 247d7f5e2c..956539f392 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
@@ -1,91 +1,91 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
-#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
-
-#include "src/compiler/config.h"
-
-#include <algorithm>
-#include <sstream>
-#include <vector>
-
-using std::getline;
-using std::transform;
-
-namespace grpc_ruby_generator {
-
-// Split splits a string using char into elems.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
+#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
+
+#include "src/compiler/config.h"
+
+#include <algorithm>
+#include <sstream>
+#include <vector>
+
+using std::getline;
+using std::transform;
+
+namespace grpc_ruby_generator {
+
+// Split splits a string using char into elems.
inline std::vector<TString>& Split(const TString& s, char delim,
std::vector<TString>* elems) {
- std::stringstream ss(s);
+ std::stringstream ss(s);
TString item;
- while (getline(ss, item, delim)) {
- elems->push_back(item);
- }
- return *elems;
-}
-
-// Split splits a string using char, returning the result in a vector.
+ while (getline(ss, item, delim)) {
+ elems->push_back(item);
+ }
+ return *elems;
+}
+
+// Split splits a string using char, returning the result in a vector.
inline std::vector<TString> Split(const TString& s, char delim) {
std::vector<TString> elems;
- Split(s, delim, &elems);
- return elems;
-}
-
-// Replace replaces from with to in s.
+ Split(s, delim, &elems);
+ return elems;
+}
+
+// Replace replaces from with to in s.
inline TString Replace(TString s, const TString& from,
const TString& to) {
- size_t start_pos = s.find(from);
+ size_t start_pos = s.find(from);
if (start_pos == TString::npos) {
- return s;
- }
- s.replace(start_pos, from.length(), to);
- return s;
-}
-
-// ReplaceAll replaces all instances of search with replace in s.
+ return s;
+ }
+ s.replace(start_pos, from.length(), to);
+ return s;
+}
+
+// ReplaceAll replaces all instances of search with replace in s.
inline TString ReplaceAll(TString s, const TString& search,
const TString& replace) {
- size_t pos = 0;
+ size_t pos = 0;
while ((pos = s.find(search, pos)) != TString::npos) {
- s.replace(pos, search.length(), replace);
- pos += replace.length();
- }
- return s;
-}
-
-// ReplacePrefix replaces from with to in s if search is a prefix of s.
+ s.replace(pos, search.length(), replace);
+ pos += replace.length();
+ }
+ return s;
+}
+
+// ReplacePrefix replaces from with to in s if search is a prefix of s.
inline bool ReplacePrefix(TString* s, const TString& from,
const TString& to) {
- size_t start_pos = s->find(from);
+ size_t start_pos = s->find(from);
if (start_pos == TString::npos || start_pos != 0) {
- return false;
- }
- s->replace(start_pos, from.length(), to);
- return true;
-}
-
+ return false;
+ }
+ s->replace(start_pos, from.length(), to);
+ return true;
+}
+
// Modularize converts a string into a ruby module compatible name
inline TString Modularize(TString s) {
- if (s.empty()) {
- return s;
- }
+ if (s.empty()) {
+ return s;
+ }
TString new_string = "";
bool was_last_underscore = false;
new_string.append(1, ::toupper(s[0]));
@@ -98,8 +98,8 @@ inline TString Modularize(TString s) {
was_last_underscore = s[i] == '_';
}
return new_string;
-}
-
+}
+
// RubyPackage gets the ruby package in either proto or ruby_package format
inline TString RubyPackage(const grpc::protobuf::FileDescriptor* file) {
TString package_name = file->package();
@@ -115,7 +115,7 @@ inline TString RubyPackage(const grpc::protobuf::FileDescriptor* file) {
return package_name;
}
-// RubyTypeOf updates a proto type to the required ruby equivalent.
+// RubyTypeOf updates a proto type to the required ruby equivalent.
inline TString RubyTypeOf(const grpc::protobuf::Descriptor* descriptor) {
TString proto_type = descriptor->full_name();
if (descriptor->file()->options().has_ruby_package()) {
@@ -126,24 +126,24 @@ inline TString RubyTypeOf(const grpc::protobuf::Descriptor* descriptor) {
}
TString res("." + proto_type);
if (res.find('.') == TString::npos) {
- return res;
- } else {
+ return res;
+ } else {
std::vector<TString> prefixes_and_type = Split(res, '.');
- res.clear();
- for (unsigned int i = 0; i < prefixes_and_type.size(); ++i) {
- if (i != 0) {
- res += "::"; // switch '.' to the ruby module delim
- }
- if (i < prefixes_and_type.size() - 1) {
+ res.clear();
+ for (unsigned int i = 0; i < prefixes_and_type.size(); ++i) {
+ if (i != 0) {
+ res += "::"; // switch '.' to the ruby module delim
+ }
+ if (i < prefixes_and_type.size() - 1) {
res += Modularize(prefixes_and_type[i]); // capitalize pkgs
- } else {
- res += prefixes_and_type[i];
- }
- }
- return res;
- }
-}
-
-} // namespace grpc_ruby_generator
-
-#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
+ } else {
+ res += prefixes_and_type[i];
+ }
+ }
+ return res;
+ }
+}
+
+} // namespace grpc_ruby_generator
+
+#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
diff --git a/contrib/libs/grpc/src/core/README.md b/contrib/libs/grpc/src/core/README.md
index e4c204a8f4..5dea45a692 100644
--- a/contrib/libs/grpc/src/core/README.md
+++ b/contrib/libs/grpc/src/core/README.md
@@ -1,4 +1,4 @@
# Overview
-
+
This directory contains source code for C library (a.k.a the *gRPC C core*) that provides all gRPC's core functionality through a low level API. Libraries in other languages in this repository (C++, C#, Ruby,
-Python, PHP, NodeJS, Objective-C) are layered on top of this library.
+Python, PHP, NodeJS, Objective-C) are layered on top of this library.
diff --git a/contrib/libs/grpc/src/core/ext/README.md b/contrib/libs/grpc/src/core/ext/README.md
index 81d492b43c..0812b20823 100644
--- a/contrib/libs/grpc/src/core/ext/README.md
+++ b/contrib/libs/grpc/src/core/ext/README.md
@@ -1,5 +1,5 @@
-Optional plugins for gRPC Core: Modules in this directory extend gRPC Core in
-useful ways. All optional code belongs here.
-
-NOTE: The movement of code between lib and ext is an ongoing effort, so this
-directory currently contains too much of the core library.
+Optional plugins for gRPC Core: Modules in this directory extend gRPC Core in
+useful ways. All optional code belongs here.
+
+NOTE: The movement of code between lib and ext is an ongoing effort, so this
+directory currently contains too much of the core library.
diff --git a/contrib/libs/grpc/src/core/ext/transport/README.md b/contrib/libs/grpc/src/core/ext/transport/README.md
index 70273b169e..2290568784 100644
--- a/contrib/libs/grpc/src/core/ext/transport/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/README.md
@@ -1 +1 @@
-Transports for gRPC
+Transports for gRPC
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/README.md
index 1d63c5f064..8880a47460 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/README.md
@@ -1 +1 @@
-CHTTP2 - gRPC's implementation of a HTTP2 based transport
+CHTTP2 - gRPC's implementation of a HTTP2 based transport
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/alpn/alpn.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/alpn/alpn.h
index 1d0af6d7d7..e2ffe4e405 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/alpn/alpn.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/alpn/alpn.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H
+
#include <grpc/support/port_platform.h>
-#include <string.h>
-
+#include <string.h>
+
/* Returns 1 if the version is supported, 0 otherwise. */
int grpc_chttp2_is_alpn_version_supported(const char* version, size_t size);
-
-/* Returns the number of protocol versions to advertise */
-size_t grpc_chttp2_num_alpn_versions(void);
-
-/* Returns the protocol version at index i (0 <= i <
- * grpc_chttp2_num_alpn_versions()) */
+
+/* Returns the number of protocol versions to advertise */
+size_t grpc_chttp2_num_alpn_versions(void);
+
+/* Returns the protocol version at index i (0 <= i <
+ * grpc_chttp2_num_alpn_versions()) */
const char* grpc_chttp2_get_alpn_version_index(size_t i);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.h
index 4e2becaafe..322cbc2eba 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
+
#include <grpc/support/port_platform.h>
-
+
#include "src/core/ext/filters/client_channel/connector.h"
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/channel/handshaker_registry.h"
namespace grpc_core {
-
+
class Chttp2Connector : public SubchannelConnector {
public:
Chttp2Connector();
@@ -72,4 +72,4 @@ class Chttp2Connector : public SubchannelConnector {
} // namespace grpc_core
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/insecure/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/insecure/README.md
index df33b76a4a..fa11463388 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/insecure/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/insecure/README.md
@@ -1 +1 @@
-Plugin for creating insecure channels using chttp2
+Plugin for creating insecure channels using chttp2
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/secure/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/secure/README.md
index 6736a4911a..405a86e5db 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/client/secure/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/client/secure/README.md
@@ -1 +1 @@
-Plugin for creating secure channels using chttp2
+Plugin for creating secure channels using chttp2
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/chttp2_server.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/chttp2_server.h
index d94880b996..095cc5e4c0 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/chttp2_server.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/chttp2_server.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/grpc_types.h>
-
+#include <grpc/impl/codegen/grpc_types.h>
+
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/surface/server.h"
-
+
namespace grpc_core {
-/// Adds a port to \a server. Sets \a port_num to the port number.
-/// Takes ownership of \a args.
+/// Adds a port to \a server. Sets \a port_num to the port number.
+/// Takes ownership of \a args.
grpc_error* Chttp2ServerAddPort(Server* server, const char* addr,
grpc_channel_args* args, int* port_num);
-
+
} // namespace grpc_core
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/insecure/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/insecure/README.md
index 74dc9e94a0..fc0bc14ed7 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/insecure/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/insecure/README.md
@@ -1 +1 @@
-Plugin for creating insecure servers using chttp2
+Plugin for creating insecure servers using chttp2
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/secure/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/secure/README.md
index 372c6dc24c..6bda696a9a 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/server/secure/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/server/secure/README.md
@@ -1 +1 @@
-Plugin for creating secure servers using chttp2
+Plugin for creating secure servers using chttp2
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/README.md b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/README.md
index 7471b0243b..4684e58759 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/README.md
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/README.md
@@ -1,4 +1,4 @@
-chttp2 transport plugin - implements grpc over http2
-
-Used by chttp2/{client,server}/{insecure,secure} plugins to implement most of
-their functionality
+chttp2 transport plugin - implements grpc over http2
+
+Used by chttp2/{client,server}/{insecure,secure} plugins to implement most of
+their functionality
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.h
index c3bc8fa701..1cbca033a1 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_decoder.h
@@ -1,56 +1,56 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include <stdbool.h>
-
-struct grpc_base64_decode_context {
- /* input/output: */
+#include <grpc/slice.h>
+#include <stdbool.h>
+
+struct grpc_base64_decode_context {
+ /* input/output: */
const uint8_t* input_cur;
const uint8_t* input_end;
uint8_t* output_cur;
uint8_t* output_end;
- /* Indicate if the decoder should handle the tail of input data*/
- bool contains_tail;
-};
-
-/* base64 decode a grpc_base64_decode_context util either input_end is reached
- or output_end is reached. When input_end is reached, (input_end - input_cur)
- is less than 4. When output_end is reached, (output_end - output_cur) is less
- than 3. Returns false if decoding is failed. */
+ /* Indicate if the decoder should handle the tail of input data*/
+ bool contains_tail;
+};
+
+/* base64 decode a grpc_base64_decode_context util either input_end is reached
+ or output_end is reached. When input_end is reached, (input_end - input_cur)
+ is less than 4. When output_end is reached, (output_end - output_cur) is less
+ than 3. Returns false if decoding is failed. */
bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx);
-
-/* base64 decode a slice with pad chars. Returns a new slice, does not take
- ownership of the input. Returns an empty slice if decoding is failed. */
+
+/* base64 decode a slice with pad chars. Returns a new slice, does not take
+ ownership of the input. Returns an empty slice if decoding is failed. */
grpc_slice grpc_chttp2_base64_decode(const grpc_slice& input);
-
-/* base64 decode a slice without pad chars, data length is needed. Returns a new
- slice, does not take ownership of the input. Returns an empty slice if
- decoding is failed. */
+
+/* base64 decode a slice without pad chars, data length is needed. Returns a new
+ slice, does not take ownership of the input. Returns an empty slice if
+ decoding is failed. */
grpc_slice grpc_chttp2_base64_decode_with_length(const grpc_slice& input,
- size_t output_length);
-
+ size_t output_length);
+
/* Infer the length of decoded data from encoded data. */
size_t grpc_chttp2_base64_infer_length_after_decode(const grpc_slice& slice);
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.h
index 10c3523877..4f7ee67bd3 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/bin_encoder.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-
-/* base64 encode a slice. Returns a new slice, does not take ownership of the
- input */
+#include <grpc/slice.h>
+
+/* base64 encode a slice. Returns a new slice, does not take ownership of the
+ input */
grpc_slice grpc_chttp2_base64_encode(const grpc_slice& input);
-
-/* Compress a slice with the static huffman encoder detailed in the hpack
- standard. Returns a new slice, does not take ownership of the input */
+
+/* Compress a slice with the static huffman encoder detailed in the hpack
+ standard. Returns a new slice, does not take ownership of the input */
grpc_slice grpc_chttp2_huffman_compress(const grpc_slice& input);
-
-/* equivalent to:
- grpc_slice x = grpc_chttp2_base64_encode(input);
- grpc_slice y = grpc_chttp2_huffman_compress(x);
+
+/* equivalent to:
+ grpc_slice x = grpc_chttp2_base64_encode(input);
+ grpc_slice y = grpc_chttp2_huffman_compress(x);
grpc_slice_unref_internal( x);
- return y; */
+ return y; */
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(
const grpc_slice& input);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h
index b2a7932eee..b04630bbe2 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h
@@ -1,39 +1,39 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/debug/trace.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/transport/transport.h"
-
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/transport/transport.h"
+
extern grpc_core::TraceFlag grpc_http_trace;
extern grpc_core::TraceFlag grpc_keepalive_trace;
extern grpc_core::TraceFlag grpc_trace_http2_stream_state;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser;
-
+
extern bool g_flow_control_enabled;
-
+
grpc_transport* grpc_create_chttp2_transport(
const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client,
grpc_resource_user* resource_user = nullptr);
@@ -41,12 +41,12 @@ grpc_transport* grpc_create_chttp2_transport(
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode>
grpc_chttp2_transport_get_socket_node(grpc_transport* transport);
-/// Takes ownership of \a read_buffer, which (if non-NULL) contains
-/// leftover bytes previously read from the endpoint (e.g., by handshakers).
+/// Takes ownership of \a read_buffer, which (if non-NULL) contains
+/// leftover bytes previously read from the endpoint (e.g., by handshakers).
/// If non-null, \a notify_on_receive_settings will be scheduled when
/// HTTP/2 settings are received from the peer.
void grpc_chttp2_transport_start_reading(
grpc_transport* transport, grpc_slice_buffer* read_buffer,
grpc_closure* notify_on_receive_settings);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame.h
index 1f5a7b2c0f..083c0076e7 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame.h
@@ -1,47 +1,47 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
+
+#include <grpc/support/port_platform.h>
+
#include <grpc/slice.h>
-#include "src/core/lib/iomgr/error.h"
-
-/* defined in internal.h */
-typedef struct grpc_chttp2_stream grpc_chttp2_stream;
-typedef struct grpc_chttp2_transport grpc_chttp2_transport;
-
-#define GRPC_CHTTP2_FRAME_DATA 0
-#define GRPC_CHTTP2_FRAME_HEADER 1
-#define GRPC_CHTTP2_FRAME_CONTINUATION 9
-#define GRPC_CHTTP2_FRAME_RST_STREAM 3
-#define GRPC_CHTTP2_FRAME_SETTINGS 4
-#define GRPC_CHTTP2_FRAME_PING 6
-#define GRPC_CHTTP2_FRAME_GOAWAY 7
-#define GRPC_CHTTP2_FRAME_WINDOW_UPDATE 8
-
-#define GRPC_CHTTP2_DATA_FLAG_END_STREAM 1
-#define GRPC_CHTTP2_FLAG_ACK 1
-#define GRPC_CHTTP2_DATA_FLAG_END_HEADERS 4
-#define GRPC_CHTTP2_DATA_FLAG_PADDED 8
-#define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H */
+#include "src/core/lib/iomgr/error.h"
+
+/* defined in internal.h */
+typedef struct grpc_chttp2_stream grpc_chttp2_stream;
+typedef struct grpc_chttp2_transport grpc_chttp2_transport;
+
+#define GRPC_CHTTP2_FRAME_DATA 0
+#define GRPC_CHTTP2_FRAME_HEADER 1
+#define GRPC_CHTTP2_FRAME_CONTINUATION 9
+#define GRPC_CHTTP2_FRAME_RST_STREAM 3
+#define GRPC_CHTTP2_FRAME_SETTINGS 4
+#define GRPC_CHTTP2_FRAME_PING 6
+#define GRPC_CHTTP2_FRAME_GOAWAY 7
+#define GRPC_CHTTP2_FRAME_WINDOW_UPDATE 8
+
+#define GRPC_CHTTP2_DATA_FLAG_END_STREAM 1
+#define GRPC_CHTTP2_FLAG_ACK 1
+#define GRPC_CHTTP2_DATA_FLAG_END_HEADERS 4
+#define GRPC_CHTTP2_DATA_FLAG_PADDED 8
+#define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_data.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_data.h
index ee08a4d758..ec3890098e 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_data.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_data.h
@@ -1,82 +1,82 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
-
-/* Parser for GRPC streams embedded in DATA frames */
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
+
+/* Parser for GRPC streams embedded in DATA frames */
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/lib/transport/byte_stream.h"
-#include "src/core/lib/transport/transport.h"
-
-typedef enum {
- GRPC_CHTTP2_DATA_FH_0,
- GRPC_CHTTP2_DATA_FH_1,
- GRPC_CHTTP2_DATA_FH_2,
- GRPC_CHTTP2_DATA_FH_3,
- GRPC_CHTTP2_DATA_FH_4,
- GRPC_CHTTP2_DATA_FRAME,
- GRPC_CHTTP2_DATA_ERROR
-} grpc_chttp2_stream_state;
-
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/lib/transport/byte_stream.h"
+#include "src/core/lib/transport/transport.h"
+
+typedef enum {
+ GRPC_CHTTP2_DATA_FH_0,
+ GRPC_CHTTP2_DATA_FH_1,
+ GRPC_CHTTP2_DATA_FH_2,
+ GRPC_CHTTP2_DATA_FH_3,
+ GRPC_CHTTP2_DATA_FH_4,
+ GRPC_CHTTP2_DATA_FRAME,
+ GRPC_CHTTP2_DATA_ERROR
+} grpc_chttp2_stream_state;
+
namespace grpc_core {
class Chttp2IncomingByteStream;
} // namespace grpc_core
-
+
struct grpc_chttp2_data_parser {
grpc_chttp2_data_parser() = default;
~grpc_chttp2_data_parser();
-
+
grpc_chttp2_stream_state state = GRPC_CHTTP2_DATA_FH_0;
uint8_t frame_type = 0;
uint32_t frame_size = 0;
grpc_error* error = GRPC_ERROR_NONE;
-
+
bool is_frame_compressed = false;
grpc_core::Chttp2IncomingByteStream* parsing_frame = nullptr;
};
-
-/* start processing a new data frame */
+
+/* start processing a new data frame */
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
- uint8_t flags,
+ uint8_t flags,
uint32_t stream_id,
grpc_chttp2_stream* s);
-
-/* handle a slice of a data frame - is_last indicates the last slice of a
- frame */
+
+/* handle a slice of a data frame - is_last indicates the last slice of a
+ frame */
grpc_error* grpc_chttp2_data_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
const grpc_slice& slice, int is_last);
-
+
void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
- uint32_t write_bytes, int is_eof,
+ uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats* stats,
grpc_slice_buffer* outbuf);
-
+
grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
grpc_slice_buffer* slices, grpc_slice* slice_out,
grpc_core::OrphanablePtr<grpc_core::ByteStream>* stream_out);
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.h
index e3f0a15f82..df6274d628 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.h
@@ -1,49 +1,49 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-
-typedef enum {
- GRPC_CHTTP2_GOAWAY_LSI0,
- GRPC_CHTTP2_GOAWAY_LSI1,
- GRPC_CHTTP2_GOAWAY_LSI2,
- GRPC_CHTTP2_GOAWAY_LSI3,
- GRPC_CHTTP2_GOAWAY_ERR0,
- GRPC_CHTTP2_GOAWAY_ERR1,
- GRPC_CHTTP2_GOAWAY_ERR2,
- GRPC_CHTTP2_GOAWAY_ERR3,
- GRPC_CHTTP2_GOAWAY_DEBUG
-} grpc_chttp2_goaway_parse_state;
-
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+
+typedef enum {
+ GRPC_CHTTP2_GOAWAY_LSI0,
+ GRPC_CHTTP2_GOAWAY_LSI1,
+ GRPC_CHTTP2_GOAWAY_LSI2,
+ GRPC_CHTTP2_GOAWAY_LSI3,
+ GRPC_CHTTP2_GOAWAY_ERR0,
+ GRPC_CHTTP2_GOAWAY_ERR1,
+ GRPC_CHTTP2_GOAWAY_ERR2,
+ GRPC_CHTTP2_GOAWAY_ERR3,
+ GRPC_CHTTP2_GOAWAY_DEBUG
+} grpc_chttp2_goaway_parse_state;
+
struct grpc_chttp2_goaway_parser {
- grpc_chttp2_goaway_parse_state state;
- uint32_t last_stream_id;
- uint32_t error_code;
+ grpc_chttp2_goaway_parse_state state;
+ uint32_t last_stream_id;
+ uint32_t error_code;
char* debug_data;
- uint32_t debug_length;
- uint32_t debug_pos;
+ uint32_t debug_length;
+ uint32_t debug_pos;
};
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p);
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p);
@@ -54,9 +54,9 @@ grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
grpc_chttp2_stream* s,
const grpc_slice& slice,
int is_last);
-
-void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
+
+void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
const grpc_slice& debug_data,
grpc_slice_buffer* slice_buffer);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_ping.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_ping.h
index 5529c2c893..e356bf43f0 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_ping.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_ping.h
@@ -1,44 +1,44 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-
+#include <grpc/slice.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+
struct grpc_chttp2_ping_parser {
- uint8_t byte;
- uint8_t is_ack;
+ uint8_t byte;
+ uint8_t is_ack;
uint64_t opaque_8bytes;
};
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes);
-
+
grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
- uint32_t length, uint8_t flags);
+ uint32_t length, uint8_t flags);
grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
const grpc_slice& slice, int is_last);
-
+
/* Test-only function for disabling ping ack */
void grpc_set_disable_ping_ack(bool disable_ping_ack);
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
index 93592da6aa..e324ee2cfc 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/lib/transport/transport.h"
-
+#include <grpc/slice.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/lib/transport/transport.h"
+
struct grpc_chttp2_rst_stream_parser {
- uint8_t byte;
- uint8_t reason_bytes[4];
+ uint8_t byte;
+ uint8_t reason_bytes[4];
};
-grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
+grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_transport_one_way_stats* stats);
-
+
// Adds RST_STREAM frame to t->qbuf (buffer for the next write). Should be
// called when we want to add RST_STREAM and we are not in
// write_action_begin_locked.
@@ -46,5 +46,5 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
grpc_chttp2_stream* s,
const grpc_slice& slice,
int is_last);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_settings.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_settings.h
index 144d6b9de9..181471401c 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_settings.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_settings.h
@@ -1,53 +1,53 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include <grpc/slice.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
-
-typedef enum {
- GRPC_CHTTP2_SPS_ID0,
- GRPC_CHTTP2_SPS_ID1,
- GRPC_CHTTP2_SPS_VAL0,
- GRPC_CHTTP2_SPS_VAL1,
- GRPC_CHTTP2_SPS_VAL2,
- GRPC_CHTTP2_SPS_VAL3
-} grpc_chttp2_settings_parse_state;
-
+
+typedef enum {
+ GRPC_CHTTP2_SPS_ID0,
+ GRPC_CHTTP2_SPS_ID1,
+ GRPC_CHTTP2_SPS_VAL0,
+ GRPC_CHTTP2_SPS_VAL1,
+ GRPC_CHTTP2_SPS_VAL2,
+ GRPC_CHTTP2_SPS_VAL3
+} grpc_chttp2_settings_parse_state;
+
struct grpc_chttp2_settings_parser {
- grpc_chttp2_settings_parse_state state;
+ grpc_chttp2_settings_parse_state state;
uint32_t* target_settings;
- uint8_t is_ack;
- uint16_t id;
- uint32_t value;
- uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
+ uint8_t is_ack;
+ uint16_t id;
+ uint32_t value;
+ uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
};
-/* Create a settings frame by diffing old & new, and updating old to be new */
+/* Create a settings frame by diffing old & new, and updating old to be new */
grpc_slice grpc_chttp2_settings_create(uint32_t* old, const uint32_t* newval,
- uint32_t force_mask, size_t count);
-/* Create an ack settings frame */
-grpc_slice grpc_chttp2_settings_ack_create(void);
-
+ uint32_t force_mask, size_t count);
+/* Create an ack settings frame */
+grpc_slice grpc_chttp2_settings_ack_create(void);
+
grpc_error* grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
uint32_t* settings);
@@ -56,5 +56,5 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* parser,
grpc_chttp2_stream* s,
const grpc_slice& slice,
int is_last);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_window_update.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_window_update.h
index e21b0e0ed0..340445d87a 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_window_update.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/frame_window_update.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/lib/transport/transport.h"
-
+#include <grpc/slice.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/lib/transport/transport.h"
+
struct grpc_chttp2_window_update_parser {
- uint8_t byte;
- uint8_t is_connection_update;
- uint32_t amount;
+ uint8_t byte;
+ uint8_t is_connection_update;
+ uint32_t amount;
};
-grpc_slice grpc_chttp2_window_update_create(
+grpc_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats* stats);
-
+
grpc_error* grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_window_update_parser* parser, uint32_t length, uint8_t flags);
grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
@@ -40,5 +40,5 @@ grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
grpc_chttp2_stream* s,
const grpc_slice& slice,
int is_last);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.h
index f8d1c893b7..5093f80ae2 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.h
@@ -1,69 +1,69 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/lib/transport/metadata.h"
-#include "src/core/lib/transport/metadata_batch.h"
-#include "src/core/lib/transport/transport.h"
-
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/transport/metadata_batch.h"
+#include "src/core/lib/transport/transport.h"
+
// This should be <= 8. We use 6 to save space.
#define GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS 6
#define GRPC_CHTTP2_HPACKC_NUM_VALUES (1 << GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS)
-/* initial table size, per spec */
-#define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096
-/* maximum table size we'll actually use */
-#define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024)
-
+/* initial table size, per spec */
+#define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096
+/* maximum table size we'll actually use */
+#define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024)
+
extern grpc_core::TraceFlag grpc_http_trace;
struct grpc_chttp2_hpack_compressor {
- uint32_t max_table_size;
- uint32_t max_table_elems;
- uint32_t cap_table_elems;
- /** maximum number of bytes we'll use for the decode table (to guard against
- peers ooming us by setting decode table size high) */
- uint32_t max_usable_size;
- /* one before the lowest usable table index */
- uint32_t tail_remote_index;
- uint32_t table_size;
- uint32_t table_elems;
+ uint32_t max_table_size;
+ uint32_t max_table_elems;
+ uint32_t cap_table_elems;
+ /** maximum number of bytes we'll use for the decode table (to guard against
+ peers ooming us by setting decode table size high) */
+ uint32_t max_usable_size;
+ /* one before the lowest usable table index */
+ uint32_t tail_remote_index;
+ uint32_t table_size;
+ uint32_t table_elems;
uint16_t* table_elem_size;
/** if non-zero, advertise to the decoder that we'll start using a table
of this size */
uint8_t advertise_table_size_change;
-
- /* filter tables for elems: this tables provides an approximate
- popularity count for particular hashes, and are used to determine whether
- a new literal should be added to the compression table or not.
- They track a single integer that counts how often a particular value has
- been seen. When that count reaches max (255), all values are halved. */
+
+ /* filter tables for elems: this tables provides an approximate
+ popularity count for particular hashes, and are used to determine whether
+ a new literal should be added to the compression table or not.
+ They track a single integer that counts how often a particular value has
+ been seen. When that count reaches max (255), all values are halved. */
uint32_t filter_elems_sum;
uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
-
- /* entry tables for keys & elems: these tables track values that have been
- seen and *may* be in the decompressor table */
+
+ /* entry tables for keys & elems: these tables track values that have been
+ seen and *may* be in the decompressor table */
struct {
struct {
grpc_mdelem value;
@@ -82,14 +82,14 @@ struct grpc_chttp2_hpack_compressor {
} entries[GRPC_CHTTP2_HPACKC_NUM_VALUES];
} key_table; /* Key table management */
};
-
+
void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c);
void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor* c);
-void grpc_chttp2_hpack_compressor_set_max_table_size(
+void grpc_chttp2_hpack_compressor_set_max_table_size(
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
-void grpc_chttp2_hpack_compressor_set_max_usable_size(
+void grpc_chttp2_hpack_compressor_set_max_usable_size(
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
-
+
struct grpc_encode_header_options {
uint32_t stream_id;
bool is_eof;
@@ -104,4 +104,4 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
const grpc_encode_header_options* options,
grpc_slice_buffer* outbuf);
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h
index dc45940986..1b859c4d7c 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/ext/transport/chttp2/transport/hpack_table.h"
-#include "src/core/lib/transport/metadata.h"
-
-typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
-
+#include <stddef.h>
+
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/ext/transport/chttp2/transport/hpack_table.h"
+#include "src/core/lib/transport/metadata.h"
+
+typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
+
typedef grpc_error* (*grpc_chttp2_hpack_parser_state)(
grpc_chttp2_hpack_parser* p, const uint8_t* beg, const uint8_t* end);
-
+
struct grpc_chttp2_hpack_parser_string {
bool copied;
struct {
@@ -43,31 +43,31 @@ struct grpc_chttp2_hpack_parser_string {
} copied;
} data;
};
-struct grpc_chttp2_hpack_parser {
- /* user specified callback for each header output */
+struct grpc_chttp2_hpack_parser {
+ /* user specified callback for each header output */
grpc_error* (*on_header)(void* user_data, grpc_mdelem md);
void* on_header_user_data;
-
+
grpc_error* last_error;
-
- /* current parse state - or a function that implements it */
- grpc_chttp2_hpack_parser_state state;
- /* future states dependent on the opening op code */
+
+ /* current parse state - or a function that implements it */
+ grpc_chttp2_hpack_parser_state state;
+ /* future states dependent on the opening op code */
const grpc_chttp2_hpack_parser_state* next_state;
- /* what to do after skipping prioritization data */
- grpc_chttp2_hpack_parser_state after_prioritization;
+ /* what to do after skipping prioritization data */
+ grpc_chttp2_hpack_parser_state after_prioritization;
/* the refcount of the slice that we're currently parsing */
grpc_slice_refcount* current_slice_refcount;
- /* the value we're currently parsing */
- union {
+ /* the value we're currently parsing */
+ union {
uint32_t* value;
grpc_chttp2_hpack_parser_string* str;
- } parsing;
- /* string parameters for each chunk */
- grpc_chttp2_hpack_parser_string key;
- grpc_chttp2_hpack_parser_string value;
- /* parsed index */
- uint32_t index;
+ } parsing;
+ /* string parameters for each chunk */
+ grpc_chttp2_hpack_parser_string key;
+ grpc_chttp2_hpack_parser_string value;
+ /* parsed index */
+ uint32_t index;
/* When we parse a value string, we determine the metadata element for a
specific index, which we need again when we're finishing up with that
header. To avoid calculating the metadata element for that index a second
@@ -76,42 +76,42 @@ struct grpc_chttp2_hpack_parser {
#ifndef NDEBUG
int64_t precomputed_md_index;
#endif
- /* length of source bytes for the currently parsing string */
- uint32_t strlen;
- /* number of source bytes read for the currently parsing string */
- uint32_t strgot;
- /* huffman decoding state */
- int16_t huff_state;
- /* is the string being decoded binary? */
- uint8_t binary;
- /* is the current string huffman encoded? */
- uint8_t huff;
- /* is a dynamic table update allowed? */
- uint8_t dynamic_table_update_allowed;
- /* set by higher layers, used by grpc_chttp2_header_parser_parse to signal
- it should append a metadata boundary at the end of frame */
- uint8_t is_boundary;
- uint8_t is_eof;
- uint32_t base64_buffer;
-
- /* hpack table */
- grpc_chttp2_hptbl table;
-};
-
+ /* length of source bytes for the currently parsing string */
+ uint32_t strlen;
+ /* number of source bytes read for the currently parsing string */
+ uint32_t strgot;
+ /* huffman decoding state */
+ int16_t huff_state;
+ /* is the string being decoded binary? */
+ uint8_t binary;
+ /* is the current string huffman encoded? */
+ uint8_t huff;
+ /* is a dynamic table update allowed? */
+ uint8_t dynamic_table_update_allowed;
+ /* set by higher layers, used by grpc_chttp2_header_parser_parse to signal
+ it should append a metadata boundary at the end of frame */
+ uint8_t is_boundary;
+ uint8_t is_eof;
+ uint32_t base64_buffer;
+
+ /* hpack table */
+ grpc_chttp2_hptbl table;
+};
+
void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p);
void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser* p);
-
+
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p);
-
+
grpc_error* grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
const grpc_slice& slice);
-
-/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
- the transport */
+
+/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
+ the transport */
grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
const grpc_slice& slice,
int is_last);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h
index 9ba29d8525..34c3dceda7 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h
@@ -1,52 +1,52 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/gprpp/memory.h"
-#include "src/core/lib/iomgr/error.h"
-#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/static_metadata.h"
-
-/* HPACK header table */
-
-/* last index in the static table */
-#define GRPC_CHTTP2_LAST_STATIC_ENTRY 61
-
-/* Initial table size as per the spec */
-#define GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE 4096
-/* Maximum table size that we'll use */
-#define GRPC_CHTTP2_MAX_HPACK_TABLE_SIZE GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE
-/* Per entry overhead bytes as per the spec */
-#define GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD 32
-#if 0
-/* Maximum number of entries we could possibly fit in the table, given defined
- overheads */
-#define GRPC_CHTTP2_MAX_TABLE_COUNT \
- ((GRPC_CHTTP2_MAX_HPACK_TABLE_SIZE + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) / \
- GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD)
-#endif
-
-/* hpack decoder table */
+
+/* HPACK header table */
+
+/* last index in the static table */
+#define GRPC_CHTTP2_LAST_STATIC_ENTRY 61
+
+/* Initial table size as per the spec */
+#define GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE 4096
+/* Maximum table size that we'll use */
+#define GRPC_CHTTP2_MAX_HPACK_TABLE_SIZE GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE
+/* Per entry overhead bytes as per the spec */
+#define GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD 32
+#if 0
+/* Maximum number of entries we could possibly fit in the table, given defined
+ overheads */
+#define GRPC_CHTTP2_MAX_TABLE_COUNT \
+ ((GRPC_CHTTP2_MAX_HPACK_TABLE_SIZE + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) / \
+ GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD)
+#endif
+
+/* hpack decoder table */
struct grpc_chttp2_hptbl {
static uint32_t entries_for_bytes(uint32_t bytes) {
return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) /
@@ -64,35 +64,35 @@ struct grpc_chttp2_hptbl {
memset(ents, 0, AllocSize);
}
- /* the first used entry in ents */
+ /* the first used entry in ents */
uint32_t first_ent = 0;
- /* how many entries are in the table */
+ /* how many entries are in the table */
uint32_t num_ents = 0;
- /* the amount of memory used by the table, according to the hpack algorithm */
+ /* the amount of memory used by the table, according to the hpack algorithm */
uint32_t mem_used = 0;
- /* the max memory allowed to be used by the table, according to the hpack
- algorithm */
+ /* the max memory allowed to be used by the table, according to the hpack
+ algorithm */
uint32_t max_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
- /* the currently agreed size of the table, according to the hpack algorithm */
+ /* the currently agreed size of the table, according to the hpack algorithm */
uint32_t current_table_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
- /* Maximum number of entries we could possibly fit in the table, given defined
- overheads */
+ /* Maximum number of entries we could possibly fit in the table, given defined
+ overheads */
uint32_t max_entries = kInitialCapacity;
- /* Number of entries allocated in ents */
+ /* Number of entries allocated in ents */
uint32_t cap_entries = kInitialCapacity;
- /* a circular buffer of headers - this is stored in the opposite order to
- what hpack specifies, in order to simplify table management a little...
- meaning lookups need to SUBTRACT from the end position */
+ /* a circular buffer of headers - this is stored in the opposite order to
+ what hpack specifies, in order to simplify table management a little...
+ meaning lookups need to SUBTRACT from the end position */
grpc_mdelem* ents = nullptr;
};
-
+
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl);
void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
- uint32_t max_bytes);
+ uint32_t max_bytes);
grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
- uint32_t bytes);
-
-/* lookup a table entry based on its hpack index */
+ uint32_t bytes);
+
+/* lookup a table entry based on its hpack index */
grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
uint32_t tbl_index);
grpc_mdelem grpc_chttp2_hptbl_lookup_ref_dynamic_index(
@@ -116,7 +116,7 @@ inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
}
}
}
-/* add a table entry to the index */
+/* add a table entry to the index */
grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
grpc_mdelem md) GRPC_MUST_USE_RESULT;
@@ -136,13 +136,13 @@ inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) {
return 0;
}
-/* Find a key/value pair in the table... returns the index in the table of the
- most similar entry, or 0 if the value was not found */
+/* Find a key/value pair in the table... returns the index in the table of the
+ most similar entry, or 0 if the value was not found */
struct grpc_chttp2_hptbl_find_result {
- uint32_t index;
- int has_value;
+ uint32_t index;
+ int has_value;
};
-grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
+grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
const grpc_chttp2_hptbl* tbl, grpc_mdelem md);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_tables.txt b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_tables.txt
index 441fb95707..08842a0267 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_tables.txt
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/hpack_tables.txt
@@ -1,66 +1,66 @@
-Static table, from the spec:
- +-------+-----------------------------+---------------+
- | Index | Header Name | Header Value |
- +-------+-----------------------------+---------------+
- | 1 | :authority | |
- | 2 | :method | GET |
- | 3 | :method | POST |
- | 4 | :path | / |
- | 5 | :path | /index.html |
- | 6 | :scheme | http |
- | 7 | :scheme | https |
- | 8 | :status | 200 |
- | 9 | :status | 204 |
- | 10 | :status | 206 |
- | 11 | :status | 304 |
- | 12 | :status | 400 |
- | 13 | :status | 404 |
- | 14 | :status | 500 |
- | 15 | accept-charset | |
- | 16 | accept-encoding | gzip, deflate |
- | 17 | accept-language | |
- | 18 | accept-ranges | |
- | 19 | accept | |
- | 20 | access-control-allow-origin | |
- | 21 | age | |
- | 22 | allow | |
- | 23 | authorization | |
- | 24 | cache-control | |
- | 25 | content-disposition | |
- | 26 | content-encoding | |
- | 27 | content-language | |
- | 28 | content-length | |
- | 29 | content-location | |
- | 30 | content-range | |
- | 31 | content-type | |
- | 32 | cookie | |
- | 33 | date | |
- | 34 | etag | |
- | 35 | expect | |
- | 36 | expires | |
- | 37 | from | |
- | 38 | host | |
- | 39 | if-match | |
- | 40 | if-modified-since | |
- | 41 | if-none-match | |
- | 42 | if-range | |
- | 43 | if-unmodified-since | |
- | 44 | last-modified | |
- | 45 | link | |
- | 46 | location | |
- | 47 | max-forwards | |
- | 48 | proxy-authenticate | |
- | 49 | proxy-authorization | |
- | 50 | range | |
- | 51 | referer | |
- | 52 | refresh | |
- | 53 | retry-after | |
- | 54 | server | |
- | 55 | set-cookie | |
- | 56 | strict-transport-security | |
- | 57 | transfer-encoding | |
- | 58 | user-agent | |
- | 59 | vary | |
- | 60 | via | |
- | 61 | www-authenticate | |
- +-------+-----------------------------+---------------+
+Static table, from the spec:
+ +-------+-----------------------------+---------------+
+ | Index | Header Name | Header Value |
+ +-------+-----------------------------+---------------+
+ | 1 | :authority | |
+ | 2 | :method | GET |
+ | 3 | :method | POST |
+ | 4 | :path | / |
+ | 5 | :path | /index.html |
+ | 6 | :scheme | http |
+ | 7 | :scheme | https |
+ | 8 | :status | 200 |
+ | 9 | :status | 204 |
+ | 10 | :status | 206 |
+ | 11 | :status | 304 |
+ | 12 | :status | 400 |
+ | 13 | :status | 404 |
+ | 14 | :status | 500 |
+ | 15 | accept-charset | |
+ | 16 | accept-encoding | gzip, deflate |
+ | 17 | accept-language | |
+ | 18 | accept-ranges | |
+ | 19 | accept | |
+ | 20 | access-control-allow-origin | |
+ | 21 | age | |
+ | 22 | allow | |
+ | 23 | authorization | |
+ | 24 | cache-control | |
+ | 25 | content-disposition | |
+ | 26 | content-encoding | |
+ | 27 | content-language | |
+ | 28 | content-length | |
+ | 29 | content-location | |
+ | 30 | content-range | |
+ | 31 | content-type | |
+ | 32 | cookie | |
+ | 33 | date | |
+ | 34 | etag | |
+ | 35 | expect | |
+ | 36 | expires | |
+ | 37 | from | |
+ | 38 | host | |
+ | 39 | if-match | |
+ | 40 | if-modified-since | |
+ | 41 | if-none-match | |
+ | 42 | if-range | |
+ | 43 | if-unmodified-since | |
+ | 44 | last-modified | |
+ | 45 | link | |
+ | 46 | location | |
+ | 47 | max-forwards | |
+ | 48 | proxy-authenticate | |
+ | 49 | proxy-authorization | |
+ | 50 | range | |
+ | 51 | referer | |
+ | 52 | refresh | |
+ | 53 | retry-after | |
+ | 54 | server | |
+ | 55 | set-cookie | |
+ | 56 | strict-transport-security | |
+ | 57 | transfer-encoding | |
+ | 58 | user-agent | |
+ | 59 | vary | |
+ | 60 | via | |
+ | 61 | www-authenticate | |
+ +-------+-----------------------------+---------------+
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/huffsyms.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/huffsyms.h
index 1ceb6efd16..49feb238f1 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/huffsyms.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/huffsyms.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H
-
-/* HPACK static huffman table */
-
-#define GRPC_CHTTP2_NUM_HUFFSYMS 257
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H
+
+/* HPACK static huffman table */
+
+#define GRPC_CHTTP2_NUM_HUFFSYMS 257
+
struct grpc_chttp2_huffsym {
- unsigned bits;
- unsigned length;
+ unsigned bits;
+ unsigned length;
};
-extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS];
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */
+extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS];
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.h
index da7b522e91..b63caa1ae2 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/transport/transport.h"
-
+#include "src/core/lib/transport/transport.h"
+
struct grpc_chttp2_incoming_metadata_buffer {
explicit grpc_chttp2_incoming_metadata_buffer(grpc_core::Arena* arena)
: arena(arena) {
@@ -42,17 +42,17 @@ struct grpc_chttp2_incoming_metadata_buffer {
grpc_linked_mdelem preallocated_mdelems[kPreallocatedMDElem];
grpc_metadata_batch batch;
};
-
-void grpc_chttp2_incoming_metadata_buffer_publish(
+
+void grpc_chttp2_incoming_metadata_buffer_publish(
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_metadata_batch* batch);
-
+
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
grpc_chttp2_incoming_metadata_buffer* buffer,
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
grpc_chttp2_incoming_metadata_buffer* buffer,
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
-void grpc_chttp2_incoming_metadata_buffer_set_deadline(
+void grpc_chttp2_incoming_metadata_buffer_set_deadline(
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_millis deadline);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/internal.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/internal.h
index 253dba1fbd..2f028c08f3 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/internal.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/internal.h
@@ -1,77 +1,77 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
+
#include <grpc/support/port_platform.h>
-#include <assert.h>
-#include <stdbool.h>
-
+#include <assert.h>
+#include <stdbool.h>
+
#include "src/core/ext/transport/chttp2/transport/flow_control.h"
-#include "src/core/ext/transport/chttp2/transport/frame.h"
-#include "src/core/ext/transport/chttp2/transport/frame_data.h"
-#include "src/core/ext/transport/chttp2/transport/frame_goaway.h"
-#include "src/core/ext/transport/chttp2/transport/frame_ping.h"
-#include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h"
-#include "src/core/ext/transport/chttp2/transport/frame_settings.h"
-#include "src/core/ext/transport/chttp2/transport/frame_window_update.h"
-#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
-#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
-#include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
-#include "src/core/ext/transport/chttp2/transport/stream_map.h"
+#include "src/core/ext/transport/chttp2/transport/frame.h"
+#include "src/core/ext/transport/chttp2/transport/frame_data.h"
+#include "src/core/ext/transport/chttp2/transport/frame_goaway.h"
+#include "src/core/ext/transport/chttp2/transport/frame_ping.h"
+#include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h"
+#include "src/core/ext/transport/chttp2/transport/frame_settings.h"
+#include "src/core/ext/transport/chttp2/transport/frame_window_update.h"
+#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
+#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
+#include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
+#include "src/core/ext/transport/chttp2/transport/stream_map.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/compression/stream_compression.h"
#include "src/core/lib/gprpp/manual_constructor.h"
-#include "src/core/lib/iomgr/combiner.h"
-#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/combiner.h"
+#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/timer.h"
-#include "src/core/lib/transport/connectivity_state.h"
-#include "src/core/lib/transport/transport_impl.h"
-
+#include "src/core/lib/transport/connectivity_state.h"
+#include "src/core/lib/transport/transport_impl.h"
+
namespace grpc_core {
class ContextList;
}
-/* streams are kept in various linked lists depending on what things need to
- happen to them... this enum labels each list */
-typedef enum {
+/* streams are kept in various linked lists depending on what things need to
+ happen to them... this enum labels each list */
+typedef enum {
/* If a stream is in the following two lists, an explicit ref is associated
with the stream */
- GRPC_CHTTP2_LIST_WRITABLE,
- GRPC_CHTTP2_LIST_WRITING,
+ GRPC_CHTTP2_LIST_WRITABLE,
+ GRPC_CHTTP2_LIST_WRITING,
/* No additional ref is taken for the following refs. Make sure to remove the
stream from these lists when the stream is removed. */
- GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT,
+ GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT,
GRPC_CHTTP2_LIST_STALLED_BY_STREAM,
- /** streams that are waiting to start because there are too many concurrent
- streams on the connection */
- GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY,
- STREAM_LIST_COUNT /* must be last */
-} grpc_chttp2_stream_list_id;
-
-typedef enum {
- GRPC_CHTTP2_WRITE_STATE_IDLE,
- GRPC_CHTTP2_WRITE_STATE_WRITING,
- GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
-} grpc_chttp2_write_state;
-
+ /** streams that are waiting to start because there are too many concurrent
+ streams on the connection */
+ GRPC_CHTTP2_LIST_WAITING_FOR_CONCURRENCY,
+ STREAM_LIST_COUNT /* must be last */
+} grpc_chttp2_stream_list_id;
+
+typedef enum {
+ GRPC_CHTTP2_WRITE_STATE_IDLE,
+ GRPC_CHTTP2_WRITE_STATE_WRITING,
+ GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
+} grpc_chttp2_write_state;
+
typedef enum {
GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY,
GRPC_CHTTP2_OPTIMIZE_FOR_THROUGHPUT,
@@ -131,49 +131,49 @@ struct grpc_chttp2_server_ping_recv_state {
grpc_millis last_ping_recv_time;
int ping_strikes;
};
-/* deframer state for the overall http2 stream of bytes */
-typedef enum {
- /* prefix: one entry per http2 connection prefix byte */
- GRPC_DTS_CLIENT_PREFIX_0 = 0,
- GRPC_DTS_CLIENT_PREFIX_1,
- GRPC_DTS_CLIENT_PREFIX_2,
- GRPC_DTS_CLIENT_PREFIX_3,
- GRPC_DTS_CLIENT_PREFIX_4,
- GRPC_DTS_CLIENT_PREFIX_5,
- GRPC_DTS_CLIENT_PREFIX_6,
- GRPC_DTS_CLIENT_PREFIX_7,
- GRPC_DTS_CLIENT_PREFIX_8,
- GRPC_DTS_CLIENT_PREFIX_9,
- GRPC_DTS_CLIENT_PREFIX_10,
- GRPC_DTS_CLIENT_PREFIX_11,
- GRPC_DTS_CLIENT_PREFIX_12,
- GRPC_DTS_CLIENT_PREFIX_13,
- GRPC_DTS_CLIENT_PREFIX_14,
- GRPC_DTS_CLIENT_PREFIX_15,
- GRPC_DTS_CLIENT_PREFIX_16,
- GRPC_DTS_CLIENT_PREFIX_17,
- GRPC_DTS_CLIENT_PREFIX_18,
- GRPC_DTS_CLIENT_PREFIX_19,
- GRPC_DTS_CLIENT_PREFIX_20,
- GRPC_DTS_CLIENT_PREFIX_21,
- GRPC_DTS_CLIENT_PREFIX_22,
- GRPC_DTS_CLIENT_PREFIX_23,
- /* frame header byte 0... */
- /* must follow from the prefix states */
- GRPC_DTS_FH_0,
- GRPC_DTS_FH_1,
- GRPC_DTS_FH_2,
- GRPC_DTS_FH_3,
- GRPC_DTS_FH_4,
- GRPC_DTS_FH_5,
- GRPC_DTS_FH_6,
- GRPC_DTS_FH_7,
- /* ... frame header byte 8 */
- GRPC_DTS_FH_8,
- /* inside a http2 frame */
- GRPC_DTS_FRAME
-} grpc_chttp2_deframe_transport_state;
-
+/* deframer state for the overall http2 stream of bytes */
+typedef enum {
+ /* prefix: one entry per http2 connection prefix byte */
+ GRPC_DTS_CLIENT_PREFIX_0 = 0,
+ GRPC_DTS_CLIENT_PREFIX_1,
+ GRPC_DTS_CLIENT_PREFIX_2,
+ GRPC_DTS_CLIENT_PREFIX_3,
+ GRPC_DTS_CLIENT_PREFIX_4,
+ GRPC_DTS_CLIENT_PREFIX_5,
+ GRPC_DTS_CLIENT_PREFIX_6,
+ GRPC_DTS_CLIENT_PREFIX_7,
+ GRPC_DTS_CLIENT_PREFIX_8,
+ GRPC_DTS_CLIENT_PREFIX_9,
+ GRPC_DTS_CLIENT_PREFIX_10,
+ GRPC_DTS_CLIENT_PREFIX_11,
+ GRPC_DTS_CLIENT_PREFIX_12,
+ GRPC_DTS_CLIENT_PREFIX_13,
+ GRPC_DTS_CLIENT_PREFIX_14,
+ GRPC_DTS_CLIENT_PREFIX_15,
+ GRPC_DTS_CLIENT_PREFIX_16,
+ GRPC_DTS_CLIENT_PREFIX_17,
+ GRPC_DTS_CLIENT_PREFIX_18,
+ GRPC_DTS_CLIENT_PREFIX_19,
+ GRPC_DTS_CLIENT_PREFIX_20,
+ GRPC_DTS_CLIENT_PREFIX_21,
+ GRPC_DTS_CLIENT_PREFIX_22,
+ GRPC_DTS_CLIENT_PREFIX_23,
+ /* frame header byte 0... */
+ /* must follow from the prefix states */
+ GRPC_DTS_FH_0,
+ GRPC_DTS_FH_1,
+ GRPC_DTS_FH_2,
+ GRPC_DTS_FH_3,
+ GRPC_DTS_FH_4,
+ GRPC_DTS_FH_5,
+ GRPC_DTS_FH_6,
+ GRPC_DTS_FH_7,
+ /* ... frame header byte 8 */
+ GRPC_DTS_FH_8,
+ /* inside a http2 frame */
+ GRPC_DTS_FRAME
+} grpc_chttp2_deframe_transport_state;
+
struct grpc_chttp2_stream_list {
grpc_chttp2_stream* head;
grpc_chttp2_stream* tail;
@@ -182,41 +182,41 @@ struct grpc_chttp2_stream_link {
grpc_chttp2_stream* next;
grpc_chttp2_stream* prev;
};
-/* We keep several sets of connection wide parameters */
-typedef enum {
- /* The settings our peer has asked for (and we have acked) */
- GRPC_PEER_SETTINGS = 0,
- /* The settings we'd like to have */
- GRPC_LOCAL_SETTINGS,
- /* The settings we've published to our peer */
- GRPC_SENT_SETTINGS,
- /* The settings the peer has acked */
- GRPC_ACKED_SETTINGS,
- GRPC_NUM_SETTING_SETS
-} grpc_chttp2_setting_set;
-
-typedef enum {
- GRPC_CHTTP2_NO_GOAWAY_SEND,
- GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED,
- GRPC_CHTTP2_GOAWAY_SENT,
-} grpc_chttp2_sent_goaway_state;
-
-typedef struct grpc_chttp2_write_cb {
- int64_t call_at_byte;
+/* We keep several sets of connection wide parameters */
+typedef enum {
+ /* The settings our peer has asked for (and we have acked) */
+ GRPC_PEER_SETTINGS = 0,
+ /* The settings we'd like to have */
+ GRPC_LOCAL_SETTINGS,
+ /* The settings we've published to our peer */
+ GRPC_SENT_SETTINGS,
+ /* The settings the peer has acked */
+ GRPC_ACKED_SETTINGS,
+ GRPC_NUM_SETTING_SETS
+} grpc_chttp2_setting_set;
+
+typedef enum {
+ GRPC_CHTTP2_NO_GOAWAY_SEND,
+ GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED,
+ GRPC_CHTTP2_GOAWAY_SENT,
+} grpc_chttp2_sent_goaway_state;
+
+typedef struct grpc_chttp2_write_cb {
+ int64_t call_at_byte;
grpc_closure* closure;
struct grpc_chttp2_write_cb* next;
-} grpc_chttp2_write_cb;
-
+} grpc_chttp2_write_cb;
+
namespace grpc_core {
-
+
class Chttp2IncomingByteStream : public ByteStream {
public:
Chttp2IncomingByteStream(grpc_chttp2_transport* transport,
grpc_chttp2_stream* stream, uint32_t frame_size,
uint32_t flags);
-
+
void Orphan() override;
-
+
bool Next(size_t max_size_hint, grpc_closure* on_complete) override;
grpc_error* Pull(grpc_slice* slice) override;
void Shutdown(grpc_error* error) override;
@@ -269,14 +269,14 @@ class Chttp2IncomingByteStream : public ByteStream {
/* Accessed only by transport thread when stream->pending_byte_stream == false
* Accessed only by application thread when stream->pending_byte_stream ==
* true */
- struct {
- grpc_closure closure;
- size_t max_size_hint;
+ struct {
+ grpc_closure closure;
+ size_t max_size_hint;
grpc_closure* on_complete;
} next_action_;
grpc_closure destroy_action_;
-};
-
+};
+
} // namespace grpc_core
typedef enum {
@@ -286,125 +286,125 @@ typedef enum {
GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED,
} grpc_chttp2_keepalive_state;
-struct grpc_chttp2_transport {
+struct grpc_chttp2_transport {
grpc_chttp2_transport(const grpc_channel_args* channel_args,
grpc_endpoint* ep, bool is_client,
grpc_resource_user* resource_user);
~grpc_chttp2_transport();
- grpc_transport base; /* must be first */
+ grpc_transport base; /* must be first */
grpc_core::RefCount refs;
grpc_endpoint* ep;
TString peer_string;
-
+
grpc_resource_user* resource_user;
grpc_core::Combiner* combiner;
-
+
grpc_closure* notify_on_receive_settings = nullptr;
- /** write execution state of the transport */
+ /** write execution state of the transport */
grpc_chttp2_write_state write_state = GRPC_CHTTP2_WRITE_STATE_IDLE;
-
- /** is the transport destroying itself? */
+
+ /** is the transport destroying itself? */
uint8_t destroying = false;
- /** has the upper layer closed the transport? */
+ /** has the upper layer closed the transport? */
grpc_error* closed_with_error = GRPC_ERROR_NONE;
-
- /** is there a read request to the endpoint outstanding? */
+
+ /** is there a read request to the endpoint outstanding? */
uint8_t endpoint_reading = 1;
-
- /** various lists of streams */
+
+ /** various lists of streams */
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT] = {};
-
- /** maps stream id to grpc_chttp2_stream objects */
- grpc_chttp2_stream_map stream_map;
-
- grpc_closure write_action_begin_locked;
- grpc_closure write_action;
- grpc_closure write_action_end_locked;
-
- grpc_closure read_action_locked;
-
- /** incoming read bytes */
- grpc_slice_buffer read_buffer;
-
- /** address to place a newly accepted stream - set and unset by
- grpc_chttp2_parsing_accept_stream; used by init_stream to
- publish the accepted server stream */
+
+ /** maps stream id to grpc_chttp2_stream objects */
+ grpc_chttp2_stream_map stream_map;
+
+ grpc_closure write_action_begin_locked;
+ grpc_closure write_action;
+ grpc_closure write_action_end_locked;
+
+ grpc_closure read_action_locked;
+
+ /** incoming read bytes */
+ grpc_slice_buffer read_buffer;
+
+ /** address to place a newly accepted stream - set and unset by
+ grpc_chttp2_parsing_accept_stream; used by init_stream to
+ publish the accepted server stream */
grpc_chttp2_stream** accepting_stream = nullptr;
-
+
/* accept stream callback */
void (*accept_stream_cb)(void* user_data, grpc_transport* transport,
const void* server_data);
void* accept_stream_cb_user_data;
-
+
/** connectivity tracking */
grpc_core::ConnectivityStateTracker state_tracker;
-
- /** data to write now */
- grpc_slice_buffer outbuf;
- /** hpack encoding */
- grpc_chttp2_hpack_compressor hpack_compressor;
- /** is this a client? */
+
+ /** data to write now */
+ grpc_slice_buffer outbuf;
+ /** hpack encoding */
+ grpc_chttp2_hpack_compressor hpack_compressor;
+ /** is this a client? */
bool is_client;
-
- /** data to write next write */
- grpc_slice_buffer qbuf;
-
- /** how much data are we willing to buffer when the WRITE_BUFFER_HINT is set?
- */
+
+ /** data to write next write */
+ grpc_slice_buffer qbuf;
+
+ /** how much data are we willing to buffer when the WRITE_BUFFER_HINT is set?
+ */
uint32_t write_buffer_size = grpc_core::chttp2::kDefaultWindow;
-
+
/** Set to a grpc_error object if a goaway frame is received. By default, set
* to GRPC_ERROR_NONE */
grpc_error* goaway_error = GRPC_ERROR_NONE;
grpc_chttp2_sent_goaway_state sent_goaway_state = GRPC_CHTTP2_NO_GOAWAY_SEND;
-
- /** are the local settings dirty and need to be sent? */
+
+ /** are the local settings dirty and need to be sent? */
bool dirtied_local_settings = true;
- /** have local settings been sent? */
+ /** have local settings been sent? */
bool sent_local_settings = false;
/** bitmask of setting indexes to send out
Hack: it's common for implementations to assume 65536 bytes initial send
window -- this should by rights be 0 */
uint32_t force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
- /** settings values */
- uint32_t settings[GRPC_NUM_SETTING_SETS][GRPC_CHTTP2_NUM_SETTINGS];
-
- /** what is the next stream id to be allocated by this peer?
- copied to next_stream_id in parsing when parsing commences */
+ /** settings values */
+ uint32_t settings[GRPC_NUM_SETTING_SETS][GRPC_CHTTP2_NUM_SETTINGS];
+
+ /** what is the next stream id to be allocated by this peer?
+ copied to next_stream_id in parsing when parsing commences */
uint32_t next_stream_id = 0;
-
- /** last new stream id */
+
+ /** last new stream id */
uint32_t last_new_stream_id = 0;
-
+
/** ping queues for various ping insertion points */
grpc_chttp2_ping_queue ping_queue = grpc_chttp2_ping_queue();
grpc_chttp2_repeated_ping_policy ping_policy;
grpc_chttp2_repeated_ping_state ping_state;
uint64_t ping_ctr = 0; /* unique id for pings */
grpc_closure retry_initiate_ping_locked;
-
+
/** ping acks */
size_t ping_ack_count = 0;
size_t ping_ack_capacity = 0;
uint64_t* ping_acks = nullptr;
grpc_chttp2_server_ping_recv_state ping_recv_state;
- /** parser for headers */
- grpc_chttp2_hpack_parser hpack_parser;
- /** simple one shot parsers */
- union {
- grpc_chttp2_window_update_parser window_update;
- grpc_chttp2_settings_parser settings;
- grpc_chttp2_ping_parser ping;
- grpc_chttp2_rst_stream_parser rst_stream;
- } simple;
- /** parser for goaway frames */
- grpc_chttp2_goaway_parser goaway_parser;
-
+ /** parser for headers */
+ grpc_chttp2_hpack_parser hpack_parser;
+ /** simple one shot parsers */
+ union {
+ grpc_chttp2_window_update_parser window_update;
+ grpc_chttp2_settings_parser settings;
+ grpc_chttp2_ping_parser ping;
+ grpc_chttp2_rst_stream_parser rst_stream;
+ } simple;
+ /** parser for goaway frames */
+ grpc_chttp2_goaway_parser goaway_parser;
+
grpc_core::PolymorphicManualConstructor<
grpc_core::chttp2::TransportFlowControlBase,
grpc_core::chttp2::TransportFlowControl,
@@ -414,8 +414,8 @@ struct grpc_chttp2_transport {
* the remote peer. If there is a positive delta, then we will make all
* streams readable since they may have become unstalled */
int64_t initial_window_update = 0;
-
- /* deframing */
+
+ /* deframing */
grpc_chttp2_deframe_transport_state deframe_state = GRPC_DTS_CLIENT_PREFIX_0;
uint8_t incoming_frame_type = 0;
uint8_t incoming_frame_flags = 0;
@@ -424,39 +424,39 @@ struct grpc_chttp2_transport {
uint32_t expect_continuation_stream_id = 0;
uint32_t incoming_frame_size = 0;
uint32_t incoming_stream_id = 0;
-
- /* active parser */
+
+ /* active parser */
void* parser_data = nullptr;
grpc_chttp2_stream* incoming_stream = nullptr;
grpc_error* (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
grpc_chttp2_stream* s, const grpc_slice& slice,
int is_last);
-
+
grpc_chttp2_write_cb* write_cb_pool = nullptr;
-
+
/* bdp estimator */
bool bdp_ping_blocked =
false; /* Is the BDP blocked due to not receiving any data? */
grpc_closure next_bdp_ping_timer_expired_locked;
grpc_closure start_bdp_ping_locked;
grpc_closure finish_bdp_ping_locked;
-
- /* if non-NULL, close the transport with this error when writes are finished
- */
+
+ /* if non-NULL, close the transport with this error when writes are finished
+ */
grpc_error* close_transport_on_writes_finished = GRPC_ERROR_NONE;
-
- /* a list of closures to run after writes are finished */
+
+ /* a list of closures to run after writes are finished */
grpc_closure_list run_after_write = GRPC_CLOSURE_LIST_INIT;
-
- /* buffer pool state */
- /** have we scheduled a benign cleanup? */
+
+ /* buffer pool state */
+ /** have we scheduled a benign cleanup? */
bool benign_reclaimer_registered = false;
- /** have we scheduled a destructive cleanup? */
+ /** have we scheduled a destructive cleanup? */
bool destructive_reclaimer_registered = false;
- /** benign cleanup closure */
- grpc_closure benign_reclaimer_locked;
- /** destructive cleanup closure */
- grpc_closure destructive_reclaimer_locked;
+ /** benign cleanup closure */
+ grpc_closure benign_reclaimer_locked;
+ /** destructive cleanup closure */
+ grpc_closure destructive_reclaimer_locked;
/* next bdp ping timer */
bool have_next_bdp_ping_timer = false;
@@ -497,16 +497,16 @@ struct grpc_chttp2_transport {
* thereby reducing the number of induced frames. */
uint32_t num_pending_induced_frames = 0;
bool reading_paused_on_pending_induced_frames = false;
-};
-
-typedef enum {
- GRPC_METADATA_NOT_PUBLISHED,
- GRPC_METADATA_SYNTHESIZED_FROM_FAKE,
- GRPC_METADATA_PUBLISHED_FROM_WIRE,
+};
+
+typedef enum {
+ GRPC_METADATA_NOT_PUBLISHED,
+ GRPC_METADATA_SYNTHESIZED_FROM_FAKE,
+ GRPC_METADATA_PUBLISHED_FROM_WIRE,
GRPC_METADATA_PUBLISHED_AT_CLOSE
-} grpc_published_metadata_method;
-
-struct grpc_chttp2_stream {
+} grpc_published_metadata_method;
+
+struct grpc_chttp2_stream {
grpc_chttp2_stream(grpc_chttp2_transport* t, grpc_stream_refcount* refcount,
const void* server_data, grpc_core::Arena* arena);
~grpc_chttp2_stream();
@@ -520,17 +520,17 @@ struct grpc_chttp2_stream {
struct Reffer {
explicit Reffer(grpc_chttp2_stream* s);
} reffer;
-
- grpc_closure destroy_stream;
+
+ grpc_closure destroy_stream;
grpc_closure* destroy_stream_arg;
-
- grpc_chttp2_stream_link links[STREAM_LIST_COUNT];
+
+ grpc_chttp2_stream_link links[STREAM_LIST_COUNT];
uint8_t included[STREAM_LIST_COUNT] = {};
-
- /** HTTP2 stream id for this stream, or zero if one has not been assigned */
+
+ /** HTTP2 stream id for this stream, or zero if one has not been assigned */
uint32_t id = 0;
-
- /** things the upper layers would like to send */
+
+ /** things the upper layers would like to send */
grpc_metadata_batch* send_initial_metadata = nullptr;
grpc_closure* send_initial_metadata_finished = nullptr;
grpc_metadata_batch* send_trailing_metadata = nullptr;
@@ -542,16 +542,16 @@ struct grpc_chttp2_stream {
// detecting cancellation on the server-side)..
bool* sent_trailing_metadata_op = nullptr;
grpc_closure* send_trailing_metadata_finished = nullptr;
-
+
grpc_core::OrphanablePtr<grpc_core::ByteStream> fetching_send_message;
uint32_t fetched_send_message_length = 0;
grpc_slice fetching_slice = grpc_empty_slice();
- int64_t next_message_end_offset;
+ int64_t next_message_end_offset;
int64_t flow_controlled_bytes_written = 0;
int64_t flow_controlled_bytes_flowed = 0;
- grpc_closure complete_fetch_locked;
+ grpc_closure complete_fetch_locked;
grpc_closure* fetching_send_message_finished = nullptr;
-
+
grpc_metadata_batch* recv_initial_metadata;
grpc_closure* recv_initial_metadata_ready = nullptr;
bool* trailing_metadata_available = nullptr;
@@ -559,39 +559,39 @@ struct grpc_chttp2_stream {
grpc_closure* recv_message_ready = nullptr;
grpc_metadata_batch* recv_trailing_metadata;
grpc_closure* recv_trailing_metadata_finished = nullptr;
-
+
grpc_transport_stream_stats* collecting_stats = nullptr;
grpc_transport_stream_stats stats = grpc_transport_stream_stats();
-
- /** Is this stream closed for writing. */
+
+ /** Is this stream closed for writing. */
bool write_closed = false;
- /** Is this stream reading half-closed. */
+ /** Is this stream reading half-closed. */
bool read_closed = false;
- /** Are all published incoming byte streams closed. */
+ /** Are all published incoming byte streams closed. */
bool all_incoming_byte_streams_finished = false;
- /** Has this stream seen an error.
- If true, then pending incoming frames can be thrown away. */
+ /** Has this stream seen an error.
+ If true, then pending incoming frames can be thrown away. */
bool seen_error = false;
- /** Are we buffering writes on this stream? If yes, we won't become writable
- until there's enough queued up in the flow_controlled_buffer */
+ /** Are we buffering writes on this stream? If yes, we won't become writable
+ until there's enough queued up in the flow_controlled_buffer */
bool write_buffering = false;
-
+
/* have we sent or received the EOS bit? */
bool eos_received = false;
bool eos_sent = false;
- /** the error that resulted in this stream being read-closed */
+ /** the error that resulted in this stream being read-closed */
grpc_error* read_closed_error = GRPC_ERROR_NONE;
- /** the error that resulted in this stream being write-closed */
+ /** the error that resulted in this stream being write-closed */
grpc_error* write_closed_error = GRPC_ERROR_NONE;
-
+
grpc_published_metadata_method published_metadata[2] = {};
bool final_metadata_requested = false;
-
- grpc_chttp2_incoming_metadata_buffer metadata_buffer[2];
-
+
+ grpc_chttp2_incoming_metadata_buffer metadata_buffer[2];
+
grpc_slice_buffer frame_storage; /* protected by t combiner */
-
+
grpc_closure* on_next = nullptr; /* protected by t combiner */
bool pending_byte_stream = false; /* protected by t combiner */
// cached length of buffer to be used by the transport thread in cases where
@@ -606,21 +606,21 @@ struct grpc_chttp2_stream {
grpc_closure reset_byte_stream;
grpc_error* byte_stream_error = GRPC_ERROR_NONE; /* protected by t combiner */
bool received_last_frame = false; /* protected by t combiner */
-
+
grpc_millis deadline = GRPC_MILLIS_INF_FUTURE;
- /** saw some stream level error */
+ /** saw some stream level error */
grpc_error* forced_close_error = GRPC_ERROR_NONE;
- /** how many header frames have we received? */
+ /** how many header frames have we received? */
uint8_t header_frames_received = 0;
- /** parsing state for data frames */
+ /** parsing state for data frames */
/* Accessed only by transport thread when stream->pending_byte_stream == false
* Accessed only by application thread when stream->pending_byte_stream ==
* true */
- grpc_chttp2_data_parser data_parser;
- /** number of bytes received - reset at end of parse thread execution */
+ grpc_chttp2_data_parser data_parser;
+ /** number of bytes received - reset at end of parse thread execution */
int64_t received_bytes = 0;
-
+
bool sent_initial_metadata = false;
bool sent_trailing_metadata = false;
@@ -630,8 +630,8 @@ struct grpc_chttp2_stream {
grpc_core::chttp2::StreamFlowControlDisabled>
flow_control;
- grpc_slice_buffer flow_controlled_buffer;
-
+ grpc_slice_buffer flow_controlled_buffer;
+
grpc_chttp2_write_cb* on_flow_controlled_cbs = nullptr;
grpc_chttp2_write_cb* on_write_finished_cbs = nullptr;
grpc_chttp2_write_cb* finish_after_write = nullptr;
@@ -669,23 +669,23 @@ struct grpc_chttp2_stream {
* compression.
*/
grpc_slice_buffer decompressed_data_buffer;
-};
-
-/** Transport writing call flow:
- grpc_chttp2_initiate_write() is called anywhere that we know bytes need to
- go out on the wire.
- If no other write has been started, a task is enqueued onto our workqueue.
- When that task executes, it obtains the global lock, and gathers the data
- to write.
- The global lock is dropped and we do the syscall to write.
- After writing, a follow-up check is made to see if another round of writing
- should be performed.
-
- The actual call chain is documented in the implementation of this function.
- */
+};
+
+/** Transport writing call flow:
+ grpc_chttp2_initiate_write() is called anywhere that we know bytes need to
+ go out on the wire.
+ If no other write has been started, a task is enqueued onto our workqueue.
+ When that task executes, it obtains the global lock, and gathers the data
+ to write.
+ The global lock is dropped and we do the syscall to write.
+ After writing, a follow-up check is made to see if another round of writing
+ should be performed.
+
+ The actual call chain is documented in the implementation of this function.
+ */
void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
grpc_chttp2_initiate_write_reason reason);
-
+
struct grpc_chttp2_begin_write_result {
/** are we writing? */
bool writing;
@@ -698,45 +698,45 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
grpc_chttp2_transport* t);
void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error);
-/** Process one slice of incoming data; return 1 if the connection is still
- viable after reading, or 0 if the connection should be torn down */
+/** Process one slice of incoming data; return 1 if the connection is still
+ viable after reading, or 0 if the connection should be torn down */
grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
const grpc_slice& slice);
-
+
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-/** Get a writable stream
- returns non-zero if there was a stream available */
+/** Get a writable stream
+ returns non-zero if there was a stream available */
bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
bool grpc_chttp2_list_remove_writable_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-
+
bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_have_writing_streams(grpc_chttp2_transport* t);
bool grpc_chttp2_list_pop_writing_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
-
+
void grpc_chttp2_list_add_written_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_pop_written_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
-
+
void grpc_chttp2_list_add_waiting_for_concurrency(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_pop_waiting_for_concurrency(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
void grpc_chttp2_list_remove_waiting_for_concurrency(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-
+
void grpc_chttp2_list_add_stalled_by_transport(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_pop_stalled_by_transport(grpc_chttp2_transport* t,
grpc_chttp2_stream** s);
void grpc_chttp2_list_remove_stalled_by_transport(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-
+
void grpc_chttp2_list_add_stalled_by_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
bool grpc_chttp2_list_pop_stalled_by_stream(grpc_chttp2_transport* t,
@@ -759,62 +759,62 @@ inline grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(
grpc_chttp2_stream_map_find(&t->stream_map, id));
}
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
- uint32_t id);
-
+ uint32_t id);
+
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
- uint32_t goaway_error,
+ uint32_t goaway_error,
uint32_t last_stream_id,
const grpc_slice& goaway_text);
-
+
void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport* t);
-
+
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_closure** pclosure,
grpc_error* error, const char* desc);
-
+
#define GRPC_HEADER_SIZE_IN_BYTES 5
#define MAX_SIZE_T (~(size_t)0)
-#define GRPC_CHTTP2_CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
-#define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN \
- (sizeof(GRPC_CHTTP2_CLIENT_CONNECT_STRING) - 1)
-
+#define GRPC_CHTTP2_CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
+#define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN \
+ (sizeof(GRPC_CHTTP2_CLIENT_CONNECT_STRING) - 1)
+
// extern grpc_core::TraceFlag grpc_http_trace;
// extern grpc_core::TraceFlag grpc_flowctl_trace;
-
+
#define GRPC_CHTTP2_IF_TRACING(stmt) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { \
(stmt); \
} \
} while (0)
-
+
void grpc_chttp2_fake_status(grpc_chttp2_transport* t,
grpc_chttp2_stream* stream, grpc_error* error);
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, int close_reads,
int close_writes, grpc_error* error);
void grpc_chttp2_start_writing(grpc_chttp2_transport* t);
-
+
#ifndef NDEBUG
-#define GRPC_CHTTP2_STREAM_REF(stream, reason) \
- grpc_chttp2_stream_ref(stream, reason)
+#define GRPC_CHTTP2_STREAM_REF(stream, reason) \
+ grpc_chttp2_stream_ref(stream, reason)
#define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
grpc_chttp2_stream_unref(stream, reason)
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason);
void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason);
-#else
-#define GRPC_CHTTP2_STREAM_REF(stream, reason) grpc_chttp2_stream_ref(stream)
+#else
+#define GRPC_CHTTP2_STREAM_REF(stream, reason) grpc_chttp2_stream_ref(stream)
#define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
grpc_chttp2_stream_unref(stream)
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s);
void grpc_chttp2_stream_unref(grpc_chttp2_stream* s);
-#endif
-
+#endif
+
#ifndef NDEBUG
-#define GRPC_CHTTP2_REF_TRANSPORT(t, r) \
- grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__)
+#define GRPC_CHTTP2_REF_TRANSPORT(t, r) \
+ grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__)
#define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) \
grpc_chttp2_unref_transport(t, r, __FILE__, __LINE__)
inline void grpc_chttp2_unref_transport(grpc_chttp2_transport* t,
@@ -829,8 +829,8 @@ inline void grpc_chttp2_ref_transport(grpc_chttp2_transport* t,
int line) {
t->refs.Ref(grpc_core::DebugLocation(file, line), reason);
}
-#else
-#define GRPC_CHTTP2_REF_TRANSPORT(t, r) grpc_chttp2_ref_transport(t)
+#else
+#define GRPC_CHTTP2_REF_TRANSPORT(t, r) grpc_chttp2_ref_transport(t)
#define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) grpc_chttp2_unref_transport(t)
inline void grpc_chttp2_unref_transport(grpc_chttp2_transport* t) {
if (t->refs.Unref()) {
@@ -840,40 +840,40 @@ inline void grpc_chttp2_unref_transport(grpc_chttp2_transport* t) {
inline void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) {
t->refs.Ref();
}
-#endif
-
+#endif
+
void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id);
-
+
/** Add a new ping strike to ping_recv_state.ping_strikes. If
ping_recv_state.ping_strikes > ping_policy.max_ping_strikes, it sends GOAWAY
with error code ENHANCE_YOUR_CALM and additional debug data resembling
"too_many_pings" followed by immediately closing the connection. */
void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t);
-
+
/** Resets ping clock. Should be called when flushing window updates,
* initial/trailing metadata or data frames. For a server, it resets the number
* of ping strikes and the last_ping_recv_time. For a ping sender, it resets
* pings_before_data_required. */
void grpc_chttp2_reset_ping_clock(grpc_chttp2_transport* t);
-/** add a ref to the stream and add it to the writable list;
- ref will be dropped in writing.c */
+/** add a ref to the stream and add it to the writable list;
+ ref will be dropped in writing.c */
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-
+
void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_error* due_to_error);
-
+
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-
+
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, grpc_error* error);
-
+
/** Set the default keepalive configurations, must only be called at
initialization */
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
@@ -883,4 +883,4 @@ void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error* error);
void schedule_bdp_ping_locked(grpc_chttp2_transport* t);
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/stream_map.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/stream_map.h
index d79e502f70..485abd2d13 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/stream_map.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/stream_map.h
@@ -1,67 +1,67 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H
-
-#include <grpc/support/port_platform.h>
-
-#include <stddef.h>
-
-/* Data structure to map a uint32_t to a data object (represented by a void*)
-
- Represented as a sorted array of keys, and a corresponding array of values.
- Lookups are performed with binary search.
- Adds are restricted to strictly higher keys than previously seen (this is
- guaranteed by http2). */
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H
+
+#include <grpc/support/port_platform.h>
+
+#include <stddef.h>
+
+/* Data structure to map a uint32_t to a data object (represented by a void*)
+
+ Represented as a sorted array of keys, and a corresponding array of values.
+ Lookups are performed with binary search.
+ Adds are restricted to strictly higher keys than previously seen (this is
+ guaranteed by http2). */
struct grpc_chttp2_stream_map {
uint32_t* keys;
void** values;
- size_t count;
- size_t free;
- size_t capacity;
+ size_t count;
+ size_t free;
+ size_t capacity;
};
void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
- size_t initial_capacity);
+ size_t initial_capacity);
void grpc_chttp2_stream_map_destroy(grpc_chttp2_stream_map* map);
-
-/* Add a new key: given http2 semantics, new keys must always be greater than
- existing keys - this is asserted */
+
+/* Add a new key: given http2 semantics, new keys must always be greater than
+ existing keys - this is asserted */
void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
void* value);
-
-/* Delete an existing key - returns the previous value of the key if it existed,
- or NULL otherwise */
+
+/* Delete an existing key - returns the previous value of the key if it existed,
+ or NULL otherwise */
void* grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map* map, uint32_t key);
-
-/* Return an existing key, or NULL if it does not exist */
+
+/* Return an existing key, or NULL if it does not exist */
void* grpc_chttp2_stream_map_find(grpc_chttp2_stream_map* map, uint32_t key);
-
-/* Return a random entry */
+
+/* Return a random entry */
void* grpc_chttp2_stream_map_rand(grpc_chttp2_stream_map* map);
-
-/* How many (populated) entries are in the stream map? */
+
+/* How many (populated) entries are in the stream map? */
size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map* map);
-
-/* Callback on each stream */
+
+/* Callback on each stream */
void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map* map,
void (*f)(void* user_data, uint32_t key,
void* value),
void* user_data);
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/varint.h b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/varint.h
index cdaeaef0a7..5a2b670f06 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/varint.h
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/varint.h
@@ -1,60 +1,60 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H
-#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H
-
-#include <grpc/support/port_platform.h>
-
-/* Helpers for hpack varint encoding */
-
-/* length of a value that needs varint tail encoding (it's bigger than can be
- bitpacked into the opcode byte) - returned value includes the length of the
- opcode byte */
-uint32_t grpc_chttp2_hpack_varint_length(uint32_t tail_value);
-
-void grpc_chttp2_hpack_write_varint_tail(uint32_t tail_value, uint8_t* target,
- uint32_t tail_length);
-
-/* maximum value that can be bitpacked with the opcode if the opcode has a
- prefix
- of length prefix_bits */
-#define GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) \
- ((uint32_t)((1 << (8 - (prefix_bits))) - 1))
-
-/* length required to bitpack a value */
-#define GRPC_CHTTP2_VARINT_LENGTH(n, prefix_bits) \
- ((n) < GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) \
- ? 1u \
- : grpc_chttp2_hpack_varint_length( \
- (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits)))
-
-#define GRPC_CHTTP2_WRITE_VARINT(n, prefix_bits, prefix_or, target, length) \
- do { \
- uint8_t* tgt = target; \
- if ((length) == 1u) { \
- (tgt)[0] = (uint8_t)((prefix_or) | (n)); \
- } else { \
- (tgt)[0] = \
- (prefix_or) | (uint8_t)GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
- grpc_chttp2_hpack_write_varint_tail( \
- (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt) + 1, (length)-1); \
- } \
- } while (0)
-
-#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H */
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H
+#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H
+
+#include <grpc/support/port_platform.h>
+
+/* Helpers for hpack varint encoding */
+
+/* length of a value that needs varint tail encoding (it's bigger than can be
+ bitpacked into the opcode byte) - returned value includes the length of the
+ opcode byte */
+uint32_t grpc_chttp2_hpack_varint_length(uint32_t tail_value);
+
+void grpc_chttp2_hpack_write_varint_tail(uint32_t tail_value, uint8_t* target,
+ uint32_t tail_length);
+
+/* maximum value that can be bitpacked with the opcode if the opcode has a
+ prefix
+ of length prefix_bits */
+#define GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) \
+ ((uint32_t)((1 << (8 - (prefix_bits))) - 1))
+
+/* length required to bitpack a value */
+#define GRPC_CHTTP2_VARINT_LENGTH(n, prefix_bits) \
+ ((n) < GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) \
+ ? 1u \
+ : grpc_chttp2_hpack_varint_length( \
+ (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits)))
+
+#define GRPC_CHTTP2_WRITE_VARINT(n, prefix_bits, prefix_or, target, length) \
+ do { \
+ uint8_t* tgt = target; \
+ if ((length) == 1u) { \
+ (tgt)[0] = (uint8_t)((prefix_or) | (n)); \
+ } else { \
+ (tgt)[0] = \
+ (prefix_or) | (uint8_t)GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
+ grpc_chttp2_hpack_write_varint_tail( \
+ (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt) + 1, (length)-1); \
+ } \
+ } while (0)
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H */
diff --git a/contrib/libs/grpc/src/core/lib/README.md b/contrib/libs/grpc/src/core/lib/README.md
index bcac36ccae..69b6bce2d9 100644
--- a/contrib/libs/grpc/src/core/lib/README.md
+++ b/contrib/libs/grpc/src/core/lib/README.md
@@ -1,6 +1,6 @@
-Required elements of gRPC Core: Each module in this directory is required to
-build gRPC. If it's possible to envisage a configuration where code is not
-required, then that code belongs in ext/ instead.
-
-NOTE: The movement of code between lib and ext is an ongoing effort, so this
-directory currently contains too much of the core library.
+Required elements of gRPC Core: Each module in this directory is required to
+build gRPC. If it's possible to envisage a configuration where code is not
+required, then that code belongs in ext/ instead.
+
+NOTE: The movement of code between lib and ext is an ongoing effort, so this
+directory currently contains too much of the core library.
diff --git a/contrib/libs/grpc/src/core/lib/channel/README.md b/contrib/libs/grpc/src/core/lib/channel/README.md
index aff64775cb..2dfcfe6e66 100644
--- a/contrib/libs/grpc/src/core/lib/channel/README.md
+++ b/contrib/libs/grpc/src/core/lib/channel/README.md
@@ -1,4 +1,4 @@
-# Channel
-
-Provides channel/call stack implementation, and implementation of common filters
-for that implementation.
+# Channel
+
+Provides channel/call stack implementation, and implementation of common filters
+for that implementation.
diff --git a/contrib/libs/grpc/src/core/lib/channel/channel_args.h b/contrib/libs/grpc/src/core/lib/channel/channel_args.h
index 695eb60464..6b973aa94d 100644
--- a/contrib/libs/grpc/src/core/lib/channel/channel_args.h
+++ b/contrib/libs/grpc/src/core/lib/channel/channel_args.h
@@ -1,81 +1,81 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
-#define GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
-#include <grpc/grpc.h>
-
+#include <grpc/grpc.h>
+
#include "src/core/lib/surface/channel_stack_type.h"
-// Channel args are intentionally immutable, to avoid the need for locking.
-
-/** Copy the arguments in \a src into a new instance */
+// Channel args are intentionally immutable, to avoid the need for locking.
+
+/** Copy the arguments in \a src into a new instance */
grpc_channel_args* grpc_channel_args_copy(const grpc_channel_args* src);
-
-/** Copy the arguments in \a src into a new instance, stably sorting keys */
+
+/** Copy the arguments in \a src into a new instance, stably sorting keys */
grpc_channel_args* grpc_channel_args_normalize(const grpc_channel_args* src);
-
-/** Copy the arguments in \a src and append \a to_add. If \a to_add is NULL, it
- * is equivalent to calling \a grpc_channel_args_copy. */
+
+/** Copy the arguments in \a src and append \a to_add. If \a to_add is NULL, it
+ * is equivalent to calling \a grpc_channel_args_copy. */
grpc_channel_args* grpc_channel_args_copy_and_add(const grpc_channel_args* src,
const grpc_arg* to_add,
- size_t num_to_add);
-
-/** Copies the arguments in \a src except for those whose keys are in
- \a to_remove. */
+ size_t num_to_add);
+
+/** Copies the arguments in \a src except for those whose keys are in
+ \a to_remove. */
grpc_channel_args* grpc_channel_args_copy_and_remove(
const grpc_channel_args* src, const char** to_remove, size_t num_to_remove);
-
-/** Copies the arguments from \a src except for those whose keys are in
- \a to_remove and appends the arguments in \a to_add. */
+
+/** Copies the arguments from \a src except for those whose keys are in
+ \a to_remove and appends the arguments in \a to_add. */
grpc_channel_args* grpc_channel_args_copy_and_add_and_remove(
const grpc_channel_args* src, const char** to_remove, size_t num_to_remove,
const grpc_arg* to_add, size_t num_to_add);
-
+
/** Perform the union of \a a and \a b, prioritizing \a a entries */
grpc_channel_args* grpc_channel_args_union(const grpc_channel_args* a,
const grpc_channel_args* b);
-
-/** Destroy arguments created by \a grpc_channel_args_copy */
+
+/** Destroy arguments created by \a grpc_channel_args_copy */
void grpc_channel_args_destroy(grpc_channel_args* a);
inline void grpc_channel_args_destroy(const grpc_channel_args* a) {
grpc_channel_args_destroy(const_cast<grpc_channel_args*>(a));
}
-
+
int grpc_channel_args_compare(const grpc_channel_args* a,
const grpc_channel_args* b);
-
-/** Returns the value of argument \a name from \a args, or NULL if not found. */
+
+/** Returns the value of argument \a name from \a args, or NULL if not found. */
const grpc_arg* grpc_channel_args_find(const grpc_channel_args* args,
const char* name);
-
+
bool grpc_channel_args_want_minimal_stack(const grpc_channel_args* args);
-typedef struct grpc_integer_options {
- int default_value; // Return this if value is outside of expected bounds.
- int min_value;
- int max_value;
-} grpc_integer_options;
+typedef struct grpc_integer_options {
+ int default_value; // Return this if value is outside of expected bounds.
+ int min_value;
+ int max_value;
+} grpc_integer_options;
/** Returns the value of \a arg, subject to the constraints in \a options. */
int grpc_channel_arg_get_integer(const grpc_arg* arg,
@@ -85,7 +85,7 @@ int grpc_channel_arg_get_integer(const grpc_arg* arg,
int grpc_channel_args_find_integer(const grpc_channel_args* args,
const char* name,
const grpc_integer_options options);
-
+
/** Returns the value of \a arg if \a arg is of type GRPC_ARG_STRING.
Otherwise, emits a warning log, and returns nullptr.
If arg is nullptr, returns nullptr, and does not emit a warning. */
@@ -131,4 +131,4 @@ void grpc_channel_args_set_client_channel_creation_mutator(
grpc_channel_args_client_channel_creation_mutator
grpc_channel_args_get_client_channel_creation_mutator();
-#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/channel_stack.h b/contrib/libs/grpc/src/core/lib/channel/channel_stack.h
index 805277a38b..e297df9488 100644
--- a/contrib/libs/grpc/src/core/lib/channel/channel_stack.h
+++ b/contrib/libs/grpc/src/core/lib/channel/channel_stack.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
-#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
-
-//////////////////////////////////////////////////////////////////////////////
-// IMPORTANT NOTE:
-//
-// When you update this API, please make the corresponding changes to
-// the C++ API in src/cpp/common/channel_filter.{h,cc}
-//////////////////////////////////////////////////////////////////////////////
-
-/* A channel filter defines how operations on a channel are implemented.
- Channel filters are chained together to create full channels, and if those
- chains are linear, then channel stacks provide a mechanism to minimize
- allocations for that chain.
- Call stacks are created by channel stacks and represent the per-call data
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
+
+//////////////////////////////////////////////////////////////////////////////
+// IMPORTANT NOTE:
+//
+// When you update this API, please make the corresponding changes to
+// the C++ API in src/cpp/common/channel_filter.{h,cc}
+//////////////////////////////////////////////////////////////////////////////
+
+/* A channel filter defines how operations on a channel are implemented.
+ Channel filters are chained together to create full channels, and if those
+ chains are linear, then channel stacks provide a mechanism to minimize
+ allocations for that chain.
+ Call stacks are created by channel stacks and represent the per-call data
for that stack.
-
+
Implementations should take care of the following details for a batch -
1. Synchronization is achieved with a CallCombiner. View
src/core/lib/iomgr/call_combiner.h for more details.
@@ -46,32 +46,32 @@
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/time.h>
-
-#include "src/core/lib/debug/trace.h"
+#include <stddef.h>
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/time.h>
+
+#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/iomgr/call_combiner.h"
-#include "src/core/lib/iomgr/polling_entity.h"
-#include "src/core/lib/transport/transport.h"
-
-typedef struct grpc_channel_element grpc_channel_element;
-typedef struct grpc_call_element grpc_call_element;
-
-typedef struct grpc_channel_stack grpc_channel_stack;
-typedef struct grpc_call_stack grpc_call_stack;
-
+#include "src/core/lib/iomgr/polling_entity.h"
+#include "src/core/lib/transport/transport.h"
+
+typedef struct grpc_channel_element grpc_channel_element;
+typedef struct grpc_call_element grpc_call_element;
+
+typedef struct grpc_channel_stack grpc_channel_stack;
+typedef struct grpc_call_stack grpc_call_stack;
+
struct grpc_channel_element_args {
grpc_channel_stack* channel_stack;
const grpc_channel_args* channel_args;
- /** Transport, iff it is known */
+ /** Transport, iff it is known */
grpc_transport* optional_transport;
- int is_first;
- int is_last;
+ int is_first;
+ int is_last;
};
struct grpc_call_element_args {
grpc_call_stack* call_stack;
@@ -84,164 +84,164 @@ struct grpc_call_element_args {
grpc_core::CallCombiner* call_combiner;
};
struct grpc_call_stats {
- grpc_transport_stream_stats transport_stream_stats;
- gpr_timespec latency; /* From call creating to enqueing of received status */
+ grpc_transport_stream_stats transport_stream_stats;
+ gpr_timespec latency; /* From call creating to enqueing of received status */
};
-/** Information about the call upon completion. */
+/** Information about the call upon completion. */
struct grpc_call_final_info {
- grpc_call_stats stats;
+ grpc_call_stats stats;
grpc_status_code final_status = GRPC_STATUS_OK;
const char* error_string = nullptr;
};
-
-/* Channel filters specify:
- 1. the amount of memory needed in the channel & call (via the sizeof_XXX
- members)
- 2. functions to initialize and destroy channel & call data
- (init_XXX, destroy_XXX)
- 3. functions to implement call operations and channel operations (call_op,
- channel_op)
- 4. a name, which is useful when debugging
-
- Members are laid out in approximate frequency of use order. */
+
+/* Channel filters specify:
+ 1. the amount of memory needed in the channel & call (via the sizeof_XXX
+ members)
+ 2. functions to initialize and destroy channel & call data
+ (init_XXX, destroy_XXX)
+ 3. functions to implement call operations and channel operations (call_op,
+ channel_op)
+ 4. a name, which is useful when debugging
+
+ Members are laid out in approximate frequency of use order. */
struct grpc_channel_filter {
- /* Called to eg. send/receive data on a call.
- See grpc_call_next_op on how to call the next element in the stack */
+ /* Called to eg. send/receive data on a call.
+ See grpc_call_next_op on how to call the next element in the stack */
void (*start_transport_stream_op_batch)(grpc_call_element* elem,
grpc_transport_stream_op_batch* op);
- /* Called to handle channel level operations - e.g. new calls, or transport
- closure.
- See grpc_channel_next_op on how to call the next element in the stack */
+ /* Called to handle channel level operations - e.g. new calls, or transport
+ closure.
+ See grpc_channel_next_op on how to call the next element in the stack */
void (*start_transport_op)(grpc_channel_element* elem, grpc_transport_op* op);
-
- /* sizeof(per call data) */
- size_t sizeof_call_data;
- /* Initialize per call data.
- elem is initialized at the start of the call, and elem->call_data is what
- needs initializing.
- The filter does not need to do any chaining.
- server_transport_data is an opaque pointer. If it is NULL, this call is
- on a client; if it is non-NULL, then it points to memory owned by the
- transport and is on the server. Most filters want to ignore this
+
+ /* sizeof(per call data) */
+ size_t sizeof_call_data;
+ /* Initialize per call data.
+ elem is initialized at the start of the call, and elem->call_data is what
+ needs initializing.
+ The filter does not need to do any chaining.
+ server_transport_data is an opaque pointer. If it is NULL, this call is
+ on a client; if it is non-NULL, then it points to memory owned by the
+ transport and is on the server. Most filters want to ignore this
argument.
Implementations may assume that elem->call_data is all zeros. */
grpc_error* (*init_call_elem)(grpc_call_element* elem,
const grpc_call_element_args* args);
void (*set_pollset_or_pollset_set)(grpc_call_element* elem,
grpc_polling_entity* pollent);
- /* Destroy per call data.
- The filter does not need to do any chaining.
- The bottom filter of a stack will be passed a non-NULL pointer to
+ /* Destroy per call data.
+ The filter does not need to do any chaining.
+ The bottom filter of a stack will be passed a non-NULL pointer to
\a then_schedule_closure that should be passed to GRPC_CLOSURE_SCHED when
destruction is complete. \a final_info contains data about the completed
call, mainly for reporting purposes. */
void (*destroy_call_elem)(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* then_schedule_closure);
-
- /* sizeof(per channel data) */
- size_t sizeof_channel_data;
- /* Initialize per-channel data.
- elem is initialized at the creating of the channel, and elem->channel_data
- is what needs initializing.
- is_first, is_last designate this elements position in the stack, and are
- useful for asserting correct configuration by upper layer code.
+
+ /* sizeof(per channel data) */
+ size_t sizeof_channel_data;
+ /* Initialize per-channel data.
+ elem is initialized at the creating of the channel, and elem->channel_data
+ is what needs initializing.
+ is_first, is_last designate this elements position in the stack, and are
+ useful for asserting correct configuration by upper layer code.
The filter does not need to do any chaining.
Implementations may assume that elem->channel_data is all zeros. */
grpc_error* (*init_channel_elem)(grpc_channel_element* elem,
grpc_channel_element_args* args);
- /* Destroy per channel data.
- The filter does not need to do any chaining */
+ /* Destroy per channel data.
+ The filter does not need to do any chaining */
void (*destroy_channel_elem)(grpc_channel_element* elem);
-
- /* Implement grpc_channel_get_info() */
+
+ /* Implement grpc_channel_get_info() */
void (*get_channel_info)(grpc_channel_element* elem,
const grpc_channel_info* channel_info);
-
- /* The name of this filter */
+
+ /* The name of this filter */
const char* name;
};
-/* A channel_element tracks its filter and the filter requested memory within
- a channel allocation */
-struct grpc_channel_element {
+/* A channel_element tracks its filter and the filter requested memory within
+ a channel allocation */
+struct grpc_channel_element {
const grpc_channel_filter* filter;
void* channel_data;
-};
-
-/* A call_element tracks its filter, the filter requested memory within
- a channel allocation, and the filter requested memory within a call
- allocation */
-struct grpc_call_element {
+};
+
+/* A call_element tracks its filter, the filter requested memory within
+ a channel allocation, and the filter requested memory within a call
+ allocation */
+struct grpc_call_element {
const grpc_channel_filter* filter;
void* channel_data;
void* call_data;
-};
-
-/* A channel stack tracks a set of related filters for one channel, and
- guarantees they live within a single malloc() allocation */
-struct grpc_channel_stack {
- grpc_stream_refcount refcount;
- size_t count;
- /* Memory required for a call stack (computed at channel stack
- initialization) */
- size_t call_stack_size;
-};
-
-/* A call stack tracks a set of related filters for one call, and guarantees
- they live within a single malloc() allocation */
-struct grpc_call_stack {
- /* shared refcount for this channel stack.
- MUST be the first element: the underlying code calls destroy
- with the address of the refcount, but higher layers prefer to think
- about the address of the call stack itself. */
- grpc_stream_refcount refcount;
- size_t count;
-};
-
-/* Get a channel element given a channel stack and its index */
+};
+
+/* A channel stack tracks a set of related filters for one channel, and
+ guarantees they live within a single malloc() allocation */
+struct grpc_channel_stack {
+ grpc_stream_refcount refcount;
+ size_t count;
+ /* Memory required for a call stack (computed at channel stack
+ initialization) */
+ size_t call_stack_size;
+};
+
+/* A call stack tracks a set of related filters for one call, and guarantees
+ they live within a single malloc() allocation */
+struct grpc_call_stack {
+ /* shared refcount for this channel stack.
+ MUST be the first element: the underlying code calls destroy
+ with the address of the refcount, but higher layers prefer to think
+ about the address of the call stack itself. */
+ grpc_stream_refcount refcount;
+ size_t count;
+};
+
+/* Get a channel element given a channel stack and its index */
grpc_channel_element* grpc_channel_stack_element(grpc_channel_stack* stack,
- size_t i);
-/* Get the last channel element in a channel stack */
+ size_t i);
+/* Get the last channel element in a channel stack */
grpc_channel_element* grpc_channel_stack_last_element(
grpc_channel_stack* stack);
-/* Get a call stack element given a call stack and an index */
+/* Get a call stack element given a call stack and an index */
grpc_call_element* grpc_call_stack_element(grpc_call_stack* stack, size_t i);
-
-/* Determine memory required for a channel stack containing a set of filters */
+
+/* Determine memory required for a channel stack containing a set of filters */
size_t grpc_channel_stack_size(const grpc_channel_filter** filters,
- size_t filter_count);
-/* Initialize a channel stack given some filters */
+ size_t filter_count);
+/* Initialize a channel stack given some filters */
grpc_error* grpc_channel_stack_init(
int initial_refs, grpc_iomgr_cb_func destroy, void* destroy_arg,
const grpc_channel_filter** filters, size_t filter_count,
const grpc_channel_args* args, grpc_transport* optional_transport,
const char* name, grpc_channel_stack* stack);
-/* Destroy a channel stack */
+/* Destroy a channel stack */
void grpc_channel_stack_destroy(grpc_channel_stack* stack);
-
-/* Initialize a call stack given a channel stack. transport_server_data is
- expected to be NULL on a client, or an opaque transport owned pointer on the
- server. */
+
+/* Initialize a call stack given a channel stack. transport_server_data is
+ expected to be NULL on a client, or an opaque transport owned pointer on the
+ server. */
grpc_error* grpc_call_stack_init(grpc_channel_stack* channel_stack,
int initial_refs, grpc_iomgr_cb_func destroy,
void* destroy_arg,
const grpc_call_element_args* elem_args);
-/* Set a pollset or a pollset_set for a call stack: must occur before the first
- * op is started */
+/* Set a pollset or a pollset_set for a call stack: must occur before the first
+ * op is started */
void grpc_call_stack_set_pollset_or_pollset_set(grpc_call_stack* call_stack,
grpc_polling_entity* pollent);
-
+
#ifndef NDEBUG
-#define GRPC_CALL_STACK_REF(call_stack, reason) \
- grpc_stream_ref(&(call_stack)->refcount, reason)
+#define GRPC_CALL_STACK_REF(call_stack, reason) \
+ grpc_stream_ref(&(call_stack)->refcount, reason)
#define GRPC_CALL_STACK_UNREF(call_stack, reason) \
grpc_stream_unref(&(call_stack)->refcount, reason)
-#define GRPC_CHANNEL_STACK_REF(channel_stack, reason) \
- grpc_stream_ref(&(channel_stack)->refcount, reason)
+#define GRPC_CHANNEL_STACK_REF(channel_stack, reason) \
+ grpc_stream_ref(&(channel_stack)->refcount, reason)
#define GRPC_CHANNEL_STACK_UNREF(channel_stack, reason) \
grpc_stream_unref(&(channel_stack)->refcount, reason)
-#else
-#define GRPC_CALL_STACK_REF(call_stack, reason) \
+#else
+#define GRPC_CALL_STACK_REF(call_stack, reason) \
do { \
grpc_stream_ref(&(call_stack)->refcount); \
(void)(reason); \
@@ -251,7 +251,7 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_call_stack* call_stack,
grpc_stream_unref(&(call_stack)->refcount); \
(void)(reason); \
} while (0);
-#define GRPC_CHANNEL_STACK_REF(channel_stack, reason) \
+#define GRPC_CHANNEL_STACK_REF(channel_stack, reason) \
do { \
grpc_stream_ref(&(channel_stack)->refcount); \
(void)(reason); \
@@ -261,44 +261,44 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_call_stack* call_stack,
grpc_stream_unref(&(channel_stack)->refcount); \
(void)(reason); \
} while (0);
-#endif
-
-/* Destroy a call stack */
+#endif
+
+/* Destroy a call stack */
void grpc_call_stack_destroy(grpc_call_stack* stack,
const grpc_call_final_info* final_info,
grpc_closure* then_schedule_closure);
-
-/* Ignore set pollset{_set} - used by filters if they don't care about pollsets
- * at all. Does nothing. */
-void grpc_call_stack_ignore_set_pollset_or_pollset_set(
+
+/* Ignore set pollset{_set} - used by filters if they don't care about pollsets
+ * at all. Does nothing. */
+void grpc_call_stack_ignore_set_pollset_or_pollset_set(
grpc_call_element* elem, grpc_polling_entity* pollent);
-/* Call the next operation in a call stack */
+/* Call the next operation in a call stack */
void grpc_call_next_op(grpc_call_element* elem,
grpc_transport_stream_op_batch* op);
-/* Call the next operation (depending on call directionality) in a channel
- stack */
+/* Call the next operation (depending on call directionality) in a channel
+ stack */
void grpc_channel_next_op(grpc_channel_element* elem, grpc_transport_op* op);
-/* Pass through a request to get_channel_info() to the next child element */
+/* Pass through a request to get_channel_info() to the next child element */
void grpc_channel_next_get_info(grpc_channel_element* elem,
const grpc_channel_info* channel_info);
-
-/* Given the top element of a channel stack, get the channel stack itself */
+
+/* Given the top element of a channel stack, get the channel stack itself */
grpc_channel_stack* grpc_channel_stack_from_top_element(
grpc_channel_element* elem);
-/* Given the top element of a call stack, get the call stack itself */
+/* Given the top element of a call stack, get the call stack itself */
grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem);
-
+
void grpc_call_log_op(const char* file, int line, gpr_log_severity severity,
grpc_call_element* elem,
grpc_transport_stream_op_batch* op);
-
+
extern grpc_core::TraceFlag grpc_trace_channel;
-
+
#define GRPC_CALL_LOG_OP(sev, elem, op) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_channel)) { \
grpc_call_log_op(sev, elem, op); \
} \
} while (0)
-
-#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H */
+
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/channel_stack_builder.h b/contrib/libs/grpc/src/core/lib/channel/channel_stack_builder.h
index 11c114ec8c..89c30e0c5e 100644
--- a/contrib/libs/grpc/src/core/lib/channel/channel_stack_builder.h
+++ b/contrib/libs/grpc/src/core/lib/channel/channel_stack_builder.h
@@ -1,59 +1,59 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
-#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
-#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/channel_stack.h"
-
-/// grpc_channel_stack_builder offers a programmatic interface to selected
-/// and order channel filters
-typedef struct grpc_channel_stack_builder grpc_channel_stack_builder;
-typedef struct grpc_channel_stack_builder_iterator
- grpc_channel_stack_builder_iterator;
-
-/// Create a new channel stack builder
+#include <stdbool.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/channel_stack.h"
+
+/// grpc_channel_stack_builder offers a programmatic interface to selected
+/// and order channel filters
+typedef struct grpc_channel_stack_builder grpc_channel_stack_builder;
+typedef struct grpc_channel_stack_builder_iterator
+ grpc_channel_stack_builder_iterator;
+
+/// Create a new channel stack builder
grpc_channel_stack_builder* grpc_channel_stack_builder_create(void);
-
-/// Assign a name to the channel stack: \a name must be statically allocated
+
+/// Assign a name to the channel stack: \a name must be statically allocated
void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder* builder,
const char* name);
-
-/// Set the target uri
+
+/// Set the target uri
void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder* b,
const char* target);
-
+
const char* grpc_channel_stack_builder_get_target(
grpc_channel_stack_builder* b);
-
-/// Attach \a transport to the builder (does not take ownership)
-void grpc_channel_stack_builder_set_transport(
+
+/// Attach \a transport to the builder (does not take ownership)
+void grpc_channel_stack_builder_set_transport(
grpc_channel_stack_builder* builder, grpc_transport* transport);
-
-/// Fetch attached transport
+
+/// Fetch attached transport
grpc_transport* grpc_channel_stack_builder_get_transport(
grpc_channel_stack_builder* builder);
-
+
/// Attach \a resource_user to the builder (does not take ownership)
void grpc_channel_stack_builder_set_resource_user(
grpc_channel_stack_builder* builder, grpc_resource_user* resource_user);
@@ -62,105 +62,105 @@ void grpc_channel_stack_builder_set_resource_user(
grpc_resource_user* grpc_channel_stack_builder_get_resource_user(
grpc_channel_stack_builder* builder);
-/// Set channel arguments: copies args
-void grpc_channel_stack_builder_set_channel_arguments(
+/// Set channel arguments: copies args
+void grpc_channel_stack_builder_set_channel_arguments(
grpc_channel_stack_builder* builder, const grpc_channel_args* args);
-
-/// Return a borrowed pointer to the channel arguments
+
+/// Return a borrowed pointer to the channel arguments
const grpc_channel_args* grpc_channel_stack_builder_get_channel_arguments(
grpc_channel_stack_builder* builder);
-
-/// Begin iterating over already defined filters in the builder at the beginning
+
+/// Begin iterating over already defined filters in the builder at the beginning
grpc_channel_stack_builder_iterator*
-grpc_channel_stack_builder_create_iterator_at_first(
+grpc_channel_stack_builder_create_iterator_at_first(
grpc_channel_stack_builder* builder);
-
-/// Begin iterating over already defined filters in the builder at the end
+
+/// Begin iterating over already defined filters in the builder at the end
grpc_channel_stack_builder_iterator*
-grpc_channel_stack_builder_create_iterator_at_last(
+grpc_channel_stack_builder_create_iterator_at_last(
grpc_channel_stack_builder* builder);
-
-/// Is an iterator at the first element?
-bool grpc_channel_stack_builder_iterator_is_first(
+
+/// Is an iterator at the first element?
+bool grpc_channel_stack_builder_iterator_is_first(
grpc_channel_stack_builder_iterator* iterator);
-
-/// Is an iterator at the end?
-bool grpc_channel_stack_builder_iterator_is_end(
+
+/// Is an iterator at the end?
+bool grpc_channel_stack_builder_iterator_is_end(
grpc_channel_stack_builder_iterator* iterator);
-
+
/// What is the name of the filter at this iterator position?
const char* grpc_channel_stack_builder_iterator_filter_name(
grpc_channel_stack_builder_iterator* iterator);
-/// Move an iterator to the next item
-bool grpc_channel_stack_builder_move_next(
+/// Move an iterator to the next item
+bool grpc_channel_stack_builder_move_next(
grpc_channel_stack_builder_iterator* iterator);
-
-/// Move an iterator to the previous item
-bool grpc_channel_stack_builder_move_prev(
+
+/// Move an iterator to the previous item
+bool grpc_channel_stack_builder_move_prev(
grpc_channel_stack_builder_iterator* iterator);
-
+
/// Return an iterator at \a filter_name, or at the end of the list if not
/// found.
grpc_channel_stack_builder_iterator* grpc_channel_stack_builder_iterator_find(
grpc_channel_stack_builder* builder, const char* filter_name);
-typedef void (*grpc_post_filter_create_init_func)(
+typedef void (*grpc_post_filter_create_init_func)(
grpc_channel_stack* channel_stack, grpc_channel_element* elem, void* arg);
-
-/// Add \a filter to the stack, after \a iterator.
-/// Call \a post_init_func(..., \a user_data) once the channel stack is
-/// created.
-bool grpc_channel_stack_builder_add_filter_after(
+
+/// Add \a filter to the stack, after \a iterator.
+/// Call \a post_init_func(..., \a user_data) once the channel stack is
+/// created.
+bool grpc_channel_stack_builder_add_filter_after(
grpc_channel_stack_builder_iterator* iterator,
const grpc_channel_filter* filter,
- grpc_post_filter_create_init_func post_init_func,
+ grpc_post_filter_create_init_func post_init_func,
void* user_data) GRPC_MUST_USE_RESULT;
-
-/// Add \a filter to the stack, before \a iterator.
-/// Call \a post_init_func(..., \a user_data) once the channel stack is
-/// created.
-bool grpc_channel_stack_builder_add_filter_before(
+
+/// Add \a filter to the stack, before \a iterator.
+/// Call \a post_init_func(..., \a user_data) once the channel stack is
+/// created.
+bool grpc_channel_stack_builder_add_filter_before(
grpc_channel_stack_builder_iterator* iterator,
const grpc_channel_filter* filter,
- grpc_post_filter_create_init_func post_init_func,
+ grpc_post_filter_create_init_func post_init_func,
void* user_data) GRPC_MUST_USE_RESULT;
-
-/// Add \a filter to the beginning of the filter list.
-/// Call \a post_init_func(..., \a user_data) once the channel stack is
-/// created.
-bool grpc_channel_stack_builder_prepend_filter(
+
+/// Add \a filter to the beginning of the filter list.
+/// Call \a post_init_func(..., \a user_data) once the channel stack is
+/// created.
+bool grpc_channel_stack_builder_prepend_filter(
grpc_channel_stack_builder* builder, const grpc_channel_filter* filter,
- grpc_post_filter_create_init_func post_init_func,
+ grpc_post_filter_create_init_func post_init_func,
void* user_data) GRPC_MUST_USE_RESULT;
-
-/// Add \a filter to the end of the filter list.
-/// Call \a post_init_func(..., \a user_data) once the channel stack is
-/// created.
-bool grpc_channel_stack_builder_append_filter(
+
+/// Add \a filter to the end of the filter list.
+/// Call \a post_init_func(..., \a user_data) once the channel stack is
+/// created.
+bool grpc_channel_stack_builder_append_filter(
grpc_channel_stack_builder* builder, const grpc_channel_filter* filter,
- grpc_post_filter_create_init_func post_init_func,
+ grpc_post_filter_create_init_func post_init_func,
void* user_data) GRPC_MUST_USE_RESULT;
-
+
/// Remove any filter whose name is \a filter_name from \a builder. Returns true
/// if \a filter_name was not found.
bool grpc_channel_stack_builder_remove_filter(
grpc_channel_stack_builder* builder, const char* filter_name);
-/// Terminate iteration and destroy \a iterator
-void grpc_channel_stack_builder_iterator_destroy(
+/// Terminate iteration and destroy \a iterator
+void grpc_channel_stack_builder_iterator_destroy(
grpc_channel_stack_builder_iterator* iterator);
-
-/// Destroy the builder, return the freshly minted channel stack in \a result.
-/// Allocates \a prefix_bytes bytes before the channel stack
-/// Returns the base pointer of the allocated block
-/// \a initial_refs, \a destroy, \a destroy_arg are as per
-/// grpc_channel_stack_init
+
+/// Destroy the builder, return the freshly minted channel stack in \a result.
+/// Allocates \a prefix_bytes bytes before the channel stack
+/// Returns the base pointer of the allocated block
+/// \a initial_refs, \a destroy, \a destroy_arg are as per
+/// grpc_channel_stack_init
grpc_error* grpc_channel_stack_builder_finish(
grpc_channel_stack_builder* builder, size_t prefix_bytes, int initial_refs,
grpc_iomgr_cb_func destroy, void* destroy_arg, void** result);
-
-/// Destroy the builder without creating a channel stack
+
+/// Destroy the builder without creating a channel stack
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder* builder);
-
-#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */
+
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/connected_channel.h b/contrib/libs/grpc/src/core/lib/channel/connected_channel.h
index db5a40cfc5..faa1c73a21 100644
--- a/contrib/libs/grpc/src/core/lib/channel/connected_channel.h
+++ b/contrib/libs/grpc/src/core/lib/channel/connected_channel.h
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
-#define GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
+#define GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/channel/channel_stack_builder.h"
-
+#include "src/core/lib/channel/channel_stack_builder.h"
+
extern const grpc_channel_filter grpc_connected_filter;
-
+
bool grpc_add_connected_filter(grpc_channel_stack_builder* builder,
void* arg_must_be_null);
/* Debug helper to dig the transport stream out of a call element */
grpc_stream* grpc_connected_channel_get_stream(grpc_call_element* elem);
-#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/context.h b/contrib/libs/grpc/src/core/lib/channel/context.h
index b1849e5f79..bd7fd495e4 100644
--- a/contrib/libs/grpc/src/core/lib/channel/context.h
+++ b/contrib/libs/grpc/src/core/lib/channel/context.h
@@ -1,49 +1,49 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_CONTEXT_H
-#define GRPC_CORE_LIB_CHANNEL_CONTEXT_H
-
-/// Call object context pointers.
-
-/// Call context is represented as an array of \a grpc_call_context_elements.
-/// This enum represents the indexes into the array, where each index
-/// contains a different type of value.
-typedef enum {
- /// Value is either a \a grpc_client_security_context or a
- /// \a grpc_server_security_context.
- GRPC_CONTEXT_SECURITY = 0,
-
- /// Value is a \a census_context.
- GRPC_CONTEXT_TRACING,
-
- /// Reserved for traffic_class_context.
- GRPC_CONTEXT_TRAFFIC,
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_CONTEXT_H
+#define GRPC_CORE_LIB_CHANNEL_CONTEXT_H
+
+/// Call object context pointers.
+
+/// Call context is represented as an array of \a grpc_call_context_elements.
+/// This enum represents the indexes into the array, where each index
+/// contains a different type of value.
+typedef enum {
+ /// Value is either a \a grpc_client_security_context or a
+ /// \a grpc_server_security_context.
+ GRPC_CONTEXT_SECURITY = 0,
+
+ /// Value is a \a census_context.
+ GRPC_CONTEXT_TRACING,
+
+ /// Reserved for traffic_class_context.
+ GRPC_CONTEXT_TRAFFIC,
+
/// Holds a pointer to ServiceConfigCallData associated with this call.
GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA,
- GRPC_CONTEXT_COUNT
-} grpc_context_index;
-
+ GRPC_CONTEXT_COUNT
+} grpc_context_index;
+
struct grpc_call_context_element {
void* value = nullptr;
void (*destroy)(void*) = nullptr;
};
-
-#endif /* GRPC_CORE_LIB_CHANNEL_CONTEXT_H */
+
+#endif /* GRPC_CORE_LIB_CHANNEL_CONTEXT_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/handshaker.h b/contrib/libs/grpc/src/core/lib/channel/handshaker.h
index 5fd29afb32..cc8e9b2578 100644
--- a/contrib/libs/grpc/src/core/lib/channel/handshaker.h
+++ b/contrib/libs/grpc/src/core/lib/channel/handshaker.h
@@ -1,80 +1,80 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H
-#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H
+#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H
+
#include <grpc/support/port_platform.h>
#include "y_absl/container/inlined_vector.h"
#include <grpc/support/string_util.h>
-#include <grpc/impl/codegen/grpc_types.h>
-
+#include <grpc/impl/codegen/grpc_types.h>
+
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/iomgr/closure.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/iomgr/tcp_server.h"
+#include "src/core/lib/iomgr/closure.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/lib/iomgr/timer.h"
-
+
namespace grpc_core {
-/// Handshakers are used to perform initial handshakes on a connection
-/// before the client sends the initial request. Some examples of what
-/// a handshaker can be used for includes support for HTTP CONNECT on
-/// the client side and various types of security initialization.
-///
-/// In general, handshakers should be used via a handshake manager.
-
-/// Arguments passed through handshakers and to the on_handshake_done callback.
-///
-/// For handshakers, all members are input/output parameters; for
-/// example, a handshaker may read from or write to \a endpoint and
-/// then later replace it with a wrapped endpoint. Similarly, a
-/// handshaker may modify \a args.
-///
-/// A handshaker takes ownership of the members while a handshake is in
-/// progress. Upon failure or shutdown of an in-progress handshaker,
-/// the handshaker is responsible for destroying the members and setting
-/// them to NULL before invoking the on_handshake_done callback.
-///
-/// For the on_handshake_done callback, all members are input arguments,
-/// which the callback takes ownership of.
+/// Handshakers are used to perform initial handshakes on a connection
+/// before the client sends the initial request. Some examples of what
+/// a handshaker can be used for includes support for HTTP CONNECT on
+/// the client side and various types of security initialization.
+///
+/// In general, handshakers should be used via a handshake manager.
+
+/// Arguments passed through handshakers and to the on_handshake_done callback.
+///
+/// For handshakers, all members are input/output parameters; for
+/// example, a handshaker may read from or write to \a endpoint and
+/// then later replace it with a wrapped endpoint. Similarly, a
+/// handshaker may modify \a args.
+///
+/// A handshaker takes ownership of the members while a handshake is in
+/// progress. Upon failure or shutdown of an in-progress handshaker,
+/// the handshaker is responsible for destroying the members and setting
+/// them to NULL before invoking the on_handshake_done callback.
+///
+/// For the on_handshake_done callback, all members are input arguments,
+/// which the callback takes ownership of.
struct HandshakerArgs {
grpc_endpoint* endpoint = nullptr;
grpc_channel_args* args = nullptr;
grpc_slice_buffer* read_buffer = nullptr;
- // A handshaker may set this to true before invoking on_handshake_done
- // to indicate that subsequent handshakers should be skipped.
+ // A handshaker may set this to true before invoking on_handshake_done
+ // to indicate that subsequent handshakers should be skipped.
bool exit_early = false;
- // User data passed through the handshake manager. Not used by
- // individual handshakers.
+ // User data passed through the handshake manager. Not used by
+ // individual handshakers.
void* user_data = nullptr;
};
-
+
///
/// Handshaker
///
-
+
class Handshaker : public RefCounted<Handshaker> {
public:
virtual ~Handshaker() = default;
@@ -84,7 +84,7 @@ class Handshaker : public RefCounted<Handshaker> {
HandshakerArgs* args) = 0;
virtual const char* name() const = 0;
};
-
+
//
// HandshakeManager
//
@@ -93,28 +93,28 @@ class HandshakeManager : public RefCounted<HandshakeManager> {
public:
HandshakeManager();
~HandshakeManager();
-
+
/// Add \a mgr to the server side list of all pending handshake managers, the
/// list starts with \a *head.
// Not thread-safe. Caller needs to synchronize.
void AddToPendingMgrList(HandshakeManager** head);
-
+
/// Remove \a mgr from the server side list of all pending handshake managers.
// Not thread-safe. Caller needs to synchronize.
void RemoveFromPendingMgrList(HandshakeManager** head);
-
+
/// Shutdown all pending handshake managers starting at head on the server
/// side. Not thread-safe. Caller needs to synchronize.
void ShutdownAllPending(grpc_error* why);
-
+
/// Adds a handshaker to the handshake manager.
/// Takes ownership of \a handshaker.
void Add(RefCountedPtr<Handshaker> handshaker);
-
+
/// Shuts down the handshake manager (e.g., to clean up when the operation is
/// aborted in the middle).
void Shutdown(grpc_error* why);
-
+
/// Invokes handshakers in the order they were added.
/// Takes ownership of \a endpoint, and then passes that ownership to
/// the \a on_handshake_done callback.
@@ -131,19 +131,19 @@ class HandshakeManager : public RefCounted<HandshakeManager> {
const grpc_channel_args* channel_args, grpc_millis deadline,
grpc_tcp_server_acceptor* acceptor,
grpc_iomgr_cb_func on_handshake_done, void* user_data);
-
+
private:
bool CallNextHandshakerLocked(grpc_error* error);
-
+
// A function used as the handshaker-done callback when chaining
// handshakers together.
static void CallNextHandshakerFn(void* arg, grpc_error* error);
-
+
// Callback invoked when deadline is exceeded.
static void OnTimeoutFn(void* arg, grpc_error* error);
-
+
static const size_t HANDSHAKERS_INIT_SIZE = 2;
-
+
gpr_mu mu_;
bool is_shutdown_ = false;
// An array of handshakers added via grpc_handshake_manager_add().
@@ -176,4 +176,4 @@ typedef grpc_core::Handshaker grpc_handshaker;
void grpc_handshake_manager_add(grpc_handshake_manager* mgr,
grpc_handshaker* handshaker);
-#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/handshaker_factory.h b/contrib/libs/grpc/src/core/lib/channel/handshaker_factory.h
index d3022c7ffa..520e5e4b25 100644
--- a/contrib/libs/grpc/src/core/lib/channel/handshaker_factory.h
+++ b/contrib/libs/grpc/src/core/lib/channel/handshaker_factory.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
-#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
+#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/grpc_types.h>
-
-#include "src/core/lib/channel/handshaker.h"
-
-// A handshaker factory is used to create handshakers.
-
+#include <grpc/impl/codegen/grpc_types.h>
+
+#include "src/core/lib/channel/handshaker.h"
+
+// A handshaker factory is used to create handshakers.
+
namespace grpc_core {
-
+
class HandshakerFactory {
public:
virtual void AddHandshakers(const grpc_channel_args* args,
grpc_pollset_set* interested_parties,
HandshakeManager* handshake_mgr) = 0;
virtual ~HandshakerFactory() = default;
-};
-
+};
+
} // namespace grpc_core
-
-#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */
+
+#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */
diff --git a/contrib/libs/grpc/src/core/lib/channel/handshaker_registry.h b/contrib/libs/grpc/src/core/lib/channel/handshaker_registry.h
index 0bbdf29b45..4a02efc3f2 100644
--- a/contrib/libs/grpc/src/core/lib/channel/handshaker_registry.h
+++ b/contrib/libs/grpc/src/core/lib/channel/handshaker_registry.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
-#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
+#define GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/grpc_types.h>
-
-#include "src/core/lib/channel/handshaker_factory.h"
-
+#include <grpc/impl/codegen/grpc_types.h>
+
+#include "src/core/lib/channel/handshaker_factory.h"
+
namespace grpc_core {
-typedef enum {
- HANDSHAKER_CLIENT = 0,
- HANDSHAKER_SERVER,
- NUM_HANDSHAKER_TYPES, // Must be last.
+typedef enum {
+ HANDSHAKER_CLIENT = 0,
+ HANDSHAKER_SERVER,
+ NUM_HANDSHAKER_TYPES, // Must be last.
} HandshakerType;
-
+
class HandshakerRegistry {
public:
/// Registers a new handshaker factory. Takes ownership.
@@ -48,7 +48,7 @@ class HandshakerRegistry {
static void Init();
static void Shutdown();
};
-
+
} // namespace grpc_core
-
-#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */
+
+#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */
diff --git a/contrib/libs/grpc/src/core/lib/compression/algorithm_metadata.h b/contrib/libs/grpc/src/core/lib/compression/algorithm_metadata.h
index ab8e17e5b4..d58d2f541a 100644
--- a/contrib/libs/grpc/src/core/lib/compression/algorithm_metadata.h
+++ b/contrib/libs/grpc/src/core/lib/compression/algorithm_metadata.h
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
-#define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
+#define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/compression.h>
+#include <grpc/compression.h>
#include "src/core/lib/compression/compression_internal.h"
-#include "src/core/lib/transport/metadata.h"
-
-/** Return compression algorithm based metadata value */
+#include "src/core/lib/transport/metadata.h"
+
+/** Return compression algorithm based metadata value */
grpc_slice grpc_compression_algorithm_slice(
- grpc_compression_algorithm algorithm);
-
+ grpc_compression_algorithm algorithm);
+
/** Find compression algorithm based on passed in mdstr - returns
* GRPC_COMPRESS_ALGORITHM_COUNT on failure */
grpc_compression_algorithm grpc_compression_algorithm_from_slice(
@@ -36,8 +36,8 @@ grpc_compression_algorithm grpc_compression_algorithm_from_slice(
/** Return compression algorithm based metadata element */
grpc_mdelem grpc_compression_encoding_mdelem(
- grpc_compression_algorithm algorithm);
-
+ grpc_compression_algorithm algorithm);
+
/** Return message compression algorithm based metadata element (grpc-encoding:
* xxx) */
grpc_mdelem grpc_message_compression_encoding_mdelem(
@@ -48,14 +48,14 @@ grpc_mdelem grpc_message_compression_encoding_mdelem(
grpc_mdelem grpc_stream_compression_encoding_mdelem(
grpc_stream_compression_algorithm algorithm);
-/** Find compression algorithm based on passed in mdstr - returns
- * GRPC_COMPRESS_ALGORITHM_COUNT on failure */
+/** Find compression algorithm based on passed in mdstr - returns
+ * GRPC_COMPRESS_ALGORITHM_COUNT on failure */
grpc_message_compression_algorithm
grpc_message_compression_algorithm_from_slice(const grpc_slice& str);
-
+
/** Find stream compression algorithm based on passed in mdstr - returns
* GRPC_STREAM_COMPRESS_ALGORITHM_COUNT on failure */
grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice(
const grpc_slice& str);
-#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */
+#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */
diff --git a/contrib/libs/grpc/src/core/lib/compression/message_compress.h b/contrib/libs/grpc/src/core/lib/compression/message_compress.h
index 0427d2f1a6..91654e47e3 100644
--- a/contrib/libs/grpc/src/core/lib/compression/message_compress.h
+++ b/contrib/libs/grpc/src/core/lib/compression/message_compress.h
@@ -1,40 +1,40 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
-#define GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
+#define GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice_buffer.h>
-
+#include <grpc/slice_buffer.h>
+
#include "src/core/lib/compression/compression_internal.h"
-/* compress 'input' to 'output' using 'algorithm'.
- On success, appends compressed slices to output and returns 1.
- On failure, appends uncompressed slices to output and returns 0. */
+/* compress 'input' to 'output' using 'algorithm'.
+ On success, appends compressed slices to output and returns 1.
+ On failure, appends uncompressed slices to output and returns 0. */
int grpc_msg_compress(grpc_message_compression_algorithm algorithm,
- grpc_slice_buffer* input, grpc_slice_buffer* output);
-
-/* decompress 'input' to 'output' using 'algorithm'.
- On success, appends slices to output and returns 1.
- On failure, output is unchanged, and returns 0. */
+ grpc_slice_buffer* input, grpc_slice_buffer* output);
+
+/* decompress 'input' to 'output' using 'algorithm'.
+ On success, appends slices to output and returns 1.
+ On failure, output is unchanged, and returns 0. */
int grpc_msg_decompress(grpc_message_compression_algorithm algorithm,
- grpc_slice_buffer* input, grpc_slice_buffer* output);
-
-#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */
+ grpc_slice_buffer* input, grpc_slice_buffer* output);
+
+#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */
diff --git a/contrib/libs/grpc/src/core/lib/debug/trace.h b/contrib/libs/grpc/src/core/lib/debug/trace.h
index bf8edb21ad..ac7b40e58a 100644
--- a/contrib/libs/grpc/src/core/lib/debug/trace.h
+++ b/contrib/libs/grpc/src/core/lib/debug/trace.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_DEBUG_TRACE_H
-#define GRPC_CORE_LIB_DEBUG_TRACE_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_DEBUG_TRACE_H
+#define GRPC_CORE_LIB_DEBUG_TRACE_H
+
+#include <grpc/support/port_platform.h>
+
#include <grpc/support/atm.h>
#include <stdbool.h>
@@ -33,8 +33,8 @@ GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_trace);
void grpc_tracer_init(const char* env_var_name);
void grpc_tracer_init();
-void grpc_tracer_shutdown(void);
-
+void grpc_tracer_shutdown(void);
+
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
#define GRPC_THREADSAFE_TRACER
@@ -128,4 +128,4 @@ class DebugOnlyTraceFlag {
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_DEBUG_TRACE_H */
+#endif /* GRPC_CORE_LIB_DEBUG_TRACE_H */
diff --git a/contrib/libs/grpc/src/core/lib/http/format_request.h b/contrib/libs/grpc/src/core/lib/http/format_request.h
index 8ef0bd0865..bcc332fe6e 100644
--- a/contrib/libs/grpc/src/core/lib/http/format_request.h
+++ b/contrib/libs/grpc/src/core/lib/http/format_request.h
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
-#define GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
+#define GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/lib/http/httpcli.h"
-
+#include <grpc/slice.h>
+#include "src/core/lib/http/httpcli.h"
+
grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request* request);
grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request,
const char* body_bytes,
- size_t body_size);
-grpc_slice grpc_httpcli_format_connect_request(
+ size_t body_size);
+grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request* request);
-
-#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */
+
+#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */
diff --git a/contrib/libs/grpc/src/core/lib/http/httpcli.h b/contrib/libs/grpc/src/core/lib/http/httpcli.h
index 77bef0c762..16a160cc96 100644
--- a/contrib/libs/grpc/src/core/lib/http/httpcli.h
+++ b/contrib/libs/grpc/src/core/lib/http/httpcli.h
@@ -1,105 +1,105 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_HTTP_HTTPCLI_H
-#define GRPC_CORE_LIB_HTTP_HTTPCLI_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_HTTP_HTTPCLI_H
+#define GRPC_CORE_LIB_HTTP_HTTPCLI_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#include <grpc/support/time.h>
-
-#include "src/core/lib/http/parser.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/iomgr_internal.h"
-#include "src/core/lib/iomgr/polling_entity.h"
-#include "src/core/lib/iomgr/pollset_set.h"
-
-/* User agent this library reports */
-#define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0"
-
-/* Tracks in-progress http requests
- TODO(ctiller): allow caching and capturing multiple requests for the
- same content and combining them */
-typedef struct grpc_httpcli_context {
+#include <stddef.h>
+
+#include <grpc/support/time.h>
+
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/polling_entity.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+
+/* User agent this library reports */
+#define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0"
+
+/* Tracks in-progress http requests
+ TODO(ctiller): allow caching and capturing multiple requests for the
+ same content and combining them */
+typedef struct grpc_httpcli_context {
grpc_pollset_set* pollset_set;
-} grpc_httpcli_context;
-
+} grpc_httpcli_context;
+
struct grpc_httpcli_handshaker {
const char* default_port;
void (*handshake)(void* arg, grpc_endpoint* endpoint, const char* host,
grpc_millis deadline,
void (*on_done)(void* arg, grpc_endpoint* endpoint));
};
-extern const grpc_httpcli_handshaker grpc_httpcli_plaintext;
-extern const grpc_httpcli_handshaker grpc_httpcli_ssl;
-
-/* A request */
-typedef struct grpc_httpcli_request {
- /* The host name to connect to */
+extern const grpc_httpcli_handshaker grpc_httpcli_plaintext;
+extern const grpc_httpcli_handshaker grpc_httpcli_ssl;
+
+/* A request */
+typedef struct grpc_httpcli_request {
+ /* The host name to connect to */
char* host;
- /* The host to verify in the SSL handshake (or NULL) */
+ /* The host to verify in the SSL handshake (or NULL) */
char* ssl_host_override;
- /* The main part of the request
- The following headers are supplied automatically and MUST NOT be set here:
- Host, Connection, User-Agent */
- grpc_http_request http;
- /* handshaker to use ssl for the request */
+ /* The main part of the request
+ The following headers are supplied automatically and MUST NOT be set here:
+ Host, Connection, User-Agent */
+ grpc_http_request http;
+ /* handshaker to use ssl for the request */
const grpc_httpcli_handshaker* handshaker;
-} grpc_httpcli_request;
-
-/* Expose the parser response type as a httpcli response too */
-typedef struct grpc_http_response grpc_httpcli_response;
-
+} grpc_httpcli_request;
+
+/* Expose the parser response type as a httpcli response too */
+typedef struct grpc_http_response grpc_httpcli_response;
+
void grpc_httpcli_context_init(grpc_httpcli_context* context);
void grpc_httpcli_context_destroy(grpc_httpcli_context* context);
-
-/* Asynchronously perform a HTTP GET.
- 'context' specifies the http context under which to do the get
- 'pollset' indicates a grpc_pollset that is interested in the result
- of the get - work on this pollset may be used to progress the get
- operation
- 'request' contains request parameters - these are caller owned and can be
- destroyed once the call returns
- 'deadline' contains a deadline for the request (or gpr_inf_future)
- 'on_response' is a callback to report results to */
+
+/* Asynchronously perform a HTTP GET.
+ 'context' specifies the http context under which to do the get
+ 'pollset' indicates a grpc_pollset that is interested in the result
+ of the get - work on this pollset may be used to progress the get
+ operation
+ 'request' contains request parameters - these are caller owned and can be
+ destroyed once the call returns
+ 'deadline' contains a deadline for the request (or gpr_inf_future)
+ 'on_response' is a callback to report results to */
void grpc_httpcli_get(grpc_httpcli_context* context,
grpc_polling_entity* pollent,
grpc_resource_quota* resource_quota,
const grpc_httpcli_request* request, grpc_millis deadline,
grpc_closure* on_complete,
grpc_httpcli_response* response);
-
-/* Asynchronously perform a HTTP POST.
- 'context' specifies the http context under which to do the post
- 'pollset' indicates a grpc_pollset that is interested in the result
- of the post - work on this pollset may be used to progress the post
- operation
- 'request' contains request parameters - these are caller owned and can be
- destroyed once the call returns
- 'body_bytes' and 'body_size' specify the payload for the post.
- When there is no body, pass in NULL as body_bytes.
- 'deadline' contains a deadline for the request (or gpr_inf_future)
- 'em' points to a caller owned event manager that must be alive for the
- lifetime of the request
- 'on_response' is a callback to report results to
- Does not support ?var1=val1&var2=val2 in the path. */
+
+/* Asynchronously perform a HTTP POST.
+ 'context' specifies the http context under which to do the post
+ 'pollset' indicates a grpc_pollset that is interested in the result
+ of the post - work on this pollset may be used to progress the post
+ operation
+ 'request' contains request parameters - these are caller owned and can be
+ destroyed once the call returns
+ 'body_bytes' and 'body_size' specify the payload for the post.
+ When there is no body, pass in NULL as body_bytes.
+ 'deadline' contains a deadline for the request (or gpr_inf_future)
+ 'em' points to a caller owned event manager that must be alive for the
+ lifetime of the request
+ 'on_response' is a callback to report results to
+ Does not support ?var1=val1&var2=val2 in the path. */
void grpc_httpcli_post(grpc_httpcli_context* context,
grpc_polling_entity* pollent,
grpc_resource_quota* resource_quota,
@@ -107,8 +107,8 @@ void grpc_httpcli_post(grpc_httpcli_context* context,
const char* body_bytes, size_t body_size,
grpc_millis deadline, grpc_closure* on_complete,
grpc_httpcli_response* response);
-
-/* override functions return 1 if they handled the request, 0 otherwise */
+
+/* override functions return 1 if they handled the request, 0 otherwise */
typedef int (*grpc_httpcli_get_override)(const grpc_httpcli_request* request,
grpc_millis deadline,
grpc_closure* on_complete,
@@ -119,8 +119,8 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request* request,
grpc_millis deadline,
grpc_closure* on_complete,
grpc_httpcli_response* response);
-
-void grpc_httpcli_set_override(grpc_httpcli_get_override get,
- grpc_httpcli_post_override post);
-
-#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */
+
+void grpc_httpcli_set_override(grpc_httpcli_get_override get,
+ grpc_httpcli_post_override post);
+
+#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */
diff --git a/contrib/libs/grpc/src/core/lib/http/parser.h b/contrib/libs/grpc/src/core/lib/http/parser.h
index 758c67e87c..2da21903e6 100644
--- a/contrib/libs/grpc/src/core/lib/http/parser.h
+++ b/contrib/libs/grpc/src/core/lib/http/parser.h
@@ -1,113 +1,113 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
-#define GRPC_CORE_LIB_HTTP_PARSER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
+#define GRPC_CORE_LIB_HTTP_PARSER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/debug/trace.h"
-#include "src/core/lib/iomgr/error.h"
-
-/* Maximum length of a header string of the form 'Key: Value\r\n' */
-#define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096
-
-/* A single header to be passed in a request */
-typedef struct grpc_http_header {
+#include "src/core/lib/iomgr/error.h"
+
+/* Maximum length of a header string of the form 'Key: Value\r\n' */
+#define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096
+
+/* A single header to be passed in a request */
+typedef struct grpc_http_header {
char* key;
char* value;
-} grpc_http_header;
-
-typedef enum {
- GRPC_HTTP_FIRST_LINE,
- GRPC_HTTP_HEADERS,
- GRPC_HTTP_BODY
-} grpc_http_parser_state;
-
-typedef enum {
- GRPC_HTTP_HTTP10,
- GRPC_HTTP_HTTP11,
- GRPC_HTTP_HTTP20,
-} grpc_http_version;
-
-typedef enum {
- GRPC_HTTP_RESPONSE,
- GRPC_HTTP_REQUEST,
-} grpc_http_type;
-
-/* A request */
-typedef struct grpc_http_request {
- /* Method of the request (e.g. GET, POST) */
+} grpc_http_header;
+
+typedef enum {
+ GRPC_HTTP_FIRST_LINE,
+ GRPC_HTTP_HEADERS,
+ GRPC_HTTP_BODY
+} grpc_http_parser_state;
+
+typedef enum {
+ GRPC_HTTP_HTTP10,
+ GRPC_HTTP_HTTP11,
+ GRPC_HTTP_HTTP20,
+} grpc_http_version;
+
+typedef enum {
+ GRPC_HTTP_RESPONSE,
+ GRPC_HTTP_REQUEST,
+} grpc_http_type;
+
+/* A request */
+typedef struct grpc_http_request {
+ /* Method of the request (e.g. GET, POST) */
char* method;
- /* The path of the resource to fetch */
+ /* The path of the resource to fetch */
char* path;
- /* HTTP version to use */
- grpc_http_version version;
- /* Headers attached to the request */
- size_t hdr_count;
+ /* HTTP version to use */
+ grpc_http_version version;
+ /* Headers attached to the request */
+ size_t hdr_count;
grpc_http_header* hdrs;
- /* Body: length and contents; contents are NOT null-terminated */
- size_t body_length;
+ /* Body: length and contents; contents are NOT null-terminated */
+ size_t body_length;
char* body;
-} grpc_http_request;
-
-/* A response */
-typedef struct grpc_http_response {
- /* HTTP status code */
+} grpc_http_request;
+
+/* A response */
+typedef struct grpc_http_response {
+ /* HTTP status code */
int status = 0;
- /* Headers: count and key/values */
+ /* Headers: count and key/values */
size_t hdr_count = 0;
grpc_http_header* hdrs = nullptr;
- /* Body: length and contents; contents are NOT null-terminated */
+ /* Body: length and contents; contents are NOT null-terminated */
size_t body_length = 0;
char* body = nullptr;
-} grpc_http_response;
-
+} grpc_http_response;
+
struct grpc_http_parser {
- grpc_http_parser_state state;
- grpc_http_type type;
-
- union {
+ grpc_http_parser_state state;
+ grpc_http_type type;
+
+ union {
grpc_http_response* response;
grpc_http_request* request;
void* request_or_response;
- } http;
- size_t body_capacity;
- size_t hdr_capacity;
-
- uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
- size_t cur_line_length;
- size_t cur_line_end_length;
+ } http;
+ size_t body_capacity;
+ size_t hdr_capacity;
+
+ uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
+ size_t cur_line_length;
+ size_t cur_line_end_length;
};
void grpc_http_parser_init(grpc_http_parser* parser, grpc_http_type type,
void* request_or_response);
void grpc_http_parser_destroy(grpc_http_parser* parser);
-
-/* Sets \a start_of_body to the offset in \a slice of the start of the body. */
+
+/* Sets \a start_of_body to the offset in \a slice of the start of the body. */
grpc_error* grpc_http_parser_parse(grpc_http_parser* parser,
const grpc_slice& slice,
size_t* start_of_body);
grpc_error* grpc_http_parser_eof(grpc_http_parser* parser);
-
+
void grpc_http_request_destroy(grpc_http_request* request);
void grpc_http_response_destroy(grpc_http_response* response);
-
+
extern grpc_core::TraceFlag grpc_http1_trace;
-
-#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */
+
+#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/README.md b/contrib/libs/grpc/src/core/lib/iomgr/README.md
index 94c0abfa68..9b22b76ceb 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/README.md
+++ b/contrib/libs/grpc/src/core/lib/iomgr/README.md
@@ -1,6 +1,6 @@
-# iomgr
-
-Platform abstractions for I/O (mostly network).
-
-Provides abstractions over TCP/UDP I/O, file loading, polling, and concurrency
-management for various operating systems.
+# iomgr
+
+Platform abstractions for I/O (mostly network).
+
+Provides abstractions over TCP/UDP I/O, file loading, polling, and concurrency
+management for various operating systems.
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/closure.h b/contrib/libs/grpc/src/core/lib/iomgr/closure.h
index 63c608136f..6bb65340d1 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/closure.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/closure.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_CLOSURE_H
-#define GRPC_CORE_LIB_IOMGR_CLOSURE_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_CLOSURE_H
+#define GRPC_CORE_LIB_IOMGR_CLOSURE_H
+
+#include <grpc/support/port_platform.h>
+
#include <assert.h>
#include <stdbool.h>
@@ -30,51 +30,51 @@
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/mpscq.h"
-#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/profiling/timers.h"
-
-struct grpc_closure;
-typedef struct grpc_closure grpc_closure;
-
+
+struct grpc_closure;
+typedef struct grpc_closure grpc_closure;
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_closure;
-typedef struct grpc_closure_list {
+typedef struct grpc_closure_list {
grpc_closure* head;
grpc_closure* tail;
-} grpc_closure_list;
-
-/** gRPC Callback definition.
- *
- * \param arg Arbitrary input.
- * \param error GRPC_ERROR_NONE if no error occurred, otherwise some grpc_error
+} grpc_closure_list;
+
+/** gRPC Callback definition.
+ *
+ * \param arg Arbitrary input.
+ * \param error GRPC_ERROR_NONE if no error occurred, otherwise some grpc_error
* describing what went wrong.
* Error contract: it is not the cb's job to unref this error;
* the closure scheduler will do that after the cb returns */
typedef void (*grpc_iomgr_cb_func)(void* arg, grpc_error* error);
-
-/** A closure over a grpc_iomgr_cb_func. */
-struct grpc_closure {
- /** Once queued, next indicates the next queued closure; before then, scratch
- * space */
- union {
+
+/** A closure over a grpc_iomgr_cb_func. */
+struct grpc_closure {
+ /** Once queued, next indicates the next queued closure; before then, scratch
+ * space */
+ union {
grpc_closure* next;
grpc_core::ManualConstructor<
grpc_core::MultiProducerSingleConsumerQueue::Node>
mpscq_node;
- uintptr_t scratch;
- } next_data;
-
- /** Bound callback. */
- grpc_iomgr_cb_func cb;
-
- /** Arguments to be passed to "cb". */
+ uintptr_t scratch;
+ } next_data;
+
+ /** Bound callback. */
+ grpc_iomgr_cb_func cb;
+
+ /** Arguments to be passed to "cb". */
void* cb_arg;
-
- /** Once queued, the result of the closure. Before then: scratch space */
- union {
+
+ /** Once queued, the result of the closure. Before then: scratch space */
+ union {
grpc_error* error;
- uintptr_t scratch;
- } error_data;
+ uintptr_t scratch;
+ } error_data;
// extra tracing and debugging for grpc_closure. This incurs a decent amount of
// overhead per closure, so it must be enabled at compile time.
@@ -86,8 +86,8 @@ struct grpc_closure {
const char* file_initiated;
int line_initiated;
#endif
-};
-
+};
+
#ifndef NDEBUG
inline grpc_closure* grpc_closure_init(const char* file, int line,
grpc_closure* closure,
@@ -110,7 +110,7 @@ inline grpc_closure* grpc_closure_init(grpc_closure* closure,
return closure;
}
-/** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */
+/** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */
#ifndef NDEBUG
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \
grpc_closure_init(__FILE__, __LINE__, closure, cb, cb_arg)
@@ -118,7 +118,7 @@ inline grpc_closure* grpc_closure_init(grpc_closure* closure,
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler) \
grpc_closure_init(closure, cb, cb_arg)
#endif
-
+
namespace closure_impl {
struct wrapped_closure {
@@ -155,7 +155,7 @@ inline grpc_closure* grpc_closure_create(grpc_iomgr_cb_func cb, void* cb_arg) {
return &wc->wrapper;
}
-/* Create a heap allocated closure: try to avoid except for very rare events */
+/* Create a heap allocated closure: try to avoid except for very rare events */
#ifndef NDEBUG
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \
grpc_closure_create(__FILE__, __LINE__, cb, cb_arg)
@@ -163,15 +163,15 @@ inline grpc_closure* grpc_closure_create(grpc_iomgr_cb_func cb, void* cb_arg) {
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler) \
grpc_closure_create(cb, cb_arg)
#endif
-
-#define GRPC_CLOSURE_LIST_INIT \
+
+#define GRPC_CLOSURE_LIST_INIT \
{ nullptr, nullptr }
-
+
inline void grpc_closure_list_init(grpc_closure_list* closure_list) {
closure_list->head = closure_list->tail = nullptr;
}
-
-/** add \a closure to the end of \a list
+
+/** add \a closure to the end of \a list
and set \a closure's result to \a error
Returns true if \a list becomes non-empty */
inline bool grpc_closure_list_append(grpc_closure_list* closure_list,
@@ -191,8 +191,8 @@ inline bool grpc_closure_list_append(grpc_closure_list* closure_list,
closure_list->tail = closure;
return was_empty;
}
-
-/** force all success bits in \a list to false */
+
+/** force all success bits in \a list to false */
inline void grpc_closure_list_fail_all(grpc_closure_list* list,
grpc_error* forced_failure) {
for (grpc_closure* c = list->head; c != nullptr; c = c->next_data.next) {
@@ -202,8 +202,8 @@ inline void grpc_closure_list_fail_all(grpc_closure_list* list,
}
GRPC_ERROR_UNREF(forced_failure);
}
-
-/** append all closures from \a src to \a dst and empty \a src. */
+
+/** append all closures from \a src to \a dst and empty \a src. */
inline void grpc_closure_list_move(grpc_closure_list* src,
grpc_closure_list* dst) {
if (src->head == nullptr) {
@@ -217,12 +217,12 @@ inline void grpc_closure_list_move(grpc_closure_list* src,
}
src->head = src->tail = nullptr;
}
-
-/** return whether \a list is empty. */
+
+/** return whether \a list is empty. */
inline bool grpc_closure_list_empty(grpc_closure_list closure_list) {
return closure_list.head == nullptr;
}
-
+
namespace grpc_core {
class Closure {
public:
@@ -252,4 +252,4 @@ class Closure {
};
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */
+#endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/combiner.h b/contrib/libs/grpc/src/core/lib/iomgr/combiner.h
index 4879dc1596..32712066be 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/combiner.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/combiner.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_COMBINER_H
-#define GRPC_CORE_LIB_IOMGR_COMBINER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_COMBINER_H
+#define GRPC_CORE_LIB_IOMGR_COMBINER_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#include <grpc/support/atm.h>
+#include <stddef.h>
+
+#include <grpc/support/atm.h>
#include "src/core/lib/debug/trace.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
-
+#include "src/core/lib/iomgr/exec_ctx.h"
+
namespace grpc_core {
// TODO(yashkt) : Remove this class and replace it with a class that does not
// use ExecCtx
@@ -53,13 +53,13 @@ class Combiner {
};
} // namespace grpc_core
-// Provides serialized access to some resource.
-// Each action queued on a combiner is executed serially in a borrowed thread.
-// The actual thread executing actions may change over time (but there will only
+// Provides serialized access to some resource.
+// Each action queued on a combiner is executed serially in a borrowed thread.
+// The actual thread executing actions may change over time (but there will only
// ever be one at a time).
-
-// Initialize the lock, with an optional workqueue to shift load to when
-// necessary
+
+// Initialize the lock, with an optional workqueue to shift load to when
+// necessary
grpc_core::Combiner* grpc_combiner_create(void);
#ifndef NDEBUG
@@ -80,9 +80,9 @@ grpc_core::Combiner* grpc_combiner_create(void);
grpc_core::Combiner* grpc_combiner_ref(
grpc_core::Combiner* lock GRPC_COMBINER_DEBUG_ARGS);
void grpc_combiner_unref(grpc_core::Combiner* lock GRPC_COMBINER_DEBUG_ARGS);
-
+
bool grpc_combiner_continue_exec_ctx();
-
+
extern grpc_core::DebugOnlyTraceFlag grpc_combiner_trace;
-
-#endif /* GRPC_CORE_LIB_IOMGR_COMBINER_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_COMBINER_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/endpoint.h b/contrib/libs/grpc/src/core/lib/iomgr/endpoint.h
index ee7c2273b8..e704c3be49 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/endpoint.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/endpoint.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_H
-#define GRPC_CORE_LIB_IOMGR_ENDPOINT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_H
+#define GRPC_CORE_LIB_IOMGR_ENDPOINT_H
+
#include <grpc/support/port_platform.h>
#include "y_absl/strings/string_view.h"
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include <grpc/support/time.h>
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/iomgr/pollset_set.h"
-#include "src/core/lib/iomgr/resource_quota.h"
-
-/* An endpoint caps a streaming channel between two communicating processes.
- Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
-
-typedef struct grpc_endpoint grpc_endpoint;
-typedef struct grpc_endpoint_vtable grpc_endpoint_vtable;
-
-struct grpc_endpoint_vtable {
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/resource_quota.h"
+
+/* An endpoint caps a streaming channel between two communicating processes.
+ Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
+
+typedef struct grpc_endpoint grpc_endpoint;
+typedef struct grpc_endpoint_vtable grpc_endpoint_vtable;
+
+struct grpc_endpoint_vtable {
void (*read)(grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb,
bool urgent);
void (*write)(grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb,
@@ -51,60 +51,60 @@ struct grpc_endpoint_vtable {
y_absl::string_view (*get_local_address)(grpc_endpoint* ep);
int (*get_fd)(grpc_endpoint* ep);
bool (*can_track_err)(grpc_endpoint* ep);
-};
-
-/* When data is available on the connection, calls the callback with slices.
- Callback success indicates that the endpoint can accept more reads, failure
- indicates the endpoint is closed.
- Valid slices may be placed into \a slices even when the callback is
- invoked with error != GRPC_ERROR_NONE. */
+};
+
+/* When data is available on the connection, calls the callback with slices.
+ Callback success indicates that the endpoint can accept more reads, failure
+ indicates the endpoint is closed.
+ Valid slices may be placed into \a slices even when the callback is
+ invoked with error != GRPC_ERROR_NONE. */
void grpc_endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb, bool urgent);
-
+
y_absl::string_view grpc_endpoint_get_peer(grpc_endpoint* ep);
-
+
y_absl::string_view grpc_endpoint_get_local_address(grpc_endpoint* ep);
-/* Get the file descriptor used by \a ep. Return -1 if \a ep is not using an fd.
+/* Get the file descriptor used by \a ep. Return -1 if \a ep is not using an fd.
*/
int grpc_endpoint_get_fd(grpc_endpoint* ep);
-
-/* Write slices out to the socket.
-
- If the connection is ready for more data after the end of the call, it
- returns GRPC_ENDPOINT_DONE.
- Otherwise it returns GRPC_ENDPOINT_PENDING and calls cb when the
- connection is ready for more data.
- \a slices may be mutated at will by the endpoint until cb is called.
- No guarantee is made to the content of slices after a write EXCEPT that
- it is a valid slice buffer.
+
+/* Write slices out to the socket.
+
+ If the connection is ready for more data after the end of the call, it
+ returns GRPC_ENDPOINT_DONE.
+ Otherwise it returns GRPC_ENDPOINT_PENDING and calls cb when the
+ connection is ready for more data.
+ \a slices may be mutated at will by the endpoint until cb is called.
+ No guarantee is made to the content of slices after a write EXCEPT that
+ it is a valid slice buffer.
\a arg is platform specific. It is currently only used by TCP on linux
platforms as an argument that would be forwarded to the timestamps callback.
- */
+ */
void grpc_endpoint_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb, void* arg);
-
-/* Causes any pending and future read/write callbacks to run immediately with
- success==0 */
+
+/* Causes any pending and future read/write callbacks to run immediately with
+ success==0 */
void grpc_endpoint_shutdown(grpc_endpoint* ep, grpc_error* why);
void grpc_endpoint_destroy(grpc_endpoint* ep);
-
+
/* Add an endpoint to a pollset or pollset_set, so that when the pollset is
polled, events from this endpoint are considered */
void grpc_endpoint_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset);
void grpc_endpoint_add_to_pollset_set(grpc_endpoint* ep,
grpc_pollset_set* pollset_set);
-
+
/* Delete an endpoint from a pollset_set */
void grpc_endpoint_delete_from_pollset_set(grpc_endpoint* ep,
grpc_pollset_set* pollset_set);
-
+
grpc_resource_user* grpc_endpoint_get_resource_user(grpc_endpoint* endpoint);
bool grpc_endpoint_can_track_err(grpc_endpoint* ep);
-struct grpc_endpoint {
+struct grpc_endpoint {
const grpc_endpoint_vtable* vtable;
-};
-
-#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */
+};
+
+#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/endpoint_pair.h b/contrib/libs/grpc/src/core/lib/iomgr/endpoint_pair.h
index 87cbccd25d..e01185b9fb 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/endpoint_pair.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/endpoint_pair.h
@@ -1,33 +1,33 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
-#define GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
+#define GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/endpoint.h"
-
+#include "src/core/lib/iomgr/endpoint.h"
+
struct grpc_endpoint_pair {
grpc_endpoint* client;
grpc_endpoint* server;
};
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
grpc_channel_args* args);
-
-#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/error.h b/contrib/libs/grpc/src/core/lib/iomgr/error.h
index 3b4cb51be4..ac3ff87628 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/error.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/error.h
@@ -1,104 +1,104 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_ERROR_H
-#define GRPC_CORE_LIB_IOMGR_ERROR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_ERROR_H
+#define GRPC_CORE_LIB_IOMGR_ERROR_H
+
#include <grpc/support/port_platform.h>
#include <inttypes.h>
-#include <stdbool.h>
-
+#include <stdbool.h>
+
#include <grpc/slice.h>
-#include <grpc/status.h>
+#include <grpc/status.h>
#include <grpc/support/log.h>
-#include <grpc/support/time.h>
-
+#include <grpc/support/time.h>
+
#include "src/core/lib/debug/trace.h"
-
-/// Opaque representation of an error.
+
+/// Opaque representation of an error.
/// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a
/// full write up of this object.
-typedef struct grpc_error grpc_error;
-
+typedef struct grpc_error grpc_error;
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount;
-typedef enum {
- /// 'errno' from the operating system
- GRPC_ERROR_INT_ERRNO,
- /// __LINE__ from the call site creating the error
- GRPC_ERROR_INT_FILE_LINE,
- /// stream identifier: for errors that are associated with an individual
- /// wire stream
- GRPC_ERROR_INT_STREAM_ID,
- /// grpc status code representing this error
- GRPC_ERROR_INT_GRPC_STATUS,
- /// offset into some binary blob (usually represented by
- /// GRPC_ERROR_STR_RAW_BYTES) where the error occurred
- GRPC_ERROR_INT_OFFSET,
- /// context sensitive index associated with the error
- GRPC_ERROR_INT_INDEX,
- /// context sensitive size associated with the error
- GRPC_ERROR_INT_SIZE,
- /// http2 error code associated with the error (see the HTTP2 RFC)
- GRPC_ERROR_INT_HTTP2_ERROR,
- /// TSI status code associated with the error
- GRPC_ERROR_INT_TSI_CODE,
- /// grpc_security_status associated with the error
- GRPC_ERROR_INT_SECURITY_STATUS,
- /// WSAGetLastError() reported when this error occurred
- GRPC_ERROR_INT_WSA_ERROR,
- /// File descriptor associated with this error
- GRPC_ERROR_INT_FD,
- /// HTTP status (i.e. 404)
- GRPC_ERROR_INT_HTTP_STATUS,
- /// context sensitive limit associated with the error
- GRPC_ERROR_INT_LIMIT,
- /// chttp2: did the error occur while a write was in progress
- GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
+typedef enum {
+ /// 'errno' from the operating system
+ GRPC_ERROR_INT_ERRNO,
+ /// __LINE__ from the call site creating the error
+ GRPC_ERROR_INT_FILE_LINE,
+ /// stream identifier: for errors that are associated with an individual
+ /// wire stream
+ GRPC_ERROR_INT_STREAM_ID,
+ /// grpc status code representing this error
+ GRPC_ERROR_INT_GRPC_STATUS,
+ /// offset into some binary blob (usually represented by
+ /// GRPC_ERROR_STR_RAW_BYTES) where the error occurred
+ GRPC_ERROR_INT_OFFSET,
+ /// context sensitive index associated with the error
+ GRPC_ERROR_INT_INDEX,
+ /// context sensitive size associated with the error
+ GRPC_ERROR_INT_SIZE,
+ /// http2 error code associated with the error (see the HTTP2 RFC)
+ GRPC_ERROR_INT_HTTP2_ERROR,
+ /// TSI status code associated with the error
+ GRPC_ERROR_INT_TSI_CODE,
+ /// grpc_security_status associated with the error
+ GRPC_ERROR_INT_SECURITY_STATUS,
+ /// WSAGetLastError() reported when this error occurred
+ GRPC_ERROR_INT_WSA_ERROR,
+ /// File descriptor associated with this error
+ GRPC_ERROR_INT_FD,
+ /// HTTP status (i.e. 404)
+ GRPC_ERROR_INT_HTTP_STATUS,
+ /// context sensitive limit associated with the error
+ GRPC_ERROR_INT_LIMIT,
+ /// chttp2: did the error occur while a write was in progress
+ GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
/// channel connectivity state associated with the error
GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE,
/// Must always be last
GRPC_ERROR_INT_MAX,
-} grpc_error_ints;
-
-typedef enum {
- /// top-level textual description of this error
- GRPC_ERROR_STR_DESCRIPTION,
- /// source file in which this error occurred
- GRPC_ERROR_STR_FILE,
- /// operating system description of this error
- GRPC_ERROR_STR_OS_ERROR,
- /// syscall that generated this error
- GRPC_ERROR_STR_SYSCALL,
- /// peer that we were trying to communicate when this error occurred
- GRPC_ERROR_STR_TARGET_ADDRESS,
- /// grpc status message associated with this error
- GRPC_ERROR_STR_GRPC_MESSAGE,
- /// hex dump (or similar) with the data that generated this error
- GRPC_ERROR_STR_RAW_BYTES,
- /// tsi error string associated with this error
- GRPC_ERROR_STR_TSI_ERROR,
- /// filename that we were trying to read/write when this error occurred
- GRPC_ERROR_STR_FILENAME,
- /// which data was queued for writing when the error occurred
+} grpc_error_ints;
+
+typedef enum {
+ /// top-level textual description of this error
+ GRPC_ERROR_STR_DESCRIPTION,
+ /// source file in which this error occurred
+ GRPC_ERROR_STR_FILE,
+ /// operating system description of this error
+ GRPC_ERROR_STR_OS_ERROR,
+ /// syscall that generated this error
+ GRPC_ERROR_STR_SYSCALL,
+ /// peer that we were trying to communicate when this error occurred
+ GRPC_ERROR_STR_TARGET_ADDRESS,
+ /// grpc status message associated with this error
+ GRPC_ERROR_STR_GRPC_MESSAGE,
+ /// hex dump (or similar) with the data that generated this error
+ GRPC_ERROR_STR_RAW_BYTES,
+ /// tsi error string associated with this error
+ GRPC_ERROR_STR_TSI_ERROR,
+ /// filename that we were trying to read/write when this error occurred
+ GRPC_ERROR_STR_FILENAME,
+ /// which data was queued for writing when the error occurred
GRPC_ERROR_STR_QUEUED_BUFFERS,
/// key associated with the error
GRPC_ERROR_STR_KEY,
@@ -107,27 +107,27 @@ typedef enum {
/// Must always be last
GRPC_ERROR_STR_MAX,
-} grpc_error_strs;
-
-typedef enum {
- /// timestamp of error creation
- GRPC_ERROR_TIME_CREATED,
+} grpc_error_strs;
+
+typedef enum {
+ /// timestamp of error creation
+ GRPC_ERROR_TIME_CREATED,
/// Must always be last
GRPC_ERROR_TIME_MAX,
-} grpc_error_times;
-
-/// The following "special" errors can be propagated without allocating memory.
+} grpc_error_times;
+
+/// The following "special" errors can be propagated without allocating memory.
/// They are always even so that other code (particularly combiner locks,
/// polling engines) can safely use the lower bit for themselves.
-
+
#define GRPC_ERROR_NONE ((grpc_error*)NULL)
#define GRPC_ERROR_RESERVED_1 ((grpc_error*)1)
#define GRPC_ERROR_OOM ((grpc_error*)2)
#define GRPC_ERROR_RESERVED_2 ((grpc_error*)3)
#define GRPC_ERROR_CANCELLED ((grpc_error*)4)
#define GRPC_ERROR_SPECIAL_MAX GRPC_ERROR_CANCELLED
-
+
inline bool grpc_error_is_special(struct grpc_error* err) {
return err <= GRPC_ERROR_SPECIAL_MAX;
}
@@ -138,35 +138,35 @@ void grpc_disable_error_creation();
void grpc_enable_error_creation();
const char* grpc_error_string(grpc_error* error);
-
-/// Create an error - but use GRPC_ERROR_CREATE instead
+
+/// Create an error - but use GRPC_ERROR_CREATE instead
grpc_error* grpc_error_create(const char* file, int line,
const grpc_slice& desc, grpc_error** referencing,
size_t num_referencing);
-/// Create an error (this is the preferred way of generating an error that is
-/// not due to a system call - for system calls, use GRPC_OS_ERROR or
-/// GRPC_WSA_ERROR as appropriate)
-/// \a referencing is an array of num_referencing elements indicating one or
-/// more errors that are believed to have contributed to this one
-/// err = grpc_error_create(x, y, z, r, nr) is equivalent to:
-/// err = grpc_error_create(x, y, z, NULL, 0);
-/// for (i=0; i<nr; i++) err = grpc_error_add_child(err, r[i]);
+/// Create an error (this is the preferred way of generating an error that is
+/// not due to a system call - for system calls, use GRPC_OS_ERROR or
+/// GRPC_WSA_ERROR as appropriate)
+/// \a referencing is an array of num_referencing elements indicating one or
+/// more errors that are believed to have contributed to this one
+/// err = grpc_error_create(x, y, z, r, nr) is equivalent to:
+/// err = grpc_error_create(x, y, z, NULL, 0);
+/// for (i=0; i<nr; i++) err = grpc_error_add_child(err, r[i]);
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc) \
grpc_error_create(__FILE__, __LINE__, grpc_slice_from_static_string(desc), \
NULL, 0)
#define GRPC_ERROR_CREATE_FROM_COPIED_STRING(desc) \
grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \
NULL, 0)
-
-// Create an error that references some other errors. This function adds a
-// reference to each error in errs - it does not consume an existing reference
+
+// Create an error that references some other errors. This function adds a
+// reference to each error in errs - it does not consume an existing reference
#define GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(desc, errs, count) \
grpc_error_create(__FILE__, __LINE__, grpc_slice_from_static_string(desc), \
errs, count)
#define GRPC_ERROR_CREATE_REFERENCING_FROM_COPIED_STRING(desc, errs, count) \
grpc_error_create(__FILE__, __LINE__, grpc_slice_from_copied_string(desc), \
errs, count)
-
+
#define GRPC_ERROR_CREATE_FROM_VECTOR(desc, error_list) \
grpc_error_create_from_vector(__FILE__, __LINE__, desc, error_list)
@@ -183,7 +183,7 @@ inline void grpc_error_unref(grpc_error* err, const char* file, int line) {
}
#define GRPC_ERROR_REF(err) grpc_error_ref(err, __FILE__, __LINE__)
#define GRPC_ERROR_UNREF(err) grpc_error_unref(err, __FILE__, __LINE__)
-#else
+#else
grpc_error* grpc_error_do_ref(grpc_error* err);
void grpc_error_do_unref(grpc_error* err);
inline grpc_error* grpc_error_ref(grpc_error* err) {
@@ -194,10 +194,10 @@ inline void grpc_error_unref(grpc_error* err) {
if (grpc_error_is_special(err)) return;
grpc_error_do_unref(err);
}
-#define GRPC_ERROR_REF(err) grpc_error_ref(err)
-#define GRPC_ERROR_UNREF(err) grpc_error_unref(err)
-#endif
-
+#define GRPC_ERROR_REF(err) grpc_error_ref(err)
+#define GRPC_ERROR_UNREF(err) grpc_error_unref(err)
+#endif
+
// Consumes all the errors in the vector and forms a referencing error from
// them. If the vector is empty, return GRPC_ERROR_NONE.
template <typename VectorType>
@@ -218,7 +218,7 @@ static grpc_error* grpc_error_create_from_vector(const char* file, int line,
}
grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which,
- intptr_t value) GRPC_MUST_USE_RESULT;
+ intptr_t value) GRPC_MUST_USE_RESULT;
/// It is an error to pass nullptr as `p`. Caller should allocate a dummy
/// intptr_t for `p`, even if the value of `p` is not used.
bool grpc_error_get_int(grpc_error* error, grpc_error_ints which, intptr_t* p);
@@ -230,9 +230,9 @@ grpc_error* grpc_error_set_str(grpc_error* src, grpc_error_strs which,
/// Caller does NOT own the slice.
bool grpc_error_get_str(grpc_error* error, grpc_error_strs which,
grpc_slice* s);
-
-/// Add a child error: an error that is believed to have contributed to this
-/// error occurring. Allows root causing high level errors from lower level
+
+/// Add a child error: an error that is believed to have contributed to this
+/// error occurring. Allows root causing high level errors from lower level
/// errors that contributed to them. The src error takes ownership of the
/// child error.
///
@@ -253,15 +253,15 @@ inline grpc_error* grpc_assert_never_ok(grpc_error* error) {
return error;
}
-/// create an error associated with errno!=0 (an 'operating system' error)
-#define GRPC_OS_ERROR(err, call_name) \
+/// create an error associated with errno!=0 (an 'operating system' error)
+#define GRPC_OS_ERROR(err, call_name) \
grpc_assert_never_ok(grpc_os_error(__FILE__, __LINE__, err, call_name))
grpc_error* grpc_wsa_error(const char* file, int line, int err,
const char* call_name) GRPC_MUST_USE_RESULT;
-/// windows only: create an error associated with WSAGetLastError()!=0
-#define GRPC_WSA_ERROR(err, call_name) \
- grpc_wsa_error(__FILE__, __LINE__, err, call_name)
-
+/// windows only: create an error associated with WSAGetLastError()!=0
+#define GRPC_WSA_ERROR(err, call_name) \
+ grpc_wsa_error(__FILE__, __LINE__, err, call_name)
+
bool grpc_log_error(const char* what, grpc_error* error, const char* file,
int line);
inline bool grpc_log_if_error(const char* what, grpc_error* error,
@@ -270,7 +270,7 @@ inline bool grpc_log_if_error(const char* what, grpc_error* error,
: grpc_log_error(what, error, file, line);
}
-#define GRPC_LOG_IF_ERROR(what, error) \
+#define GRPC_LOG_IF_ERROR(what, error) \
(grpc_log_if_error((what), (error), __FILE__, __LINE__))
-
-#endif /* GRPC_CORE_LIB_IOMGR_ERROR_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_ERROR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/ev_poll_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/ev_poll_posix.h
index a700ba2430..ab3cd9029e 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/ev_poll_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/ev_poll_posix.h
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* Copyright 2015-2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/ev_posix.h"
-
+#include "src/core/lib/iomgr/ev_posix.h"
+
const grpc_event_engine_vtable* grpc_init_poll_posix(bool explicit_request);
const grpc_event_engine_vtable* grpc_init_poll_cv_posix(bool explicit_request);
-
-#endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/ev_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/ev_posix.h
index cad12361f1..84edabce71 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/ev_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/ev_posix.h
@@ -1,35 +1,35 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_EV_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_EV_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EV_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_EV_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include <poll.h>
-
+#include <poll.h>
+
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/global_config.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/iomgr/pollset_set.h"
-#include "src/core/lib/iomgr/wakeup_fd_posix.h"
-
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
+
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_poll_strategy);
extern grpc_core::DebugOnlyTraceFlag grpc_fd_trace; /* Disabled by default */
@@ -41,13 +41,13 @@ extern grpc_core::DebugOnlyTraceFlag
gpr_log(GPR_INFO, "(fd-trace) " format, __VA_ARGS__); \
}
-typedef struct grpc_fd grpc_fd;
-
-typedef struct grpc_event_engine_vtable {
- size_t pollset_size;
+typedef struct grpc_fd grpc_fd;
+
+typedef struct grpc_event_engine_vtable {
+ size_t pollset_size;
bool can_track_err;
bool run_in_background;
-
+
grpc_fd* (*fd_create)(int fd, const char* name, bool track_err);
int (*fd_wrapped_fd)(grpc_fd* fd);
void (*fd_orphan)(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
@@ -60,7 +60,7 @@ typedef struct grpc_event_engine_vtable {
void (*fd_set_writable)(grpc_fd* fd);
void (*fd_set_error)(grpc_fd* fd);
bool (*fd_is_shutdown)(grpc_fd* fd);
-
+
void (*pollset_init)(grpc_pollset* pollset, gpr_mu** mu);
void (*pollset_shutdown)(grpc_pollset* pollset, grpc_closure* closure);
void (*pollset_destroy)(grpc_pollset* pollset);
@@ -70,7 +70,7 @@ typedef struct grpc_event_engine_vtable {
grpc_error* (*pollset_kick)(grpc_pollset* pollset,
grpc_pollset_worker* specific_worker);
void (*pollset_add_fd)(grpc_pollset* pollset, struct grpc_fd* fd);
-
+
grpc_pollset_set* (*pollset_set_create)(void);
void (*pollset_set_destroy)(grpc_pollset_set* pollset_set);
void (*pollset_set_add_pollset)(grpc_pollset_set* pollset_set,
@@ -83,25 +83,25 @@ typedef struct grpc_event_engine_vtable {
grpc_pollset_set* item);
void (*pollset_set_add_fd)(grpc_pollset_set* pollset_set, grpc_fd* fd);
void (*pollset_set_del_fd)(grpc_pollset_set* pollset_set, grpc_fd* fd);
-
+
bool (*is_any_background_poller_thread)(void);
void (*shutdown_background_closure)(void);
- void (*shutdown_engine)(void);
+ void (*shutdown_engine)(void);
bool (*add_closure_to_background_poller)(grpc_closure* closure,
grpc_error* error);
-} grpc_event_engine_vtable;
-
+} grpc_event_engine_vtable;
+
/* register a new event engine factory */
void grpc_register_event_engine_factory(
const char* name, const grpc_event_engine_vtable* (*factory)(bool),
bool add_at_head);
-void grpc_event_engine_init(void);
-void grpc_event_engine_shutdown(void);
-
-/* Return the name of the poll strategy */
+void grpc_event_engine_init(void);
+void grpc_event_engine_shutdown(void);
+
+/* Return the name of the poll strategy */
const char* grpc_get_poll_strategy_name();
-
+
/* Returns true if polling engine can track errors separately, false otherwise.
* If this is true, fd can be created with track_err set. After this, error
* events will be reported using fd_notify_on_error. If it is not set, errors
@@ -115,54 +115,54 @@ bool grpc_event_engine_can_track_errors();
*/
bool grpc_event_engine_run_in_background();
-/* Create a wrapped file descriptor.
- Requires fd is a non-blocking file descriptor.
+/* Create a wrapped file descriptor.
+ Requires fd is a non-blocking file descriptor.
\a track_err if true means that error events would be tracked separately
using grpc_fd_notify_on_error. Currently, valid only for linux systems.
- This takes ownership of closing fd. */
+ This takes ownership of closing fd. */
grpc_fd* grpc_fd_create(int fd, const char* name, bool track_err);
-
-/* Return the wrapped fd, or -1 if it has been released or closed. */
+
+/* Return the wrapped fd, or -1 if it has been released or closed. */
int grpc_fd_wrapped_fd(grpc_fd* fd);
-
-/* Releases fd to be asynchronously destroyed.
- on_done is called when the underlying file descriptor is definitely close()d.
- If on_done is NULL, no callback will be made.
- If release_fd is not NULL, it's set to fd and fd will not be closed.
- Requires: *fd initialized; no outstanding notify_on_read or
- notify_on_write.
- MUST NOT be called with a pollset lock taken */
+
+/* Releases fd to be asynchronously destroyed.
+ on_done is called when the underlying file descriptor is definitely close()d.
+ If on_done is NULL, no callback will be made.
+ If release_fd is not NULL, it's set to fd and fd will not be closed.
+ Requires: *fd initialized; no outstanding notify_on_read or
+ notify_on_write.
+ MUST NOT be called with a pollset lock taken */
void grpc_fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
const char* reason);
-
-/* Has grpc_fd_shutdown been called on an fd? */
+
+/* Has grpc_fd_shutdown been called on an fd? */
bool grpc_fd_is_shutdown(grpc_fd* fd);
-
-/* Cause any current and future callbacks to fail. */
+
+/* Cause any current and future callbacks to fail. */
void grpc_fd_shutdown(grpc_fd* fd, grpc_error* why);
-
-/* Register read interest, causing read_cb to be called once when fd becomes
- readable, on deadline specified by deadline, or on shutdown triggered by
- grpc_fd_shutdown.
- read_cb will be called with read_cb_arg when *fd becomes readable.
- read_cb is Called with status of GRPC_CALLBACK_SUCCESS if readable,
- GRPC_CALLBACK_TIMED_OUT if the call timed out,
- and CANCELLED if the call was cancelled.
-
- Requires:This method must not be called before the read_cb for any previous
- call runs. Edge triggered events are used whenever they are supported by the
- underlying platform. This means that users must drain fd in read_cb before
- calling notify_on_read again. Users are also expected to handle spurious
- events, i.e read_cb is called while nothing can be readable from fd */
+
+/* Register read interest, causing read_cb to be called once when fd becomes
+ readable, on deadline specified by deadline, or on shutdown triggered by
+ grpc_fd_shutdown.
+ read_cb will be called with read_cb_arg when *fd becomes readable.
+ read_cb is Called with status of GRPC_CALLBACK_SUCCESS if readable,
+ GRPC_CALLBACK_TIMED_OUT if the call timed out,
+ and CANCELLED if the call was cancelled.
+
+ Requires:This method must not be called before the read_cb for any previous
+ call runs. Edge triggered events are used whenever they are supported by the
+ underlying platform. This means that users must drain fd in read_cb before
+ calling notify_on_read again. Users are also expected to handle spurious
+ events, i.e read_cb is called while nothing can be readable from fd */
void grpc_fd_notify_on_read(grpc_fd* fd, grpc_closure* closure);
-
-/* Exactly the same semantics as above, except based on writable events. */
+
+/* Exactly the same semantics as above, except based on writable events. */
void grpc_fd_notify_on_write(grpc_fd* fd, grpc_closure* closure);
-
+
/* Exactly the same semantics as above, except based on error events. track_err
* needs to have been set on grpc_fd_create */
void grpc_fd_notify_on_error(grpc_fd* fd, grpc_closure* closure);
-
+
/* Forcibly set the fd to be readable, resulting in the closure registered with
* grpc_fd_notify_on_read being invoked.
*/
@@ -178,16 +178,16 @@ void grpc_fd_set_writable(grpc_fd* fd);
*/
void grpc_fd_set_error(grpc_fd* fd);
-/* pollset_posix functions */
-
-/* Add an fd to a pollset */
+/* pollset_posix functions */
+
+/* Add an fd to a pollset */
void grpc_pollset_add_fd(grpc_pollset* pollset, struct grpc_fd* fd);
-
-/* pollset_set_posix functions */
-
+
+/* pollset_set_posix functions */
+
void grpc_pollset_set_add_fd(grpc_pollset_set* pollset_set, grpc_fd* fd);
void grpc_pollset_set_del_fd(grpc_pollset_set* pollset_set, grpc_fd* fd);
-
+
/* Returns true if the caller is a worker thread for any background poller. */
bool grpc_is_any_background_poller_thread();
@@ -200,8 +200,8 @@ bool grpc_add_closure_to_background_poller(grpc_closure* closure,
/* Shut down all the closures registered in the background poller. */
void grpc_shutdown_background_closure();
-/* override to allow tests to hook poll() usage */
+/* override to allow tests to hook poll() usage */
typedef int (*grpc_poll_function_type)(struct pollfd*, nfds_t, int);
-extern grpc_poll_function_type grpc_poll_function;
-
-#endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */
+extern grpc_poll_function_type grpc_poll_function;
+
+#endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/exec_ctx.h b/contrib/libs/grpc/src/core/lib/iomgr/exec_ctx.h
index 827ec010bf..6b4e184cad 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/exec_ctx.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/exec_ctx.h
@@ -1,24 +1,24 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
-#define GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
+#define GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
+
#include <grpc/support/port_platform.h>
#include <limits>
@@ -32,17 +32,17 @@
#include "src/core/lib/gpr/tls.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/fork.h"
-#include "src/core/lib/iomgr/closure.h"
-
+#include "src/core/lib/iomgr/closure.h"
+
typedef int64_t grpc_millis;
-
+
#define GRPC_MILLIS_INF_FUTURE INT64_MAX
#define GRPC_MILLIS_INF_PAST INT64_MIN
/** A combiner represents a list of work to be executed later.
Forward declared here to avoid a circular dependency with combiner.h. */
-typedef struct grpc_combiner grpc_combiner;
-
+typedef struct grpc_combiner grpc_combiner;
+
/* This exec_ctx is ready to return: either pre-populated, or cached as soon as
the finish_check returns true */
#define GRPC_EXEC_CTX_FLAG_IS_FINISHED 1
@@ -65,11 +65,11 @@ grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles);
namespace grpc_core {
class Combiner;
-/** Execution context.
- * A bag of data that collects information along a callstack.
+/** Execution context.
+ * A bag of data that collects information along a callstack.
* It is created on the stack at core entry points (public API or iomgr), and
* stored internally as a thread-local variable.
- *
+ *
* Generally, to create an exec_ctx instance, add the following line at the top
* of the public API entry point or at the start of a thread's work function :
*
@@ -78,17 +78,17 @@ class Combiner;
* Access the created ExecCtx instance using :
* grpc_core::ExecCtx::Get()
*
- * Specific responsibilities (this may grow in the future):
+ * Specific responsibilities (this may grow in the future):
* - track a list of core work that needs to be delayed until the base of the
- * call stack (this provides a convenient mechanism to run callbacks
- * without worrying about locking issues)
+ * call stack (this provides a convenient mechanism to run callbacks
+ * without worrying about locking issues)
* - provide a decision maker (via IsReadyToFinish) that provides a
- * signal as to whether a borrowed thread should continue to do work or
- * should actively try to finish up and get this thread back to its owner
- *
- * CONVENTIONS:
- * - Instance of this must ALWAYS be constructed on the stack, never
- * heap allocated.
+ * signal as to whether a borrowed thread should continue to do work or
+ * should actively try to finish up and get this thread back to its owner
+ *
+ * CONVENTIONS:
+ * - Instance of this must ALWAYS be constructed on the stack, never
+ * heap allocated.
* - Do not pass exec_ctx as a parameter to a function. Always access it using
* grpc_core::ExecCtx::Get().
* - NOTE: In the future, the convention is likely to change to allow only one
@@ -102,16 +102,16 @@ class Combiner;
* Stage 2: Assert if a 2nd one is ever created on the stack
* since that implies a core re-entry outside of application
* callbacks.
- */
+ */
class ExecCtx {
public:
/** Default Constructor */
-
+
ExecCtx() : flags_(GRPC_EXEC_CTX_FLAG_IS_FINISHED) {
grpc_core::Fork::IncExecCtxCount();
Set(this);
}
-
+
/** Parameterised Constructor */
ExecCtx(uintptr_t fl) : flags_(fl) {
if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
@@ -119,7 +119,7 @@ class ExecCtx {
}
Set(this);
}
-
+
/** Destructor */
virtual ~ExecCtx() {
flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED;
@@ -129,25 +129,25 @@ class ExecCtx {
grpc_core::Fork::DecExecCtxCount();
}
}
-
+
/** Disallow copy and assignment operators */
ExecCtx(const ExecCtx&) = delete;
ExecCtx& operator=(const ExecCtx&) = delete;
-
+
unsigned starting_cpu() {
if (starting_cpu_ == std::numeric_limits<unsigned>::max()) {
starting_cpu_ = gpr_cpu_current_cpu();
}
return starting_cpu_;
}
-
+
struct CombinerData {
/* currently active combiner: updated only via combiner.c */
Combiner* active_combiner;
/* last active combiner in the active combiner list */
Combiner* last_combiner;
};
-
+
/** Only to be used by grpc-combiner code */
CombinerData* combiner_data() { return &combiner_data_; }
@@ -379,4 +379,4 @@ class ApplicationCallbackExecCtx {
};
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_IOMGR_EXEC_CTX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_EXEC_CTX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/executor.h b/contrib/libs/grpc/src/core/lib/iomgr/executor.h
index 21a7cd2b55..ae523ff212 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/executor.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/executor.h
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_EXECUTOR_H
-#define GRPC_CORE_LIB_IOMGR_EXECUTOR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EXECUTOR_H
+#define GRPC_CORE_LIB_IOMGR_EXECUTOR_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/gprpp/thd.h"
-#include "src/core/lib/iomgr/closure.h"
-
+#include "src/core/lib/iomgr/closure.h"
+
namespace grpc_core {
struct ThreadState {
@@ -38,14 +38,14 @@ struct ThreadState {
bool queued_long_job;
grpc_core::Thread thd;
};
-
+
enum class ExecutorType {
DEFAULT = 0,
RESOLVER,
-
+
NUM_EXECUTORS // Add new values above this
};
-
+
enum class ExecutorJobType {
SHORT = 0,
LONG,
@@ -122,4 +122,4 @@ void grpc_executor_global_init();
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/iocp_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/iocp_windows.h
index 980bff7ca5..68d9de6158 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/iocp_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/iocp_windows.h
@@ -1,48 +1,48 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/support/sync.h>
-
+#include <grpc/support/sync.h>
+
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/iomgr/socket_windows.h"
-
-typedef enum {
- GRPC_IOCP_WORK_WORK,
- GRPC_IOCP_WORK_TIMEOUT,
- GRPC_IOCP_WORK_KICK
-} grpc_iocp_work_status;
-
+#include "src/core/lib/iomgr/socket_windows.h"
+
+typedef enum {
+ GRPC_IOCP_WORK_WORK,
+ GRPC_IOCP_WORK_TIMEOUT,
+ GRPC_IOCP_WORK_KICK
+} grpc_iocp_work_status;
+
grpc_iocp_work_status grpc_iocp_work(grpc_millis deadline);
-void grpc_iocp_init(void);
-void grpc_iocp_kick(void);
-void grpc_iocp_flush(void);
-void grpc_iocp_shutdown(void);
+void grpc_iocp_init(void);
+void grpc_iocp_kick(void);
+void grpc_iocp_flush(void);
+void grpc_iocp_shutdown(void);
void grpc_iocp_add_socket(grpc_winsocket*);
-
+
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/iomgr.h b/contrib/libs/grpc/src/core/lib/iomgr/iomgr.h
index 83a70d454b..e02f15e551 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/iomgr.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/iomgr.h
@@ -1,41 +1,41 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H
-#define GRPC_CORE_LIB_IOMGR_IOMGR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/closure.h"
-#include "src/core/lib/iomgr/port.h"
-
+#include "src/core/lib/iomgr/port.h"
+
#include <stdlib.h>
-/** Initializes the iomgr. */
+/** Initializes the iomgr. */
void grpc_iomgr_init();
-
+
/** Starts any background threads for iomgr. */
void grpc_iomgr_start();
-/** Signals the intention to shutdown the iomgr. Expects to be able to flush
- * exec_ctx. */
+/** Signals the intention to shutdown the iomgr. Expects to be able to flush
+ * exec_ctx. */
void grpc_iomgr_shutdown();
-
+
/** Signals the intention to shutdown all the closures registered in the
* background poller. */
void grpc_iomgr_shutdown_background_closure();
@@ -57,4 +57,4 @@ bool grpc_iomgr_add_closure_to_background_poller(grpc_closure* closure,
/* Exposed only for testing */
size_t grpc_iomgr_count_objects_for_testing();
-#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/iomgr_internal.h b/contrib/libs/grpc/src/core/lib/iomgr/iomgr_internal.h
index d31831b847..17607f98f1 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/iomgr_internal.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/iomgr_internal.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
-#define GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
-#include "src/core/lib/iomgr/iomgr.h"
-
-typedef struct grpc_iomgr_object {
+#include <stdbool.h>
+
+#include "src/core/lib/iomgr/iomgr.h"
+
+typedef struct grpc_iomgr_object {
char* name;
struct grpc_iomgr_object* next;
struct grpc_iomgr_object* prev;
-} grpc_iomgr_object;
-
+} grpc_iomgr_object;
+
typedef struct grpc_iomgr_platform_vtable {
void (*init)(void);
void (*flush)(void);
@@ -40,7 +40,7 @@ typedef struct grpc_iomgr_platform_vtable {
bool (*add_closure_to_background_poller)(grpc_closure* closure,
grpc_error* error);
} grpc_iomgr_platform_vtable;
-
+
void grpc_iomgr_register_object(grpc_iomgr_object* obj, const char* name);
void grpc_iomgr_unregister_object(grpc_iomgr_object* obj);
@@ -50,12 +50,12 @@ void grpc_set_iomgr_platform_vtable(grpc_iomgr_platform_vtable* vtable);
void grpc_set_default_iomgr_platform();
-void grpc_iomgr_platform_init(void);
-/** flush any globally queued work from iomgr */
-void grpc_iomgr_platform_flush(void);
-/** tear down all platform specific global iomgr structures */
-void grpc_iomgr_platform_shutdown(void);
-
+void grpc_iomgr_platform_init(void);
+/** flush any globally queued work from iomgr */
+void grpc_iomgr_platform_flush(void);
+/** tear down all platform specific global iomgr structures */
+void grpc_iomgr_platform_shutdown(void);
+
/** shut down all the closures registered in the background poller */
void grpc_iomgr_platform_shutdown_background_closure(void);
@@ -68,6 +68,6 @@ bool grpc_iomgr_platform_is_any_background_poller_thread(void);
bool grpc_iomgr_platform_add_closure_to_background_poller(grpc_closure* closure,
grpc_error* error);
-bool grpc_iomgr_abort_on_leaks(void);
-
-#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */
+bool grpc_iomgr_abort_on_leaks(void);
+
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/iomgr_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/iomgr_posix.h
index ab8bdca649..54ec46e1bb 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/iomgr_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/iomgr_posix.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/iomgr_internal.h"
-
-#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H */
+#include "src/core/lib/iomgr/iomgr_internal.h"
+
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/load_file.h b/contrib/libs/grpc/src/core/lib/iomgr/load_file.h
index a9e7531816..1cb2b5de73 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/load_file.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/load_file.h
@@ -1,35 +1,35 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_LOAD_FILE_H
-#define GRPC_CORE_LIB_IOMGR_LOAD_FILE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_LOAD_FILE_H
+#define GRPC_CORE_LIB_IOMGR_LOAD_FILE_H
+
#include <grpc/support/port_platform.h>
-#include <stdio.h>
-
-#include <grpc/slice.h>
-
-#include "src/core/lib/iomgr/error.h"
-
-/* Loads the content of a file into a slice. add_null_terminator will add
- a NULL terminator if non-zero. */
+#include <stdio.h>
+
+#include <grpc/slice.h>
+
+#include "src/core/lib/iomgr/error.h"
+
+/* Loads the content of a file into a slice. add_null_terminator will add
+ a NULL terminator if non-zero. */
grpc_error* grpc_load_file(const char* filename, int add_null_terminator,
grpc_slice* slice);
-
-#endif /* GRPC_CORE_LIB_IOMGR_LOAD_FILE_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_LOAD_FILE_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/polling_entity.h b/contrib/libs/grpc/src/core/lib/iomgr/polling_entity.h
index bfeba8f045..6f4c5bdd66 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/polling_entity.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/polling_entity.h
@@ -1,68 +1,68 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H
-#define GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H
+#define GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/iomgr/pollset_set.h"
-
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+
typedef enum grpc_pollset_tag {
GRPC_POLLS_NONE,
GRPC_POLLS_POLLSET,
GRPC_POLLS_POLLSET_SET
} grpc_pollset_tag;
-/* A grpc_polling_entity is a pollset-or-pollset_set container. It allows
+/* A grpc_polling_entity is a pollset-or-pollset_set container. It allows
* functions that accept a pollset XOR a pollset_set to do so through an
* abstract interface. No ownership is taken. */
-
+
struct grpc_polling_entity {
- union {
+ union {
grpc_pollset* pollset = nullptr;
grpc_pollset_set* pollset_set;
- } pollent;
+ } pollent;
grpc_pollset_tag tag = GRPC_POLLS_NONE;
};
-
-grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
+
+grpc_polling_entity grpc_polling_entity_create_from_pollset_set(
grpc_pollset_set* pollset_set);
-grpc_polling_entity grpc_polling_entity_create_from_pollset(
+grpc_polling_entity grpc_polling_entity_create_from_pollset(
grpc_pollset* pollset);
-
-/** If \a pollent contains a pollset, return it. Otherwise, return NULL */
+
+/** If \a pollent contains a pollset, return it. Otherwise, return NULL */
grpc_pollset* grpc_polling_entity_pollset(grpc_polling_entity* pollent);
-
-/** If \a pollent contains a pollset_set, return it. Otherwise, return NULL */
+
+/** If \a pollent contains a pollset_set, return it. Otherwise, return NULL */
grpc_pollset_set* grpc_polling_entity_pollset_set(grpc_polling_entity* pollent);
-
+
bool grpc_polling_entity_is_empty(const grpc_polling_entity* pollent);
-
-/** Add the pollset or pollset_set in \a pollent to the destination pollset_set
+
+/** Add the pollset or pollset_set in \a pollent to the destination pollset_set
* \a * pss_dst */
void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent,
grpc_pollset_set* pss_dst);
-
-/** Delete the pollset or pollset_set in \a pollent from the destination
+
+/** Delete the pollset or pollset_set in \a pollent from the destination
* pollset_set \a * pss_dst */
void grpc_polling_entity_del_from_pollset_set(grpc_polling_entity* pollent,
grpc_pollset_set* pss_dst);
-
-#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/pollset.h b/contrib/libs/grpc/src/core/lib/iomgr/pollset.h
index ae71218395..28472b360d 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/pollset.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/pollset.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_H
-#define GRPC_CORE_LIB_IOMGR_POLLSET_H
-
-#include <grpc/support/port_platform.h>
-
-#include <grpc/support/sync.h>
-#include <grpc/support/time.h>
-
-#include "src/core/lib/iomgr/exec_ctx.h"
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_H
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
+
+#include "src/core/lib/iomgr/exec_ctx.h"
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount;
-
-/* A grpc_pollset is a set of file descriptors that a higher level item is
- interested in. For example:
- - a server will typically keep a pollset containing all connected channels,
- so that it can find new calls to service
- - a completion queue might keep a pollset with an entry for each transport
- that is servicing a call that it's tracking */
-
-typedef struct grpc_pollset grpc_pollset;
-typedef struct grpc_pollset_worker grpc_pollset_worker;
-
+
+/* A grpc_pollset is a set of file descriptors that a higher level item is
+ interested in. For example:
+ - a server will typically keep a pollset containing all connected channels,
+ so that it can find new calls to service
+ - a completion queue might keep a pollset with an entry for each transport
+ that is servicing a call that it's tracking */
+
+typedef struct grpc_pollset grpc_pollset;
+typedef struct grpc_pollset_worker grpc_pollset_worker;
+
typedef struct grpc_pollset_vtable {
void (*global_init)(void);
void (*global_shutdown)(void);
@@ -56,44 +56,44 @@ void grpc_set_pollset_vtable(grpc_pollset_vtable* vtable);
void grpc_pollset_global_init(void);
void grpc_pollset_global_shutdown(void);
-size_t grpc_pollset_size(void);
+size_t grpc_pollset_size(void);
/* Initialize a pollset: assumes *pollset contains all zeros */
void grpc_pollset_init(grpc_pollset* pollset, gpr_mu** mu);
-/* Begin shutting down the pollset, and call closure when done.
- * pollset's mutex must be held */
+/* Begin shutting down the pollset, and call closure when done.
+ * pollset's mutex must be held */
void grpc_pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure);
void grpc_pollset_destroy(grpc_pollset* pollset);
-
-/* Do some work on a pollset.
- May involve invoking asynchronous callbacks, or actually polling file
- descriptors.
- Requires pollset's mutex locked.
- May unlock its mutex during its execution.
-
- worker is a (platform-specific) handle that can be used to wake up
- from grpc_pollset_work before any events are received and before the timeout
- has expired. It is both initialized and destroyed by grpc_pollset_work.
- Initialization of worker is guaranteed to occur BEFORE the
- pollset's mutex is released for the first time by grpc_pollset_work
- and it is guaranteed that it will not be released by grpc_pollset_work
- AFTER worker has been destroyed.
-
+
+/* Do some work on a pollset.
+ May involve invoking asynchronous callbacks, or actually polling file
+ descriptors.
+ Requires pollset's mutex locked.
+ May unlock its mutex during its execution.
+
+ worker is a (platform-specific) handle that can be used to wake up
+ from grpc_pollset_work before any events are received and before the timeout
+ has expired. It is both initialized and destroyed by grpc_pollset_work.
+ Initialization of worker is guaranteed to occur BEFORE the
+ pollset's mutex is released for the first time by grpc_pollset_work
+ and it is guaranteed that it will not be released by grpc_pollset_work
+ AFTER worker has been destroyed.
+
It's legal for worker to be NULL: in that case, this specific thread can not
be directly woken with a kick, but maybe be indirectly (with a kick against
the pollset as a whole).
- Tries not to block past deadline.
- May call grpc_closure_list_run on grpc_closure_list, without holding the
- pollset
- lock */
+ Tries not to block past deadline.
+ May call grpc_closure_list_run on grpc_closure_list, without holding the
+ pollset
+ lock */
grpc_error* grpc_pollset_work(grpc_pollset* pollset,
grpc_pollset_worker** worker,
grpc_millis deadline) GRPC_MUST_USE_RESULT;
-
-/* Break one polling thread out of polling work for this pollset.
+
+/* Break one polling thread out of polling work for this pollset.
If specific_worker is non-NULL, then kick that worker. */
grpc_error* grpc_pollset_kick(grpc_pollset* pollset,
grpc_pollset_worker* specific_worker)
- GRPC_MUST_USE_RESULT;
-
-#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_H */
+ GRPC_MUST_USE_RESULT;
+
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/pollset_set.h b/contrib/libs/grpc/src/core/lib/iomgr/pollset_set.h
index f629f2d99f..d3355b8ff8 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/pollset_set.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/pollset_set.h
@@ -1,35 +1,35 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
-#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/pollset.h"
-
-/* A grpc_pollset_set is a set of pollsets that are interested in an
- action. Adding a pollset to a pollset_set automatically adds any
- fd's (etc) that have been registered with the set_set to that pollset.
- Registering fd's automatically adds them to all current pollsets. */
-
-typedef struct grpc_pollset_set grpc_pollset_set;
-
+#include "src/core/lib/iomgr/pollset.h"
+
+/* A grpc_pollset_set is a set of pollsets that are interested in an
+ action. Adding a pollset to a pollset_set automatically adds any
+ fd's (etc) that have been registered with the set_set to that pollset.
+ Registering fd's automatically adds them to all current pollsets. */
+
+typedef struct grpc_pollset_set grpc_pollset_set;
+
typedef struct grpc_pollset_set_vtable {
grpc_pollset_set* (*create)(void);
void (*destroy)(grpc_pollset_set* pollset_set);
@@ -38,7 +38,7 @@ typedef struct grpc_pollset_set_vtable {
void (*add_pollset_set)(grpc_pollset_set* bag, grpc_pollset_set* item);
void (*del_pollset_set)(grpc_pollset_set* bag, grpc_pollset_set* item);
} grpc_pollset_set_vtable;
-
+
void grpc_set_pollset_set_vtable(grpc_pollset_set_vtable* vtable);
grpc_pollset_set* grpc_pollset_set_create(void);
@@ -52,4 +52,4 @@ void grpc_pollset_set_add_pollset_set(grpc_pollset_set* bag,
void grpc_pollset_set_del_pollset_set(grpc_pollset_set* bag,
grpc_pollset_set* item);
-#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/pollset_set_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/pollset_set_windows.h
index c2f7a0f22b..5ac9d1823b 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/pollset_set_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/pollset_set_windows.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/pollset_set.h"
-
-#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H */
+#include "src/core/lib/iomgr/pollset_set.h"
+
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/pollset_uv.h b/contrib/libs/grpc/src/core/lib/iomgr/pollset_uv.h
index f2f14cadf5..de82bcc1d3 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/pollset_uv.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/pollset_uv.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_UV_H
-#define GRPC_CORE_LIB_IOMGR_POLLSET_UV_H
-
-extern int grpc_pollset_work_run_loop;
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_UV_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_UV_H
+
+extern int grpc_pollset_work_run_loop;
+
typedef struct grpc_custom_poller_vtable {
void (*init)(void);
void (*run_loop)(int blocking);
} grpc_custom_poller_vtable;
-
+
void grpc_custom_pollset_global_init(grpc_custom_poller_vtable* vtable);
void grpc_custom_pollset_global_shutdown(void);
-#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/pollset_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/pollset_windows.h
index 5b431924bd..e89758c694 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/pollset_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/pollset_windows.h
@@ -1,70 +1,70 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/support/sync.h>
-
+#include <grpc/support/sync.h>
+
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
-#include "src/core/lib/iomgr/socket_windows.h"
-
-/* There isn't really any such thing as a pollset under Windows, due to the
- nature of the IO completion ports. A Windows "pollset" is merely a mutex
- used to synchronize with the IOCP, and workers are condition variables
- used to block threads until work is ready. */
-
-typedef enum {
- GRPC_POLLSET_WORKER_LINK_POLLSET = 0,
- GRPC_POLLSET_WORKER_LINK_GLOBAL,
- GRPC_POLLSET_WORKER_LINK_TYPES
-} grpc_pollset_worker_link_type;
-
-typedef struct grpc_pollset_worker_link {
+#include "src/core/lib/iomgr/socket_windows.h"
+
+/* There isn't really any such thing as a pollset under Windows, due to the
+ nature of the IO completion ports. A Windows "pollset" is merely a mutex
+ used to synchronize with the IOCP, and workers are condition variables
+ used to block threads until work is ready. */
+
+typedef enum {
+ GRPC_POLLSET_WORKER_LINK_POLLSET = 0,
+ GRPC_POLLSET_WORKER_LINK_GLOBAL,
+ GRPC_POLLSET_WORKER_LINK_TYPES
+} grpc_pollset_worker_link_type;
+
+typedef struct grpc_pollset_worker_link {
struct grpc_pollset_worker* next;
struct grpc_pollset_worker* prev;
-} grpc_pollset_worker_link;
-
-struct grpc_pollset;
-typedef struct grpc_pollset grpc_pollset;
-
-typedef struct grpc_pollset_worker {
- gpr_cv cv;
- int kicked;
+} grpc_pollset_worker_link;
+
+struct grpc_pollset;
+typedef struct grpc_pollset grpc_pollset;
+
+typedef struct grpc_pollset_worker {
+ gpr_cv cv;
+ int kicked;
struct grpc_pollset* pollset;
- grpc_pollset_worker_link links[GRPC_POLLSET_WORKER_LINK_TYPES];
-} grpc_pollset_worker;
-
-struct grpc_pollset {
- int shutting_down;
- int kicked_without_pollers;
- int is_iocp_worker;
- grpc_pollset_worker root_worker;
+ grpc_pollset_worker_link links[GRPC_POLLSET_WORKER_LINK_TYPES];
+} grpc_pollset_worker;
+
+struct grpc_pollset {
+ int shutting_down;
+ int kicked_without_pollers;
+ int is_iocp_worker;
+ grpc_pollset_worker root_worker;
grpc_closure* on_shutdown;
-};
-
-void grpc_pollset_global_init(void);
-void grpc_pollset_global_shutdown(void);
-
+};
+
+void grpc_pollset_global_init(void);
+void grpc_pollset_global_shutdown(void);
+
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/port.h b/contrib/libs/grpc/src/core/lib/iomgr/port.h
index c62fa8d357..2a8d67b261 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/port.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/port.h
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#ifndef GRPC_CORE_LIB_IOMGR_PORT_H
-#define GRPC_CORE_LIB_IOMGR_PORT_H
-
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#ifndef GRPC_CORE_LIB_IOMGR_PORT_H
+#define GRPC_CORE_LIB_IOMGR_PORT_H
+
#ifdef GRPC_UV
#ifndef GRPC_CUSTOM_SOCKET
#define GRPC_CUSTOM_SOCKET
@@ -33,26 +33,26 @@
#endif
#if defined(GRPC_CUSTOM_SOCKET)
// Do Nothing
-#elif defined(GPR_WINDOWS)
-#define GRPC_WINSOCK_SOCKET 1
-#define GRPC_WINDOWS_SOCKETUTILS 1
+#elif defined(GPR_WINDOWS)
+#define GRPC_WINSOCK_SOCKET 1
+#define GRPC_WINDOWS_SOCKETUTILS 1
#define GRPC_WINDOWS_SOCKET_ARES_EV_DRIVER 1
-#elif defined(GPR_ANDROID)
-#define GRPC_HAVE_IPV6_RECVPKTINFO 1
-#define GRPC_HAVE_IP_PKTINFO 1
-#define GRPC_HAVE_MSG_NOSIGNAL 1
-#define GRPC_HAVE_UNIX_SOCKET 1
-#define GRPC_LINUX_EVENTFD 1
-#define GRPC_POSIX_SOCKET 1
-#define GRPC_POSIX_SOCKETUTILS 1
-#define GRPC_POSIX_WAKEUP_FD 1
-#elif defined(GPR_LINUX)
+#elif defined(GPR_ANDROID)
+#define GRPC_HAVE_IPV6_RECVPKTINFO 1
+#define GRPC_HAVE_IP_PKTINFO 1
+#define GRPC_HAVE_MSG_NOSIGNAL 1
+#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_LINUX_EVENTFD 1
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_WAKEUP_FD 1
+#elif defined(GPR_LINUX)
#define GRPC_HAVE_ARPA_NAMESER 1
#define GRPC_HAVE_IFADDRS 1
-#define GRPC_HAVE_IPV6_RECVPKTINFO 1
-#define GRPC_HAVE_IP_PKTINFO 1
-#define GRPC_HAVE_MSG_NOSIGNAL 1
-#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_HAVE_IPV6_RECVPKTINFO 1
+#define GRPC_HAVE_IP_PKTINFO 1
+#define GRPC_HAVE_MSG_NOSIGNAL 1
+#define GRPC_HAVE_UNIX_SOCKET 1
/* Linux has TCP_INQ support since 4.18, but it is safe to set
the socket option on older kernels. */
#define GRPC_HAVE_TCP_INQ 1
@@ -61,22 +61,22 @@
#define GRPC_LINUX_ERRQUEUE 1
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) */
#endif /* LINUX_VERSION_CODE */
-#define GRPC_LINUX_MULTIPOLL_WITH_EPOLL 1
+#define GRPC_LINUX_MULTIPOLL_WITH_EPOLL 1
#define GRPC_POSIX_FORK 1
#define GRPC_POSIX_HOST_NAME_MAX 1
-#define GRPC_POSIX_SOCKET 1
-#define GRPC_POSIX_WAKEUP_FD 1
-#ifdef __GLIBC_PREREQ
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_WAKEUP_FD 1
+#ifdef __GLIBC_PREREQ
#if __GLIBC_PREREQ(2, 4)
#define GRPC_LINUX_EPOLL 1
#endif
-#if __GLIBC_PREREQ(2, 9)
+#if __GLIBC_PREREQ(2, 9)
#define GRPC_LINUX_EPOLL_CREATE1 1
-#define GRPC_LINUX_EVENTFD 1
-#endif
-#if __GLIBC_PREREQ(2, 10)
-#define GRPC_LINUX_SOCKETUTILS 1
-#endif
+#define GRPC_LINUX_EVENTFD 1
+#endif
+#if __GLIBC_PREREQ(2, 10)
+#define GRPC_LINUX_SOCKETUTILS 1
+#endif
#if !(__GLIBC_PREREQ(2, 17))
/*
* TCP_USER_TIMEOUT wasn't imported to glibc until 2.17. Use Linux system
@@ -91,20 +91,20 @@
#define GRPC_LINUX_EVENTFD 1
#define GRPC_MSG_IOVLEN_TYPE int
#endif
-#ifndef GRPC_LINUX_EVENTFD
-#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
-#endif
-#ifndef GRPC_LINUX_SOCKETUTILS
-#define GRPC_POSIX_SOCKETUTILS
-#endif
-#elif defined(GPR_APPLE)
+#ifndef GRPC_LINUX_EVENTFD
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#endif
+#ifndef GRPC_LINUX_SOCKETUTILS
+#define GRPC_POSIX_SOCKETUTILS
+#endif
+#elif defined(GPR_APPLE)
#define GRPC_HAVE_ARPA_NAMESER 1
#define GRPC_HAVE_IFADDRS 1
-#define GRPC_HAVE_SO_NOSIGPIPE 1
-#define GRPC_HAVE_UNIX_SOCKET 1
-#define GRPC_MSG_IOVLEN_TYPE int
+#define GRPC_HAVE_SO_NOSIGPIPE 1
+#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_MSG_IOVLEN_TYPE int
#define GRPC_POSIX_FORK 1
-#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
#ifdef GRPC_CFSTREAM
#define GRPC_CFSTREAM_IOMGR 1
#define GRPC_CFSTREAM_CLIENT 1
@@ -126,22 +126,22 @@
#define GRPC_POSIX_SOCKET_UDP_SERVER 1
#define GRPC_POSIX_SOCKET_UTILS_COMMON 1
#else
-#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKET 1
#endif
-#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_SOCKETUTILS 1
#define GRPC_POSIX_SYSCONF 1
-#define GRPC_POSIX_WAKEUP_FD 1
-#elif defined(GPR_FREEBSD)
+#define GRPC_POSIX_WAKEUP_FD 1
+#elif defined(GPR_FREEBSD)
#define GRPC_HAVE_ARPA_NAMESER 1
#define GRPC_HAVE_IFADDRS 1
-#define GRPC_HAVE_IPV6_RECVPKTINFO 1
-#define GRPC_HAVE_SO_NOSIGPIPE 1
-#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_HAVE_IPV6_RECVPKTINFO 1
+#define GRPC_HAVE_SO_NOSIGPIPE 1
+#define GRPC_HAVE_UNIX_SOCKET 1
#define GRPC_POSIX_FORK 1
-#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
-#define GRPC_POSIX_SOCKET 1
-#define GRPC_POSIX_SOCKETUTILS 1
-#define GRPC_POSIX_WAKEUP_FD 1
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_WAKEUP_FD 1
#elif defined(GPR_OPENBSD)
#define GRPC_HAVE_IFADDRS 1
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
@@ -162,12 +162,12 @@
#define GRPC_POSIX_SOCKET 1
#define GRPC_POSIX_SOCKETUTILS 1
#define GRPC_POSIX_WAKEUP_FD 1
-#elif defined(GPR_NACL)
+#elif defined(GPR_NACL)
#define GRPC_HAVE_ARPA_NAMESER 1
-#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
-#define GRPC_POSIX_SOCKET 1
-#define GRPC_POSIX_SOCKETUTILS 1
-#define GRPC_POSIX_WAKEUP_FD 1
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_WAKEUP_FD 1
#elif defined(GPR_FUCHSIA)
#define GRPC_HAVE_IFADDRS 1
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
@@ -184,17 +184,17 @@
// TODO(rudominer) Check this does something we want.
#define GRPC_POSIX_SOCKETUTILS 1
#define GRPC_TIMER_USE_GENERIC 1
-#elif !defined(GPR_NO_AUTODETECT_PLATFORM)
-#error "Platform not recognized"
-#endif
-
-#if defined(GRPC_POSIX_SOCKET) + defined(GRPC_WINSOCK_SOCKET) + \
+#elif !defined(GPR_NO_AUTODETECT_PLATFORM)
+#error "Platform not recognized"
+#endif
+
+#if defined(GRPC_POSIX_SOCKET) + defined(GRPC_WINSOCK_SOCKET) + \
defined(GRPC_CUSTOM_SOCKET) + defined(GRPC_CFSTREAM) != \
- 1
+ 1
#error \
"Must define exactly one of GRPC_POSIX_SOCKET, GRPC_WINSOCK_SOCKET, GRPC_CUSTOM_SOCKET"
-#endif
-
+#endif
+
#ifdef GRPC_POSIX_SOCKET
#define GRPC_POSIX_SOCKET_ARES_EV_DRIVER 1
#define GRPC_POSIX_SOCKET_EV 1
@@ -221,4 +221,4 @@
#define GRPC_GETHOSTNAME_FALLBACK 1
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_PORT_H */
+#endif /* GRPC_CORE_LIB_IOMGR_PORT_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/resolve_address.h b/contrib/libs/grpc/src/core/lib/iomgr/resolve_address.h
index 7ddda895fb..57126c7c93 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/resolve_address.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/resolve_address.h
@@ -1,27 +1,27 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
-#define GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
+#define GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
+#include <stddef.h>
#include "src/core/lib/iomgr/port.h"
@@ -37,16 +37,16 @@
#include <sys/socket.h>
#endif
-#include "src/core/lib/iomgr/pollset_set.h"
-
-#define GRPC_MAX_SOCKADDR_SIZE 128
-
+#include "src/core/lib/iomgr/pollset_set.h"
+
+#define GRPC_MAX_SOCKADDR_SIZE 128
+
struct grpc_resolved_address {
- char addr[GRPC_MAX_SOCKADDR_SIZE];
+ char addr[GRPC_MAX_SOCKADDR_SIZE];
socklen_t len;
};
struct grpc_resolved_addresses {
- size_t naddrs;
+ size_t naddrs;
grpc_resolved_address* addrs;
};
typedef struct grpc_address_resolver_vtable {
@@ -61,21 +61,21 @@ typedef struct grpc_address_resolver_vtable {
void grpc_set_resolver_impl(grpc_address_resolver_vtable* vtable);
-/* Asynchronously resolve addr. Use default_port if a port isn't designated
- in addr, otherwise use the port in addr. */
+/* Asynchronously resolve addr. Use default_port if a port isn't designated
+ in addr, otherwise use the port in addr. */
/* TODO(apolcyn): add a timeout here */
void grpc_resolve_address(const char* addr, const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
grpc_resolved_addresses** addresses);
-/* Destroy resolved addresses */
+/* Destroy resolved addresses */
void grpc_resolved_addresses_destroy(grpc_resolved_addresses* addresses);
-
+
/* Resolve addr in a blocking fashion. On success,
- result must be freed with grpc_resolved_addresses_destroy. */
+ result must be freed with grpc_resolved_addresses_destroy. */
grpc_error* grpc_blocking_resolve_address(const char* name,
const char* default_port,
grpc_resolved_addresses** addresses);
-
-#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/resource_quota.h b/contrib/libs/grpc/src/core/lib/iomgr/resource_quota.h
index e590f58f09..ec89a92020 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/resource_quota.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/resource_quota.h
@@ -1,70 +1,70 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H
-#define GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H
+#define GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
-
+#include <grpc/grpc.h>
+
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/closure.h"
-
-/** \file Tracks resource usage against a pool.
-
- The current implementation tracks only memory usage, but in the future
- this may be extended to (for example) threads and file descriptors.
-
- A grpc_resource_quota represents the pooled resources, and
- grpc_resource_user instances attach to the quota and consume those
- resources. They also offer a vector for reclamation: if we become
- resource constrained, grpc_resource_user instances are asked (in turn) to
- free up whatever they can so that the system as a whole can make progress.
-
- There are three kinds of reclamation that take place, in order of increasing
- invasiveness:
- - an internal reclamation, where cached resource at the resource user level
- is returned to the quota
- - a benign reclamation phase, whereby resources that are in use but are not
- helping anything make progress are reclaimed
- - a destructive reclamation, whereby resources that are helping something
- make progress may be enacted so that at least one part of the system can
- complete.
-
- Only one reclamation will be outstanding for a given quota at a given time.
- On each reclamation attempt, the kinds of reclamation are tried in order of
- increasing invasiveness, stopping at the first one that succeeds. Thus, on a
- given reclamation attempt, if internal and benign reclamation both fail, it
- will wind up doing a destructive reclamation. However, the next reclamation
- attempt may then be able to get what it needs via internal or benign
- reclamation, due to resources that may have been freed up by the destructive
- reclamation in the previous attempt.
-
- Future work will be to expose the current resource pressure so that back
- pressure can be applied to avoid reclamation phases starting.
-
- Resource users own references to resource quotas, and resource quotas
- maintain lists of users (which users arrange to leave before they are
- destroyed) */
-
+
+/** \file Tracks resource usage against a pool.
+
+ The current implementation tracks only memory usage, but in the future
+ this may be extended to (for example) threads and file descriptors.
+
+ A grpc_resource_quota represents the pooled resources, and
+ grpc_resource_user instances attach to the quota and consume those
+ resources. They also offer a vector for reclamation: if we become
+ resource constrained, grpc_resource_user instances are asked (in turn) to
+ free up whatever they can so that the system as a whole can make progress.
+
+ There are three kinds of reclamation that take place, in order of increasing
+ invasiveness:
+ - an internal reclamation, where cached resource at the resource user level
+ is returned to the quota
+ - a benign reclamation phase, whereby resources that are in use but are not
+ helping anything make progress are reclaimed
+ - a destructive reclamation, whereby resources that are helping something
+ make progress may be enacted so that at least one part of the system can
+ complete.
+
+ Only one reclamation will be outstanding for a given quota at a given time.
+ On each reclamation attempt, the kinds of reclamation are tried in order of
+ increasing invasiveness, stopping at the first one that succeeds. Thus, on a
+ given reclamation attempt, if internal and benign reclamation both fail, it
+ will wind up doing a destructive reclamation. However, the next reclamation
+ attempt may then be able to get what it needs via internal or benign
+ reclamation, due to resources that may have been freed up by the destructive
+ reclamation in the previous attempt.
+
+ Future work will be to expose the current resource pressure so that back
+ pressure can be applied to avoid reclamation phases starting.
+
+ Resource users own references to resource quotas, and resource quotas
+ maintain lists of users (which users arrange to leave before they are
+ destroyed) */
+
extern grpc_core::TraceFlag grpc_resource_quota_trace;
-
+
// TODO(juanlishen): This is a hack. We need to do real accounting instead of
// hard coding.
constexpr size_t GRPC_RESOURCE_QUOTA_CALL_SIZE = 15 * 1024;
@@ -75,7 +75,7 @@ grpc_resource_quota* grpc_resource_quota_ref_internal(
void grpc_resource_quota_unref_internal(grpc_resource_quota* resource_quota);
grpc_resource_quota* grpc_resource_quota_from_channel_args(
const grpc_channel_args* channel_args, bool create = true);
-
+
/* Return a number indicating current memory pressure:
0.0 ==> no memory usage
1.0 ==> maximum memory usage */
@@ -84,20 +84,20 @@ double grpc_resource_quota_get_memory_pressure(
size_t grpc_resource_quota_peek_size(grpc_resource_quota* resource_quota);
-typedef struct grpc_resource_user grpc_resource_user;
-
+typedef struct grpc_resource_user grpc_resource_user;
+
grpc_resource_user* grpc_resource_user_create(
grpc_resource_quota* resource_quota, const char* name);
-
-/* Returns a borrowed reference to the underlying resource quota for this
- resource user. */
+
+/* Returns a borrowed reference to the underlying resource quota for this
+ resource user. */
grpc_resource_quota* grpc_resource_user_quota(
grpc_resource_user* resource_user);
-
+
void grpc_resource_user_ref(grpc_resource_user* resource_user);
void grpc_resource_user_unref(grpc_resource_user* resource_user);
void grpc_resource_user_shutdown(grpc_resource_user* resource_user);
-
+
/* Attempts to get quota from the resource_user to create 'thread_count' number
* of threads. Returns true if successful (i.e the caller is now free to create
* 'thread_count' number of threads) or false if quota is not available */
@@ -133,45 +133,45 @@ bool grpc_resource_user_safe_alloc(grpc_resource_user* resource_user,
bool grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size,
grpc_closure* optional_on_done)
GRPC_MUST_USE_RESULT;
-/* Release memory back to the quota */
+/* Release memory back to the quota */
void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size);
-/* Post a memory reclaimer to the resource user. Only one benign and one
- destructive reclaimer can be posted at once. When executed, the reclaimer
- MUST call grpc_resource_user_finish_reclamation before it completes, to
- return control to the resource quota. */
+/* Post a memory reclaimer to the resource user. Only one benign and one
+ destructive reclaimer can be posted at once. When executed, the reclaimer
+ MUST call grpc_resource_user_finish_reclamation before it completes, to
+ return control to the resource quota. */
void grpc_resource_user_post_reclaimer(grpc_resource_user* resource_user,
bool destructive, grpc_closure* closure);
-/* Finish a reclamation step */
+/* Finish a reclamation step */
void grpc_resource_user_finish_reclamation(grpc_resource_user* resource_user);
-
-/* Helper to allocate slices from a resource user */
-typedef struct grpc_resource_user_slice_allocator {
- /* Closure for when a resource user allocation completes */
- grpc_closure on_allocated;
- /* Closure to call when slices have been allocated */
- grpc_closure on_done;
- /* Length of slices to allocate on the current request */
- size_t length;
- /* Number of slices to allocate on the current request */
- size_t count;
- /* Destination for slices to allocate on the current request */
+
+/* Helper to allocate slices from a resource user */
+typedef struct grpc_resource_user_slice_allocator {
+ /* Closure for when a resource user allocation completes */
+ grpc_closure on_allocated;
+ /* Closure to call when slices have been allocated */
+ grpc_closure on_done;
+ /* Length of slices to allocate on the current request */
+ size_t length;
+ /* Number of slices to allocate on the current request */
+ size_t count;
+ /* Destination for slices to allocate on the current request */
grpc_slice_buffer* dest;
- /* Parent resource user */
+ /* Parent resource user */
grpc_resource_user* resource_user;
-} grpc_resource_user_slice_allocator;
-
-/* Initialize a slice allocator.
- When an allocation is completed, calls \a cb with arg \p. */
-void grpc_resource_user_slice_allocator_init(
+} grpc_resource_user_slice_allocator;
+
+/* Initialize a slice allocator.
+ When an allocation is completed, calls \a cb with arg \p. */
+void grpc_resource_user_slice_allocator_init(
grpc_resource_user_slice_allocator* slice_allocator,
grpc_resource_user* resource_user, grpc_iomgr_cb_func cb, void* p);
-
-/* Allocate \a count slices of length \a length into \a dest. Only one request
+
+/* Allocate \a count slices of length \a length into \a dest. Only one request
can be outstanding at a time.
Returns whether the slice was allocated inline in the function. If true,
the \a slice_allocator->on_allocated callback will not be called. */
bool grpc_resource_user_alloc_slices(
grpc_resource_user_slice_allocator* slice_allocator, size_t length,
size_t count, grpc_slice_buffer* dest) GRPC_MUST_USE_RESULT;
-
-#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr.h b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr.h
index ce06ac66b6..5edf735cd1 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-/* This header transitively includes other headers that care about include
- * order, so it should be included first. As a consequence, it should not be
- * included in any other header. */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H
-#define GRPC_CORE_LIB_IOMGR_SOCKADDR_H
-
+ *
+ */
+
+/* This header transitively includes other headers that care about include
+ * order, so it should be included first. As a consequence, it should not be
+ * included in any other header. */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_H
+
#include <grpc/support/port_platform.h>
-
+
#include "src/core/lib/iomgr/sockaddr_custom.h"
#include "src/core/lib/iomgr/sockaddr_posix.h"
-#include "src/core/lib/iomgr/sockaddr_windows.h"
-
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_H */
+#include "src/core/lib/iomgr/sockaddr_windows.h"
+
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_posix.h
index a8dfddc43d..3cedd9082d 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_posix.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_POSIX_SOCKET_SOCKADDR
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
-
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
typedef struct sockaddr grpc_sockaddr;
typedef struct sockaddr_in grpc_sockaddr_in;
typedef struct in_addr grpc_in_addr;
@@ -52,4 +52,4 @@ typedef struct in6_addr grpc_in6_addr;
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_utils.h b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_utils.h
index e96e390f4a..eeedeeb90c 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_utils.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_utils.h
@@ -1,63 +1,63 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
-#define GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
-#include "src/core/lib/iomgr/resolve_address.h"
-
-/* Returns true if addr is an IPv4-mapped IPv6 address within the
- ::ffff:0.0.0.0/96 range, or false otherwise.
-
- If addr4_out is non-NULL, the inner IPv4 address will be copied here when
- returning true. */
+#include "src/core/lib/iomgr/resolve_address.h"
+
+/* Returns true if addr is an IPv4-mapped IPv6 address within the
+ ::ffff:0.0.0.0/96 range, or false otherwise.
+
+ If addr4_out is non-NULL, the inner IPv4 address will be copied here when
+ returning true. */
int grpc_sockaddr_is_v4mapped(const grpc_resolved_address* addr,
grpc_resolved_address* addr4_out);
-
-/* If addr is an AF_INET address, writes the corresponding ::ffff:0.0.0.0/96
- address to addr6_out and returns true. Otherwise returns false. */
+
+/* If addr is an AF_INET address, writes the corresponding ::ffff:0.0.0.0/96
+ address to addr6_out and returns true. Otherwise returns false. */
int grpc_sockaddr_to_v4mapped(const grpc_resolved_address* addr,
grpc_resolved_address* addr6_out);
-
-/* If addr is ::, 0.0.0.0, or ::ffff:0.0.0.0, writes the port number to
+
+/* If addr is ::, 0.0.0.0, or ::ffff:0.0.0.0, writes the port number to
*port_out (if not NULL) and returns true, otherwise returns false. */
int grpc_sockaddr_is_wildcard(const grpc_resolved_address* addr, int* port_out);
-
-/* Writes 0.0.0.0:port and [::]:port to separate sockaddrs. */
+
+/* Writes 0.0.0.0:port and [::]:port to separate sockaddrs. */
void grpc_sockaddr_make_wildcards(int port, grpc_resolved_address* wild4_out,
grpc_resolved_address* wild6_out);
-
-/* Writes 0.0.0.0:port. */
+
+/* Writes 0.0.0.0:port. */
void grpc_sockaddr_make_wildcard4(int port, grpc_resolved_address* wild_out);
-
-/* Writes [::]:port. */
+
+/* Writes [::]:port. */
void grpc_sockaddr_make_wildcard6(int port, grpc_resolved_address* wild_out);
-
-/* Return the IP port number of a sockaddr */
+
+/* Return the IP port number of a sockaddr */
int grpc_sockaddr_get_port(const grpc_resolved_address* addr);
-
-/* Set IP port number of a sockaddr */
+
+/* Set IP port number of a sockaddr */
int grpc_sockaddr_set_port(const grpc_resolved_address* addr, int port);
-
+
// Converts a sockaddr into a newly-allocated human-readable string.
//
// Currently, only the AF_INET and AF_INET6 families are recognized.
@@ -65,10 +65,10 @@ int grpc_sockaddr_set_port(const grpc_resolved_address* addr, int port);
// displayed as plain IPv4.
TString grpc_sockaddr_to_string(const grpc_resolved_address* addr,
bool normalize);
-
+
void grpc_string_to_sockaddr(grpc_resolved_address* out, const char* addr,
int port);
-
+
/* Returns the URI string corresponding to \a addr */
TString grpc_sockaddr_to_uri(const grpc_resolved_address* addr);
@@ -77,4 +77,4 @@ const char* grpc_sockaddr_get_uri_scheme(const grpc_resolved_address* addr);
int grpc_sockaddr_get_family(const grpc_resolved_address* resolved_addr);
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
index 593b22abf2..9faebbc254 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/sockaddr_windows.h
@@ -1,24 +1,24 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
@@ -27,12 +27,12 @@
#define OPTIONAL
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-// must be included after the above
-#include <mswsock.h>
-
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+// must be included after the above
+#include <mswsock.h>
+
#undef OPTIONAL
typedef struct sockaddr grpc_sockaddr;
@@ -56,4 +56,4 @@ typedef struct in6_addr grpc_in6_addr;
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/socket_mutator.h b/contrib/libs/grpc/src/core/lib/iomgr/socket_mutator.h
index 0ddb85050e..9f77a3b266 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/socket_mutator.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/socket_mutator.h
@@ -1,60 +1,60 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H
-#define GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/support/sync.h>
-
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/support/sync.h>
+
#include <stdbool.h>
-
-/** The virtual table of grpc_socket_mutator */
+
+/** The virtual table of grpc_socket_mutator */
struct grpc_socket_mutator_vtable {
/** Mutates the socket options of \a fd */
bool (*mutate_fd)(int fd, grpc_socket_mutator* mutator);
- /** Compare socket mutator \a a and \a b */
+ /** Compare socket mutator \a a and \a b */
int (*compare)(grpc_socket_mutator* a, grpc_socket_mutator* b);
- /** Destroys the socket mutator instance */
+ /** Destroys the socket mutator instance */
void (*destroy)(grpc_socket_mutator* mutator);
};
-/** The Socket Mutator interface allows changes on socket options */
-struct grpc_socket_mutator {
+/** The Socket Mutator interface allows changes on socket options */
+struct grpc_socket_mutator {
const grpc_socket_mutator_vtable* vtable;
- gpr_refcount refcount;
-};
-
-/** called by concrete implementations to initialize the base struct */
+ gpr_refcount refcount;
+};
+
+/** called by concrete implementations to initialize the base struct */
void grpc_socket_mutator_init(grpc_socket_mutator* mutator,
const grpc_socket_mutator_vtable* vtable);
-
-/** Wrap \a mutator as a grpc_arg */
+
+/** Wrap \a mutator as a grpc_arg */
grpc_arg grpc_socket_mutator_to_arg(grpc_socket_mutator* mutator);
-
-/** Perform the file descriptor mutation operation of \a mutator on \a fd */
+
+/** Perform the file descriptor mutation operation of \a mutator on \a fd */
bool grpc_socket_mutator_mutate_fd(grpc_socket_mutator* mutator, int fd);
-
-/** Compare if \a a and \a b are the same mutator or have same settings */
+
+/** Compare if \a a and \a b are the same mutator or have same settings */
int grpc_socket_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b);
-
+
grpc_socket_mutator* grpc_socket_mutator_ref(grpc_socket_mutator* mutator);
void grpc_socket_mutator_unref(grpc_socket_mutator* mutator);
-
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/socket_utils.h b/contrib/libs/grpc/src/core/lib/iomgr/socket_utils.h
index 84f4adee9e..14bb081e93 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/socket_utils.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/socket_utils.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H
-#define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
+#include <stddef.h>
+
// TODO(juanlishen): The following functions might be simple enough to implement
// ourselves, so that they don't cause any portability hassle.
@@ -41,7 +41,7 @@ uint32_t grpc_ntohl(uint32_t netlong);
/* A wrapper for inet_pton on POSIX and WINDOWS */
int grpc_inet_pton(int af, const char* src, void* dst);
-/* A wrapper for inet_ntop on POSIX systems and InetNtop on Windows systems */
+/* A wrapper for inet_ntop on POSIX systems and InetNtop on Windows systems */
const char* grpc_inet_ntop(int af, const void* src, char* dst, size_t size);
-
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/socket_utils_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/socket_utils_posix.h
index 70af9c91b7..b4dc909d1e 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/socket_utils_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/socket_utils_posix.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/resolve_address.h"
-
-#include <sys/socket.h>
-#include <unistd.h>
-
-#include <grpc/impl/codegen/grpc_types.h>
-#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <grpc/impl/codegen/grpc_types.h>
+#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/socket_factory_posix.h"
-#include "src/core/lib/iomgr/socket_mutator.h"
-
+#include "src/core/lib/iomgr/socket_mutator.h"
+
#ifdef GRPC_LINUX_ERRQUEUE
#ifndef SO_ZEROCOPY
#define SO_ZEROCOPY 60
@@ -40,31 +40,31 @@
#endif
#endif /* ifdef GRPC_LINUX_ERRQUEUE */
-/* a wrapper for accept or accept4 */
+/* a wrapper for accept or accept4 */
int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
- int cloexec);
-
+ int cloexec);
+
/* set a socket to use zerocopy */
grpc_error* grpc_set_socket_zerocopy(int fd);
-/* set a socket to non blocking mode */
+/* set a socket to non blocking mode */
grpc_error* grpc_set_socket_nonblocking(int fd, int non_blocking);
-
-/* set a socket to close on exec */
+
+/* set a socket to close on exec */
grpc_error* grpc_set_socket_cloexec(int fd, int close_on_exec);
-
-/* set a socket to reuse old addresses */
+
+/* set a socket to reuse old addresses */
grpc_error* grpc_set_socket_reuse_addr(int fd, int reuse);
-
+
/* return true if SO_REUSEPORT is supported */
bool grpc_is_socket_reuse_port_supported();
-/* disable nagle */
+/* disable nagle */
grpc_error* grpc_set_socket_low_latency(int fd, int low_latency);
-
-/* set SO_REUSEPORT */
+
+/* set SO_REUSEPORT */
grpc_error* grpc_set_socket_reuse_port(int fd, int reuse);
-
+
/* Configure the default values for TCP_USER_TIMEOUT */
void config_default_tcp_user_timeout(bool enable, int timeout, bool is_client);
@@ -72,92 +72,92 @@ void config_default_tcp_user_timeout(bool enable, int timeout, bool is_client);
grpc_error* grpc_set_socket_tcp_user_timeout(
int fd, const grpc_channel_args* channel_args, bool is_client);
-/* Returns true if this system can create AF_INET6 sockets bound to ::1.
- The value is probed once, and cached for the life of the process.
-
- This is more restrictive than checking for socket(AF_INET6) to succeed,
- because Linux with "net.ipv6.conf.all.disable_ipv6 = 1" is able to create
- and bind IPv6 sockets, but cannot connect to a getsockname() of [::]:port
- without a valid loopback interface. Rather than expose this half-broken
- state to library users, we turn off IPv6 sockets. */
-int grpc_ipv6_loopback_available(void);
-
-/* Tries to set SO_NOSIGPIPE if available on this platform.
- If SO_NO_SIGPIPE is not available, returns 1. */
+/* Returns true if this system can create AF_INET6 sockets bound to ::1.
+ The value is probed once, and cached for the life of the process.
+
+ This is more restrictive than checking for socket(AF_INET6) to succeed,
+ because Linux with "net.ipv6.conf.all.disable_ipv6 = 1" is able to create
+ and bind IPv6 sockets, but cannot connect to a getsockname() of [::]:port
+ without a valid loopback interface. Rather than expose this half-broken
+ state to library users, we turn off IPv6 sockets. */
+int grpc_ipv6_loopback_available(void);
+
+/* Tries to set SO_NOSIGPIPE if available on this platform.
+ If SO_NO_SIGPIPE is not available, returns 1. */
grpc_error* grpc_set_socket_no_sigpipe_if_possible(int fd);
-
-/* Tries to set IP_PKTINFO if available on this platform.
- If IP_PKTINFO is not available, returns 1. */
+
+/* Tries to set IP_PKTINFO if available on this platform.
+ If IP_PKTINFO is not available, returns 1. */
grpc_error* grpc_set_socket_ip_pktinfo_if_possible(int fd);
-
-/* Tries to set IPV6_RECVPKTINFO if available on this platform.
- If IPV6_RECVPKTINFO is not available, returns 1. */
+
+/* Tries to set IPV6_RECVPKTINFO if available on this platform.
+ If IPV6_RECVPKTINFO is not available, returns 1. */
grpc_error* grpc_set_socket_ipv6_recvpktinfo_if_possible(int fd);
-
-/* Tries to set the socket's send buffer to given size. */
+
+/* Tries to set the socket's send buffer to given size. */
grpc_error* grpc_set_socket_sndbuf(int fd, int buffer_size_bytes);
-
-/* Tries to set the socket's receive buffer to given size. */
+
+/* Tries to set the socket's receive buffer to given size. */
grpc_error* grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes);
-
-/* Tries to set the socket using a grpc_socket_mutator */
+
+/* Tries to set the socket using a grpc_socket_mutator */
grpc_error* grpc_set_socket_with_mutator(int fd, grpc_socket_mutator* mutator);
-
+
/* Extracts the first socket mutator from args if any and applies on the fd. */
grpc_error* grpc_apply_socket_mutator_in_args(int fd,
const grpc_channel_args* args);
-/* An enum to keep track of IPv4/IPv6 socket modes.
-
- Currently, this information is only used when a socket is first created, but
- in the future we may wish to store it alongside the fd. This would let calls
- like sendto() know which family to use without asking the kernel first. */
-typedef enum grpc_dualstack_mode {
- /* Uninitialized, or a non-IP socket. */
- GRPC_DSMODE_NONE,
- /* AF_INET only. */
- GRPC_DSMODE_IPV4,
- /* AF_INET6 only, because IPV6_V6ONLY could not be cleared. */
- GRPC_DSMODE_IPV6,
- /* AF_INET6, which also supports ::ffff-mapped IPv4 addresses. */
- GRPC_DSMODE_DUALSTACK
-} grpc_dualstack_mode;
-
-/* Only tests should use this flag. */
-extern int grpc_forbid_dualstack_sockets_for_testing;
-
+/* An enum to keep track of IPv4/IPv6 socket modes.
+
+ Currently, this information is only used when a socket is first created, but
+ in the future we may wish to store it alongside the fd. This would let calls
+ like sendto() know which family to use without asking the kernel first. */
+typedef enum grpc_dualstack_mode {
+ /* Uninitialized, or a non-IP socket. */
+ GRPC_DSMODE_NONE,
+ /* AF_INET only. */
+ GRPC_DSMODE_IPV4,
+ /* AF_INET6 only, because IPV6_V6ONLY could not be cleared. */
+ GRPC_DSMODE_IPV6,
+ /* AF_INET6, which also supports ::ffff-mapped IPv4 addresses. */
+ GRPC_DSMODE_DUALSTACK
+} grpc_dualstack_mode;
+
+/* Only tests should use this flag. */
+extern int grpc_forbid_dualstack_sockets_for_testing;
+
/* Tries to set the socket to dualstack. Returns 1 on success. */
int grpc_set_socket_dualstack(int fd);
-/* Creates a new socket for connecting to (or listening on) an address.
-
- If addr is AF_INET6, this creates an IPv6 socket first. If that fails,
- and addr is within ::ffff:0.0.0.0/96, then it automatically falls back to
- an IPv4 socket.
-
- If addr is AF_INET, AF_UNIX, or anything else, then this is similar to
- calling socket() directly.
-
- Returns an fd on success, otherwise returns -1 with errno set to the result
- of a failed socket() call.
-
- The *dsmode output indicates which address family was actually created.
- The recommended way to use this is:
- - First convert to IPv6 using grpc_sockaddr_to_v4mapped().
- - Create the socket.
- - If *dsmode is IPV4, use grpc_sockaddr_is_v4mapped() to convert back to
- IPv4, so that bind() or connect() see the correct family.
- Also, it's important to distinguish between DUALSTACK and IPV6 when
- listening on the [::] wildcard address. */
+/* Creates a new socket for connecting to (or listening on) an address.
+
+ If addr is AF_INET6, this creates an IPv6 socket first. If that fails,
+ and addr is within ::ffff:0.0.0.0/96, then it automatically falls back to
+ an IPv4 socket.
+
+ If addr is AF_INET, AF_UNIX, or anything else, then this is similar to
+ calling socket() directly.
+
+ Returns an fd on success, otherwise returns -1 with errno set to the result
+ of a failed socket() call.
+
+ The *dsmode output indicates which address family was actually created.
+ The recommended way to use this is:
+ - First convert to IPv6 using grpc_sockaddr_to_v4mapped().
+ - Create the socket.
+ - If *dsmode is IPV4, use grpc_sockaddr_is_v4mapped() to convert back to
+ IPv4, so that bind() or connect() see the correct family.
+ Also, it's important to distinguish between DUALSTACK and IPV6 when
+ listening on the [::] wildcard address. */
grpc_error* grpc_create_dualstack_socket(const grpc_resolved_address* addr,
- int type, int protocol,
+ int type, int protocol,
grpc_dualstack_mode* dsmode,
int* newfd);
-
+
/* Same as grpc_create_dualstack_socket(), but use the given socket factory (if
non-null) to create the socket, rather than calling socket() directly. */
grpc_error* grpc_create_dualstack_socket_using_factory(
grpc_socket_factory* factory, const grpc_resolved_address* addr, int type,
int protocol, grpc_dualstack_mode* dsmode, int* newfd);
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.h
index 32132458c5..78f79453c6 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/socket_windows.h
@@ -1,119 +1,119 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
-
-#include <grpc/support/port_platform.h>
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
+
+#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
-#include <winsock2.h>
-
-#include <grpc/support/atm.h>
-#include <grpc/support/sync.h>
-
+#include <winsock2.h>
+
+#include <grpc/support/atm.h>
+#include <grpc/support/sync.h>
+
#include "src/core/lib/iomgr/closure.h"
-#include "src/core/lib/iomgr/iomgr_internal.h"
-
+#include "src/core/lib/iomgr/iomgr_internal.h"
+
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
#endif
-/* This holds the data for an outstanding read or write on a socket.
- The mutex to protect the concurrent access to that data is the one
- inside the winsocket wrapper. */
-typedef struct grpc_winsocket_callback_info {
- /* This is supposed to be a WSAOVERLAPPED, but in order to get that
- definition, we need to include ws2tcpip.h, which needs to be included
- from the top, otherwise it'll clash with a previous inclusion of
- windows.h that in turns includes winsock.h. If anyone knows a way
- to do it properly, feel free to send a patch. */
- OVERLAPPED overlapped;
- /* The callback information for the pending operation. May be empty if the
- caller hasn't registered a callback yet. */
+/* This holds the data for an outstanding read or write on a socket.
+ The mutex to protect the concurrent access to that data is the one
+ inside the winsocket wrapper. */
+typedef struct grpc_winsocket_callback_info {
+ /* This is supposed to be a WSAOVERLAPPED, but in order to get that
+ definition, we need to include ws2tcpip.h, which needs to be included
+ from the top, otherwise it'll clash with a previous inclusion of
+ windows.h that in turns includes winsock.h. If anyone knows a way
+ to do it properly, feel free to send a patch. */
+ OVERLAPPED overlapped;
+ /* The callback information for the pending operation. May be empty if the
+ caller hasn't registered a callback yet. */
grpc_closure* closure;
- /* A boolean to describe if the IO Completion Port got a notification for
- that operation. This will happen if the operation completed before the
- called had time to register a callback. We could avoid that behavior
- altogether by forcing the caller to always register its callback before
- proceeding queue an operation, but it is frequent for an IO Completion
- Port to trigger quickly. This way we avoid a context switch for calling
- the callback. We also simplify the read / write operations to avoid having
- to hold a mutex for a long amount of time. */
- int has_pending_iocp;
- /* The results of the overlapped operation. */
+ /* A boolean to describe if the IO Completion Port got a notification for
+ that operation. This will happen if the operation completed before the
+ called had time to register a callback. We could avoid that behavior
+ altogether by forcing the caller to always register its callback before
+ proceeding queue an operation, but it is frequent for an IO Completion
+ Port to trigger quickly. This way we avoid a context switch for calling
+ the callback. We also simplify the read / write operations to avoid having
+ to hold a mutex for a long amount of time. */
+ int has_pending_iocp;
+ /* The results of the overlapped operation. */
DWORD bytes_transferred;
- int wsa_error;
-} grpc_winsocket_callback_info;
-
-/* This is a wrapper to a Windows socket. A socket can have one outstanding
- read, and one outstanding write. Doing an asynchronous accept means waiting
- for a read operation. Doing an asynchronous connect means waiting for a
- write operation. These are completely arbitrary ties between the operation
- and the kind of event, because we can have one overlapped per pending
- operation, whichever its nature is. So we could have more dedicated pending
- operation callbacks for connect and listen. But given the scope of listen
- and accept, we don't need to go to that extent and waste memory. Also, this
- is closer to what happens in posix world. */
-typedef struct grpc_winsocket {
- SOCKET socket;
- bool destroy_called;
-
- grpc_winsocket_callback_info write_info;
- grpc_winsocket_callback_info read_info;
-
- gpr_mu state_mu;
- bool shutdown_called;
-
- /* You can't add the same socket twice to the same IO Completion Port.
- This prevents that. */
- int added_to_iocp;
-
- grpc_closure shutdown_closure;
-
- /* A label for iomgr to track outstanding objects */
- grpc_iomgr_object iomgr_object;
-} grpc_winsocket;
-
-/* Create a wrapped windows handle. This takes ownership of it, meaning that
- it will be responsible for closing it. */
+ int wsa_error;
+} grpc_winsocket_callback_info;
+
+/* This is a wrapper to a Windows socket. A socket can have one outstanding
+ read, and one outstanding write. Doing an asynchronous accept means waiting
+ for a read operation. Doing an asynchronous connect means waiting for a
+ write operation. These are completely arbitrary ties between the operation
+ and the kind of event, because we can have one overlapped per pending
+ operation, whichever its nature is. So we could have more dedicated pending
+ operation callbacks for connect and listen. But given the scope of listen
+ and accept, we don't need to go to that extent and waste memory. Also, this
+ is closer to what happens in posix world. */
+typedef struct grpc_winsocket {
+ SOCKET socket;
+ bool destroy_called;
+
+ grpc_winsocket_callback_info write_info;
+ grpc_winsocket_callback_info read_info;
+
+ gpr_mu state_mu;
+ bool shutdown_called;
+
+ /* You can't add the same socket twice to the same IO Completion Port.
+ This prevents that. */
+ int added_to_iocp;
+
+ grpc_closure shutdown_closure;
+
+ /* A label for iomgr to track outstanding objects */
+ grpc_iomgr_object iomgr_object;
+} grpc_winsocket;
+
+/* Create a wrapped windows handle. This takes ownership of it, meaning that
+ it will be responsible for closing it. */
grpc_winsocket* grpc_winsocket_create(SOCKET socket, const char* name);
-
+
SOCKET grpc_winsocket_wrapped_socket(grpc_winsocket* socket);
-/* Initiate an asynchronous shutdown of the socket. Will call off any pending
- operation to cancel them. */
+/* Initiate an asynchronous shutdown of the socket. Will call off any pending
+ operation to cancel them. */
void grpc_winsocket_shutdown(grpc_winsocket* socket);
-
-/* Destroy a socket. Should only be called if there's no pending operation. */
+
+/* Destroy a socket. Should only be called if there's no pending operation. */
void grpc_winsocket_destroy(grpc_winsocket* socket);
-
+
void grpc_socket_notify_on_write(grpc_winsocket* winsocket,
grpc_closure* closure);
-
+
void grpc_socket_notify_on_read(grpc_winsocket* winsocket,
grpc_closure* closure);
-
+
void grpc_socket_become_ready(grpc_winsocket* winsocket,
grpc_winsocket_callback_info* ci);
-
+
/* Returns true if this system can create AF_INET6 sockets bound to ::1.
The value is probed once, and cached for the life of the process. */
int grpc_ipv6_loopback_available(void);
@@ -124,4 +124,4 @@ DWORD grpc_get_default_wsa_socket_flags();
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client.h b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client.h
index 0197d15954..d209eeb8c2 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client.h
@@ -1,52 +1,52 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
-#define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
+#define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/support/time.h>
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/pollset_set.h"
-#include "src/core/lib/iomgr/resolve_address.h"
-
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+
typedef struct grpc_tcp_client_vtable {
void (*connect)(grpc_closure* on_connect, grpc_endpoint** endpoint,
grpc_pollset_set* interested_parties,
const grpc_channel_args* channel_args,
const grpc_resolved_address* addr, grpc_millis deadline);
} grpc_tcp_client_vtable;
-
-/* Asynchronously connect to an address (specified as (addr, len)), and call
- cb with arg and the completed connection when done (or call cb with arg and
- NULL on failure).
- interested_parties points to a set of pollsets that would be interested
- in this connection being established (in order to continue their work) */
+
+/* Asynchronously connect to an address (specified as (addr, len)), and call
+ cb with arg and the completed connection when done (or call cb with arg and
+ NULL on failure).
+ interested_parties points to a set of pollsets that would be interested
+ in this connection being established (in order to continue their work) */
void grpc_tcp_client_connect(grpc_closure* on_connect, grpc_endpoint** endpoint,
grpc_pollset_set* interested_parties,
const grpc_channel_args* channel_args,
const grpc_resolved_address* addr,
grpc_millis deadline);
-
+
void grpc_tcp_client_global_init();
void grpc_set_tcp_client_impl(grpc_tcp_client_vtable* impl);
-#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.h
index 26d64b0c62..6f61866fc4 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_client_posix.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/ev_posix.h"
-#include "src/core/lib/iomgr/tcp_client.h"
-
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/ev_posix.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+
/* Create an endpoint from a connected grpc_fd.
-
+
fd: a connected FD. Ownership is taken.
channel_args: may contain custom settings for the endpoint
addr_str: destination address in printable format
@@ -65,4 +65,4 @@ void grpc_tcp_client_create_from_prepared_fd(
const grpc_channel_args* channel_args, const grpc_resolved_address* addr,
grpc_millis deadline, grpc_endpoint** ep);
-#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/tcp_posix.h
index 5821198f99..eff825cb92 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_posix.h
@@ -1,60 +1,60 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
-/*
- Low level TCP "bottom half" implementation, for use by transports built on
- top of a TCP connection.
-
- Note that this file does not (yet) include APIs for creating the socket in
- the first place.
-
- All calls passing slice transfer ownership of a slice refcount unless
- otherwise specified.
-*/
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
+/*
+ Low level TCP "bottom half" implementation, for use by transports built on
+ top of a TCP connection.
+
+ Note that this file does not (yet) include APIs for creating the socket in
+ the first place.
+
+ All calls passing slice transfer ownership of a slice refcount unless
+ otherwise specified.
+*/
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/buffer_list.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/ev_posix.h"
-
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/ev_posix.h"
+
extern grpc_core::TraceFlag grpc_tcp_trace;
-
-/* Create a tcp endpoint given a file desciptor and a read slice size.
- Takes ownership of fd. */
+
+/* Create a tcp endpoint given a file desciptor and a read slice size.
+ Takes ownership of fd. */
grpc_endpoint* grpc_tcp_create(grpc_fd* fd, const grpc_channel_args* args,
const char* peer_string);
-
-/* Return the tcp endpoint's fd, or -1 if this is not available. Does not
- release the fd.
- Requires: ep must be a tcp endpoint.
- */
+
+/* Return the tcp endpoint's fd, or -1 if this is not available. Does not
+ release the fd.
+ Requires: ep must be a tcp endpoint.
+ */
int grpc_tcp_fd(grpc_endpoint* ep);
-
-/* Destroy the tcp endpoint without closing its fd. *fd will be set and done
- * will be called when the endpoint is destroyed.
- * Requires: ep must be a tcp endpoint and fd must not be NULL. */
+
+/* Destroy the tcp endpoint without closing its fd. *fd will be set and done
+ * will be called when the endpoint is destroyed.
+ * Requires: ep must be a tcp endpoint and fd must not be NULL. */
void grpc_tcp_destroy_and_release_fd(grpc_endpoint* ep, int* fd,
grpc_closure* done);
-
-#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_server.h b/contrib/libs/grpc/src/core/lib/iomgr/tcp_server.h
index 31abe0ffde..6ba3513da5 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_server.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_server.h
@@ -1,53 +1,53 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
-#define GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
+#define GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
+#include <grpc/grpc.h>
#include <grpc/impl/codegen/grpc_types.h>
-
+
#include <vector>
-#include "src/core/lib/iomgr/closure.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/resolve_address.h"
-
-/* Forward decl of grpc_tcp_server */
-typedef struct grpc_tcp_server grpc_tcp_server;
-
-typedef struct grpc_tcp_server_acceptor {
- /* grpc_tcp_server_cb functions share a ref on from_server that is valid
- until the function returns. */
+#include "src/core/lib/iomgr/closure.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+
+/* Forward decl of grpc_tcp_server */
+typedef struct grpc_tcp_server grpc_tcp_server;
+
+typedef struct grpc_tcp_server_acceptor {
+ /* grpc_tcp_server_cb functions share a ref on from_server that is valid
+ until the function returns. */
grpc_tcp_server* from_server;
- /* Indices that may be passed to grpc_tcp_server_port_fd(). */
- unsigned port_index;
- unsigned fd_index;
+ /* Indices that may be passed to grpc_tcp_server_port_fd(). */
+ unsigned port_index;
+ unsigned fd_index;
/* Data when the connection is passed to tcp_server from external. */
bool external_connection;
int listener_fd;
grpc_byte_buffer* pending_data;
-} grpc_tcp_server_acceptor;
-
-/* Called for newly connected TCP connections.
- Takes ownership of acceptor. */
+} grpc_tcp_server_acceptor;
+
+/* Called for newly connected TCP connections.
+ Takes ownership of acceptor. */
typedef void (*grpc_tcp_server_cb)(void* arg, grpc_endpoint* ep,
grpc_pollset* accepting_pollset,
grpc_tcp_server_acceptor* acceptor);
@@ -61,7 +61,7 @@ class TcpServerFdHandler {
grpc_byte_buffer* pending_read) = 0;
};
} // namespace grpc_core
-
+
typedef struct grpc_tcp_server_vtable {
grpc_error* (*create)(grpc_closure* shutdown_complete,
const grpc_channel_args* args,
@@ -81,65 +81,65 @@ typedef struct grpc_tcp_server_vtable {
void (*shutdown_listeners)(grpc_tcp_server* s);
} grpc_tcp_server_vtable;
-/* Create a server, initially not bound to any ports. The caller owns one ref.
- If shutdown_complete is not NULL, it will be used by
- grpc_tcp_server_unref() when the ref count reaches zero. */
+/* Create a server, initially not bound to any ports. The caller owns one ref.
+ If shutdown_complete is not NULL, it will be used by
+ grpc_tcp_server_unref() when the ref count reaches zero. */
grpc_error* grpc_tcp_server_create(grpc_closure* shutdown_complete,
const grpc_channel_args* args,
grpc_tcp_server** server);
-
-/* Start listening to bound ports */
+
+/* Start listening to bound ports */
void grpc_tcp_server_start(grpc_tcp_server* server,
const std::vector<grpc_pollset*>* pollsets,
grpc_tcp_server_cb on_accept_cb, void* cb_arg);
-
-/* Add a port to the server, returning the newly allocated port on success, or
- -1 on failure.
-
- The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
- both IPv4 and IPv6 connections, but :: is the preferred style. This usually
- creates one socket, but possibly two on systems which support IPv6,
- but not dualstack sockets. */
-/* TODO(ctiller): deprecate this, and make grpc_tcp_server_add_ports to handle
- all of the multiple socket port matching logic in one place */
+
+/* Add a port to the server, returning the newly allocated port on success, or
+ -1 on failure.
+
+ The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
+ both IPv4 and IPv6 connections, but :: is the preferred style. This usually
+ creates one socket, but possibly two on systems which support IPv6,
+ but not dualstack sockets. */
+/* TODO(ctiller): deprecate this, and make grpc_tcp_server_add_ports to handle
+ all of the multiple socket port matching logic in one place */
grpc_error* grpc_tcp_server_add_port(grpc_tcp_server* s,
const grpc_resolved_address* addr,
int* out_port);
-
+
/* Create and return a TcpServerFdHandler so that it can be used by upper layer
to hand over an externally connected fd to the grpc server. */
grpc_core::TcpServerFdHandler* grpc_tcp_server_create_fd_handler(
grpc_tcp_server* s);
-/* Number of fds at the given port_index, or 0 if port_index is out of
- bounds. */
+/* Number of fds at the given port_index, or 0 if port_index is out of
+ bounds. */
unsigned grpc_tcp_server_port_fd_count(grpc_tcp_server* s, unsigned port_index);
-
-/* Returns the file descriptor of the Mth (fd_index) listening socket of the Nth
- (port_index) call to add_port() on this server, or -1 if the indices are out
- of bounds. The file descriptor remains owned by the server, and will be
- cleaned up when the ref count reaches zero. */
+
+/* Returns the file descriptor of the Mth (fd_index) listening socket of the Nth
+ (port_index) call to add_port() on this server, or -1 if the indices are out
+ of bounds. The file descriptor remains owned by the server, and will be
+ cleaned up when the ref count reaches zero. */
int grpc_tcp_server_port_fd(grpc_tcp_server* s, unsigned port_index,
- unsigned fd_index);
-
-/* Ref s and return s. */
+ unsigned fd_index);
+
+/* Ref s and return s. */
grpc_tcp_server* grpc_tcp_server_ref(grpc_tcp_server* s);
-
-/* shutdown_starting is called when ref count has reached zero and the server is
- about to be destroyed. The server will be deleted after it returns. Calling
- grpc_tcp_server_ref() from it has no effect. */
+
+/* shutdown_starting is called when ref count has reached zero and the server is
+ about to be destroyed. The server will be deleted after it returns. Calling
+ grpc_tcp_server_ref() from it has no effect. */
void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server* s,
grpc_closure* shutdown_starting);
-
-/* If the refcount drops to zero, enqueue calls on exec_ctx to
- shutdown_listeners and delete s. */
+
+/* If the refcount drops to zero, enqueue calls on exec_ctx to
+ shutdown_listeners and delete s. */
void grpc_tcp_server_unref(grpc_tcp_server* s);
-
-/* Shutdown the fds of listeners. */
+
+/* Shutdown the fds of listeners. */
void grpc_tcp_server_shutdown_listeners(grpc_tcp_server* s);
-
+
void grpc_tcp_server_global_init();
void grpc_set_tcp_server_impl(grpc_tcp_server_vtable* impl);
-#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/tcp_windows.h b/contrib/libs/grpc/src/core/lib/iomgr/tcp_windows.h
index aa5e8de735..04ef8102b6 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/tcp_windows.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/tcp_windows.h
@@ -1,53 +1,53 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
-#define GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
-/*
- Low level TCP "bottom half" implementation, for use by transports built on
- top of a TCP connection.
-
- Note that this file does not (yet) include APIs for creating the socket in
- the first place.
-
- All calls passing slice transfer ownership of a slice refcount unless
- otherwise specified.
-*/
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
+/*
+ Low level TCP "bottom half" implementation, for use by transports built on
+ top of a TCP connection.
+
+ Note that this file does not (yet) include APIs for creating the socket in
+ the first place.
+
+ All calls passing slice transfer ownership of a slice refcount unless
+ otherwise specified.
+*/
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/socket_windows.h"
-
-/* Create a tcp endpoint given a winsock handle.
- * Takes ownership of the handle.
- */
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/socket_windows.h"
+
+/* Create a tcp endpoint given a winsock handle.
+ * Takes ownership of the handle.
+ */
grpc_endpoint* grpc_tcp_create(grpc_winsocket* socket,
grpc_channel_args* channel_args,
const char* peer_string);
-
+
grpc_error* grpc_tcp_prepare_socket(SOCKET sock);
-
+
grpc_error* grpc_tcp_set_non_block(SOCKET sock);
#endif
-#endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/time_averaged_stats.h b/contrib/libs/grpc/src/core/lib/iomgr/time_averaged_stats.h
index 1a4688d136..877d1bec0e 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/time_averaged_stats.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/time_averaged_stats.h
@@ -1,72 +1,72 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
-#define GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
-
-/* This tracks a time-decaying weighted average. It works by collecting
- batches of samples and then mixing their average into a time-decaying
- weighted mean. It is designed for batch operations where we do many adds
- before updating the average. */
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
+#define GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
+
+/* This tracks a time-decaying weighted average. It works by collecting
+ batches of samples and then mixing their average into a time-decaying
+ weighted mean. It is designed for batch operations where we do many adds
+ before updating the average. */
+
struct grpc_time_averaged_stats {
- /* The initial average value. This is the reported average until the first
- grpc_time_averaged_stats_update_average call. If a positive regress_weight
- is used, we also regress towards this value on each update. */
- double init_avg;
- /* The sample weight of "init_avg" that is mixed in with each call to
- grpc_time_averaged_stats_update_average. If the calls to
- grpc_time_averaged_stats_add_sample stop, this will cause the average to
- regress back to the mean. This should be non-negative. Set it to 0 to
- disable the bias. A value of 1 has the effect of adding in 1 bonus sample
- with value init_avg to each sample period. */
- double regress_weight;
- /* This determines the rate of decay of the time-averaging from one period
- to the next by scaling the aggregate_total_weight of samples from prior
- periods when combining with the latest period. It should be in the range
- [0,1]. A higher value adapts more slowly. With a value of 0.5, if the
- batches each have k samples, the samples_in_avg_ will grow to 2 k, so the
- weighting of the time average will eventually be 1/3 new batch and 2/3
- old average. */
- double persistence_factor;
-
- /* The total value of samples since the last UpdateAverage(). */
- double batch_total_value;
- /* The number of samples since the last UpdateAverage(). */
- double batch_num_samples;
- /* The time-decayed sum of batch_num_samples_ over previous batches. This is
- the "weight" of the old aggregate_weighted_avg_ when updating the
- average. */
- double aggregate_total_weight;
- /* A time-decayed average of the (batch_total_value_ / batch_num_samples_),
- computed by decaying the samples_in_avg_ weight in the weighted average. */
- double aggregate_weighted_avg;
+ /* The initial average value. This is the reported average until the first
+ grpc_time_averaged_stats_update_average call. If a positive regress_weight
+ is used, we also regress towards this value on each update. */
+ double init_avg;
+ /* The sample weight of "init_avg" that is mixed in with each call to
+ grpc_time_averaged_stats_update_average. If the calls to
+ grpc_time_averaged_stats_add_sample stop, this will cause the average to
+ regress back to the mean. This should be non-negative. Set it to 0 to
+ disable the bias. A value of 1 has the effect of adding in 1 bonus sample
+ with value init_avg to each sample period. */
+ double regress_weight;
+ /* This determines the rate of decay of the time-averaging from one period
+ to the next by scaling the aggregate_total_weight of samples from prior
+ periods when combining with the latest period. It should be in the range
+ [0,1]. A higher value adapts more slowly. With a value of 0.5, if the
+ batches each have k samples, the samples_in_avg_ will grow to 2 k, so the
+ weighting of the time average will eventually be 1/3 new batch and 2/3
+ old average. */
+ double persistence_factor;
+
+ /* The total value of samples since the last UpdateAverage(). */
+ double batch_total_value;
+ /* The number of samples since the last UpdateAverage(). */
+ double batch_num_samples;
+ /* The time-decayed sum of batch_num_samples_ over previous batches. This is
+ the "weight" of the old aggregate_weighted_avg_ when updating the
+ average. */
+ double aggregate_total_weight;
+ /* A time-decayed average of the (batch_total_value_ / batch_num_samples_),
+ computed by decaying the samples_in_avg_ weight in the weighted average. */
+ double aggregate_weighted_avg;
};
-/* See the comments on the members above for an explanation of init_avg,
- regress_weight, and persistence_factor. */
-void grpc_time_averaged_stats_init(grpc_time_averaged_stats* stats,
- double init_avg, double regress_weight,
- double persistence_factor);
-/* Add a sample to the current batch. */
-void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats* stats,
- double value);
-/* Complete a batch and compute the new estimate of the average sample
- value. */
-double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats);
-
-#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */
+/* See the comments on the members above for an explanation of init_avg,
+ regress_weight, and persistence_factor. */
+void grpc_time_averaged_stats_init(grpc_time_averaged_stats* stats,
+ double init_avg, double regress_weight,
+ double persistence_factor);
+/* Add a sample to the current batch. */
+void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats* stats,
+ double value);
+/* Complete a batch and compute the new estimate of the average sample
+ value. */
+double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats);
+
+#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/timer.h b/contrib/libs/grpc/src/core/lib/iomgr/timer.h
index 3fe0be99de..11da149652 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/timer.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/timer.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TIMER_H
-#define GRPC_CORE_LIB_IOMGR_TIMER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TIMER_H
+#define GRPC_CORE_LIB_IOMGR_TIMER_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/port.h"
-
-#include <grpc/support/time.h>
-#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/iomgr/iomgr.h"
-
+#include "src/core/lib/iomgr/port.h"
+
+#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr.h"
+
typedef struct grpc_timer {
grpc_millis deadline;
// Uninitialized if not using heap, or INVALID_HEAP_INDEX if not in heap.
@@ -38,7 +38,7 @@ typedef struct grpc_timer {
#ifndef NDEBUG
struct grpc_timer* hash_table_next;
#endif
-
+
// Optional field used by custom timers
void* custom_timer;
} grpc_timer;
@@ -60,68 +60,68 @@ typedef struct grpc_timer_vtable {
void (*consume_kick)(void);
} grpc_timer_vtable;
-/* Initialize *timer. When expired or canceled, closure will be called with
- error set to indicate if it expired (GRPC_ERROR_NONE) or was canceled
+/* Initialize *timer. When expired or canceled, closure will be called with
+ error set to indicate if it expired (GRPC_ERROR_NONE) or was canceled
(GRPC_ERROR_CANCELLED). *closure is guaranteed to be called exactly once, and
- application code should check the error to determine how it was invoked. The
- application callback is also responsible for maintaining information about
+ application code should check the error to determine how it was invoked. The
+ application callback is also responsible for maintaining information about
when to free up any user-level state. Behavior is undefined for a deadline of
GRPC_MILLIS_INF_FUTURE. */
void grpc_timer_init(grpc_timer* timer, grpc_millis deadline,
grpc_closure* closure);
-
+
/* Initialize *timer without setting it. This can later be passed through
the regular init or cancel */
void grpc_timer_init_unset(grpc_timer* timer);
-/* Note that there is no timer destroy function. This is because the
- timer is a one-time occurrence with a guarantee that the callback will
- be called exactly once, either at expiration or cancellation. Thus, all
- the internal timer event management state is destroyed just before
- that callback is invoked. If the user has additional state associated with
- the timer, the user is responsible for determining when it is safe to
- destroy that state. */
-
-/* Cancel an *timer.
- There are three cases:
- 1. We normally cancel the timer
- 2. The timer has already run
- 3. We can't cancel the timer because it is "in flight".
-
- In all of these cases, the cancellation is still considered successful.
- They are essentially distinguished in that the timer_cb will be run
- exactly once from either the cancellation (with error GRPC_ERROR_CANCELLED)
- or from the activation (with error GRPC_ERROR_NONE).
-
- Note carefully that the callback function MAY occur in the same callstack
- as grpc_timer_cancel. It's expected that most timers will be cancelled (their
- primary use is to implement deadlines), and so this code is optimized such
- that cancellation costs as little as possible. Making callbacks run inline
- matches this aim.
-
- Requires: cancel() must happen after init() on a given timer */
+/* Note that there is no timer destroy function. This is because the
+ timer is a one-time occurrence with a guarantee that the callback will
+ be called exactly once, either at expiration or cancellation. Thus, all
+ the internal timer event management state is destroyed just before
+ that callback is invoked. If the user has additional state associated with
+ the timer, the user is responsible for determining when it is safe to
+ destroy that state. */
+
+/* Cancel an *timer.
+ There are three cases:
+ 1. We normally cancel the timer
+ 2. The timer has already run
+ 3. We can't cancel the timer because it is "in flight".
+
+ In all of these cases, the cancellation is still considered successful.
+ They are essentially distinguished in that the timer_cb will be run
+ exactly once from either the cancellation (with error GRPC_ERROR_CANCELLED)
+ or from the activation (with error GRPC_ERROR_NONE).
+
+ Note carefully that the callback function MAY occur in the same callstack
+ as grpc_timer_cancel. It's expected that most timers will be cancelled (their
+ primary use is to implement deadlines), and so this code is optimized such
+ that cancellation costs as little as possible. Making callbacks run inline
+ matches this aim.
+
+ Requires: cancel() must happen after init() on a given timer */
void grpc_timer_cancel(grpc_timer* timer);
-
-/* iomgr internal api for dealing with timers */
-
-/* Check for timers to be run, and run them.
- Return true if timer callbacks were executed.
- If next is non-null, TRY to update *next with the next running timer
- IF that timer occurs before *next current value.
- *next is never guaranteed to be updated on any given execution; however,
- with high probability at least one thread in the system will see an update
- at any time slice. */
+
+/* iomgr internal api for dealing with timers */
+
+/* Check for timers to be run, and run them.
+ Return true if timer callbacks were executed.
+ If next is non-null, TRY to update *next with the next running timer
+ IF that timer occurs before *next current value.
+ *next is never guaranteed to be updated on any given execution; however,
+ with high probability at least one thread in the system will see an update
+ at any time slice. */
grpc_timer_check_result grpc_timer_check(grpc_millis* next);
void grpc_timer_list_init();
void grpc_timer_list_shutdown();
-
+
/* Consume a kick issued by grpc_kick_poller */
void grpc_timer_consume_kick(void);
-/* the following must be implemented by each iomgr implementation */
-void grpc_kick_poller(void);
-
+/* the following must be implemented by each iomgr implementation */
+void grpc_kick_poller(void);
+
/* Sets the timer implementation */
void grpc_set_timer_impl(grpc_timer_vtable* vtable);
-#endif /* GRPC_CORE_LIB_IOMGR_TIMER_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TIMER_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/timer_generic.h b/contrib/libs/grpc/src/core/lib/iomgr/timer_generic.h
index b5ee254473..97a4513355 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/timer_generic.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/timer_generic.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H
-#define GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H
+#define GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/support/time.h>
-#include "src/core/lib/iomgr/exec_ctx.h"
-
-struct grpc_timer {
+#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
+
+struct grpc_timer {
gpr_atm deadline;
- uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */
+ uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */
bool pending;
struct grpc_timer* next;
struct grpc_timer* prev;
@@ -34,6 +34,6 @@ struct grpc_timer {
#ifndef NDEBUG
struct grpc_timer* hash_table_next;
#endif
-};
-
-#endif /* GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H */
+};
+
+#endif /* GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/timer_heap.h b/contrib/libs/grpc/src/core/lib/iomgr/timer_heap.h
index e8ea01db48..2b08c65108 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/timer_heap.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/timer_heap.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
-#define GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
+#define GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/timer.h"
-
+#include "src/core/lib/iomgr/timer.h"
+
struct grpc_timer_heap {
grpc_timer** timers;
- uint32_t timer_count;
- uint32_t timer_capacity;
+ uint32_t timer_count;
+ uint32_t timer_capacity;
};
/* return true if the new timer is the first timer in the heap */
bool grpc_timer_heap_add(grpc_timer_heap* heap, grpc_timer* timer);
-
+
void grpc_timer_heap_init(grpc_timer_heap* heap);
void grpc_timer_heap_destroy(grpc_timer_heap* heap);
-
+
void grpc_timer_heap_remove(grpc_timer_heap* heap, grpc_timer* timer);
grpc_timer* grpc_timer_heap_top(grpc_timer_heap* heap);
void grpc_timer_heap_pop(grpc_timer_heap* heap);
-
+
bool grpc_timer_heap_is_empty(grpc_timer_heap* heap);
-
-#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/udp_server.h b/contrib/libs/grpc/src/core/lib/iomgr/udp_server.h
index 8ba3680c71..6cda332a5b 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/udp_server.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/udp_server.h
@@ -1,39 +1,39 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
-#define GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
+#define GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
+
#include <grpc/support/port_platform.h>
#include <vector>
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/ev_posix.h"
-#include "src/core/lib/iomgr/resolve_address.h"
-
-/* Forward decl of struct grpc_server */
-/* This is not typedef'ed to avoid a typedef-redefinition error */
-struct grpc_server;
-
-/* Forward decl of grpc_udp_server */
-typedef struct grpc_udp_server grpc_udp_server;
-
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/ev_posix.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+
+/* Forward decl of struct grpc_server */
+/* This is not typedef'ed to avoid a typedef-redefinition error */
+struct grpc_server;
+
+/* Forward decl of grpc_udp_server */
+typedef struct grpc_udp_server grpc_udp_server;
+
/* An interface associated with a socket. udp server delivers I/O event on that
* socket to the subclass of this interface which is created through
* GrpcUdpHandlerFactory.
@@ -42,10 +42,10 @@ class GrpcUdpHandler {
public:
GrpcUdpHandler(grpc_fd* /* emfd */, void* /* user_data */) {}
virtual ~GrpcUdpHandler() {}
-
+
// Interfaces to be implemented by subclasses to do the actual setup/tear down
// or I/O.
-
+
// Called when data is available to read from the socket. Returns true if
// there is more data to read after this call.
virtual bool Read() = 0;
@@ -70,35 +70,35 @@ class GrpcUdpHandlerFactory {
virtual void DestroyUdpHandler(GrpcUdpHandler* handler) = 0;
};
-/* Create a server, initially not bound to any ports */
+/* Create a server, initially not bound to any ports */
grpc_udp_server* grpc_udp_server_create(const grpc_channel_args* args);
-
+
/* Start listening to bound ports. user_data is passed to callbacks. */
void grpc_udp_server_start(grpc_udp_server* udp_server,
const std::vector<grpc_pollset*>* pollsets,
void* user_data);
-
+
int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index);
-
-/* Add a port to the server, returning port number on success, or negative
- on failure.
-
+
+/* Add a port to the server, returning port number on success, or negative
+ on failure.
+
Create |num_listeners| sockets for given address to listen on using
SO_REUSEPORT if supported.
- The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
+ The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
both IPv4 and IPv6 connections, but :: is the preferred style. This usually
creates |num_listeners| sockets, but possibly 2 * |num_listeners| on systems
which support IPv6, but not dualstack sockets. */
-
-/* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle
- all of the multiple socket port matching logic in one place */
+
+/* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle
+ all of the multiple socket port matching logic in one place */
int grpc_udp_server_add_port(grpc_udp_server* s,
const grpc_resolved_address* addr,
int rcv_buf_size, int snd_buf_size,
GrpcUdpHandlerFactory* handler_factory,
size_t num_listeners);
-
+
void grpc_udp_server_destroy(grpc_udp_server* server, grpc_closure* on_done);
-
-#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/unix_sockets_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/unix_sockets_posix.h
index 648d6ee01a..962adde71c 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/unix_sockets_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/unix_sockets_posix.h
@@ -1,45 +1,45 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
-#include "src/core/lib/iomgr/port.h"
-
-#include <grpc/support/string_util.h>
-
-#include "src/core/lib/iomgr/resolve_address.h"
-
-void grpc_create_socketpair_if_unix(int sv[2]);
-
+#include "src/core/lib/iomgr/port.h"
+
+#include <grpc/support/string_util.h>
+
+#include "src/core/lib/iomgr/resolve_address.h"
+
+void grpc_create_socketpair_if_unix(int sv[2]);
+
grpc_error* grpc_resolve_unix_domain_address(
const char* name, grpc_resolved_addresses** addresses);
-
+
int grpc_is_unix_socket(const grpc_resolved_address* resolved_addr);
-
-void grpc_unlink_if_unix_domain_socket(
+
+void grpc_unlink_if_unix_domain_socket(
const grpc_resolved_address* resolved_addr);
-
+
TString grpc_sockaddr_to_uri_unix_if_possible(
const grpc_resolved_address* resolved_addr);
-
-#endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_pipe.h b/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_pipe.h
index 808a808e85..1756976305 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_pipe.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_pipe.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
-#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
+#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/wakeup_fd_posix.h"
-
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
+
extern const grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable;
-
-#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H */
+
+#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H */
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_posix.h b/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_posix.h
index f6832a1d33..670c319593 100644
--- a/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_posix.h
+++ b/contrib/libs/grpc/src/core/lib/iomgr/wakeup_fd_posix.h
@@ -1,96 +1,96 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-/*
- * wakeup_fd abstracts the concept of a file descriptor for the purpose of
- * waking up a thread in select()/poll()/epoll_wait()/etc.
-
- * The poll() family of system calls provide a way for a thread to block until
- * there is activity on one (or more) of a set of file descriptors. An
- * application may wish to wake up this thread to do non file related work. The
- * typical way to do this is to add a pipe to the set of file descriptors, then
- * write to the pipe to wake up the thread in poll().
- *
- * Linux has a lighter weight eventfd specifically designed for this purpose.
- * wakeup_fd abstracts the difference between the two.
- *
- * Setup:
- * 1. Before calling anything, call global_init() at least once.
+ *
+ */
+
+/*
+ * wakeup_fd abstracts the concept of a file descriptor for the purpose of
+ * waking up a thread in select()/poll()/epoll_wait()/etc.
+
+ * The poll() family of system calls provide a way for a thread to block until
+ * there is activity on one (or more) of a set of file descriptors. An
+ * application may wish to wake up this thread to do non file related work. The
+ * typical way to do this is to add a pipe to the set of file descriptors, then
+ * write to the pipe to wake up the thread in poll().
+ *
+ * Linux has a lighter weight eventfd specifically designed for this purpose.
+ * wakeup_fd abstracts the difference between the two.
+ *
+ * Setup:
+ * 1. Before calling anything, call global_init() at least once.
* 1. Call grpc_wakeup_fd_init() to set up a wakeup_fd.
- * 2. Add the result of GRPC_WAKEUP_FD_FD to the set of monitored file
- * descriptors for the poll() style API you are using. Monitor the file
- * descriptor for readability.
- * 3. To tear down, call grpc_wakeup_fd_destroy(). This closes the underlying
- * file descriptor.
- *
- * Usage:
- * 1. To wake up a polling thread, call grpc_wakeup_fd_wakeup() on a wakeup_fd
- * it is monitoring.
- * 2. If the polling thread was awakened by a wakeup_fd event, call
- * grpc_wakeup_fd_consume_wakeup() on it.
- */
-#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
-#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
-
+ * 2. Add the result of GRPC_WAKEUP_FD_FD to the set of monitored file
+ * descriptors for the poll() style API you are using. Monitor the file
+ * descriptor for readability.
+ * 3. To tear down, call grpc_wakeup_fd_destroy(). This closes the underlying
+ * file descriptor.
+ *
+ * Usage:
+ * 1. To wake up a polling thread, call grpc_wakeup_fd_wakeup() on a wakeup_fd
+ * it is monitoring.
+ * 2. If the polling thread was awakened by a wakeup_fd event, call
+ * grpc_wakeup_fd_consume_wakeup() on it.
+ */
+#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/error.h"
-
-void grpc_wakeup_fd_global_init(void);
-void grpc_wakeup_fd_global_destroy(void);
-
-/* Force using the fallback implementation. This is intended for testing
- * purposes only.*/
-void grpc_wakeup_fd_global_init_force_fallback(void);
-
-int grpc_has_wakeup_fd(void);
-int grpc_cv_wakeup_fds_enabled(void);
-void grpc_enable_cv_wakeup_fds(int enable);
-
-typedef struct grpc_wakeup_fd grpc_wakeup_fd;
-
-typedef struct grpc_wakeup_fd_vtable {
- grpc_error* (*init)(grpc_wakeup_fd* fd_info);
- grpc_error* (*consume)(grpc_wakeup_fd* fd_info);
- grpc_error* (*wakeup)(grpc_wakeup_fd* fd_info);
- void (*destroy)(grpc_wakeup_fd* fd_info);
- /* Must be called before calling any other functions */
- int (*check_availability)(void);
-} grpc_wakeup_fd_vtable;
-
-struct grpc_wakeup_fd {
- int read_fd;
- int write_fd;
-};
-
-extern int grpc_allow_specialized_wakeup_fd;
-extern int grpc_allow_pipe_wakeup_fd;
-
-#define GRPC_WAKEUP_FD_GET_READ_FD(fd_info) ((fd_info)->read_fd)
-
-grpc_error* grpc_wakeup_fd_init(grpc_wakeup_fd* fd_info) GRPC_MUST_USE_RESULT;
-grpc_error* grpc_wakeup_fd_consume_wakeup(grpc_wakeup_fd* fd_info)
- GRPC_MUST_USE_RESULT;
-grpc_error* grpc_wakeup_fd_wakeup(grpc_wakeup_fd* fd_info) GRPC_MUST_USE_RESULT;
-void grpc_wakeup_fd_destroy(grpc_wakeup_fd* fd_info);
-
-/* Defined in some specialized implementation's .c file, or by
- * wakeup_fd_nospecial.c if no such implementation exists. */
-extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable;
-
-#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H */
+#include "src/core/lib/iomgr/error.h"
+
+void grpc_wakeup_fd_global_init(void);
+void grpc_wakeup_fd_global_destroy(void);
+
+/* Force using the fallback implementation. This is intended for testing
+ * purposes only.*/
+void grpc_wakeup_fd_global_init_force_fallback(void);
+
+int grpc_has_wakeup_fd(void);
+int grpc_cv_wakeup_fds_enabled(void);
+void grpc_enable_cv_wakeup_fds(int enable);
+
+typedef struct grpc_wakeup_fd grpc_wakeup_fd;
+
+typedef struct grpc_wakeup_fd_vtable {
+ grpc_error* (*init)(grpc_wakeup_fd* fd_info);
+ grpc_error* (*consume)(grpc_wakeup_fd* fd_info);
+ grpc_error* (*wakeup)(grpc_wakeup_fd* fd_info);
+ void (*destroy)(grpc_wakeup_fd* fd_info);
+ /* Must be called before calling any other functions */
+ int (*check_availability)(void);
+} grpc_wakeup_fd_vtable;
+
+struct grpc_wakeup_fd {
+ int read_fd;
+ int write_fd;
+};
+
+extern int grpc_allow_specialized_wakeup_fd;
+extern int grpc_allow_pipe_wakeup_fd;
+
+#define GRPC_WAKEUP_FD_GET_READ_FD(fd_info) ((fd_info)->read_fd)
+
+grpc_error* grpc_wakeup_fd_init(grpc_wakeup_fd* fd_info) GRPC_MUST_USE_RESULT;
+grpc_error* grpc_wakeup_fd_consume_wakeup(grpc_wakeup_fd* fd_info)
+ GRPC_MUST_USE_RESULT;
+grpc_error* grpc_wakeup_fd_wakeup(grpc_wakeup_fd* fd_info) GRPC_MUST_USE_RESULT;
+void grpc_wakeup_fd_destroy(grpc_wakeup_fd* fd_info);
+
+/* Defined in some specialized implementation's .c file, or by
+ * wakeup_fd_nospecial.c if no such implementation exists. */
+extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable;
+
+#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H */
diff --git a/contrib/libs/grpc/src/core/lib/json/json.h b/contrib/libs/grpc/src/core/lib/json/json.h
index 32dea4bacc..f426fbf1dd 100644
--- a/contrib/libs/grpc/src/core/lib/json/json.h
+++ b/contrib/libs/grpc/src/core/lib/json/json.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_JSON_JSON_H
-#define GRPC_CORE_LIB_JSON_JSON_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_JSON_JSON_H
+#define GRPC_CORE_LIB_JSON_JSON_H
+
#include <grpc/support/port_platform.h>
-#include <stdlib.h>
-
+#include <stdlib.h>
+
#include <map>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include <vector>
-
+
#include "y_absl/strings/string_view.h"
#include "src/core/lib/iomgr/error.h"
-
+
namespace grpc_core {
// A JSON value, which can be any one of object, array, string,
@@ -52,15 +52,15 @@ class Json {
OBJECT,
ARRAY
};
-
+
using Object = std::map<TString, Json>;
using Array = std::vector<Json>;
-
+
// Parses JSON string from json_str. On error, sets *error.
static Json Parse(y_absl::string_view json_str, grpc_error** error);
-
+
Json() = default;
-
+
// Copyable.
Json(const Json& other) { CopyFrom(other); }
Json& operator=(const Json& other) {
@@ -238,4 +238,4 @@ class Json {
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_JSON_JSON_H */
+#endif /* GRPC_CORE_LIB_JSON_JSON_H */
diff --git a/contrib/libs/grpc/src/core/lib/profiling/stap_probes.d b/contrib/libs/grpc/src/core/lib/profiling/stap_probes.d
index 30f17e0899..153de91752 100644
--- a/contrib/libs/grpc/src/core/lib/profiling/stap_probes.d
+++ b/contrib/libs/grpc/src/core/lib/profiling/stap_probes.d
@@ -1,7 +1,7 @@
-provider _stap {
- probe add_mark(int tag);
- probe add_important_mark(int tag);
- probe timing_ns_begin(int tag);
- probe timing_ns_end(int tag);
-};
-
+provider _stap {
+ probe add_mark(int tag);
+ probe add_important_mark(int tag);
+ probe timing_ns_begin(int tag);
+ probe timing_ns_end(int tag);
+};
+
diff --git a/contrib/libs/grpc/src/core/lib/profiling/timers.h b/contrib/libs/grpc/src/core/lib/profiling/timers.h
index 4448c3564d..7ff72783ec 100644
--- a/contrib/libs/grpc/src/core/lib/profiling/timers.h
+++ b/contrib/libs/grpc/src/core/lib/profiling/timers.h
@@ -1,94 +1,94 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_PROFILING_TIMERS_H
-#define GRPC_CORE_LIB_PROFILING_TIMERS_H
-
-void gpr_timers_global_init(void);
-void gpr_timers_global_destroy(void);
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_PROFILING_TIMERS_H
+#define GRPC_CORE_LIB_PROFILING_TIMERS_H
+
+void gpr_timers_global_init(void);
+void gpr_timers_global_destroy(void);
+
void gpr_timer_add_mark(const char* tagstr, int important, const char* file,
- int line);
+ int line);
void gpr_timer_begin(const char* tagstr, int important, const char* file,
- int line);
+ int line);
void gpr_timer_end(const char* tagstr, int important, const char* file,
- int line);
-
+ int line);
+
void gpr_timers_set_log_filename(const char* filename);
-
-void gpr_timer_set_enabled(int enabled);
-
+
+void gpr_timer_set_enabled(int enabled);
+
#if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER) + \
defined(GRPC_CUSTOM_PROFILER))
-/* No profiling. No-op all the things. */
-#define GPR_TIMER_MARK(tag, important) \
- do { \
- } while (0)
-
+/* No profiling. No-op all the things. */
+#define GPR_TIMER_MARK(tag, important) \
+ do { \
+ } while (0)
+
#define GPR_TIMER_SCOPE(tag, important) \
- do { \
- } while (0)
-
-#else /* at least one profiler requested... */
-/* ... hopefully only one. */
-#if defined(GRPC_STAP_PROFILER) && defined(GRPC_BASIC_PROFILER)
-#error "GRPC_STAP_PROFILER and GRPC_BASIC_PROFILER are mutually exclusive."
-#endif
+ do { \
+ } while (0)
+
+#else /* at least one profiler requested... */
+/* ... hopefully only one. */
+#if defined(GRPC_STAP_PROFILER) && defined(GRPC_BASIC_PROFILER)
+#error "GRPC_STAP_PROFILER and GRPC_BASIC_PROFILER are mutually exclusive."
+#endif
#if defined(GRPC_STAP_PROFILER) && defined(GRPC_CUSTOM_PROFILER)
#error "GRPC_STAP_PROFILER and GRPC_CUSTOM_PROFILER are mutually exclusive."
#endif
#if defined(GRPC_CUSTOM_PROFILER) && defined(GRPC_BASIC_PROFILER)
#error "GRPC_CUSTOM_PROFILER and GRPC_BASIC_PROFILER are mutually exclusive."
#endif
-
-/* Generic profiling interface. */
-#define GPR_TIMER_MARK(tag, important) \
- gpr_timer_add_mark(tag, important, __FILE__, __LINE__);
-
-#ifdef GRPC_STAP_PROFILER
-/* Empty placeholder for now. */
-#endif /* GRPC_STAP_PROFILER */
-
-#ifdef GRPC_BASIC_PROFILER
-/* Empty placeholder for now. */
-#endif /* GRPC_BASIC_PROFILER */
-
-namespace grpc {
-class ProfileScope {
- public:
+
+/* Generic profiling interface. */
+#define GPR_TIMER_MARK(tag, important) \
+ gpr_timer_add_mark(tag, important, __FILE__, __LINE__);
+
+#ifdef GRPC_STAP_PROFILER
+/* Empty placeholder for now. */
+#endif /* GRPC_STAP_PROFILER */
+
+#ifdef GRPC_BASIC_PROFILER
+/* Empty placeholder for now. */
+#endif /* GRPC_BASIC_PROFILER */
+
+namespace grpc {
+class ProfileScope {
+ public:
ProfileScope(const char* desc, bool important, const char* file, int line)
: desc_(desc) {
gpr_timer_begin(desc_, important ? 1 : 0, file, line);
- }
+ }
~ProfileScope() { gpr_timer_end(desc_, 0, "n/a", 0); }
-
- private:
+
+ private:
const char* const desc_;
-};
+};
} // namespace grpc
-
+
#define GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line) prefix##line
#define GPR_TIMER_SCOPE_NAME(prefix, line) \
GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line)
#define GPR_TIMER_SCOPE(tag, important) \
::grpc::ProfileScope GPR_TIMER_SCOPE_NAME(_profile_scope_, __LINE__)( \
(tag), (important), __FILE__, __LINE__)
-
+
#endif /* at least one profiler requested. */
-#endif /* GRPC_CORE_LIB_PROFILING_TIMERS_H */
+#endif /* GRPC_CORE_LIB_PROFILING_TIMERS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/context/security_context.h b/contrib/libs/grpc/src/core/lib/security/context/security_context.h
index 92dba476fd..b1991089ae 100644
--- a/contrib/libs/grpc/src/core/lib/security/context/security_context.h
+++ b/contrib/libs/grpc/src/core/lib/security/context/security_context.h
@@ -1,48 +1,48 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
-#define GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
+#define GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
+
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/security/credentials/credentials.h"
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount;
-
-/* --- grpc_auth_context ---
-
- High level authentication context object. Can optionally be chained. */
-
-/* Property names are always NULL terminated. */
-
+
+/* --- grpc_auth_context ---
+
+ High level authentication context object. Can optionally be chained. */
+
+/* Property names are always NULL terminated. */
+
struct grpc_auth_property_array {
grpc_auth_property* array = nullptr;
size_t count = 0;
size_t capacity = 0;
-};
-
+};
+
void grpc_auth_property_reset(grpc_auth_property* property);
-
+
// This type is forward declared as a C struct and we cannot define it as a
// class. Otherwise, compiler will complain about type mismatch due to
// -Wmismatched-tags.
@@ -60,7 +60,7 @@ struct grpc_auth_context
peer_identity_property_name_ = chained_->peer_identity_property_name_;
}
}
-
+
~grpc_auth_context() {
chained_.reset(DEBUG_LOCATION, "chained");
if (properties_.array != nullptr) {
@@ -70,7 +70,7 @@ struct grpc_auth_context
gpr_free(properties_.array);
}
}
-
+
const grpc_auth_context* chained() const { return chained_.get(); }
const grpc_auth_property_array& properties() const { return properties_; }
@@ -94,20 +94,20 @@ struct grpc_auth_context
const char* peer_identity_property_name_ = nullptr;
};
-/* --- grpc_security_context_extension ---
-
- Extension to the security context that may be set in a filter and accessed
- later by a higher level method on a grpc_call object. */
-
+/* --- grpc_security_context_extension ---
+
+ Extension to the security context that may be set in a filter and accessed
+ later by a higher level method on a grpc_call object. */
+
struct grpc_security_context_extension {
void* instance = nullptr;
void (*destroy)(void*) = nullptr;
};
-
-/* --- grpc_client_security_context ---
-
- Internal client-side security context. */
-
+
+/* --- grpc_client_security_context ---
+
+ Internal client-side security context. */
+
struct grpc_client_security_context {
explicit grpc_client_security_context(
grpc_core::RefCountedPtr<grpc_call_credentials> creds)
@@ -116,35 +116,35 @@ struct grpc_client_security_context {
grpc_core::RefCountedPtr<grpc_call_credentials> creds;
grpc_core::RefCountedPtr<grpc_auth_context> auth_context;
- grpc_security_context_extension extension;
+ grpc_security_context_extension extension;
};
-
+
grpc_client_security_context* grpc_client_security_context_create(
grpc_core::Arena* arena, grpc_call_credentials* creds);
void grpc_client_security_context_destroy(void* ctx);
-
-/* --- grpc_server_security_context ---
-
- Internal server-side security context. */
-
+
+/* --- grpc_server_security_context ---
+
+ Internal server-side security context. */
+
struct grpc_server_security_context {
grpc_server_security_context() = default;
~grpc_server_security_context();
grpc_core::RefCountedPtr<grpc_auth_context> auth_context;
- grpc_security_context_extension extension;
+ grpc_security_context_extension extension;
};
-
+
grpc_server_security_context* grpc_server_security_context_create(
grpc_core::Arena* arena);
void grpc_server_security_context_destroy(void* ctx);
-
-/* --- Channel args for auth context --- */
-#define GRPC_AUTH_CONTEXT_ARG "grpc.auth_context"
-
+
+/* --- Channel args for auth context --- */
+#define GRPC_AUTH_CONTEXT_ARG "grpc.auth_context"
+
grpc_arg grpc_auth_context_to_arg(grpc_auth_context* c);
grpc_auth_context* grpc_auth_context_from_arg(const grpc_arg* arg);
grpc_auth_context* grpc_find_auth_context_in_args(
const grpc_channel_args* args);
-
-#endif /* GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/composite/composite_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/composite/composite_credentials.h
index 052146adc4..5bebb9bd5a 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/composite/composite_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/composite/composite_credentials.h
@@ -1,24 +1,24 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
@@ -26,10 +26,10 @@
#include "y_absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+
/* -- Composite channel credentials. -- */
-
+
class grpc_composite_channel_credentials : public grpc_channel_credentials {
public:
grpc_composite_channel_credentials(
@@ -38,20 +38,20 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials {
: grpc_channel_credentials(channel_creds->type()),
inner_creds_(std::move(channel_creds)),
call_creds_(std::move(call_creds)) {}
-
+
~grpc_composite_channel_credentials() override = default;
-
+
grpc_core::RefCountedPtr<grpc_channel_credentials>
duplicate_without_call_credentials() override {
return inner_creds_;
}
-
+
grpc_core::RefCountedPtr<grpc_channel_security_connector>
create_security_connector(
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target, const grpc_channel_args* args,
grpc_channel_args** new_args) override;
-
+
grpc_channel_args* update_arguments(grpc_channel_args* args) override {
return inner_creds_->update_arguments(args);
}
@@ -67,13 +67,13 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials {
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds_;
};
-/* -- Composite call credentials. -- */
-
+/* -- Composite call credentials. -- */
+
class grpc_composite_call_credentials : public grpc_call_credentials {
public:
using CallCredentialsList =
y_absl::InlinedVector<grpc_core::RefCountedPtr<grpc_call_credentials>, 2>;
-
+
grpc_composite_call_credentials(
grpc_core::RefCountedPtr<grpc_call_credentials> creds1,
grpc_core::RefCountedPtr<grpc_call_credentials> creds2);
@@ -102,5 +102,5 @@ class grpc_composite_call_credentials : public grpc_call_credentials {
CallCredentialsList inner_;
};
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
*/
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/credentials.h
index df71f4fee3..15a85cbd0b 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/credentials.h
@@ -1,98 +1,98 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <string.h>
#include <util/generic/string.h>
-#include <grpc/grpc.h>
-#include <grpc/grpc_security.h>
-#include <grpc/support/sync.h>
-#include "src/core/lib/transport/metadata_batch.h"
-
+#include <grpc/grpc.h>
+#include <grpc/grpc_security.h>
+#include <grpc/support/sync.h>
+#include "src/core/lib/transport/metadata_batch.h"
+
#include "src/core/lib/gprpp/ref_counted.h"
-#include "src/core/lib/http/httpcli.h"
-#include "src/core/lib/http/parser.h"
-#include "src/core/lib/iomgr/polling_entity.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/security/security_connector/security_connector.h"
-
-struct grpc_http_response;
-
-/* --- Constants. --- */
-
-typedef enum {
- GRPC_CREDENTIALS_OK = 0,
- GRPC_CREDENTIALS_ERROR
-} grpc_credentials_status;
-
-#define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake"
-
-#define GRPC_CHANNEL_CREDENTIALS_TYPE_SSL "Ssl"
-#define GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY \
- "FakeTransportSecurity"
+
+struct grpc_http_response;
+
+/* --- Constants. --- */
+
+typedef enum {
+ GRPC_CREDENTIALS_OK = 0,
+ GRPC_CREDENTIALS_ERROR
+} grpc_credentials_status;
+
+#define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake"
+
+#define GRPC_CHANNEL_CREDENTIALS_TYPE_SSL "Ssl"
+#define GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY \
+ "FakeTransportSecurity"
#define GRPC_CHANNEL_CREDENTIALS_TYPE_GOOGLE_DEFAULT "GoogleDefault"
-
-#define GRPC_CALL_CREDENTIALS_TYPE_OAUTH2 "Oauth2"
-#define GRPC_CALL_CREDENTIALS_TYPE_JWT "Jwt"
-#define GRPC_CALL_CREDENTIALS_TYPE_IAM "Iam"
-#define GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE "Composite"
-
-#define GRPC_AUTHORIZATION_METADATA_KEY "authorization"
-#define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \
- "x-goog-iam-authorization-token"
-#define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector"
-
-#define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60
-
+
+#define GRPC_CALL_CREDENTIALS_TYPE_OAUTH2 "Oauth2"
+#define GRPC_CALL_CREDENTIALS_TYPE_JWT "Jwt"
+#define GRPC_CALL_CREDENTIALS_TYPE_IAM "Iam"
+#define GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE "Composite"
+
+#define GRPC_AUTHORIZATION_METADATA_KEY "authorization"
+#define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \
+ "x-goog-iam-authorization-token"
+#define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector"
+
+#define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60
+
#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal."
-#define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
- "/computeMetadata/v1/instance/service-accounts/default/token"
-
+#define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
+ "/computeMetadata/v1/instance/service-accounts/default/token"
+
#define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "oauth2.googleapis.com"
#define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/token"
-
-#define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX \
- "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \
- "assertion="
-
-#define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \
- "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token"
-
-/* --- Google utils --- */
-
-/* It is the caller's responsibility to gpr_free the result if not NULL. */
+
+#define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX \
+ "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \
+ "assertion="
+
+#define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \
+ "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token"
+
+/* --- Google utils --- */
+
+/* It is the caller's responsibility to gpr_free the result if not NULL. */
TString grpc_get_well_known_google_credentials_file_path(void);
-
-/* Implementation function for the different platforms. */
+
+/* Implementation function for the different platforms. */
TString grpc_get_well_known_google_credentials_file_path_impl(void);
-
-/* Override for testing only. Not thread-safe */
+
+/* Override for testing only. Not thread-safe */
typedef TString (*grpc_well_known_credentials_path_getter)(void);
-void grpc_override_well_known_credentials_path_getter(
- grpc_well_known_credentials_path_getter getter);
-
-/* --- grpc_channel_credentials. --- */
-
+void grpc_override_well_known_credentials_path_getter(
+ grpc_well_known_credentials_path_getter getter);
+
+/* --- grpc_channel_credentials. --- */
+
#define GRPC_ARG_CHANNEL_CREDENTIALS "grpc.channel_credentials"
// This type is forward declared as a C struct and we cannot define it as a
@@ -103,7 +103,7 @@ struct grpc_channel_credentials
public:
explicit grpc_channel_credentials(const char* type) : type_(type) {}
virtual ~grpc_channel_credentials() = default;
-
+
// Creates a security connector for the channel. May also create new channel
// args for the channel to be used in place of the passed in const args if
// returned non NULL. In that case the caller is responsible for destroying
@@ -113,7 +113,7 @@ struct grpc_channel_credentials
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target, const grpc_channel_args* args,
grpc_channel_args** new_args) = 0;
-
+
// Creates a version of the channel credentials without any attached call
// credentials. This can be used in order to open a channel to a non-trusted
// gRPC load balancer.
@@ -122,7 +122,7 @@ struct grpc_channel_credentials
// By default we just increment the refcount.
return Ref();
}
-
+
// Allows credentials to optionally modify a parent channel's args.
// By default, leave channel args as is. The callee takes ownership
// of the passed-in channel args, and the caller takes ownership
@@ -130,20 +130,20 @@ struct grpc_channel_credentials
virtual grpc_channel_args* update_arguments(grpc_channel_args* args) {
return args;
}
-
+
const char* type() const { return type_; }
-
+
private:
const char* type_;
};
-
+
/* Util to encapsulate the channel credentials in a channel arg. */
grpc_arg grpc_channel_credentials_to_arg(grpc_channel_credentials* credentials);
-
+
/* Util to get the channel credentials from a channel arg. */
grpc_channel_credentials* grpc_channel_credentials_from_arg(
const grpc_arg* arg);
-
+
/* Util to find the channel credentials from channel args. */
grpc_channel_credentials* grpc_channel_credentials_find_in_args(
const grpc_channel_args* args);
@@ -157,15 +157,15 @@ struct grpc_credentials_mdelem_array {
/// Takes a new ref to \a md.
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array* list,
grpc_mdelem md);
-
+
/// Appends all elements from \a src to \a dst, taking a new ref to each one.
void grpc_credentials_mdelem_array_append(grpc_credentials_mdelem_array* dst,
grpc_credentials_mdelem_array* src);
-
+
void grpc_credentials_mdelem_array_destroy(grpc_credentials_mdelem_array* list);
-/* --- grpc_call_credentials. --- */
-
+/* --- grpc_call_credentials. --- */
+
// This type is forward declared as a C struct and we cannot define it as a
// class. Otherwise, compiler will complain about type mismatch due to
// -Wmismatched-tags.
@@ -178,7 +178,7 @@ struct grpc_call_credentials
: type_(type), min_security_level_(min_security_level) {}
virtual ~grpc_call_credentials() = default;
-
+
// Returns true if completed synchronously, in which case \a error will
// be set to indicate the result. Otherwise, \a on_request_metadata will
// be invoked asynchronously when complete. \a md_array will be populated
@@ -188,13 +188,13 @@ struct grpc_call_credentials
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) = 0;
-
+
// Cancels a pending asynchronous operation started by
// grpc_call_credentials_get_request_metadata() with the corresponding
// value of \a md_array.
virtual void cancel_get_request_metadata(
grpc_credentials_mdelem_array* md_array, grpc_error* error) = 0;
-
+
virtual grpc_security_level min_security_level() const {
return min_security_level_;
}
@@ -210,13 +210,13 @@ struct grpc_call_credentials
const grpc_security_level min_security_level_;
};
-/* Metadata-only credentials with the specified key and value where
- asynchronicity can be simulated for testing. */
+/* Metadata-only credentials with the specified key and value where
+ asynchronicity can be simulated for testing. */
grpc_call_credentials* grpc_md_only_test_credentials_create(
const char* md_key, const char* md_value, bool is_async);
-
-/* --- grpc_server_credentials. --- */
-
+
+/* --- grpc_server_credentials. --- */
+
// This type is forward declared as a C struct and we cannot define it as a
// class. Otherwise, compiler will complain about type mismatch due to
// -Wmismatched-tags.
@@ -224,20 +224,20 @@ struct grpc_server_credentials
: public grpc_core::RefCounted<grpc_server_credentials> {
public:
explicit grpc_server_credentials(const char* type) : type_(type) {}
-
+
virtual ~grpc_server_credentials() { DestroyProcessor(); }
-
+
virtual grpc_core::RefCountedPtr<grpc_server_security_connector>
create_security_connector() = 0;
-
+
const char* type() const { return type_; }
-
+
const grpc_auth_metadata_processor& auth_metadata_processor() const {
return processor_;
}
void set_auth_metadata_processor(
const grpc_auth_metadata_processor& processor);
-
+
private:
void DestroyProcessor() {
if (processor_.destroy != nullptr && processor_.state != nullptr) {
@@ -250,15 +250,15 @@ struct grpc_server_credentials
grpc_auth_metadata_processor(); // Zero-initialize the C struct.
};
-#define GRPC_SERVER_CREDENTIALS_ARG "grpc.server_credentials"
-
+#define GRPC_SERVER_CREDENTIALS_ARG "grpc.server_credentials"
+
grpc_arg grpc_server_credentials_to_arg(grpc_server_credentials* c);
grpc_server_credentials* grpc_server_credentials_from_arg(const grpc_arg* arg);
grpc_server_credentials* grpc_find_server_credentials_in_args(
const grpc_channel_args* args);
-
-/* -- Credentials Metadata Request. -- */
-
+
+/* -- Credentials Metadata Request. -- */
+
struct grpc_credentials_metadata_request {
explicit grpc_credentials_metadata_request(
grpc_core::RefCountedPtr<grpc_call_credentials> creds)
@@ -268,18 +268,18 @@ struct grpc_credentials_metadata_request {
}
grpc_core::RefCountedPtr<grpc_call_credentials> creds;
- grpc_http_response response;
+ grpc_http_response response;
};
-
+
inline grpc_credentials_metadata_request*
grpc_credentials_metadata_request_create(
grpc_core::RefCountedPtr<grpc_call_credentials> creds) {
return new grpc_credentials_metadata_request(std::move(creds));
}
-
+
inline void grpc_credentials_metadata_request_destroy(
grpc_credentials_metadata_request* r) {
delete r;
}
-
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/fake/fake_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/fake/fake_credentials.h
index 34417d50df..27f3a28451 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/fake/fake_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/fake/fake_credentials.h
@@ -1,42 +1,42 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <string.h>
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+
#define GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS \
"grpc.fake_security.expected_targets"
-/* -- Fake transport security credentials. -- */
-
-/* Creates a fake transport security credentials object for testing. */
+/* -- Fake transport security credentials. -- */
+
+/* Creates a fake transport security credentials object for testing. */
grpc_channel_credentials* grpc_fake_transport_security_credentials_create(void);
-
-/* Creates a fake server transport security credentials object for testing. */
+
+/* Creates a fake server transport security credentials object for testing. */
grpc_server_credentials* grpc_fake_transport_security_server_credentials_create(
- void);
-
+ void);
+
/* Used to verify the target names given to the fake transport security
* connector.
*
@@ -55,8 +55,8 @@ grpc_arg grpc_fake_transport_expected_targets_arg(char* expected_targets);
const char* grpc_fake_transport_get_expected_targets(
const grpc_channel_args* args);
-/* -- Metadata-only Test credentials. -- */
-
+/* -- Metadata-only Test credentials. -- */
+
class grpc_md_only_test_credentials : public grpc_call_credentials {
public:
grpc_md_only_test_credentials(const char* md_key, const char* md_value,
@@ -67,7 +67,7 @@ class grpc_md_only_test_credentials : public grpc_call_credentials {
grpc_slice_from_copied_string(md_value))),
is_async_(is_async) {}
~grpc_md_only_test_credentials() override { GRPC_MDELEM_UNREF(md_); }
-
+
bool get_request_metadata(grpc_polling_entity* pollent,
grpc_auth_metadata_context context,
grpc_credentials_mdelem_array* md_array,
@@ -84,4 +84,4 @@ class grpc_md_only_test_credentials : public grpc_call_credentials {
bool is_async_;
};
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/google_default/google_default_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/google_default/google_default_credentials.h
index 3c5a87817b..8a945da31e 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/google_default/google_default_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/google_default/google_default_credentials.h
@@ -1,45 +1,45 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H
-
-#include <grpc/support/port_platform.h>
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H
+
+#include <grpc/support/port_platform.h>
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
-#include "src/core/lib/security/credentials/credentials.h"
-
-#define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud"
-#define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \
- "application_default_credentials.json"
-
-#ifdef GPR_WINDOWS
-#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "APPDATA"
-#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX \
- GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY \
- "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE
-#else
-#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "HOME"
-#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX \
- ".config/" GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY \
- "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE
-#endif
-
+#include "src/core/lib/security/credentials/credentials.h"
+
+#define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud"
+#define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \
+ "application_default_credentials.json"
+
+#ifdef GPR_WINDOWS
+#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "APPDATA"
+#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX \
+ GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY \
+ "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE
+#else
+#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "HOME"
+#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX \
+ ".config/" GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY \
+ "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE
+#endif
+
class grpc_google_default_channel_credentials
: public grpc_channel_credentials {
public:
@@ -78,10 +78,10 @@ typedef bool (*grpc_gce_tenancy_checker)(void);
void set_gce_tenancy_checker_for_testing(grpc_gce_tenancy_checker checker);
// TEST-ONLY. Reset the internal global state.
-void grpc_flush_cached_google_default_credentials(void);
-
+void grpc_flush_cached_google_default_credentials(void);
+
} // namespace internal
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H \
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H \
*/
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/iam/iam_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/iam/iam_credentials.h
index 8b3503254c..76b6acfa28 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/iam/iam_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/iam/iam_credentials.h
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+
class grpc_google_iam_credentials : public grpc_call_credentials {
public:
grpc_google_iam_credentials(const char* token,
const char* authority_selector);
~grpc_google_iam_credentials() override;
-
+
bool get_request_metadata(grpc_polling_entity* pollent,
grpc_auth_metadata_context context,
grpc_credentials_mdelem_array* md_array,
@@ -46,4 +46,4 @@ class grpc_google_iam_credentials : public grpc_call_credentials {
const TString debug_string_;
};
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_IAM_IAM_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/json_token.h b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/json_token.h
index 302d13693c..b9a41c6b2b 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/json_token.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/json_token.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include <openssl/rsa.h>
-
-#include "src/core/lib/json/json.h"
-
-/* --- Constants. --- */
-
+#include <grpc/slice.h>
+#include <openssl/rsa.h>
+
+#include "src/core/lib/json/json.h"
+
+/* --- Constants. --- */
+
#define GRPC_JWT_OAUTH2_AUDIENCE "https://oauth2.googleapis.com/token"
-
-/* --- auth_json_key parsing. --- */
-
+
+/* --- auth_json_key parsing. --- */
+
struct grpc_auth_json_key {
const char* type;
char* private_key_id;
@@ -39,37 +39,37 @@ struct grpc_auth_json_key {
char* client_email;
RSA* private_key;
};
-/* Returns 1 if the object is valid, 0 otherwise. */
+/* Returns 1 if the object is valid, 0 otherwise. */
int grpc_auth_json_key_is_valid(const grpc_auth_json_key* json_key);
-
-/* Creates a json_key object from string. Returns an invalid object if a parsing
- error has been encountered. */
-grpc_auth_json_key grpc_auth_json_key_create_from_string(
+
+/* Creates a json_key object from string. Returns an invalid object if a parsing
+ error has been encountered. */
+grpc_auth_json_key grpc_auth_json_key_create_from_string(
const char* json_string);
-
-/* Creates a json_key object from parsed json. Returns an invalid object if a
- parsing error has been encountered. */
+
+/* Creates a json_key object from parsed json. Returns an invalid object if a
+ parsing error has been encountered. */
grpc_auth_json_key grpc_auth_json_key_create_from_json(
const grpc_core::Json& json);
-
-/* Destructs the object. */
+
+/* Destructs the object. */
void grpc_auth_json_key_destruct(grpc_auth_json_key* json_key);
-
-/* --- json token encoding and signing. --- */
-
-/* Caller is responsible for calling gpr_free on the returned value. May return
- NULL on invalid input. The scope parameter may be NULL. */
+
+/* --- json token encoding and signing. --- */
+
+/* Caller is responsible for calling gpr_free on the returned value. May return
+ NULL on invalid input. The scope parameter may be NULL. */
char* grpc_jwt_encode_and_sign(const grpc_auth_json_key* json_key,
const char* audience,
gpr_timespec token_lifetime, const char* scope);
-
-/* Override encode_and_sign function for testing. */
+
+/* Override encode_and_sign function for testing. */
typedef char* (*grpc_jwt_encode_and_sign_override)(
const grpc_auth_json_key* json_key, const char* audience,
gpr_timespec token_lifetime, const char* scope);
-
-/* Set a custom encode_and_sign override for testing. */
-void grpc_jwt_encode_and_sign_set_override(
- grpc_jwt_encode_and_sign_override func);
-
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H */
+
+/* Set a custom encode_and_sign override for testing. */
+void grpc_jwt_encode_and_sign_set_override(
+ grpc_jwt_encode_and_sign_override func);
+
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_credentials.h
index 7e4b2a84fb..9b60deacb5 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_credentials.h
@@ -1,24 +1,24 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
@@ -27,16 +27,16 @@
#include "y_absl/strings/str_format.h"
#include "y_absl/time/time.h"
-#include "src/core/lib/security/credentials/credentials.h"
-#include "src/core/lib/security/credentials/jwt/json_token.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+#include "src/core/lib/security/credentials/jwt/json_token.h"
+
class grpc_service_account_jwt_access_credentials
: public grpc_call_credentials {
public:
grpc_service_account_jwt_access_credentials(grpc_auth_json_key key,
gpr_timespec token_lifetime);
~grpc_service_account_jwt_access_credentials() override;
-
+
bool get_request_metadata(grpc_polling_entity* pollent,
grpc_auth_metadata_context context,
grpc_credentials_mdelem_array* md_array,
@@ -58,23 +58,23 @@ class grpc_service_account_jwt_access_credentials
private:
void reset_cache();
- // Have a simple cache for now with just 1 entry. We could have a map based on
- // the service_url for a more sophisticated one.
+ // Have a simple cache for now with just 1 entry. We could have a map based on
+ // the service_url for a more sophisticated one.
gpr_mu cache_mu_;
- struct {
+ struct {
grpc_mdelem jwt_md = GRPC_MDNULL;
char* service_url = nullptr;
- gpr_timespec jwt_expiration;
+ gpr_timespec jwt_expiration;
} cached_;
-
+
grpc_auth_json_key key_;
gpr_timespec jwt_lifetime_;
};
-
-// Private constructor for jwt credentials from an already parsed json key.
-// Takes ownership of the key.
+
+// Private constructor for jwt credentials from an already parsed json key.
+// Takes ownership of the key.
grpc_core::RefCountedPtr<grpc_call_credentials>
-grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
+grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
grpc_auth_json_key key, gpr_timespec token_lifetime);
-
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.h b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.h
index 2b1b55065f..66ddbf2206 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/jwt/jwt_verifier.h
@@ -1,64 +1,64 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/json/json.h"
-
-#include <grpc/slice.h>
-#include <grpc/support/time.h>
-
-/* --- Constants. --- */
-
-#define GRPC_OPENID_CONFIG_URL_SUFFIX "/.well-known/openid-configuration"
-#define GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN "gserviceaccount.com"
-#define GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX \
- "www.googleapis.com/robot/v1/metadata/x509"
-
-/* --- grpc_jwt_verifier_status. --- */
-
-typedef enum {
- GRPC_JWT_VERIFIER_OK = 0,
- GRPC_JWT_VERIFIER_BAD_SIGNATURE,
- GRPC_JWT_VERIFIER_BAD_FORMAT,
- GRPC_JWT_VERIFIER_BAD_AUDIENCE,
- GRPC_JWT_VERIFIER_KEY_RETRIEVAL_ERROR,
- GRPC_JWT_VERIFIER_TIME_CONSTRAINT_FAILURE,
- GRPC_JWT_VERIFIER_BAD_SUBJECT,
- GRPC_JWT_VERIFIER_GENERIC_ERROR
-} grpc_jwt_verifier_status;
-
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/json/json.h"
+
+#include <grpc/slice.h>
+#include <grpc/support/time.h>
+
+/* --- Constants. --- */
+
+#define GRPC_OPENID_CONFIG_URL_SUFFIX "/.well-known/openid-configuration"
+#define GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN "gserviceaccount.com"
+#define GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX \
+ "www.googleapis.com/robot/v1/metadata/x509"
+
+/* --- grpc_jwt_verifier_status. --- */
+
+typedef enum {
+ GRPC_JWT_VERIFIER_OK = 0,
+ GRPC_JWT_VERIFIER_BAD_SIGNATURE,
+ GRPC_JWT_VERIFIER_BAD_FORMAT,
+ GRPC_JWT_VERIFIER_BAD_AUDIENCE,
+ GRPC_JWT_VERIFIER_KEY_RETRIEVAL_ERROR,
+ GRPC_JWT_VERIFIER_TIME_CONSTRAINT_FAILURE,
+ GRPC_JWT_VERIFIER_BAD_SUBJECT,
+ GRPC_JWT_VERIFIER_GENERIC_ERROR
+} grpc_jwt_verifier_status;
+
const char* grpc_jwt_verifier_status_to_string(grpc_jwt_verifier_status status);
-
-/* --- grpc_jwt_claims. --- */
-
-typedef struct grpc_jwt_claims grpc_jwt_claims;
-
+
+/* --- grpc_jwt_claims. --- */
+
+typedef struct grpc_jwt_claims grpc_jwt_claims;
+
void grpc_jwt_claims_destroy(grpc_jwt_claims* claims);
-
-/* Returns the whole JSON tree of the claims. */
+
+/* Returns the whole JSON tree of the claims. */
const grpc_core::Json* grpc_jwt_claims_json(const grpc_jwt_claims* claims);
-
-/* Access to registered claims in https://tools.ietf.org/html/rfc7519#page-9 */
+
+/* Access to registered claims in https://tools.ietf.org/html/rfc7519#page-9 */
const char* grpc_jwt_claims_subject(const grpc_jwt_claims* claims);
const char* grpc_jwt_claims_issuer(const grpc_jwt_claims* claims);
const char* grpc_jwt_claims_id(const grpc_jwt_claims* claims);
@@ -66,57 +66,57 @@ const char* grpc_jwt_claims_audience(const grpc_jwt_claims* claims);
gpr_timespec grpc_jwt_claims_issued_at(const grpc_jwt_claims* claims);
gpr_timespec grpc_jwt_claims_expires_at(const grpc_jwt_claims* claims);
gpr_timespec grpc_jwt_claims_not_before(const grpc_jwt_claims* claims);
-
-/* --- grpc_jwt_verifier. --- */
-
-typedef struct grpc_jwt_verifier grpc_jwt_verifier;
-
+
+/* --- grpc_jwt_verifier. --- */
+
+typedef struct grpc_jwt_verifier grpc_jwt_verifier;
+
struct grpc_jwt_verifier_email_domain_key_url_mapping {
- /* The email domain is the part after the @ sign. */
+ /* The email domain is the part after the @ sign. */
const char* email_domain;
-
- /* The key url prefix will be used to get the public key from the issuer:
- https://<key_url_prefix>/<issuer_email>
- Therefore the key_url_prefix must NOT contain https://. */
+
+ /* The key url prefix will be used to get the public key from the issuer:
+ https://<key_url_prefix>/<issuer_email>
+ Therefore the key_url_prefix must NOT contain https://. */
const char* key_url_prefix;
};
-/* Globals to control the verifier. Not thread-safe. */
-extern gpr_timespec grpc_jwt_verifier_clock_skew;
+/* Globals to control the verifier. Not thread-safe. */
+extern gpr_timespec grpc_jwt_verifier_clock_skew;
extern grpc_millis grpc_jwt_verifier_max_delay;
-
-/* The verifier can be created with some custom mappings to help with key
- discovery in the case where the issuer is an email address.
- mappings can be NULL in which case num_mappings MUST be 0.
- A verifier object has one built-in mapping (unless overridden):
- GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN ->
- GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX.*/
+
+/* The verifier can be created with some custom mappings to help with key
+ discovery in the case where the issuer is an email address.
+ mappings can be NULL in which case num_mappings MUST be 0.
+ A verifier object has one built-in mapping (unless overridden):
+ GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN ->
+ GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX.*/
grpc_jwt_verifier* grpc_jwt_verifier_create(
const grpc_jwt_verifier_email_domain_key_url_mapping* mappings,
- size_t num_mappings);
-
-/*The verifier must not be destroyed if there are still outstanding callbacks.*/
+ size_t num_mappings);
+
+/*The verifier must not be destroyed if there are still outstanding callbacks.*/
void grpc_jwt_verifier_destroy(grpc_jwt_verifier* verifier);
-
-/* User provided callback that will be called when the verification of the JWT
- is done (maybe in another thread).
- It is the responsibility of the callee to call grpc_jwt_claims_destroy on
- the claims. */
+
+/* User provided callback that will be called when the verification of the JWT
+ is done (maybe in another thread).
+ It is the responsibility of the callee to call grpc_jwt_claims_destroy on
+ the claims. */
typedef void (*grpc_jwt_verification_done_cb)(void* user_data,
- grpc_jwt_verifier_status status,
+ grpc_jwt_verifier_status status,
grpc_jwt_claims* claims);
-
-/* Verifies for the JWT for the given expected audience. */
+
+/* Verifies for the JWT for the given expected audience. */
void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
grpc_pollset* pollset, const char* jwt,
const char* audience,
- grpc_jwt_verification_done_cb cb,
+ grpc_jwt_verification_done_cb cb,
void* user_data);
-
-/* --- TESTING ONLY exposed functions. --- */
-
+
+/* --- TESTING ONLY exposed functions. --- */
+
grpc_jwt_claims* grpc_jwt_claims_from_json(grpc_core::Json json);
grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims* claims,
const char* audience);
const char* grpc_jwt_issuer_email_domain(const char* issuer);
-
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h
index 1ba0ef64cc..fd886405cf 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h
@@ -1,67 +1,67 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
#include <grpc/grpc_security.h>
-#include "src/core/lib/json/json.h"
-#include "src/core/lib/security/credentials/credentials.h"
+#include "src/core/lib/json/json.h"
+#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/uri/uri_parser.h"
-
+
// Constants.
#define GRPC_STS_POST_MINIMAL_BODY_FORMAT_STRING \
"grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=%" \
"s&subject_token_type=%s"
-// auth_refresh_token parsing.
+// auth_refresh_token parsing.
struct grpc_auth_refresh_token {
const char* type;
char* client_id;
char* client_secret;
char* refresh_token;
};
-/// Returns 1 if the object is valid, 0 otherwise.
-int grpc_auth_refresh_token_is_valid(
+/// Returns 1 if the object is valid, 0 otherwise.
+int grpc_auth_refresh_token_is_valid(
const grpc_auth_refresh_token* refresh_token);
-
-/// Creates a refresh token object from string. Returns an invalid object if a
-/// parsing error has been encountered.
-grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string(
+
+/// Creates a refresh token object from string. Returns an invalid object if a
+/// parsing error has been encountered.
+grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string(
const char* json_string);
-
-/// Creates a refresh token object from parsed json. Returns an invalid object
-/// if a parsing error has been encountered.
-grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
+
+/// Creates a refresh token object from parsed json. Returns an invalid object
+/// if a parsing error has been encountered.
+grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
const grpc_core::Json& json);
-
-/// Destructs the object.
+
+/// Destructs the object.
void grpc_auth_refresh_token_destruct(grpc_auth_refresh_token* refresh_token);
-
-// -- Oauth2 Token Fetcher credentials --
-//
-// This object is a base for credentials that need to acquire an oauth2 token
-// from an http service.
-
+
+// -- Oauth2 Token Fetcher credentials --
+//
+// This object is a base for credentials that need to acquire an oauth2 token
+// from an http service.
+
struct grpc_oauth2_pending_get_request_metadata {
grpc_credentials_mdelem_array* md_array;
grpc_closure* on_request_metadata;
@@ -73,7 +73,7 @@ class grpc_oauth2_token_fetcher_credentials : public grpc_call_credentials {
public:
grpc_oauth2_token_fetcher_credentials();
~grpc_oauth2_token_fetcher_credentials() override;
-
+
bool get_request_metadata(grpc_polling_entity* pollent,
grpc_auth_metadata_context context,
grpc_credentials_mdelem_array* md_array,
@@ -103,13 +103,13 @@ class grpc_oauth2_token_fetcher_credentials : public grpc_call_credentials {
grpc_polling_entity pollent_;
};
-// Google refresh token credentials.
+// Google refresh token credentials.
class grpc_google_refresh_token_credentials final
: public grpc_oauth2_token_fetcher_credentials {
public:
grpc_google_refresh_token_credentials(grpc_auth_refresh_token refresh_token);
~grpc_google_refresh_token_credentials() override;
-
+
const grpc_auth_refresh_token& refresh_token() const {
return refresh_token_;
}
@@ -127,12 +127,12 @@ class grpc_google_refresh_token_credentials final
grpc_closure http_post_cb_closure_;
};
-// Access token credentials.
+// Access token credentials.
class grpc_access_token_credentials final : public grpc_call_credentials {
public:
grpc_access_token_credentials(const char* access_token);
~grpc_access_token_credentials() override;
-
+
bool get_request_metadata(grpc_polling_entity* pollent,
grpc_auth_metadata_context context,
grpc_credentials_mdelem_array* md_array,
@@ -148,18 +148,18 @@ class grpc_access_token_credentials final : public grpc_call_credentials {
grpc_mdelem access_token_md_;
};
-// Private constructor for refresh token credentials from an already parsed
-// refresh token. Takes ownership of the refresh token.
+// Private constructor for refresh token credentials from an already parsed
+// refresh token. Takes ownership of the refresh token.
grpc_core::RefCountedPtr<grpc_call_credentials>
-grpc_refresh_token_credentials_create_from_auth_refresh_token(
- grpc_auth_refresh_token token);
-
-// Exposed for testing only.
-grpc_credentials_status
-grpc_oauth2_token_fetcher_credentials_parse_server_response(
+grpc_refresh_token_credentials_create_from_auth_refresh_token(
+ grpc_auth_refresh_token token);
+
+// Exposed for testing only.
+grpc_credentials_status
+grpc_oauth2_token_fetcher_credentials_parse_server_response(
const struct grpc_http_response* response, grpc_mdelem* token_md,
grpc_millis* token_lifetime);
-
+
namespace grpc_core {
// Exposed for testing only. This function validates the options, ensuring that
// the required fields are set, and outputs the parsed URL of the STS token
@@ -168,4 +168,4 @@ grpc_error* ValidateStsCredentialsOptions(
const grpc_sts_credentials_options* options, grpc_uri** sts_url);
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/plugin/plugin_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/plugin/plugin_credentials.h
index 30309179db..78bca05fb9 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/plugin/plugin_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/plugin/plugin_credentials.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+
extern grpc_core::TraceFlag grpc_plugin_credentials_trace;
// This type is forward declared as a C struct and we cannot define it as a
@@ -48,7 +48,7 @@ struct grpc_plugin_credentials final : public grpc_call_credentials {
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) override;
-
+
void cancel_get_request_metadata(grpc_credentials_mdelem_array* md_array,
grpc_error* error) override;
@@ -69,4 +69,4 @@ struct grpc_plugin_credentials final : public grpc_call_credentials {
pending_request* pending_requests_ = nullptr;
};
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_PLUGIN_PLUGIN_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/credentials/ssl/ssl_credentials.h b/contrib/libs/grpc/src/core/lib/security/credentials/ssl/ssl_credentials.h
index 546e970087..4c90813f8d 100644
--- a/contrib/libs/grpc/src/core/lib/security/credentials/ssl/ssl_credentials.h
+++ b/contrib/libs/grpc/src/core/lib/security/credentials/ssl/ssl_credentials.h
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
-#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
-
+ *
+ */
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/security/credentials/credentials.h"
-
+#include "src/core/lib/security/credentials/credentials.h"
+
#include "src/core/lib/security/security_connector/ssl/ssl_security_connector.h"
-
+
class grpc_ssl_credentials : public grpc_channel_credentials {
public:
grpc_ssl_credentials(const char* pem_root_certs,
@@ -67,7 +67,7 @@ class grpc_ssl_server_credentials final : public grpc_server_credentials {
grpc_ssl_server_credentials(
const grpc_ssl_server_credentials_options& options);
~grpc_ssl_server_credentials() override;
-
+
grpc_core::RefCountedPtr<grpc_server_security_connector>
create_security_connector() override;
@@ -106,4 +106,4 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs(
void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp,
size_t num_key_cert_pairs);
-#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/transport/auth_filters.h b/contrib/libs/grpc/src/core/lib/security/transport/auth_filters.h
index 63c2b4f4fa..ae31b1d578 100644
--- a/contrib/libs/grpc/src/core/lib/security/transport/auth_filters.h
+++ b/contrib/libs/grpc/src/core/lib/security/transport/auth_filters.h
@@ -1,35 +1,35 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
-#define GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
+#define GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
+
#include <grpc/support/port_platform.h>
#include <grpc/grpc_security.h>
-#include "src/core/lib/channel/channel_stack.h"
-
-extern const grpc_channel_filter grpc_client_auth_filter;
-extern const grpc_channel_filter grpc_server_auth_filter;
-
+#include "src/core/lib/channel/channel_stack.h"
+
+extern const grpc_channel_filter grpc_client_auth_filter;
+extern const grpc_channel_filter grpc_server_auth_filter;
+
void grpc_auth_metadata_context_build(
const char* url_scheme, const grpc_slice& call_host,
const grpc_slice& call_method, grpc_auth_context* auth_context,
grpc_auth_metadata_context* auth_md_context);
-#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/transport/secure_endpoint.h b/contrib/libs/grpc/src/core/lib/security/transport/secure_endpoint.h
index 38b5fbfcd5..e7e3351678 100644
--- a/contrib/libs/grpc/src/core/lib/security/transport/secure_endpoint.h
+++ b/contrib/libs/grpc/src/core/lib/security/transport/secure_endpoint.h
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
-#define GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
+#define GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice.h>
-#include "src/core/lib/iomgr/endpoint.h"
-
-struct tsi_frame_protector;
+#include <grpc/slice.h>
+#include "src/core/lib/iomgr/endpoint.h"
+
+struct tsi_frame_protector;
struct tsi_zero_copy_grpc_protector;
-
+
extern grpc_core::TraceFlag grpc_trace_secure_endpoint;
-
+
/* Takes ownership of protector, zero_copy_protector, and to_wrap, and refs
* leftover_slices. If zero_copy_protector is not NULL, protector will never be
* used. */
@@ -37,5 +37,5 @@ grpc_endpoint* grpc_secure_endpoint_create(
struct tsi_zero_copy_grpc_protector* zero_copy_protector,
grpc_endpoint* to_wrap, grpc_slice* leftover_slices,
size_t leftover_nslices);
-
-#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/transport/security_handshaker.h b/contrib/libs/grpc/src/core/lib/security/transport/security_handshaker.h
index f4b22ef318..a9e1fe83d4 100644
--- a/contrib/libs/grpc/src/core/lib/security/transport/security_handshaker.h
+++ b/contrib/libs/grpc/src/core/lib/security/transport/security_handshaker.h
@@ -1,39 +1,39 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H
-#define GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H
+#define GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/channel/handshaker.h"
+#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/security/security_connector/security_connector.h"
-
+
namespace grpc_core {
-/// Creates a security handshaker using \a handshaker.
+/// Creates a security handshaker using \a handshaker.
RefCountedPtr<Handshaker> SecurityHandshakerCreate(
tsi_handshaker* handshaker, grpc_security_connector* connector,
const grpc_channel_args* args);
-
-/// Registers security handshaker factories.
+
+/// Registers security handshaker factories.
void SecurityRegisterHandshakerFactories();
-
+
} // namespace grpc_core
// TODO(arjunroy): This is transitional to account for the new handshaker API
@@ -42,4 +42,4 @@ grpc_handshaker* grpc_security_handshaker_create(
tsi_handshaker* handshaker, grpc_security_connector* connector,
const grpc_channel_args* args);
-#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */
+#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/transport/tsi_error.h b/contrib/libs/grpc/src/core/lib/security/transport/tsi_error.h
index 4d7377c307..16e04f70f1 100644
--- a/contrib/libs/grpc/src/core/lib/security/transport/tsi_error.h
+++ b/contrib/libs/grpc/src/core/lib/security/transport/tsi_error.h
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H
-#define GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H
+#define GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/error.h"
#include "src/core/tsi/transport_security_interface.h"
-
+
grpc_error* grpc_set_tsi_error_result(grpc_error* error, tsi_result result);
-
-#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */
diff --git a/contrib/libs/grpc/src/core/lib/security/util/json_util.h b/contrib/libs/grpc/src/core/lib/security/util/json_util.h
index 3338c6569d..42f7005e00 100644
--- a/contrib/libs/grpc/src/core/lib/security/util/json_util.h
+++ b/contrib/libs/grpc/src/core/lib/security/util/json_util.h
@@ -1,44 +1,44 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H
-#define GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H
+#define GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
+#include <stdbool.h>
+
#include "src/core/lib/iomgr/error.h"
-#include "src/core/lib/json/json.h"
-
-// Constants.
-#define GRPC_AUTH_JSON_TYPE_INVALID "invalid"
-#define GRPC_AUTH_JSON_TYPE_SERVICE_ACCOUNT "service_account"
-#define GRPC_AUTH_JSON_TYPE_AUTHORIZED_USER "authorized_user"
-
-// Gets a child property from a json node.
+#include "src/core/lib/json/json.h"
+
+// Constants.
+#define GRPC_AUTH_JSON_TYPE_INVALID "invalid"
+#define GRPC_AUTH_JSON_TYPE_SERVICE_ACCOUNT "service_account"
+#define GRPC_AUTH_JSON_TYPE_AUTHORIZED_USER "authorized_user"
+
+// Gets a child property from a json node.
const char* grpc_json_get_string_property(const grpc_core::Json& json,
const char* prop_name,
grpc_error** error);
-
-// Copies the value of the json child property specified by prop_name.
-// Returns false if the property was not found.
+
+// Copies the value of the json child property specified by prop_name.
+// Returns false if the property was not found.
bool grpc_copy_json_string_property(const grpc_core::Json& json,
const char* prop_name, char** copied_value);
-
-#endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */
+
+#endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */
diff --git a/contrib/libs/grpc/src/core/lib/slice/percent_encoding.h b/contrib/libs/grpc/src/core/lib/slice/percent_encoding.h
index 1d703b18a3..43b20f090f 100644
--- a/contrib/libs/grpc/src/core/lib/slice/percent_encoding.h
+++ b/contrib/libs/grpc/src/core/lib/slice/percent_encoding.h
@@ -1,65 +1,65 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
-#define GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
-
-/* Percent encoding and decoding of slices.
- Transforms arbitrary strings into safe-for-transmission strings by using
- variants of percent encoding (RFC 3986).
- Two major variants are supplied: one that strictly matches URL encoding,
- and another which applies percent encoding only to non-http2 header
- bytes (the 'compatible' variant) */
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
+#define GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
+
+/* Percent encoding and decoding of slices.
+ Transforms arbitrary strings into safe-for-transmission strings by using
+ variants of percent encoding (RFC 3986).
+ Two major variants are supplied: one that strictly matches URL encoding,
+ and another which applies percent encoding only to non-http2 header
+ bytes (the 'compatible' variant) */
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
-#include <grpc/slice.h>
-
-/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
- grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
- Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines
- */
-extern const uint8_t grpc_url_percent_encoding_unreserved_bytes[256 / 8];
-/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
- grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
- Flags ascii7 non-control characters excluding '%' as unreserved bytes for the
- percent encoding routines */
-extern const uint8_t grpc_compatible_percent_encoding_unreserved_bytes[256 / 8];
-
-/* Percent-encode a slice, returning the new slice (this cannot fail):
- unreserved_bytes is a bitfield indicating which bytes are considered
- unreserved and thus do not need percent encoding */
+#include <stdbool.h>
+
+#include <grpc/slice.h>
+
+/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
+ grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
+ Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines
+ */
+extern const uint8_t grpc_url_percent_encoding_unreserved_bytes[256 / 8];
+/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
+ grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
+ Flags ascii7 non-control characters excluding '%' as unreserved bytes for the
+ percent encoding routines */
+extern const uint8_t grpc_compatible_percent_encoding_unreserved_bytes[256 / 8];
+
+/* Percent-encode a slice, returning the new slice (this cannot fail):
+ unreserved_bytes is a bitfield indicating which bytes are considered
+ unreserved and thus do not need percent encoding */
grpc_slice grpc_percent_encode_slice(const grpc_slice& slice,
const uint8_t* unreserved_bytes);
-/* Percent-decode a slice, strictly.
- If the input is legal (contains no unreserved bytes, and legal % encodings),
- returns true and sets *slice_out to the decoded slice.
- If the input is not legal, returns false and leaves *slice_out untouched.
- unreserved_bytes is a bitfield indicating which bytes are considered
- unreserved and thus do not need percent encoding */
+/* Percent-decode a slice, strictly.
+ If the input is legal (contains no unreserved bytes, and legal % encodings),
+ returns true and sets *slice_out to the decoded slice.
+ If the input is not legal, returns false and leaves *slice_out untouched.
+ unreserved_bytes is a bitfield indicating which bytes are considered
+ unreserved and thus do not need percent encoding */
bool grpc_strict_percent_decode_slice(const grpc_slice& slice_in,
const uint8_t* unreserved_bytes,
grpc_slice* slice_out);
-/* Percent-decode a slice, permissively.
- If a % triplet can not be decoded, pass it through verbatim.
- This cannot fail. */
+/* Percent-decode a slice, permissively.
+ If a % triplet can not be decoded, pass it through verbatim.
+ This cannot fail. */
grpc_slice grpc_permissive_percent_decode_slice(const grpc_slice& slice_in);
-
-#endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */
+
+#endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */
diff --git a/contrib/libs/grpc/src/core/lib/slice/slice_internal.h b/contrib/libs/grpc/src/core/lib/slice/slice_internal.h
index 2880cd1fb1..8a17b6e72e 100644
--- a/contrib/libs/grpc/src/core/lib/slice/slice_internal.h
+++ b/contrib/libs/grpc/src/core/lib/slice/slice_internal.h
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
-#define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
+#define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
+
#include <grpc/support/port_platform.h>
#include <grpc/support/log.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <string.h>
-
+
#include "src/core/lib/gpr/murmur_hash.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted.h"
@@ -279,7 +279,7 @@ void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer* sb);
void grpc_slice_buffer_partial_unref_internal(grpc_slice_buffer* sb,
size_t idx);
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer* sb);
-
+
// Returns a pointer to the first slice in the slice buffer without giving
// ownership to or a reference count on that slice.
inline grpc_slice* grpc_slice_buffer_peek_first(grpc_slice_buffer* sb) {
@@ -362,4 +362,4 @@ inline bool operator==(const grpc_slice& s1, const grpc_slice& s2) {
return grpc_slice_eq(s1, s2);
}
-#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */
+#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */
diff --git a/contrib/libs/grpc/src/core/lib/slice/slice_string_helpers.h b/contrib/libs/grpc/src/core/lib/slice/slice_string_helpers.h
index b9ad320765..6551a6df75 100644
--- a/contrib/libs/grpc/src/core/lib/slice/slice_string_helpers.h
+++ b/contrib/libs/grpc/src/core/lib/slice/slice_string_helpers.h
@@ -1,49 +1,49 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
-#define GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
+#define GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
+
#include <grpc/support/port_platform.h>
#include <stdbool.h>
-#include <stddef.h>
-
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-
+#include <stddef.h>
+
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+
#include "src/core/lib/gpr/string.h"
-
-/* Calls gpr_dump on a slice. */
+
+/* Calls gpr_dump on a slice. */
char* grpc_dump_slice(const grpc_slice& slice, uint32_t flags);
/* Calls gpr_dump on a slice and returns the result as a slice. */
grpc_slice grpc_dump_slice_to_slice(const grpc_slice& slice, uint32_t flags);
-
-/** Split \a str by the separator \a sep. Results are stored in \a dst, which
- * should be a properly initialized instance. */
+
+/** Split \a str by the separator \a sep. Results are stored in \a dst, which
+ * should be a properly initialized instance. */
void grpc_slice_split(grpc_slice str, const char* sep, grpc_slice_buffer* dst);
-
+
/** Split \a str by the separator \a sep and remove the leading and trailing
* spaces of each resulting token. Results are stored in \a dst, which should be
* a properly initialized instance. */
void grpc_slice_split_without_space(grpc_slice str, const char* sep,
grpc_slice_buffer* dst);
-
+
bool grpc_parse_slice_to_uint32(grpc_slice str, uint32_t* result);
-#endif /* GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H */
+#endif /* GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/README.md b/contrib/libs/grpc/src/core/lib/surface/README.md
index c809639055..74cbd71131 100644
--- a/contrib/libs/grpc/src/core/lib/surface/README.md
+++ b/contrib/libs/grpc/src/core/lib/surface/README.md
@@ -1,4 +1,4 @@
-# Surface
-
-Surface provides the bulk of the gRPC Core public API, and translates it into
-calls against core components.
+# Surface
+
+Surface provides the bulk of the gRPC Core public API, and translates it into
+calls against core components.
diff --git a/contrib/libs/grpc/src/core/lib/surface/api_trace.h b/contrib/libs/grpc/src/core/lib/surface/api_trace.h
index 4b0275a184..51d1f52223 100644
--- a/contrib/libs/grpc/src/core/lib/surface/api_trace.h
+++ b/contrib/libs/grpc/src/core/lib/surface/api_trace.h
@@ -1,52 +1,52 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_API_TRACE_H
-#define GRPC_CORE_LIB_SURFACE_API_TRACE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_API_TRACE_H
+#define GRPC_CORE_LIB_SURFACE_API_TRACE_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/support/log.h>
-#include "src/core/lib/debug/trace.h"
-
+#include <grpc/support/log.h>
+#include "src/core/lib/debug/trace.h"
+
extern grpc_core::TraceFlag grpc_api_trace;
-
-/* Provide unwrapping macros because we're in C89 and variadic macros weren't
- introduced until C99... */
-#define GRPC_API_TRACE_UNWRAP0()
-#define GRPC_API_TRACE_UNWRAP1(a) , a
-#define GRPC_API_TRACE_UNWRAP2(a, b) , a, b
-#define GRPC_API_TRACE_UNWRAP3(a, b, c) , a, b, c
-#define GRPC_API_TRACE_UNWRAP4(a, b, c, d) , a, b, c, d
-#define GRPC_API_TRACE_UNWRAP5(a, b, c, d, e) , a, b, c, d, e
-#define GRPC_API_TRACE_UNWRAP6(a, b, c, d, e, f) , a, b, c, d, e, f
-#define GRPC_API_TRACE_UNWRAP7(a, b, c, d, e, f, g) , a, b, c, d, e, f, g
-#define GRPC_API_TRACE_UNWRAP8(a, b, c, d, e, f, g, h) , a, b, c, d, e, f, g, h
-#define GRPC_API_TRACE_UNWRAP9(a, b, c, d, e, f, g, h, i) \
- , a, b, c, d, e, f, g, h, i
-#define GRPC_API_TRACE_UNWRAP10(a, b, c, d, e, f, g, h, i, j) \
- , a, b, c, d, e, f, g, h, i, j
-
-/* Due to the limitations of C89's preprocessor, the arity of the var-arg list
- 'nargs' must be specified. */
-#define GRPC_API_TRACE(fmt, nargs, args) \
+
+/* Provide unwrapping macros because we're in C89 and variadic macros weren't
+ introduced until C99... */
+#define GRPC_API_TRACE_UNWRAP0()
+#define GRPC_API_TRACE_UNWRAP1(a) , a
+#define GRPC_API_TRACE_UNWRAP2(a, b) , a, b
+#define GRPC_API_TRACE_UNWRAP3(a, b, c) , a, b, c
+#define GRPC_API_TRACE_UNWRAP4(a, b, c, d) , a, b, c, d
+#define GRPC_API_TRACE_UNWRAP5(a, b, c, d, e) , a, b, c, d, e
+#define GRPC_API_TRACE_UNWRAP6(a, b, c, d, e, f) , a, b, c, d, e, f
+#define GRPC_API_TRACE_UNWRAP7(a, b, c, d, e, f, g) , a, b, c, d, e, f, g
+#define GRPC_API_TRACE_UNWRAP8(a, b, c, d, e, f, g, h) , a, b, c, d, e, f, g, h
+#define GRPC_API_TRACE_UNWRAP9(a, b, c, d, e, f, g, h, i) \
+ , a, b, c, d, e, f, g, h, i
+#define GRPC_API_TRACE_UNWRAP10(a, b, c, d, e, f, g, h, i, j) \
+ , a, b, c, d, e, f, g, h, i, j
+
+/* Due to the limitations of C89's preprocessor, the arity of the var-arg list
+ 'nargs' must be specified. */
+#define GRPC_API_TRACE(fmt, nargs, args) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace)) { \
- gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \
- }
-
-#endif /* GRPC_CORE_LIB_SURFACE_API_TRACE_H */
+ gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \
+ }
+
+#endif /* GRPC_CORE_LIB_SURFACE_API_TRACE_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/call.h b/contrib/libs/grpc/src/core/lib/surface/call.h
index f385533d48..34d01db902 100644
--- a/contrib/libs/grpc/src/core/lib/surface/call.h
+++ b/contrib/libs/grpc/src/core/lib/surface/call.h
@@ -1,126 +1,126 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_CALL_H
-#define GRPC_CORE_LIB_SURFACE_CALL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_CALL_H
+#define GRPC_CORE_LIB_SURFACE_CALL_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/channel/context.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/arena.h"
-#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h"
-
-#include <grpc/grpc.h>
-#include <grpc/impl/codegen/compression_types.h>
-
+
+#include <grpc/grpc.h>
+#include <grpc/impl/codegen/compression_types.h>
+
typedef void (*grpc_ioreq_completion_func)(grpc_call* call, int success,
void* user_data);
-
-typedef struct grpc_call_create_args {
+
+typedef struct grpc_call_create_args {
grpc_channel* channel;
grpc_core::Server* server;
-
+
grpc_call* parent;
- uint32_t propagation_mask;
-
+ uint32_t propagation_mask;
+
grpc_completion_queue* cq;
- /* if not NULL, it'll be used in lieu of cq */
+ /* if not NULL, it'll be used in lieu of cq */
grpc_pollset_set* pollset_set_alternative;
-
+
const void* server_transport_data;
-
+
grpc_mdelem* add_initial_metadata;
- size_t add_initial_metadata_count;
-
+ size_t add_initial_metadata_count;
+
grpc_millis send_deadline;
-} grpc_call_create_args;
-
-/* Create a new call based on \a args.
- Regardless of success or failure, always returns a valid new call into *call
- */
+} grpc_call_create_args;
+
+/* Create a new call based on \a args.
+ Regardless of success or failure, always returns a valid new call into *call
+ */
grpc_error* grpc_call_create(const grpc_call_create_args* args,
grpc_call** call);
-
+
void grpc_call_set_completion_queue(grpc_call* call, grpc_completion_queue* cq);
-
+
#ifndef NDEBUG
void grpc_call_internal_ref(grpc_call* call, const char* reason);
void grpc_call_internal_unref(grpc_call* call, const char* reason);
-#define GRPC_CALL_INTERNAL_REF(call, reason) \
- grpc_call_internal_ref(call, reason)
+#define GRPC_CALL_INTERNAL_REF(call, reason) \
+ grpc_call_internal_ref(call, reason)
#define GRPC_CALL_INTERNAL_UNREF(call, reason) \
grpc_call_internal_unref(call, reason)
-#else
+#else
void grpc_call_internal_ref(grpc_call* call);
void grpc_call_internal_unref(grpc_call* call);
-#define GRPC_CALL_INTERNAL_REF(call, reason) grpc_call_internal_ref(call)
+#define GRPC_CALL_INTERNAL_REF(call, reason) grpc_call_internal_ref(call)
#define GRPC_CALL_INTERNAL_UNREF(call, reason) grpc_call_internal_unref(call)
-#endif
-
+#endif
+
grpc_core::Arena* grpc_call_get_arena(grpc_call* call);
grpc_call_stack* grpc_call_get_call_stack(grpc_call* call);
-
+
grpc_call_error grpc_call_start_batch_and_execute(grpc_call* call,
const grpc_op* ops,
- size_t nops,
+ size_t nops,
grpc_closure* closure);
-
+
/* gRPC core internal version of grpc_call_cancel that does not create
* exec_ctx. */
void grpc_call_cancel_internal(grpc_call* call);
-/* Given the top call_element, get the call object. */
+/* Given the top call_element, get the call object. */
grpc_call* grpc_call_from_top_element(grpc_call_element* surface_element);
-
+
void grpc_call_log_batch(const char* file, int line, gpr_log_severity severity,
const grpc_op* ops, size_t nops);
-
-/* Set a context pointer.
- No thread safety guarantees are made wrt this value. */
+
+/* Set a context pointer.
+ No thread safety guarantees are made wrt this value. */
/* TODO(#9731): add exec_ctx to destroy */
void grpc_call_context_set(grpc_call* call, grpc_context_index elem,
void* value, void (*destroy)(void* value));
-/* Get a context pointer. */
+/* Get a context pointer. */
void* grpc_call_context_get(grpc_call* call, grpc_context_index elem);
-
+
#define GRPC_CALL_LOG_BATCH(sev, ops, nops) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace)) { \
grpc_call_log_batch(sev, ops, nops); \
} \
} while (0)
-
+
uint8_t grpc_call_is_client(grpc_call* call);
-
+
/* Get the estimated memory size for a call BESIDES the call stack. Combined
* with the size of the call stack, it helps estimate the arena size for the
* initial call. */
size_t grpc_call_get_initial_size_estimate();
-/* Return an appropriate compression algorithm for the requested compression \a
- * level in the context of \a call. */
-grpc_compression_algorithm grpc_call_compression_for_level(
+/* Return an appropriate compression algorithm for the requested compression \a
+ * level in the context of \a call. */
+grpc_compression_algorithm grpc_call_compression_for_level(
grpc_call* call, grpc_compression_level level);
-
+
extern grpc_core::TraceFlag grpc_call_error_trace;
extern grpc_core::TraceFlag grpc_compression_trace;
-
-#endif /* GRPC_CORE_LIB_SURFACE_CALL_H */
+
+#endif /* GRPC_CORE_LIB_SURFACE_CALL_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/call_test_only.h b/contrib/libs/grpc/src/core/lib/surface/call_test_only.h
index c15be27d69..dbd1a866ca 100644
--- a/contrib/libs/grpc/src/core/lib/surface/call_test_only.h
+++ b/contrib/libs/grpc/src/core/lib/surface/call_test_only.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
-#define GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
+#define GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
-
+#include <grpc/grpc.h>
+
/** Return the message compression algorithm from \a call.
- *
- * \warning This function should \b only be used in test code. */
-grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(
+ *
+ * \warning This function should \b only be used in test code. */
+grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(
grpc_call* call);
-
-/** Return the message flags from \a call.
- *
- * \warning This function should \b only be used in test code. */
+
+/** Return the message flags from \a call.
+ *
+ * \warning This function should \b only be used in test code. */
uint32_t grpc_call_test_only_get_message_flags(grpc_call* call);
-
-/** Returns a bitset for the encodings (compression algorithms) supported by \a
- * call's peer.
- *
- * To be indexed by grpc_compression_algorithm enum values. */
+
+/** Returns a bitset for the encodings (compression algorithms) supported by \a
+ * call's peer.
+ *
+ * To be indexed by grpc_compression_algorithm enum values. */
uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call* call);
-
-#endif /* GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H */
+
+#endif /* GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/channel.h b/contrib/libs/grpc/src/core/lib/surface/channel.h
index 8f0f4233b6..e49b9261f7 100644
--- a/contrib/libs/grpc/src/core/lib/surface/channel.h
+++ b/contrib/libs/grpc/src/core/lib/surface/channel.h
@@ -1,41 +1,41 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_H
-#define GRPC_CORE_LIB_SURFACE_CHANNEL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_H
+
#include <grpc/support/port_platform.h>
#include <map>
-#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/gprpp/manual_constructor.h"
-#include "src/core/lib/surface/channel_stack_type.h"
+#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/metadata.h"
-
+
grpc_channel* grpc_channel_create(const char* target,
const grpc_channel_args* args,
- grpc_channel_stack_type channel_stack_type,
+ grpc_channel_stack_type channel_stack_type,
grpc_transport* optional_transport,
grpc_resource_user* resource_user = nullptr);
-
+
/** The same as grpc_channel_destroy, but doesn't create an ExecCtx, and so
* is safe to use from within core. */
void grpc_channel_destroy_internal(grpc_channel* channel);
@@ -44,22 +44,22 @@ grpc_channel* grpc_channel_create_with_builder(
grpc_channel_stack_builder* builder,
grpc_channel_stack_type channel_stack_type);
-/** Create a call given a grpc_channel, in order to call \a method.
- Progress is tied to activity on \a pollset_set. The returned call object is
- meant to be used with \a grpc_call_start_batch_and_execute, which relies on
- callbacks to signal completions. \a method and \a host need
- only live through the invocation of this function. If \a parent_call is
- non-NULL, it must be a server-side call. It will be used to propagate
- properties from the server call to this new client call, depending on the
- value of \a propagation_mask (see propagation_bits.h for possible values) */
+/** Create a call given a grpc_channel, in order to call \a method.
+ Progress is tied to activity on \a pollset_set. The returned call object is
+ meant to be used with \a grpc_call_start_batch_and_execute, which relies on
+ callbacks to signal completions. \a method and \a host need
+ only live through the invocation of this function. If \a parent_call is
+ non-NULL, it must be a server-side call. It will be used to propagate
+ properties from the server call to this new client call, depending on the
+ value of \a propagation_mask (see propagation_bits.h for possible values) */
grpc_call* grpc_channel_create_pollset_set_call(
grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask,
grpc_pollset_set* pollset_set, const grpc_slice& method,
const grpc_slice* host, grpc_millis deadline, void* reserved);
-
-/** Get a (borrowed) pointer to this channels underlying channel stack */
+
+/** Get a (borrowed) pointer to this channels underlying channel stack */
grpc_channel_stack* grpc_channel_get_channel_stack(grpc_channel* channel);
-
+
grpc_core::channelz::ChannelNode* grpc_channel_get_channelz_node(
grpc_channel* channel);
@@ -144,30 +144,30 @@ inline void grpc_channel_internal_unref(grpc_channel* channel,
const char* reason) {
GRPC_CHANNEL_STACK_UNREF(CHANNEL_STACK_FROM_CHANNEL(channel), reason);
}
-#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
- grpc_channel_internal_ref(channel, reason)
+#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
+ grpc_channel_internal_ref(channel, reason)
#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason) \
grpc_channel_internal_unref(channel, reason)
-#else
+#else
inline void grpc_channel_internal_ref(grpc_channel* channel) {
GRPC_CHANNEL_STACK_REF(CHANNEL_STACK_FROM_CHANNEL(channel), "unused");
}
inline void grpc_channel_internal_unref(grpc_channel* channel) {
GRPC_CHANNEL_STACK_UNREF(CHANNEL_STACK_FROM_CHANNEL(channel), "unused");
}
-#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
- grpc_channel_internal_ref(channel)
+#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
+ grpc_channel_internal_ref(channel)
#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason) \
grpc_channel_internal_unref(channel)
-#endif
-
+#endif
+
// Return the channel's compression options.
-grpc_compression_options grpc_channel_compression_options(
+grpc_compression_options grpc_channel_compression_options(
const grpc_channel* channel);
-
+
// Ping the channels peer (load balanced channels will select one sub-channel to
// ping); if the channel is not connected, posts a failed.
void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq,
void* tag, void* reserved);
-#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/channel_init.h b/contrib/libs/grpc/src/core/lib/surface/channel_init.h
index 12337945a0..d17a721606 100644
--- a/contrib/libs/grpc/src/core/lib/surface/channel_init.h
+++ b/contrib/libs/grpc/src/core/lib/surface/channel_init.h
@@ -1,78 +1,78 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
-#define GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/channel/channel_stack_builder.h"
-#include "src/core/lib/surface/channel_stack_type.h"
-#include "src/core/lib/transport/transport.h"
-
-#define GRPC_CHANNEL_INIT_BUILTIN_PRIORITY 10000
-
-/// This module provides a way for plugins (and the grpc core library itself)
-/// to register mutators for channel stacks.
-/// It also provides a universal entry path to run those mutators to build
-/// a channel stack for various subsystems.
-
-/// One stage of mutation: call functions against \a builder to influence the
-/// finally constructed channel stack
+#include "src/core/lib/channel/channel_stack_builder.h"
+#include "src/core/lib/surface/channel_stack_type.h"
+#include "src/core/lib/transport/transport.h"
+
+#define GRPC_CHANNEL_INIT_BUILTIN_PRIORITY 10000
+
+/// This module provides a way for plugins (and the grpc core library itself)
+/// to register mutators for channel stacks.
+/// It also provides a universal entry path to run those mutators to build
+/// a channel stack for various subsystems.
+
+/// One stage of mutation: call functions against \a builder to influence the
+/// finally constructed channel stack
typedef bool (*grpc_channel_init_stage)(grpc_channel_stack_builder* builder,
void* arg);
-
-/// Global initialization of the system
-void grpc_channel_init_init(void);
-
-/// Register one stage of mutators.
-/// Stages are run in priority order (lowest to highest), and then in
-/// registration order (in the case of a tie).
-/// Stages are registered against one of the pre-determined channel stack
-/// types.
+
+/// Global initialization of the system
+void grpc_channel_init_init(void);
+
+/// Register one stage of mutators.
+/// Stages are run in priority order (lowest to highest), and then in
+/// registration order (in the case of a tie).
+/// Stages are registered against one of the pre-determined channel stack
+/// types.
/// If the channel stack type is GRPC_CLIENT_SUBCHANNEL, the caller should
/// ensure that subchannels with different filter lists will always have
/// different channel args. This requires setting a channel arg in case the
/// registration function relies on some condition other than channel args to
/// decide whether to add a filter or not.
-void grpc_channel_init_register_stage(grpc_channel_stack_type type,
- int priority,
- grpc_channel_init_stage stage_fn,
+void grpc_channel_init_register_stage(grpc_channel_stack_type type,
+ int priority,
+ grpc_channel_init_stage stage_fn,
void* stage_arg);
-
-/// Finalize registration. No more calls to grpc_channel_init_register_stage are
-/// allowed.
-void grpc_channel_init_finalize(void);
-/// Shutdown the channel init system
-void grpc_channel_init_shutdown(void);
-
-/// Construct a channel stack of some sort: see channel_stack.h for details
-/// \a type is the type of channel stack to create
-/// \a prefix_bytes is the number of bytes before the channel stack to allocate
-/// \a args are configuration arguments for the channel stack
-/// \a initial_refs is the initial refcount to give the channel stack
-/// \a destroy and \a destroy_arg specify how to destroy the channel stack
-/// if destroy_arg is NULL, the returned value from this function will be
-/// substituted
-/// \a optional_transport is either NULL or a constructed transport object
-/// Returns a pointer to the base of the memory allocated (the actual channel
-/// stack object will be prefix_bytes past that pointer)
+
+/// Finalize registration. No more calls to grpc_channel_init_register_stage are
+/// allowed.
+void grpc_channel_init_finalize(void);
+/// Shutdown the channel init system
+void grpc_channel_init_shutdown(void);
+
+/// Construct a channel stack of some sort: see channel_stack.h for details
+/// \a type is the type of channel stack to create
+/// \a prefix_bytes is the number of bytes before the channel stack to allocate
+/// \a args are configuration arguments for the channel stack
+/// \a initial_refs is the initial refcount to give the channel stack
+/// \a destroy and \a destroy_arg specify how to destroy the channel stack
+/// if destroy_arg is NULL, the returned value from this function will be
+/// substituted
+/// \a optional_transport is either NULL or a constructed transport object
+/// Returns a pointer to the base of the memory allocated (the actual channel
+/// stack object will be prefix_bytes past that pointer)
bool grpc_channel_init_create_stack(grpc_channel_stack_builder* builder,
- grpc_channel_stack_type type);
-
-#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H */
+ grpc_channel_stack_type type);
+
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/channel_stack_type.h b/contrib/libs/grpc/src/core/lib/surface/channel_stack_type.h
index 6eb92e3008..8a3c08e1cc 100644
--- a/contrib/libs/grpc/src/core/lib/surface/channel_stack_type.h
+++ b/contrib/libs/grpc/src/core/lib/surface/channel_stack_type.h
@@ -1,47 +1,47 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
-#define GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
-typedef enum {
- // normal top-half client channel with load-balancing, connection management
- GRPC_CLIENT_CHANNEL,
- // bottom-half of a client channel: everything that happens post-load
- // balancing (bound to a specific transport)
- GRPC_CLIENT_SUBCHANNEL,
- // a permanently broken client channel
- GRPC_CLIENT_LAME_CHANNEL,
- // a directly connected client channel (without load-balancing, directly talks
- // to a transport)
- GRPC_CLIENT_DIRECT_CHANNEL,
- // server side channel
- GRPC_SERVER_CHANNEL,
- // must be last
- GRPC_NUM_CHANNEL_STACK_TYPES
-} grpc_channel_stack_type;
-
-bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type);
-
+#include <stdbool.h>
+
+typedef enum {
+ // normal top-half client channel with load-balancing, connection management
+ GRPC_CLIENT_CHANNEL,
+ // bottom-half of a client channel: everything that happens post-load
+ // balancing (bound to a specific transport)
+ GRPC_CLIENT_SUBCHANNEL,
+ // a permanently broken client channel
+ GRPC_CLIENT_LAME_CHANNEL,
+ // a directly connected client channel (without load-balancing, directly talks
+ // to a transport)
+ GRPC_CLIENT_DIRECT_CHANNEL,
+ // server side channel
+ GRPC_SERVER_CHANNEL,
+ // must be last
+ GRPC_NUM_CHANNEL_STACK_TYPES
+} grpc_channel_stack_type;
+
+bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type);
+
const char* grpc_channel_stack_type_string(grpc_channel_stack_type type);
-#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/completion_queue.h b/contrib/libs/grpc/src/core/lib/surface/completion_queue.h
index 78f2c686a2..4a114be828 100644
--- a/contrib/libs/grpc/src/core/lib/surface/completion_queue.h
+++ b/contrib/libs/grpc/src/core/lib/surface/completion_queue.h
@@ -1,97 +1,97 @@
-/*
- *
+/*
+ *
* Copyright 2015-2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
-#define GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
-
-/* Internal API for completion queues */
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
+#define GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
+
+/* Internal API for completion queues */
+
#include <grpc/support/port_platform.h>
-#include <grpc/grpc.h>
+#include <grpc/grpc.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/manual_constructor.h"
-#include "src/core/lib/iomgr/pollset.h"
-
-/* These trace flags default to 1. The corresponding lines are only traced
- if grpc_api_trace is also truthy */
+#include "src/core/lib/iomgr/pollset.h"
+
+/* These trace flags default to 1. The corresponding lines are only traced
+ if grpc_api_trace is also truthy */
extern grpc_core::TraceFlag grpc_cq_pluck_trace;
extern grpc_core::TraceFlag grpc_trace_operation_failures;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount;
-
-typedef struct grpc_cq_completion {
+
+typedef struct grpc_cq_completion {
grpc_core::ManualConstructor<grpc_core::MultiProducerSingleConsumerQueue>
node;
- /** user supplied tag */
+ /** user supplied tag */
void* tag;
- /** done callback - called when this queue element is no longer
- needed by the completion queue */
+ /** done callback - called when this queue element is no longer
+ needed by the completion queue */
void (*done)(void* done_arg, struct grpc_cq_completion* c);
void* done_arg;
- /** next pointer; low bit is used to indicate success or not */
- uintptr_t next;
-} grpc_cq_completion;
-
+ /** next pointer; low bit is used to indicate success or not */
+ uintptr_t next;
+} grpc_cq_completion;
+
#ifndef NDEBUG
void grpc_cq_internal_ref(grpc_completion_queue* cc, const char* reason,
const char* file, int line);
void grpc_cq_internal_unref(grpc_completion_queue* cc, const char* reason,
const char* file, int line);
-#define GRPC_CQ_INTERNAL_REF(cc, reason) \
- grpc_cq_internal_ref(cc, reason, __FILE__, __LINE__)
-#define GRPC_CQ_INTERNAL_UNREF(cc, reason) \
- grpc_cq_internal_unref(cc, reason, __FILE__, __LINE__)
-#else
+#define GRPC_CQ_INTERNAL_REF(cc, reason) \
+ grpc_cq_internal_ref(cc, reason, __FILE__, __LINE__)
+#define GRPC_CQ_INTERNAL_UNREF(cc, reason) \
+ grpc_cq_internal_unref(cc, reason, __FILE__, __LINE__)
+#else
void grpc_cq_internal_ref(grpc_completion_queue* cc);
void grpc_cq_internal_unref(grpc_completion_queue* cc);
-#define GRPC_CQ_INTERNAL_REF(cc, reason) grpc_cq_internal_ref(cc)
-#define GRPC_CQ_INTERNAL_UNREF(cc, reason) grpc_cq_internal_unref(cc)
-#endif
-
+#define GRPC_CQ_INTERNAL_REF(cc, reason) grpc_cq_internal_ref(cc)
+#define GRPC_CQ_INTERNAL_UNREF(cc, reason) grpc_cq_internal_unref(cc)
+#endif
+
/* Initializes global variables used by completion queues */
void grpc_cq_global_init();
-/* Flag that an operation is beginning: the completion channel will not finish
- shutdown until a corrensponding grpc_cq_end_* call is made.
+/* Flag that an operation is beginning: the completion channel will not finish
+ shutdown until a corrensponding grpc_cq_end_* call is made.
\a tag is currently used only in debug builds. Return true on success, and
false if completion_queue has been shutdown. */
bool grpc_cq_begin_op(grpc_completion_queue* cc, void* tag);
-
-/* Queue a GRPC_OP_COMPLETED operation; tag must correspond to the tag passed to
- grpc_cq_begin_op */
+
+/* Queue a GRPC_OP_COMPLETED operation; tag must correspond to the tag passed to
+ grpc_cq_begin_op */
void grpc_cq_end_op(grpc_completion_queue* cc, void* tag, grpc_error* error,
void (*done)(void* done_arg, grpc_cq_completion* storage),
void* done_arg, grpc_cq_completion* storage,
bool internal = false);
-
+
grpc_pollset* grpc_cq_pollset(grpc_completion_queue* cc);
-
+
bool grpc_cq_can_listen(grpc_completion_queue* cc);
-
+
grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue* cc);
-
+
int grpc_get_cq_poll_num(grpc_completion_queue* cc);
grpc_completion_queue* grpc_completion_queue_create_internal(
grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type,
grpc_experimental_completion_queue_functor* shutdown_callback);
-#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/event_string.h b/contrib/libs/grpc/src/core/lib/surface/event_string.h
index ea077ba105..f4ad847b3c 100644
--- a/contrib/libs/grpc/src/core/lib/surface/event_string.h
+++ b/contrib/libs/grpc/src/core/lib/surface/event_string.h
@@ -1,31 +1,31 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
-#define GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
+#define GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
+
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
-#include <grpc/grpc.h>
-
-/* Returns a string describing an event. Must be later freed with gpr_free() */
+#include <grpc/grpc.h>
+
+/* Returns a string describing an event. Must be later freed with gpr_free() */
TString grpc_event_string(grpc_event* ev);
-
-#endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */
+
+#endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/init.h b/contrib/libs/grpc/src/core/lib/surface/init.h
index cb1082d6f8..6eaa488d05 100644
--- a/contrib/libs/grpc/src/core/lib/surface/init.h
+++ b/contrib/libs/grpc/src/core/lib/surface/init.h
@@ -1,27 +1,27 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_INIT_H
-#define GRPC_CORE_LIB_SURFACE_INIT_H
-
-void grpc_register_security_filters(void);
-void grpc_security_pre_init(void);
-void grpc_security_init(void);
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_INIT_H
+#define GRPC_CORE_LIB_SURFACE_INIT_H
+
+void grpc_register_security_filters(void);
+void grpc_security_pre_init(void);
+void grpc_security_init(void);
void grpc_maybe_wait_for_async_shutdown(void);
-
-#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */
+
+#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/lame_client.h b/contrib/libs/grpc/src/core/lib/surface/lame_client.h
index 0da23196b6..aefa67c24a 100644
--- a/contrib/libs/grpc/src/core/lib/surface/lame_client.h
+++ b/contrib/libs/grpc/src/core/lib/surface/lame_client.h
@@ -1,28 +1,28 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
-#define GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
+#define GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/channel/channel_stack.h"
-
-extern const grpc_channel_filter grpc_lame_filter;
-
-#endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */
+#include "src/core/lib/channel/channel_stack.h"
+
+extern const grpc_channel_filter grpc_lame_filter;
+
+#endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */
diff --git a/contrib/libs/grpc/src/core/lib/surface/server.h b/contrib/libs/grpc/src/core/lib/surface/server.h
index 5ba15e5cf0..f4f4ff6449 100644
--- a/contrib/libs/grpc/src/core/lib/surface/server.h
+++ b/contrib/libs/grpc/src/core/lib/surface/server.h
@@ -13,10 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-
-#ifndef GRPC_CORE_LIB_SURFACE_SERVER_H
-#define GRPC_CORE_LIB_SURFACE_SERVER_H
-
+
+#ifndef GRPC_CORE_LIB_SURFACE_SERVER_H
+#define GRPC_CORE_LIB_SURFACE_SERVER_H
+
#include <grpc/support/port_platform.h>
#include <list>
@@ -24,28 +24,28 @@
#include "y_absl/types/optional.h"
-#include <grpc/grpc.h>
+#include <grpc/grpc.h>
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/surface/completion_queue.h"
-#include "src/core/lib/transport/transport.h"
-
+#include "src/core/lib/transport/transport.h"
+
namespace grpc_core {
-
+
extern TraceFlag grpc_server_channel_trace;
-
+
class Server : public InternallyRefCounted<Server> {
public:
// Filter vtable.
static const grpc_channel_filter kServerTopFilter;
-
+
// Opaque type used for registered methods.
struct RegisteredMethod;
-
+
// An object to represent the most relevant characteristics of a
// newly-allocated call object when using an AllocatingRequestMatcherBatch.
struct BatchCallAllocation {
@@ -65,7 +65,7 @@ class Server : public InternallyRefCounted<Server> {
gpr_timespec* deadline;
grpc_byte_buffer** optional_payload;
};
-
+
/// Interface for listeners.
/// Implementations must override the Orphan() method, which should stop
/// listening and initiate destruction of the listener.
@@ -77,11 +77,11 @@ class Server : public InternallyRefCounted<Server> {
/// this call, so it is a pointer rather than a reference.
virtual void Start(Server* server,
const std::vector<grpc_pollset*>* pollsets) = 0;
-
+
/// Returns the channelz node for the listen socket, or null if not
/// supported.
virtual channelz::ListenSocketNode* channelz_listen_socket_node() const = 0;
-
+
/// Sets a closure to be invoked by the listener when its destruction
/// is complete.
virtual void SetOnDestroyDone(grpc_closure* on_destroy_done) = 0;
@@ -394,4 +394,4 @@ struct grpc_server {
grpc_core::OrphanablePtr<grpc_core::Server> core_server;
};
-#endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */
+#endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/README.md b/contrib/libs/grpc/src/core/lib/transport/README.md
index 345e1bcd04..e7e135edeb 100644
--- a/contrib/libs/grpc/src/core/lib/transport/README.md
+++ b/contrib/libs/grpc/src/core/lib/transport/README.md
@@ -1,7 +1,7 @@
-# Transport
-
-Common implementation details for gRPC Transports.
-
-Transports multiplex messages across some single connection. In ext/ there are
-implementations atop [a custom http2 implementation](/src/core/ext/transport/chttp2/README.md)
-and atop [cronet](/src/core/ext/transport/cronet/README.md).
+# Transport
+
+Common implementation details for gRPC Transports.
+
+Transports multiplex messages across some single connection. In ext/ there are
+implementations atop [a custom http2 implementation](/src/core/ext/transport/chttp2/README.md)
+and atop [cronet](/src/core/ext/transport/cronet/README.md).
diff --git a/contrib/libs/grpc/src/core/lib/transport/byte_stream.h b/contrib/libs/grpc/src/core/lib/transport/byte_stream.h
index 64e27cfbf7..ecb605ad9b 100644
--- a/contrib/libs/grpc/src/core/lib/transport/byte_stream.h
+++ b/contrib/libs/grpc/src/core/lib/transport/byte_stream.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
-#define GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
+#define GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
+
#include <grpc/support/port_platform.h>
-#include <grpc/slice_buffer.h>
+#include <grpc/slice_buffer.h>
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/closure.h"
-
-/** Internal bit flag for grpc_begin_message's \a flags signaling the use of
+
+/** Internal bit flag for grpc_begin_message's \a flags signaling the use of
* compression for the message. (Does not apply for stream compression.) */
-#define GRPC_WRITE_INTERNAL_COMPRESS (0x80000000u)
+#define GRPC_WRITE_INTERNAL_COMPRESS (0x80000000u)
/** Internal bit flag for determining whether the message was compressed and had
* to be decompressed by the message_decompress filter. (Does not apply for
* stream compression.) */
#define GRPC_WRITE_INTERNAL_TEST_ONLY_WAS_COMPRESSED (0x40000000u)
-/** Mask of all valid internal flags. */
+/** Mask of all valid internal flags. */
#define GRPC_WRITE_INTERNAL_USED_MASK \
(GRPC_WRITE_INTERNAL_COMPRESS | GRPC_WRITE_INTERNAL_TEST_ONLY_WAS_COMPRESSED)
-
+
namespace grpc_core {
-
+
class ByteStream : public Orphanable {
public:
virtual ~ByteStream() {}
@@ -79,23 +79,23 @@ class ByteStream : public Orphanable {
private:
const uint32_t length_;
uint32_t flags_;
-};
-
+};
+
//
// SliceBufferByteStream
//
// A ByteStream that wraps a slice buffer.
//
-
+
class SliceBufferByteStream : public ByteStream {
public:
// Removes all slices in slice_buffer, leaving it empty.
SliceBufferByteStream(grpc_slice_buffer* slice_buffer, uint32_t flags);
-
+
~SliceBufferByteStream();
-
+
void Orphan() override;
-
+
bool Next(size_t max_size_hint, grpc_closure* on_complete) override;
grpc_error* Pull(grpc_slice* slice) override;
void Shutdown(grpc_error* error) override;
@@ -162,4 +162,4 @@ class ByteStreamCache {
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/connectivity_state.h b/contrib/libs/grpc/src/core/lib/transport/connectivity_state.h
index ec1bf0f835..9e34c646c7 100644
--- a/contrib/libs/grpc/src/core/lib/transport/connectivity_state.h
+++ b/contrib/libs/grpc/src/core/lib/transport/connectivity_state.h
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
-#define GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
+#define GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
+
#include <grpc/support/port_platform.h>
#include "y_absl/status/status.h"
-#include <grpc/grpc.h>
+#include <grpc/grpc.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/atomic.h"
@@ -32,14 +32,14 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/work_serializer.h"
-
+
namespace grpc_core {
-
+
extern TraceFlag grpc_connectivity_state_trace;
-
+
// Enum to string conversion.
const char* ConnectivityStateName(grpc_connectivity_state state);
-
+
// Interface for watching connectivity state.
// Subclasses must implement the Notify() method.
//
@@ -49,14 +49,14 @@ class ConnectivityStateWatcherInterface
: public InternallyRefCounted<ConnectivityStateWatcherInterface> {
public:
virtual ~ConnectivityStateWatcherInterface() = default;
-
+
// Notifies the watcher that the state has changed to new_state.
virtual void Notify(grpc_connectivity_state new_state,
const y_absl::Status& status) = 0;
-
+
void Orphan() override { Unref(); }
};
-
+
// An alternative watcher interface that performs notifications via an
// asynchronous callback scheduled on the ExecCtx.
// Subclasses must implement the OnConnectivityStateChange() method.
@@ -64,12 +64,12 @@ class AsyncConnectivityStateWatcherInterface
: public ConnectivityStateWatcherInterface {
public:
virtual ~AsyncConnectivityStateWatcherInterface() = default;
-
+
// Schedules a closure on the ExecCtx to invoke
// OnConnectivityStateChange() asynchronously.
void Notify(grpc_connectivity_state new_state,
const y_absl::Status& status) override final;
-
+
protected:
class Notifier;
@@ -78,7 +78,7 @@ class AsyncConnectivityStateWatcherInterface
explicit AsyncConnectivityStateWatcherInterface(
std::shared_ptr<WorkSerializer> work_serializer = nullptr)
: work_serializer_(std::move(work_serializer)) {}
-
+
// Invoked asynchronously when Notify() is called.
virtual void OnConnectivityStateChange(grpc_connectivity_state new_state,
const y_absl::Status& status) = 0;
@@ -140,4 +140,4 @@ class ConnectivityStateTracker {
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/metadata.h b/contrib/libs/grpc/src/core/lib/transport/metadata.h
index 81ca52af0e..4bb8d64dd0 100644
--- a/contrib/libs/grpc/src/core/lib/transport/metadata.h
+++ b/contrib/libs/grpc/src/core/lib/transport/metadata.h
@@ -1,78 +1,78 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_H
-#define GRPC_CORE_LIB_TRANSPORT_METADATA_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_H
+#define GRPC_CORE_LIB_TRANSPORT_METADATA_H
+
#include <grpc/support/port_platform.h>
#include <grpc/impl/codegen/log.h>
#include <grpc/grpc.h>
-#include <grpc/slice.h>
-
+#include <grpc/slice.h>
+
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/slice/slice_utils.h"
-
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata;
-
-/* This file provides a mechanism for tracking metadata through the grpc stack.
- It's not intended for consumption outside of the library.
-
+
+/* This file provides a mechanism for tracking metadata through the grpc stack.
+ It's not intended for consumption outside of the library.
+
Metadata is tracked in the context of a sharded global grpc_mdctx. The
context tracks unique strings (grpc_mdstr) and pairs of strings
- (grpc_mdelem). Any of these objects can be checked for equality by comparing
- their pointers. These objects are reference counted.
-
- grpc_mdelem can additionally store a (non-NULL) user data pointer. This
- pointer is intended to be used to cache semantic meaning of a metadata
- element. For example, an OAuth token may cache the credentials it represents
- and the time at which it expires in the mdelem user data.
-
- Combining this metadata cache and the hpack compression table allows us to
- simply lookup complete preparsed objects quickly, incurring a few atomic
- ops per metadata element on the fast path.
-
- grpc_mdelem instances MAY live longer than their refcount implies, and are
- garbage collected periodically, meaning cached data can easily outlive a
- single request.
-
- STATIC METADATA: in static_metadata.h we declare a set of static metadata.
- These mdelems and mdstrs are available via pre-declared code generated macros
- and are available to code anywhere between grpc_init() and grpc_shutdown().
- They are not refcounted, but can be passed to _ref and _unref functions
- declared here - in which case those functions are effectively no-ops. */
-
-/* Forward declarations */
-typedef struct grpc_mdelem grpc_mdelem;
-
+ (grpc_mdelem). Any of these objects can be checked for equality by comparing
+ their pointers. These objects are reference counted.
+
+ grpc_mdelem can additionally store a (non-NULL) user data pointer. This
+ pointer is intended to be used to cache semantic meaning of a metadata
+ element. For example, an OAuth token may cache the credentials it represents
+ and the time at which it expires in the mdelem user data.
+
+ Combining this metadata cache and the hpack compression table allows us to
+ simply lookup complete preparsed objects quickly, incurring a few atomic
+ ops per metadata element on the fast path.
+
+ grpc_mdelem instances MAY live longer than their refcount implies, and are
+ garbage collected periodically, meaning cached data can easily outlive a
+ single request.
+
+ STATIC METADATA: in static_metadata.h we declare a set of static metadata.
+ These mdelems and mdstrs are available via pre-declared code generated macros
+ and are available to code anywhere between grpc_init() and grpc_shutdown().
+ They are not refcounted, but can be passed to _ref and _unref functions
+ declared here - in which case those functions are effectively no-ops. */
+
+/* Forward declarations */
+typedef struct grpc_mdelem grpc_mdelem;
+
/* if changing this, make identical changes in:
- grpc_core::{InternedMetadata, AllocatedMetadata}
- grpc_metadata in grpc_types.h */
typedef struct grpc_mdelem_data {
const grpc_slice key;
const grpc_slice value;
- /* there is a private part to this in metadata.c */
+ /* there is a private part to this in metadata.c */
} grpc_mdelem_data;
-
+
/* GRPC_MDELEM_STORAGE_* enum values that can be treated as interned always have
this bit set in their integer value */
#define GRPC_MDELEM_STORAGE_INTERNED_BIT 1
@@ -95,12 +95,12 @@ typedef enum {
GRPC_MDELEM_STORAGE_INTERNED = 2 | GRPC_MDELEM_STORAGE_INTERNED_BIT,
} grpc_mdelem_data_storage;
-struct grpc_mdelem {
+struct grpc_mdelem {
/* a grpc_mdelem_data* generally, with the two lower bits signalling memory
ownership as per grpc_mdelem_data_storage */
uintptr_t payload;
-};
-
+};
+
#define GRPC_MDELEM_DATA(md) ((grpc_mdelem_data*)((md).payload & ~(uintptr_t)3))
#define GRPC_MDELEM_STORAGE(md) \
((grpc_mdelem_data_storage)((md).payload & (uintptr_t)3))
@@ -114,14 +114,14 @@ struct grpc_mdelem {
#define GRPC_MDELEM_IS_INTERNED(md) \
((grpc_mdelem_data_storage)((md).payload & \
(uintptr_t)GRPC_MDELEM_STORAGE_INTERNED_BIT))
-
+
/* Given arbitrary input slices, create a grpc_mdelem object. The caller refs
* the input slices; we unref them. This method is always safe to call; however,
* if we know data about the slices in question (e.g. if we knew our key was
* static) we can call specializations that save on cycle count. */
grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key,
const grpc_slice& value);
-
+
/* Like grpc_mdelem_from_slices, but we know that key is a static slice. This
saves us a few branches and a no-op call to md_unref() for the key. */
grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key,
@@ -143,7 +143,7 @@ grpc_mdelem grpc_mdelem_from_slices(const grpc_core::ManagedMemorySlice& key,
/* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata
object as backing storage (so lifetimes should align) */
grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata);
-
+
/* Does not unref the slices; if a new non-interned mdelem is needed, allocates
one if compatible_external_backing_store is NULL, or uses
compatible_external_backing_store if it is non-NULL (in which case it's the
@@ -151,7 +151,7 @@ grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata);
grpc_mdelem grpc_mdelem_create(
const grpc_slice& key, const grpc_slice& value,
grpc_mdelem_data* compatible_external_backing_store);
-
+
/* Like grpc_mdelem_create, but we know that key is static. */
grpc_mdelem grpc_mdelem_create(
const grpc_core::StaticMetadataSlice& key, const grpc_slice& value,
@@ -170,7 +170,7 @@ inline bool grpc_mdelem_static_value_eq(grpc_mdelem a, grpc_mdelem b_static) {
return grpc_slice_eq_static_interned(GRPC_MDVALUE(a), GRPC_MDVALUE(b_static));
}
#define GRPC_MDISNULL(md) (GRPC_MDELEM_DATA(md) == NULL)
-
+
inline bool grpc_mdelem_both_interned_eq(grpc_mdelem a_interned,
grpc_mdelem b_interned) {
GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(a_interned) ||
@@ -180,12 +180,12 @@ inline bool grpc_mdelem_both_interned_eq(grpc_mdelem a_interned,
return a_interned.payload == b_interned.payload;
}
-/* Mutator and accessor for grpc_mdelem user data. The destructor function
- is used as a type tag and is checked during user_data fetch. */
+/* Mutator and accessor for grpc_mdelem user data. The destructor function
+ is used as a type tag and is checked during user_data fetch. */
void* grpc_mdelem_get_user_data(grpc_mdelem md, void (*if_destroy_func)(void*));
void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*),
void* data);
-
+
// Defined in metadata.cc.
struct mdtab_shard;
@@ -328,7 +328,7 @@ class AllocatedMetadata : public RefcountedMdBase {
} // namespace grpc_core
#ifndef NDEBUG
-#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__)
+#define GRPC_MDELEM_REF(s) grpc_mdelem_ref((s), __FILE__, __LINE__)
inline grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd, const char* file,
int line) {
#else // ifndef NDEBUG
@@ -369,12 +369,12 @@ inline grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd) {
void grpc_mdelem_on_final_unref(grpc_mdelem_data_storage storage, void* ptr,
uint32_t hash, const char* file, int line);
inline void grpc_mdelem_unref(grpc_mdelem gmd, const char* file, int line) {
-#else
+#else
#define GRPC_MDELEM_UNREF(s) grpc_mdelem_unref((s))
void grpc_mdelem_on_final_unref(grpc_mdelem_data_storage storage, void* ptr,
uint32_t hash);
inline void grpc_mdelem_unref(grpc_mdelem gmd) {
-#endif
+#endif
const grpc_mdelem_data_storage storage = GRPC_MDELEM_STORAGE(gmd);
switch (storage) {
case GRPC_MDELEM_STORAGE_EXTERNAL:
@@ -399,19 +399,19 @@ inline void grpc_mdelem_unref(grpc_mdelem gmd) {
return;
}
}
-
+
#define GRPC_MDNULL GRPC_MAKE_MDELEM(NULL, GRPC_MDELEM_STORAGE_EXTERNAL)
-
-/* We add 32 bytes of padding as per RFC-7540 section 6.5.2. */
+
+/* We add 32 bytes of padding as per RFC-7540 section 6.5.2. */
#define GRPC_MDELEM_LENGTH(e) \
(GRPC_SLICE_LENGTH(GRPC_MDKEY((e))) + GRPC_SLICE_LENGTH(GRPC_MDVALUE((e))) + \
32)
-
-#define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash))
-
-void grpc_mdctx_global_init(void);
+
+#define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash))
+
+void grpc_mdctx_global_init(void);
void grpc_mdctx_global_shutdown();
-
+
/* Like grpc_mdelem_from_slices, but we know that key is a static or interned
slice and value is not static or interned. This gives us an inlinable
fastpath - we know we must allocate metadata now, and that we do not need to
@@ -443,4 +443,4 @@ inline grpc_mdelem grpc_mdelem_from_slices(
GRPC_MDELEM_STORAGE_ALLOCATED);
}
-#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/metadata_batch.h b/contrib/libs/grpc/src/core/lib/transport/metadata_batch.h
index cf37dbd82b..3101f485a2 100644
--- a/contrib/libs/grpc/src/core/lib/transport/metadata_batch.h
+++ b/contrib/libs/grpc/src/core/lib/transport/metadata_batch.h
@@ -1,75 +1,75 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
-#define GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
+#define GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
+
#include <grpc/support/port_platform.h>
-#include <stdbool.h>
-
-#include <grpc/grpc.h>
-#include <grpc/slice.h>
-#include <grpc/support/time.h>
+#include <stdbool.h>
+
+#include <grpc/grpc.h>
+#include <grpc/slice.h>
+#include <grpc/support/time.h>
#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/static_metadata.h"
-
-typedef struct grpc_linked_mdelem {
+
+typedef struct grpc_linked_mdelem {
grpc_linked_mdelem() {}
grpc_mdelem md;
struct grpc_linked_mdelem* next = nullptr;
struct grpc_linked_mdelem* prev = nullptr;
void* reserved;
-} grpc_linked_mdelem;
-
-typedef struct grpc_mdelem_list {
+} grpc_linked_mdelem;
+
+typedef struct grpc_mdelem_list {
size_t count;
size_t default_count; // Number of default keys.
grpc_linked_mdelem* head;
grpc_linked_mdelem* tail;
-} grpc_mdelem_list;
-
-typedef struct grpc_metadata_batch {
- /** Metadata elements in this batch */
- grpc_mdelem_list list;
+} grpc_mdelem_list;
+
+typedef struct grpc_metadata_batch {
+ /** Metadata elements in this batch */
+ grpc_mdelem_list list;
grpc_metadata_batch_callouts idx;
- /** Used to calculate grpc-timeout at the point of sending,
+ /** Used to calculate grpc-timeout at the point of sending,
or GRPC_MILLIS_INF_FUTURE if this batch does not need to send a
- grpc-timeout */
+ grpc-timeout */
grpc_millis deadline;
-} grpc_metadata_batch;
-
+} grpc_metadata_batch;
+
void grpc_metadata_batch_init(grpc_metadata_batch* batch);
void grpc_metadata_batch_destroy(grpc_metadata_batch* batch);
void grpc_metadata_batch_clear(grpc_metadata_batch* batch);
bool grpc_metadata_batch_is_empty(grpc_metadata_batch* batch);
-
-/* Returns the transport size of the batch. */
+
+/* Returns the transport size of the batch. */
size_t grpc_metadata_batch_size(grpc_metadata_batch* batch);
-
+
/** Remove \a storage from the batch, unreffing the mdelem contained */
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage);
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx);
-
+
/** Substitute a new mdelem for an old value */
grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage,
@@ -78,11 +78,11 @@ grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
const grpc_slice& value);
-/** Add \a storage to the beginning of \a batch. storage->md is
- assumed to be valid.
- \a storage is owned by the caller and must survive for the
- lifetime of batch. This usually means it should be around
- for the lifetime of the call. */
+/** Add \a storage to the beginning of \a batch. storage->md is
+ assumed to be valid.
+ \a storage is owned by the caller and must survive for the
+ lifetime of batch. This usually means it should be around
+ for the lifetime of the call. */
grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage)
GRPC_MUST_USE_RESULT;
@@ -90,24 +90,24 @@ grpc_error* grpc_metadata_batch_link_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
-/** Add \a storage to the end of \a batch. storage->md is
- assumed to be valid.
- \a storage is owned by the caller and must survive for the
- lifetime of batch. This usually means it should be around
- for the lifetime of the call. */
+/** Add \a storage to the end of \a batch. storage->md is
+ assumed to be valid.
+ \a storage is owned by the caller and must survive for the
+ lifetime of batch. This usually means it should be around
+ for the lifetime of the call. */
grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage)
GRPC_MUST_USE_RESULT;
grpc_error* grpc_metadata_batch_link_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
-
-/** Add \a elem_to_add as the first element in \a batch, using
- \a storage as backing storage for the linked list element.
- \a storage is owned by the caller and must survive for the
- lifetime of batch. This usually means it should be around
- for the lifetime of the call.
- Takes ownership of \a elem_to_add */
+
+/** Add \a elem_to_add as the first element in \a batch, using
+ \a storage as backing storage for the linked list element.
+ \a storage is owned by the caller and must survive for the
+ lifetime of batch. This usually means it should be around
+ for the lifetime of the call.
+ Takes ownership of \a elem_to_add */
grpc_error* grpc_metadata_batch_add_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
@@ -128,16 +128,16 @@ inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
return grpc_metadata_batch_add_head(batch, storage, idx);
}
-/** Add \a elem_to_add as the last element in \a batch, using
- \a storage as backing storage for the linked list element.
- \a storage is owned by the caller and must survive for the
- lifetime of batch. This usually means it should be around
- for the lifetime of the call.
- Takes ownership of \a elem_to_add */
+/** Add \a elem_to_add as the last element in \a batch, using
+ \a storage as backing storage for the linked list element.
+ \a storage is owned by the caller and must survive for the
+ lifetime of batch. This usually means it should be around
+ for the lifetime of the call.
+ Takes ownership of \a elem_to_add */
grpc_error* grpc_metadata_batch_add_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
-
+
inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
@@ -153,7 +153,7 @@ inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
}
grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md);
-
+
struct grpc_filtered_mdelem {
grpc_error* error;
grpc_mdelem md;
@@ -171,21 +171,21 @@ grpc_error* grpc_metadata_batch_filter(
grpc_metadata_batch* batch, grpc_metadata_batch_filter_func func,
void* user_data, const char* composite_error_string) GRPC_MUST_USE_RESULT;
-#ifndef NDEBUG
+#ifndef NDEBUG
void grpc_metadata_batch_assert_ok(grpc_metadata_batch* comd);
-#else
-#define grpc_metadata_batch_assert_ok(comd) \
- do { \
- } while (0)
-#endif
-
+#else
+#define grpc_metadata_batch_assert_ok(comd) \
+ do { \
+ } while (0)
+#endif
+
/// Copies \a src to \a dst. \a storage must point to an array of
/// \a grpc_linked_mdelem structs of at least the same size as \a src.
void grpc_metadata_batch_copy(grpc_metadata_batch* src,
grpc_metadata_batch* dst,
grpc_linked_mdelem* storage);
-
+
void grpc_metadata_batch_move(grpc_metadata_batch* src,
grpc_metadata_batch* dst);
-#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/pid_controller.h b/contrib/libs/grpc/src/core/lib/transport/pid_controller.h
index 37baeac336..e26205bf20 100644
--- a/contrib/libs/grpc/src/core/lib/transport/pid_controller.h
+++ b/contrib/libs/grpc/src/core/lib/transport/pid_controller.h
@@ -1,37 +1,37 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H
-#define GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H
+#define GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H
+
#include <grpc/support/port_platform.h>
#include <limits>
-/* \file Simple PID controller.
- Implements a proportional-integral-derivative controller.
- Used when we want to iteratively control a variable to converge some other
- observed value to a 'set-point'.
- Gains can be set to adjust sensitivity to current error (p), the integral
- of error (i), and the derivative of error (d). */
-
+/* \file Simple PID controller.
+ Implements a proportional-integral-derivative controller.
+ Used when we want to iteratively control a variable to converge some other
+ observed value to a 'set-point'.
+ Gains can be set to adjust sensitivity to current error (p), the integral
+ of error (i), and the derivative of error (d). */
+
namespace grpc_core {
-
+
class PidController {
public:
class Args {
@@ -43,7 +43,7 @@ class PidController {
double min_control_value() const { return min_control_value_; }
double max_control_value() const { return max_control_value_; }
double integral_range() const { return integral_range_; }
-
+
Args& set_gain_p(double gain_p) {
gain_p_ = gain_p;
return *this;
@@ -72,7 +72,7 @@ class PidController {
integral_range_ = integral_range;
return *this;
}
-
+
private:
double gain_p_ = 0.0;
double gain_i_ = 0.0;
@@ -82,7 +82,7 @@ class PidController {
double max_control_value_ = std::numeric_limits<double>::max();
double integral_range_ = std::numeric_limits<double>::max();
};
-
+
explicit PidController(const Args& args);
/// Reset the controller internal state: useful when the environment has
@@ -113,4 +113,4 @@ class PidController {
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/static_metadata.h b/contrib/libs/grpc/src/core/lib/transport/static_metadata.h
index 38eca2dba4..5d844af558 100644
--- a/contrib/libs/grpc/src/core/lib/transport/static_metadata.h
+++ b/contrib/libs/grpc/src/core/lib/transport/static_metadata.h
@@ -1,38 +1,38 @@
-/*
+/*
* 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.
- */
-
-/*
- * WARNING: Auto-generated code.
- *
- * To make changes to this file, change
- * tools/codegen/core/gen_static_metadata.py, and then re-run it.
- *
+ */
+
+/*
+ * WARNING: Auto-generated code.
+ *
+ * To make changes to this file, change
+ * tools/codegen/core/gen_static_metadata.py, and then re-run it.
+ *
* See metadata.h for an explanation of the interface here, and metadata.cc for
- * an explanation of what's going on.
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
-#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
-
+ * an explanation of what's going on.
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
+#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
+
#include <grpc/support/port_platform.h>
#include <cstdint>
-#include "src/core/lib/transport/metadata.h"
-
+#include "src/core/lib/transport/metadata.h"
+
static_assert(
std::is_trivially_destructible<grpc_core::StaticMetadataSlice>::value,
"grpc_core::StaticMetadataSlice must be trivially destructible.");
@@ -106,9 +106,9 @@ inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
#define GRPC_MDSTR_X_ENDPOINT_LOAD_METRICS_BIN (grpc_static_slice_table()[23])
/* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[24])
-/* "1" */
+/* "1" */
#define GRPC_MDSTR_1 (grpc_static_slice_table()[25])
-/* "2" */
+/* "2" */
#define GRPC_MDSTR_2 (grpc_static_slice_table()[26])
/* "3" */
#define GRPC_MDSTR_3 (grpc_static_slice_table()[27])
@@ -166,103 +166,103 @@ inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[48])
/* "200" */
#define GRPC_MDSTR_200 (grpc_static_slice_table()[49])
-/* "204" */
+/* "204" */
#define GRPC_MDSTR_204 (grpc_static_slice_table()[50])
-/* "206" */
+/* "206" */
#define GRPC_MDSTR_206 (grpc_static_slice_table()[51])
-/* "304" */
+/* "304" */
#define GRPC_MDSTR_304 (grpc_static_slice_table()[52])
-/* "400" */
+/* "400" */
#define GRPC_MDSTR_400 (grpc_static_slice_table()[53])
/* "404" */
#define GRPC_MDSTR_404 (grpc_static_slice_table()[54])
-/* "500" */
+/* "500" */
#define GRPC_MDSTR_500 (grpc_static_slice_table()[55])
-/* "accept-charset" */
+/* "accept-charset" */
#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[56])
/* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[57])
-/* "accept-language" */
+/* "accept-language" */
#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[58])
-/* "accept-ranges" */
+/* "accept-ranges" */
#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[59])
/* "accept" */
#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[60])
-/* "access-control-allow-origin" */
+/* "access-control-allow-origin" */
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[61])
-/* "age" */
+/* "age" */
#define GRPC_MDSTR_AGE (grpc_static_slice_table()[62])
-/* "allow" */
+/* "allow" */
#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[63])
-/* "authorization" */
+/* "authorization" */
#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[64])
-/* "cache-control" */
+/* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[65])
-/* "content-disposition" */
+/* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[66])
-/* "content-language" */
+/* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[67])
-/* "content-length" */
+/* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[68])
-/* "content-location" */
+/* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[69])
-/* "content-range" */
+/* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[70])
-/* "cookie" */
+/* "cookie" */
#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[71])
-/* "date" */
+/* "date" */
#define GRPC_MDSTR_DATE (grpc_static_slice_table()[72])
-/* "etag" */
+/* "etag" */
#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[73])
-/* "expect" */
+/* "expect" */
#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[74])
-/* "expires" */
+/* "expires" */
#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[75])
-/* "from" */
+/* "from" */
#define GRPC_MDSTR_FROM (grpc_static_slice_table()[76])
-/* "if-match" */
+/* "if-match" */
#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[77])
-/* "if-modified-since" */
+/* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[78])
-/* "if-none-match" */
+/* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[79])
-/* "if-range" */
+/* "if-range" */
#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[80])
-/* "if-unmodified-since" */
+/* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[81])
-/* "last-modified" */
+/* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[82])
-/* "link" */
+/* "link" */
#define GRPC_MDSTR_LINK (grpc_static_slice_table()[83])
-/* "location" */
+/* "location" */
#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[84])
-/* "max-forwards" */
+/* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[85])
-/* "proxy-authenticate" */
+/* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[86])
-/* "proxy-authorization" */
+/* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[87])
-/* "range" */
+/* "range" */
#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[88])
-/* "referer" */
+/* "referer" */
#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[89])
-/* "refresh" */
+/* "refresh" */
#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[90])
-/* "retry-after" */
+/* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[91])
-/* "server" */
+/* "server" */
#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[92])
-/* "set-cookie" */
+/* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[93])
-/* "strict-transport-security" */
+/* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[94])
-/* "transfer-encoding" */
+/* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[95])
-/* "vary" */
+/* "vary" */
#define GRPC_MDSTR_VARY (grpc_static_slice_table()[96])
-/* "via" */
+/* "via" */
#define GRPC_MDSTR_VIA (grpc_static_slice_table()[97])
-/* "www-authenticate" */
+/* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[98])
/* "0" */
#define GRPC_MDSTR_0 (grpc_static_slice_table()[99])
@@ -287,7 +287,7 @@ inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
/* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(grpc_static_slice_table()[109])
-
+
namespace grpc_core {
struct StaticSliceRefcount;
extern StaticSliceRefcount* g_static_metadata_slice_refcounts;
@@ -326,7 +326,7 @@ inline grpc_mdelem* grpc_static_mdelem_manifested() {
return grpc_core::g_static_mdelem_manifested;
}
-extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
+extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* ":authority": "" */
#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested()[0])
/* ":method": "GET" */
@@ -356,108 +356,108 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested()[12])
/* ":status": "500" */
#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested()[13])
-/* "accept-charset": "" */
+/* "accept-charset": "" */
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested()[14])
-/* "accept-encoding": "gzip, deflate" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
+/* "accept-encoding": "gzip, deflate" */
+#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
(grpc_static_mdelem_manifested()[15])
-/* "accept-language": "" */
+/* "accept-language": "" */
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[16])
-/* "accept-ranges": "" */
+/* "accept-ranges": "" */
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested()[17])
/* "accept": "" */
#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested()[18])
-/* "access-control-allow-origin": "" */
-#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
+/* "access-control-allow-origin": "" */
+#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
(grpc_static_mdelem_manifested()[19])
-/* "age": "" */
+/* "age": "" */
#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested()[20])
-/* "allow": "" */
+/* "allow": "" */
#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested()[21])
-/* "authorization": "" */
+/* "authorization": "" */
#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested()[22])
-/* "cache-control": "" */
+/* "cache-control": "" */
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested()[23])
-/* "content-disposition": "" */
+/* "content-disposition": "" */
#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
(grpc_static_mdelem_manifested()[24])
-/* "content-encoding": "" */
+/* "content-encoding": "" */
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[25])
-/* "content-language": "" */
+/* "content-language": "" */
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[26])
-/* "content-length": "" */
+/* "content-length": "" */
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested()[27])
-/* "content-location": "" */
+/* "content-location": "" */
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested()[28])
-/* "content-range": "" */
+/* "content-range": "" */
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested()[29])
-/* "content-type": "" */
+/* "content-type": "" */
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested()[30])
-/* "cookie": "" */
+/* "cookie": "" */
#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested()[31])
-/* "date": "" */
+/* "date": "" */
#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested()[32])
-/* "etag": "" */
+/* "etag": "" */
#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested()[33])
-/* "expect": "" */
+/* "expect": "" */
#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested()[34])
-/* "expires": "" */
+/* "expires": "" */
#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested()[35])
-/* "from": "" */
+/* "from": "" */
#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested()[36])
-/* "host": "" */
+/* "host": "" */
#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested()[37])
-/* "if-match": "" */
+/* "if-match": "" */
#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested()[38])
-/* "if-modified-since": "" */
+/* "if-modified-since": "" */
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \
(grpc_static_mdelem_manifested()[39])
-/* "if-none-match": "" */
+/* "if-none-match": "" */
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested()[40])
-/* "if-range": "" */
+/* "if-range": "" */
#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested()[41])
-/* "if-unmodified-since": "" */
+/* "if-unmodified-since": "" */
#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
(grpc_static_mdelem_manifested()[42])
-/* "last-modified": "" */
+/* "last-modified": "" */
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested()[43])
-/* "link": "" */
+/* "link": "" */
#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested()[44])
-/* "location": "" */
+/* "location": "" */
#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested()[45])
-/* "max-forwards": "" */
+/* "max-forwards": "" */
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested()[46])
-/* "proxy-authenticate": "" */
+/* "proxy-authenticate": "" */
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
(grpc_static_mdelem_manifested()[47])
-/* "proxy-authorization": "" */
+/* "proxy-authorization": "" */
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
(grpc_static_mdelem_manifested()[48])
-/* "range": "" */
+/* "range": "" */
#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested()[49])
-/* "referer": "" */
+/* "referer": "" */
#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested()[50])
-/* "refresh": "" */
+/* "refresh": "" */
#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested()[51])
-/* "retry-after": "" */
+/* "retry-after": "" */
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested()[52])
-/* "server": "" */
+/* "server": "" */
#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested()[53])
-/* "set-cookie": "" */
+/* "set-cookie": "" */
#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested()[54])
-/* "strict-transport-security": "" */
-#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
+/* "strict-transport-security": "" */
+#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
(grpc_static_mdelem_manifested()[55])
-/* "transfer-encoding": "" */
+/* "transfer-encoding": "" */
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
(grpc_static_mdelem_manifested()[56])
-/* "user-agent": "" */
+/* "user-agent": "" */
#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested()[57])
-/* "vary": "" */
+/* "vary": "" */
#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested()[58])
-/* "via": "" */
+/* "via": "" */
#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested()[59])
-/* "www-authenticate": "" */
+/* "www-authenticate": "" */
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested()[60])
/* "grpc-status": "0" */
#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested()[61])
@@ -518,7 +518,7 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* "accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(grpc_static_mdelem_manifested()[84])
-
+
grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b);
typedef enum {
GRPC_BATCH_PATH,
@@ -588,7 +588,7 @@ typedef union {
->index) \
: GRPC_BATCH_CALLOUTS_COUNT)
-extern const uint8_t grpc_static_accept_encoding_metadata[8];
+extern const uint8_t grpc_static_accept_encoding_metadata[8];
#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table() \
[grpc_static_accept_encoding_metadata[(algs)]] \
@@ -601,4 +601,4 @@ extern const uint8_t grpc_static_accept_stream_encoding_metadata[4];
[grpc_static_accept_stream_encoding_metadata[(algs)]] \
.data(), \
GRPC_MDELEM_STORAGE_STATIC))
-#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/timeout_encoding.h b/contrib/libs/grpc/src/core/lib/transport/timeout_encoding.h
index aacc8178c7..c87ff39d49 100644
--- a/contrib/libs/grpc/src/core/lib/transport/timeout_encoding.h
+++ b/contrib/libs/grpc/src/core/lib/transport/timeout_encoding.h
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H
-#define GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H
+#define GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H
+
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
-#include <grpc/support/time.h>
-
+#include <grpc/support/time.h>
+
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE 10
-
-/* Encode/decode timeouts to the GRPC over HTTP/2 format;
+
+/* Encode/decode timeouts to the GRPC over HTTP/2 format;
encoding may round up arbitrarily. If the timeout is larger than about 1157
days, it will be capped and "99999999S" will be sent on the wire. */
void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer);
int grpc_http2_decode_timeout(const grpc_slice& text, grpc_millis* timeout);
-
-#endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */
+
+#endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/transport.h b/contrib/libs/grpc/src/core/lib/transport/transport.h
index b661ad4c4b..2404455f9f 100644
--- a/contrib/libs/grpc/src/core/lib/transport/transport.h
+++ b/contrib/libs/grpc/src/core/lib/transport/transport.h
@@ -1,83 +1,83 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
-#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
+#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
+
#include <grpc/support/port_platform.h>
-#include <stddef.h>
-
-#include "src/core/lib/channel/context.h"
+#include <stddef.h>
+
+#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/call_combiner.h"
-#include "src/core/lib/iomgr/endpoint.h"
-#include "src/core/lib/iomgr/polling_entity.h"
-#include "src/core/lib/iomgr/pollset.h"
-#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/polling_entity.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/slice/slice_internal.h"
-#include "src/core/lib/transport/byte_stream.h"
+#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/connectivity_state.h"
-#include "src/core/lib/transport/metadata_batch.h"
-
+#include "src/core/lib/transport/metadata_batch.h"
+
/* Minimum and maximum protocol accepted versions. */
#define GRPC_PROTOCOL_VERSION_MAX_MAJOR 2
#define GRPC_PROTOCOL_VERSION_MAX_MINOR 1
#define GRPC_PROTOCOL_VERSION_MIN_MAJOR 2
#define GRPC_PROTOCOL_VERSION_MIN_MINOR 1
-
-/* forward declarations */
-
-typedef struct grpc_transport grpc_transport;
-
-/* grpc_stream doesn't actually exist. It's used as a typesafe
- opaque pointer for whatever data the transport wants to track
- for a stream. */
-typedef struct grpc_stream grpc_stream;
-
+
+/* forward declarations */
+
+typedef struct grpc_transport grpc_transport;
+
+/* grpc_stream doesn't actually exist. It's used as a typesafe
+ opaque pointer for whatever data the transport wants to track
+ for a stream. */
+typedef struct grpc_stream grpc_stream;
+
extern grpc_core::DebugOnlyTraceFlag grpc_trace_stream_refcount;
-
-typedef struct grpc_stream_refcount {
+
+typedef struct grpc_stream_refcount {
grpc_core::RefCount refs;
- grpc_closure destroy;
+ grpc_closure destroy;
#ifndef NDEBUG
const char* object_type;
-#endif
+#endif
grpc_slice_refcount slice_refcount;
-} grpc_stream_refcount;
-
+} grpc_stream_refcount;
+
#ifndef NDEBUG
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
grpc_iomgr_cb_func cb, void* cb_arg,
const char* object_type);
-#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype) \
- grpc_stream_ref_init(rc, ir, cb, cb_arg, objtype)
-#else
+#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype) \
+ grpc_stream_ref_init(rc, ir, cb, cb_arg, objtype)
+#else
void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
grpc_iomgr_cb_func cb, void* cb_arg);
-#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype) \
+#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype) \
do { \
grpc_stream_ref_init(rc, ir, cb, cb_arg); \
(void)(objtype); \
} while (0)
-#endif
-
+#endif
+
#ifndef NDEBUG
inline void grpc_stream_ref(grpc_stream_refcount* refcount,
const char* reason) {
@@ -124,18 +124,18 @@ struct grpc_transport_one_way_stats {
uint64_t data_bytes = 0;
uint64_t header_bytes = 0;
};
-
+
struct grpc_transport_stream_stats {
- grpc_transport_one_way_stats incoming;
- grpc_transport_one_way_stats outgoing;
+ grpc_transport_one_way_stats incoming;
+ grpc_transport_one_way_stats outgoing;
};
-
+
void grpc_transport_move_one_way_stats(grpc_transport_one_way_stats* from,
grpc_transport_one_way_stats* to);
-
+
void grpc_transport_move_stats(grpc_transport_stream_stats* from,
grpc_transport_stream_stats* to);
-
+
// This struct (which is present in both grpc_transport_stream_op_batch
// and grpc_transport_op_batch) is a convenience to allow filters or
// transports to schedule a closure related to a particular batch without
@@ -151,15 +151,15 @@ void grpc_transport_move_stats(grpc_transport_stream_stats* from,
// this struct anymore, because the next handler may reuse it.
struct grpc_handler_private_op_data {
void* extra_arg = nullptr;
- grpc_closure closure;
+ grpc_closure closure;
grpc_handler_private_op_data() { memset(&closure, 0, sizeof(closure)); }
};
-
+
typedef struct grpc_transport_stream_op_batch_payload
grpc_transport_stream_op_batch_payload;
-/* Transport stream op: a set of operations to perform on a transport
- against a single stream */
+/* Transport stream op: a set of operations to perform on a transport
+ against a single stream */
struct grpc_transport_stream_op_batch {
grpc_transport_stream_op_batch()
: send_initial_metadata(false),
@@ -170,7 +170,7 @@ struct grpc_transport_stream_op_batch {
recv_trailing_metadata(false),
cancel_stream(false),
is_traced(false) {}
-
+
/** Should be scheduled when all of the non-recv operations in the batch
are complete.
@@ -184,39 +184,39 @@ struct grpc_transport_stream_op_batch {
/** Values for the stream op (fields set are determined by flags above) */
grpc_transport_stream_op_batch_payload* payload = nullptr;
-
+
/** Send initial metadata to the peer, from the provided metadata batch. */
bool send_initial_metadata : 1;
-
- /** Send trailing metadata to the peer, from the provided metadata batch. */
+
+ /** Send trailing metadata to the peer, from the provided metadata batch. */
bool send_trailing_metadata : 1;
-
- /** Send message data to the peer, from the provided byte stream. */
+
+ /** Send message data to the peer, from the provided byte stream. */
bool send_message : 1;
-
- /** Receive initial metadata from the stream, into provided metadata batch. */
+
+ /** Receive initial metadata from the stream, into provided metadata batch. */
bool recv_initial_metadata : 1;
-
- /** Receive message data from the stream, into provided byte stream. */
+
+ /** Receive message data from the stream, into provided byte stream. */
bool recv_message : 1;
-
- /** Receive trailing metadata from the stream, into provided metadata batch.
- */
+
+ /** Receive trailing metadata from the stream, into provided metadata batch.
+ */
bool recv_trailing_metadata : 1;
-
+
/** Cancel this stream with the provided error */
bool cancel_stream : 1;
-
+
/** Is this stream traced */
bool is_traced : 1;
- /***************************************************************************
- * remaining fields are initialized and used at the discretion of the
+ /***************************************************************************
+ * remaining fields are initialized and used at the discretion of the
* current handler of the op */
-
+
grpc_handler_private_op_data handler_private;
};
-
+
struct grpc_transport_stream_op_batch_payload {
explicit grpc_transport_stream_op_batch_payload(
grpc_call_context_element* context)
@@ -326,11 +326,11 @@ struct grpc_transport_stream_op_batch_payload {
grpc_call_context_element* context;
};
-/** Transport op: a set of operations to perform on a transport as a whole */
-typedef struct grpc_transport_op {
- /** Called when processing of this op is done. */
+/** Transport op: a set of operations to perform on a transport as a whole */
+typedef struct grpc_transport_op {
+ /** Called when processing of this op is done. */
grpc_closure* on_consumed = nullptr;
- /** connectivity monitoring - set connectivity_state to NULL to unsubscribe */
+ /** connectivity monitoring - set connectivity_state to NULL to unsubscribe */
grpc_core::OrphanablePtr<grpc_core::ConnectivityStateWatcherInterface>
start_connectivity_watch;
grpc_connectivity_state start_connectivity_watch_state = GRPC_CHANNEL_IDLE;
@@ -344,17 +344,17 @@ typedef struct grpc_transport_op {
* Error contract: the transport that gets this op must cause
* goaway_error to be unref'ed after processing it */
grpc_error* goaway_error = nullptr;
- /** set the callback for accepting new streams;
- this is a permanent callback, unlike the other one-shot closures.
- If true, the callback is set to set_accept_stream_fn, with its
- user_data argument set to set_accept_stream_user_data */
+ /** set the callback for accepting new streams;
+ this is a permanent callback, unlike the other one-shot closures.
+ If true, the callback is set to set_accept_stream_fn, with its
+ user_data argument set to set_accept_stream_user_data */
bool set_accept_stream = false;
void (*set_accept_stream_fn)(void* user_data, grpc_transport* transport,
const void* server_data) = nullptr;
void* set_accept_stream_user_data = nullptr;
- /** add this transport to a pollset */
+ /** add this transport to a pollset */
grpc_pollset* bind_pollset = nullptr;
- /** add this transport to a pollset_set */
+ /** add this transport to a pollset_set */
grpc_pollset_set* bind_pollset_set = nullptr;
/** send a ping, if either on_initiate or on_ack is not NULL */
struct {
@@ -366,99 +366,99 @@ typedef struct grpc_transport_op {
} send_ping;
// If true, will reset the channel's connection backoff.
bool reset_connect_backoff = false;
-
- /***************************************************************************
- * remaining fields are initialized and used at the discretion of the
- * transport implementation */
-
+
+ /***************************************************************************
+ * remaining fields are initialized and used at the discretion of the
+ * transport implementation */
+
grpc_handler_private_op_data handler_private;
-} grpc_transport_op;
-
-/* Returns the amount of memory required to store a grpc_stream for this
- transport */
+} grpc_transport_op;
+
+/* Returns the amount of memory required to store a grpc_stream for this
+ transport */
size_t grpc_transport_stream_size(grpc_transport* transport);
-
-/* Initialize transport data for a stream.
-
- Returns 0 on success, any other (transport-defined) value for failure.
+
+/* Initialize transport data for a stream.
+
+ Returns 0 on success, any other (transport-defined) value for failure.
May assume that stream contains all-zeros.
-
- Arguments:
- transport - the transport on which to create this stream
- stream - a pointer to uninitialized memory to initialize
- server_data - either NULL for a client initiated stream, or a pointer
- supplied from the accept_stream callback function */
+
+ Arguments:
+ transport - the transport on which to create this stream
+ stream - a pointer to uninitialized memory to initialize
+ server_data - either NULL for a client initiated stream, or a pointer
+ supplied from the accept_stream callback function */
int grpc_transport_init_stream(grpc_transport* transport, grpc_stream* stream,
grpc_stream_refcount* refcount,
const void* server_data,
grpc_core::Arena* arena);
-
+
void grpc_transport_set_pops(grpc_transport* transport, grpc_stream* stream,
grpc_polling_entity* pollent);
-
-/* Destroy transport data for a stream.
-
- Requires: a recv_batch with final_state == GRPC_STREAM_CLOSED has been
- received by the up-layer. Must not be called in the same call stack as
- recv_frame.
-
- Arguments:
- transport - the transport on which to create this stream
- stream - the grpc_stream to destroy (memory is still owned by the
- caller, but any child memory must be cleaned up) */
+
+/* Destroy transport data for a stream.
+
+ Requires: a recv_batch with final_state == GRPC_STREAM_CLOSED has been
+ received by the up-layer. Must not be called in the same call stack as
+ recv_frame.
+
+ Arguments:
+ transport - the transport on which to create this stream
+ stream - the grpc_stream to destroy (memory is still owned by the
+ caller, but any child memory must be cleaned up) */
void grpc_transport_destroy_stream(grpc_transport* transport,
grpc_stream* stream,
grpc_closure* then_schedule_closure);
-
+
void grpc_transport_stream_op_batch_finish_with_failure(
grpc_transport_stream_op_batch* op, grpc_error* error,
grpc_core::CallCombiner* call_combiner);
-
+
TString grpc_transport_stream_op_batch_string(
grpc_transport_stream_op_batch* op);
TString grpc_transport_op_string(grpc_transport_op* op);
-
-/* Send a batch of operations on a transport
-
- Takes ownership of any objects contained in ops.
-
- Arguments:
- transport - the transport on which to initiate the stream
- stream - the stream on which to send the operations. This must be
- non-NULL and previously initialized by the same transport.
+
+/* Send a batch of operations on a transport
+
+ Takes ownership of any objects contained in ops.
+
+ Arguments:
+ transport - the transport on which to initiate the stream
+ stream - the stream on which to send the operations. This must be
+ non-NULL and previously initialized by the same transport.
op - a grpc_transport_stream_op_batch specifying the op to perform
*/
void grpc_transport_perform_stream_op(grpc_transport* transport,
grpc_stream* stream,
grpc_transport_stream_op_batch* op);
-
+
void grpc_transport_perform_op(grpc_transport* transport,
grpc_transport_op* op);
-
-/* Send a ping on a transport
-
- Calls cb with user data when a response is received. */
+
+/* Send a ping on a transport
+
+ Calls cb with user data when a response is received. */
void grpc_transport_ping(grpc_transport* transport, grpc_closure* cb);
-
-/* Advise peer of pending connection termination. */
+
+/* Advise peer of pending connection termination. */
void grpc_transport_goaway(grpc_transport* transport, grpc_status_code status,
- grpc_slice debug_data);
-
-/* Destroy the transport */
+ grpc_slice debug_data);
+
+/* Destroy the transport */
void grpc_transport_destroy(grpc_transport* transport);
-
-/* Get the endpoint used by \a transport */
+
+/* Get the endpoint used by \a transport */
grpc_endpoint* grpc_transport_get_endpoint(grpc_transport* transport);
-
-/* Allocate a grpc_transport_op, and preconfigure the on_consumed closure to
- \a on_consumed and then delete the returned transport op */
+
+/* Allocate a grpc_transport_op, and preconfigure the on_consumed closure to
+ \a on_consumed and then delete the returned transport op */
grpc_transport_op* grpc_make_transport_op(grpc_closure* on_consumed);
/* Allocate a grpc_transport_stream_op_batch, and preconfigure the on_consumed
closure
- to \a on_consumed and then delete the returned transport op */
+ to \a on_consumed and then delete the returned transport op */
grpc_transport_stream_op_batch* grpc_make_transport_stream_op(
grpc_closure* on_consumed);
-
+
namespace grpc_core {
// This is the key to be used for loading/storing keepalive_throttling in the
// y_absl::Status object.
@@ -466,4 +466,4 @@ constexpr const char* kKeepaliveThrottlingKey =
"grpc.internal.keepalive_throttling";
} // namespace grpc_core
-#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */
diff --git a/contrib/libs/grpc/src/core/lib/transport/transport_impl.h b/contrib/libs/grpc/src/core/lib/transport/transport_impl.h
index 37e793c7f9..526cc1b1ba 100644
--- a/contrib/libs/grpc/src/core/lib/transport/transport_impl.h
+++ b/contrib/libs/grpc/src/core/lib/transport/transport_impl.h
@@ -1,71 +1,71 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
-#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
-
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
+#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
+
#include <grpc/support/port_platform.h>
-#include "src/core/lib/transport/transport.h"
-
-typedef struct grpc_transport_vtable {
- /* Memory required for a single stream element - this is allocated by upper
- layers and initialized by the transport */
- size_t sizeof_stream; /* = sizeof(transport stream) */
-
- /* name of this transport implementation */
+#include "src/core/lib/transport/transport.h"
+
+typedef struct grpc_transport_vtable {
+ /* Memory required for a single stream element - this is allocated by upper
+ layers and initialized by the transport */
+ size_t sizeof_stream; /* = sizeof(transport stream) */
+
+ /* name of this transport implementation */
const char* name;
-
- /* implementation of grpc_transport_init_stream */
+
+ /* implementation of grpc_transport_init_stream */
int (*init_stream)(grpc_transport* self, grpc_stream* stream,
grpc_stream_refcount* refcount, const void* server_data,
grpc_core::Arena* arena);
-
- /* implementation of grpc_transport_set_pollset */
+
+ /* implementation of grpc_transport_set_pollset */
void (*set_pollset)(grpc_transport* self, grpc_stream* stream,
grpc_pollset* pollset);
-
- /* implementation of grpc_transport_set_pollset */
+
+ /* implementation of grpc_transport_set_pollset */
void (*set_pollset_set)(grpc_transport* self, grpc_stream* stream,
grpc_pollset_set* pollset_set);
-
- /* implementation of grpc_transport_perform_stream_op */
+
+ /* implementation of grpc_transport_perform_stream_op */
void (*perform_stream_op)(grpc_transport* self, grpc_stream* stream,
grpc_transport_stream_op_batch* op);
-
- /* implementation of grpc_transport_perform_op */
+
+ /* implementation of grpc_transport_perform_op */
void (*perform_op)(grpc_transport* self, grpc_transport_op* op);
-
- /* implementation of grpc_transport_destroy_stream */
+
+ /* implementation of grpc_transport_destroy_stream */
void (*destroy_stream)(grpc_transport* self, grpc_stream* stream,
grpc_closure* then_schedule_closure);
-
- /* implementation of grpc_transport_destroy */
+
+ /* implementation of grpc_transport_destroy */
void (*destroy)(grpc_transport* self);
-
- /* implementation of grpc_transport_get_endpoint */
+
+ /* implementation of grpc_transport_get_endpoint */
grpc_endpoint* (*get_endpoint)(grpc_transport* self);
-} grpc_transport_vtable;
-
-/* an instance of a grpc transport */
-struct grpc_transport {
- /* pointer to a vtable defining operations on this transport */
+} grpc_transport_vtable;
+
+/* an instance of a grpc transport */
+struct grpc_transport {
+ /* pointer to a vtable defining operations on this transport */
const grpc_transport_vtable* vtable;
-};
-
-#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */
+};
+
+#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */
diff --git a/contrib/libs/grpc/src/cpp/README.md b/contrib/libs/grpc/src/cpp/README.md
index 464427e34e..967a0a43b7 100755
--- a/contrib/libs/grpc/src/cpp/README.md
+++ b/contrib/libs/grpc/src/cpp/README.md
@@ -1,14 +1,14 @@
# gRPC C++
-
+
This directory contains the C++ implementation of gRPC.
-
+
# To start using gRPC C++
-
+
This section describes how to add gRPC as a dependency to your C++ project.
In the C++ world, there's no universally accepted standard for managing project dependencies.
Therefore, gRPC supports several major build systems, which should satisfy most users.
-
+
## Bazel
Bazel is the primary build system used by the core gRPC development team. Bazel
@@ -159,22 +159,22 @@ The gRPC port in vcpkg is kept up to date by Microsoft team members and communit
## Examples & Additional Documentation
-You can find out how to build and run our simplest gRPC C++ example in our
-[C++ quick start](../../examples/cpp).
-
-For more detailed documentation on using gRPC in C++ , see our main
+You can find out how to build and run our simplest gRPC C++ example in our
+[C++ quick start](../../examples/cpp).
+
+For more detailed documentation on using gRPC in C++ , see our main
documentation site at [grpc.io](https://grpc.io), specifically:
-
+
* [Overview](https://grpc.io/docs): An introduction to gRPC with a simple
- Hello World example in all our supported languages, including C++.
+ Hello World example in all our supported languages, including C++.
* [gRPC Basics - C++](https://grpc.io/docs/languages/cpp/basics):
- A tutorial that steps you through creating a simple gRPC C++ example
- application.
+ A tutorial that steps you through creating a simple gRPC C++ example
+ application.
* [Asynchronous Basics - C++](https://grpc.io/docs/languages/cpp/async):
- A tutorial that shows you how to use gRPC C++'s asynchronous/non-blocking
- APIs.
-
-
+ A tutorial that shows you how to use gRPC C++'s asynchronous/non-blocking
+ APIs.
+
+
# To start developing gRPC C++
-
+
For instructions on how to build gRPC C++ from source, follow the [Building gRPC C++](../../BUILDING.md) instructions.
diff --git a/contrib/libs/grpc/src/cpp/client/channel_cc.cc b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
index 282a694888..ac95c29efc 100644
--- a/contrib/libs/grpc/src/cpp/client/channel_cc.cc
+++ b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/channel.h>
-
+
#include <cstring>
-#include <memory>
-
-#include <grpc/grpc.h>
-#include <grpc/slice.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
+#include <memory>
+
+#include <grpc/grpc.h>
+#include <grpc/slice.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <grpcpp/client_context.h>
@@ -40,28 +40,28 @@
#include <grpcpp/support/status.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/surface/completion_queue.h"
-
+
namespace grpc {
-
+
static ::grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel(const TString& host, grpc_channel* channel,
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators)
- : host_(host), c_channel_(channel) {
+ : host_(host), c_channel_(channel) {
interceptor_creators_ = std::move(interceptor_creators);
- g_gli_initializer.summon();
-}
-
+ g_gli_initializer.summon();
+}
+
Channel::~Channel() {
grpc_channel_destroy(c_channel_);
if (callback_cq_ != nullptr) {
callback_cq_->Shutdown();
}
}
-
-namespace {
-
+
+namespace {
+
inline grpc_slice SliceFromArray(const char* arr, size_t len) {
return g_core_codegen_interface->grpc_slice_from_copied_buffer(arr, len);
}
@@ -70,29 +70,29 @@ TString GetChannelInfoField(grpc_channel* channel,
grpc_channel_info* channel_info,
char*** channel_info_field) {
char* value = nullptr;
- memset(channel_info, 0, sizeof(*channel_info));
- *channel_info_field = &value;
- grpc_channel_get_info(channel, channel_info);
+ memset(channel_info, 0, sizeof(*channel_info));
+ *channel_info_field = &value;
+ grpc_channel_get_info(channel, channel_info);
if (value == nullptr) return "";
TString result = value;
- gpr_free(value);
- return result;
-}
-
-} // namespace
-
+ gpr_free(value);
+ return result;
+}
+
+} // namespace
+
TString Channel::GetLoadBalancingPolicyName() const {
- grpc_channel_info channel_info;
- return GetChannelInfoField(c_channel_, &channel_info,
- &channel_info.lb_policy_name);
-}
-
+ grpc_channel_info channel_info;
+ return GetChannelInfoField(c_channel_, &channel_info,
+ &channel_info.lb_policy_name);
+}
+
TString Channel::GetServiceConfigJSON() const {
- grpc_channel_info channel_info;
- return GetChannelInfoField(c_channel_, &channel_info,
- &channel_info.service_config_json);
-}
-
+ grpc_channel_info channel_info;
+ return GetChannelInfoField(c_channel_, &channel_info,
+ &channel_info.service_config_json);
+}
+
namespace experimental {
void ChannelResetConnectionBackoff(Channel* channel) {
@@ -104,20 +104,20 @@ void ChannelResetConnectionBackoff(Channel* channel) {
::grpc::internal::Call Channel::CreateCallInternal(
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq, size_t interceptor_pos) {
- const bool kRegistered = method.channel_tag() && context->authority().empty();
+ const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr;
- if (kRegistered) {
- c_call = grpc_channel_create_registered_call(
- c_channel_, context->propagate_from_call_,
- context->propagation_options_.c_bitmask(), cq->cq(),
- method.channel_tag(), context->raw_deadline(), nullptr);
- } else {
+ if (kRegistered) {
+ c_call = grpc_channel_create_registered_call(
+ c_channel_, context->propagate_from_call_,
+ context->propagation_options_.c_bitmask(), cq->cq(),
+ method.channel_tag(), context->raw_deadline(), nullptr);
+ } else {
const ::TString* host_str = nullptr;
if (!context->authority_.empty()) {
host_str = &context->authority_;
- } else if (!host_.empty()) {
+ } else if (!host_.empty()) {
host_str = &host_;
- }
+ }
grpc_slice method_slice =
SliceFromArray(method.name(), strlen(method.name()));
grpc_slice host_slice;
@@ -133,8 +133,8 @@ void ChannelResetConnectionBackoff(Channel* channel) {
if (host_str != nullptr) {
grpc_slice_unref(host_slice);
}
- }
- grpc_census_call_set_context(c_call, context->census_context());
+ }
+ grpc_census_call_set_context(c_call, context->census_context());
// ClientRpcInfo should be set before call because set_call also checks
// whether the call has been cancelled, and if the call was cancelled, we
@@ -142,11 +142,11 @@ void ChannelResetConnectionBackoff(Channel* channel) {
auto* info =
context->set_client_rpc_info(method.name(), method.method_type(), this,
interceptor_creators_, interceptor_pos);
- context->set_call(c_call, shared_from_this());
+ context->set_call(c_call, shared_from_this());
return ::grpc::internal::Call(c_call, this, cq, info);
-}
-
+}
+
::grpc::internal::Call Channel::CreateCall(
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
CompletionQueue* cq) {
@@ -157,54 +157,54 @@ void Channel::PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
::grpc::internal::Call* call) {
ops->FillOps(
call); // Make a copy of call. It's fine since Call just has pointers
-}
-
-void* Channel::RegisterMethod(const char* method) {
- return grpc_channel_register_call(
+}
+
+void* Channel::RegisterMethod(const char* method) {
+ return grpc_channel_register_call(
c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr);
-}
-
-grpc_connectivity_state Channel::GetState(bool try_to_connect) {
- return grpc_channel_check_connectivity_state(c_channel_, try_to_connect);
-}
-
-namespace {
+}
+
+grpc_connectivity_state Channel::GetState(bool try_to_connect) {
+ return grpc_channel_check_connectivity_state(c_channel_, try_to_connect);
+}
+
+namespace {
class TagSaver final : public ::grpc::internal::CompletionQueueTag {
- public:
- explicit TagSaver(void* tag) : tag_(tag) {}
- ~TagSaver() override {}
+ public:
+ explicit TagSaver(void* tag) : tag_(tag) {}
+ ~TagSaver() override {}
bool FinalizeResult(void** tag, bool* /*status*/) override {
- *tag = tag_;
- delete this;
- return true;
- }
-
- private:
- void* tag_;
-};
-
-} // namespace
-
-void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
- gpr_timespec deadline,
+ *tag = tag_;
+ delete this;
+ return true;
+ }
+
+ private:
+ void* tag_;
+};
+
+} // namespace
+
+void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
+ gpr_timespec deadline,
::grpc::CompletionQueue* cq, void* tag) {
- TagSaver* tag_saver = new TagSaver(tag);
- grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline,
- cq->cq(), tag_saver);
-}
-
-bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,
- gpr_timespec deadline) {
+ TagSaver* tag_saver = new TagSaver(tag);
+ grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline,
+ cq->cq(), tag_saver);
+}
+
+bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,
+ gpr_timespec deadline) {
::grpc::CompletionQueue cq;
- bool ok = false;
+ bool ok = false;
void* tag = nullptr;
NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr);
- cq.Next(&tag, &ok);
+ cq.Next(&tag, &ok);
GPR_ASSERT(tag == nullptr);
- return ok;
-}
-
+ return ok;
+}
+
namespace {
class ShutdownCallback : public grpc_experimental_completion_queue_functor {
public:
diff --git a/contrib/libs/grpc/src/cpp/client/client_context.cc b/contrib/libs/grpc/src/cpp/client/client_context.cc
index 458965186c..b75343d089 100644
--- a/contrib/libs/grpc/src/cpp/client/client_context.cc
+++ b/contrib/libs/grpc/src/cpp/client/client_context.cc
@@ -1,77 +1,77 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/client_context.h>
-
-#include <grpc/compression.h>
-#include <grpc/grpc.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-
+
+#include <grpc/compression.h>
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+
#include <grpcpp/impl/codegen/interceptor_common.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/time.h>
-
+
namespace grpc {
-
+
class Channel;
-class DefaultGlobalClientCallbacks final
- : public ClientContext::GlobalCallbacks {
- public:
- ~DefaultGlobalClientCallbacks() override {}
+class DefaultGlobalClientCallbacks final
+ : public ClientContext::GlobalCallbacks {
+ public:
+ ~DefaultGlobalClientCallbacks() override {}
void DefaultConstructor(ClientContext* /*context*/) override {}
void Destructor(ClientContext* /*context*/) override {}
-};
-
+};
+
static internal::GrpcLibraryInitializer g_gli_initializer;
static DefaultGlobalClientCallbacks* g_default_client_callbacks =
new DefaultGlobalClientCallbacks();
-static ClientContext::GlobalCallbacks* g_client_callbacks =
+static ClientContext::GlobalCallbacks* g_client_callbacks =
g_default_client_callbacks;
-
-ClientContext::ClientContext()
- : initial_metadata_received_(false),
- wait_for_ready_(false),
- wait_for_ready_explicitly_set_(false),
- idempotent_(false),
- cacheable_(false),
- call_(nullptr),
- call_canceled_(false),
- deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
- census_context_(nullptr),
+
+ClientContext::ClientContext()
+ : initial_metadata_received_(false),
+ wait_for_ready_(false),
+ wait_for_ready_explicitly_set_(false),
+ idempotent_(false),
+ cacheable_(false),
+ call_(nullptr),
+ call_canceled_(false),
+ deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
+ census_context_(nullptr),
propagate_from_call_(nullptr),
compression_algorithm_(GRPC_COMPRESS_NONE),
initial_metadata_corked_(false) {
- g_client_callbacks->DefaultConstructor(this);
-}
-
-ClientContext::~ClientContext() {
- if (call_) {
+ g_client_callbacks->DefaultConstructor(this);
+}
+
+ClientContext::~ClientContext() {
+ if (call_) {
grpc_call_unref(call_);
- }
- g_client_callbacks->Destructor(this);
-}
-
+ }
+ g_client_callbacks->Destructor(this);
+}
+
void ClientContext::set_credentials(
const std::shared_ptr<CallCredentials>& creds) {
creds_ = creds;
@@ -90,12 +90,12 @@ void ClientContext::set_credentials(
std::unique_ptr<ClientContext> ClientContext::FromInternalServerContext(
const grpc::ServerContextBase& context, PropagationOptions options) {
- std::unique_ptr<ClientContext> ctx(new ClientContext);
+ std::unique_ptr<ClientContext> ctx(new ClientContext);
ctx->propagate_from_call_ = context.call_.call;
- ctx->propagation_options_ = options;
- return ctx;
-}
-
+ ctx->propagation_options_ = options;
+ return ctx;
+}
+
std::unique_ptr<ClientContext> ClientContext::FromServerContext(
const grpc::ServerContext& server_context, PropagationOptions options) {
return FromInternalServerContext(server_context, options);
@@ -109,50 +109,50 @@ std::unique_ptr<ClientContext> ClientContext::FromCallbackServerContext(
void ClientContext::AddMetadata(const TString& meta_key,
const TString& meta_value) {
- send_initial_metadata_.insert(std::make_pair(meta_key, meta_value));
-}
-
+ send_initial_metadata_.insert(std::make_pair(meta_key, meta_value));
+}
+
void ClientContext::set_call(grpc_call* call,
const std::shared_ptr<Channel>& channel) {
internal::MutexLock lock(&mu_);
- GPR_ASSERT(call_ == nullptr);
- call_ = call;
- channel_ = channel;
- if (creds_ && !creds_->ApplyToCall(call_)) {
+ GPR_ASSERT(call_ == nullptr);
+ call_ = call;
+ channel_ = channel;
+ if (creds_ && !creds_->ApplyToCall(call_)) {
// TODO(yashykt): should interceptors also see this status?
SendCancelToInterceptors();
- grpc_call_cancel_with_status(call, GRPC_STATUS_CANCELLED,
- "Failed to set credentials to rpc.", nullptr);
- }
- if (call_canceled_) {
+ grpc_call_cancel_with_status(call, GRPC_STATUS_CANCELLED,
+ "Failed to set credentials to rpc.", nullptr);
+ }
+ if (call_canceled_) {
SendCancelToInterceptors();
- grpc_call_cancel(call_, nullptr);
- }
-}
-
-void ClientContext::set_compression_algorithm(
- grpc_compression_algorithm algorithm) {
+ grpc_call_cancel(call_, nullptr);
+ }
+}
+
+void ClientContext::set_compression_algorithm(
+ grpc_compression_algorithm algorithm) {
compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
- if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
- gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
- algorithm);
- abort();
- }
- GPR_ASSERT(algorithm_name != nullptr);
- AddMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
-}
-
-void ClientContext::TryCancel() {
+ if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
+ gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
+ algorithm);
+ abort();
+ }
+ GPR_ASSERT(algorithm_name != nullptr);
+ AddMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
+}
+
+void ClientContext::TryCancel() {
internal::MutexLock lock(&mu_);
- if (call_) {
+ if (call_) {
SendCancelToInterceptors();
- grpc_call_cancel(call_, nullptr);
- } else {
- call_canceled_ = true;
- }
-}
-
+ grpc_call_cancel(call_, nullptr);
+ } else {
+ call_canceled_ = true;
+ }
+}
+
void ClientContext::SendCancelToInterceptors() {
internal::CancelInterceptorBatchMethods cancel_methods;
for (size_t i = 0; i < rpc_info_.interceptors_.size(); i++) {
@@ -162,19 +162,19 @@ void ClientContext::SendCancelToInterceptors() {
TString ClientContext::peer() const {
TString peer;
- if (call_) {
- char* c_peer = grpc_call_get_peer(call_);
- peer = c_peer;
- gpr_free(c_peer);
- }
- return peer;
-}
-
-void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
+ if (call_) {
+ char* c_peer = grpc_call_get_peer(call_);
+ peer = c_peer;
+ gpr_free(c_peer);
+ }
+ return peer;
+}
+
+void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
GPR_ASSERT(g_client_callbacks == g_default_client_callbacks);
GPR_ASSERT(client_callbacks != nullptr);
GPR_ASSERT(client_callbacks != g_default_client_callbacks);
- g_client_callbacks = client_callbacks;
-}
-
+ g_client_callbacks = client_callbacks;
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel.cc b/contrib/libs/grpc/src/cpp/client/create_channel.cc
index 9958d317c6..97327490ed 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel.cc
@@ -1,40 +1,40 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <memory>
-
+ *
+ */
+
+#include <memory>
+
#include <grpcpp/channel.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h>
-
-#include "src/cpp/client/create_channel_internal.h"
-
+
+#include "src/cpp/client/create_channel_internal.h"
+
namespace grpc {
std::shared_ptr<grpc::Channel> CreateChannel(
- const grpc::string& target,
+ const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds) {
return CreateCustomChannel(target, creds, grpc::ChannelArguments());
-}
-
+}
+
std::shared_ptr<grpc::Channel> CreateCustomChannel(
- const grpc::string& target,
+ const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args) {
grpc::GrpcLibraryCodegen
@@ -48,8 +48,8 @@ std::shared_ptr<grpc::Channel> CreateCustomChannel(
std::vector<std::unique_ptr<
grpc::experimental::
ClientInterceptorFactoryInterface>>());
-}
-
+}
+
namespace experimental {
/// Create a new \em custom \a Channel pointing to \a target with \a
/// interceptors being invoked per call.
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc b/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
index ff961afc78..da2a878a22 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
@@ -1,29 +1,29 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <memory>
-
+ *
+ */
+
+#include <memory>
+
#include <grpcpp/channel.h>
-
-struct grpc_channel;
-
-namespace grpc {
-
+
+struct grpc_channel;
+
+namespace grpc {
+
std::shared_ptr<Channel> CreateChannelInternal(
const TString& host, grpc_channel* c_channel,
std::vector<std::unique_ptr<
@@ -31,6 +31,6 @@ std::shared_ptr<Channel> CreateChannelInternal(
interceptor_creators) {
return std::shared_ptr<Channel>(
new Channel(host, c_channel, std::move(interceptor_creators)));
-}
+}
-} // namespace grpc
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_internal.h b/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
index e944622298..09d4e56b02 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
@@ -1,40 +1,40 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
-#define GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
-
-#include <memory>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+#define GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+
+#include <memory>
+
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/support/config.h>
-
-struct grpc_channel;
-
-namespace grpc {
-
+
+struct grpc_channel;
+
+namespace grpc {
+
std::shared_ptr<Channel> CreateChannelInternal(
const TString& host, grpc_channel* c_channel,
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc b/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
index 9a84e105f4..db09eda8a6 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
@@ -1,58 +1,58 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <grpc/grpc.h>
-#include <grpc/grpc_posix.h>
+ *
+ */
+
+#include <grpc/grpc.h>
+#include <grpc/grpc_posix.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/channel_arguments.h>
-
-#include "src/cpp/client/create_channel_internal.h"
-
+
+#include "src/cpp/client/create_channel_internal.h"
+
namespace grpc {
-
+
class ChannelArguments;
-#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
-
+#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
+
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const TString& target,
int fd) {
grpc::internal::GrpcLibrary init_lib;
- init_lib.init();
+ init_lib.init();
return CreateChannelInternal(
"", grpc_insecure_channel_create_from_fd(target.c_str(), fd, nullptr),
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>());
-}
-
+}
+
std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd(
const TString& target, int fd, const grpc::ChannelArguments& args) {
internal::GrpcLibrary init_lib;
- init_lib.init();
- grpc_channel_args channel_args;
- args.SetChannelArgs(&channel_args);
+ init_lib.init();
+ grpc_channel_args channel_args;
+ args.SetChannelArgs(&channel_args);
return CreateChannelInternal(
"",
grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args),
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>());
-}
-
+}
+
namespace experimental {
std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
@@ -72,6 +72,6 @@ std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
} // namespace experimental
-#endif // GPR_SUPPORT_CHANNELS_FROM_FD
-
+#endif // GPR_SUPPORT_CHANNELS_FROM_FD
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc b/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
index 5c673c2f5b..9dfb2f491c 100644
--- a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
+++ b/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
@@ -1,33 +1,33 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
-
+
namespace grpc {
-
+
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
-ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
-
-ChannelCredentials::~ChannelCredentials() {}
-
-CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
-
-CallCredentials::~CallCredentials() {}
-
+ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
+
+ChannelCredentials::~ChannelCredentials() {}
+
+CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
+
+CallCredentials::~CallCredentials() {}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc b/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
index 9d9586fcb1..e5bafff70a 100644
--- a/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
@@ -1,34 +1,34 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
+ *
+ */
#include <grpcpp/security/credentials.h>
-
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
-#include "src/cpp/client/create_channel_internal.h"
-
+#include "src/cpp/client/create_channel_internal.h"
+
namespace grpc {
-
-namespace {
-class InsecureChannelCredentialsImpl final : public ChannelCredentials {
- public:
+
+namespace {
+class InsecureChannelCredentialsImpl final : public ChannelCredentials {
+ public:
std::shared_ptr<Channel> CreateChannelImpl(
const TString& target, const ChannelArguments& args) override {
return CreateChannelWithInterceptors(
@@ -42,21 +42,21 @@ class InsecureChannelCredentialsImpl final : public ChannelCredentials {
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) override {
- grpc_channel_args channel_args;
- args.SetChannelArgs(&channel_args);
+ grpc_channel_args channel_args;
+ args.SetChannelArgs(&channel_args);
return ::grpc::CreateChannelInternal(
- "",
+ "",
grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr),
std::move(interceptor_creators));
- }
-
- SecureChannelCredentials* AsSecureCredentials() override { return nullptr; }
-};
-} // namespace
-
-std::shared_ptr<ChannelCredentials> InsecureChannelCredentials() {
- return std::shared_ptr<ChannelCredentials>(
- new InsecureChannelCredentialsImpl());
-}
-
+ }
+
+ SecureChannelCredentials* AsSecureCredentials() override { return nullptr; }
+};
+} // namespace
+
+std::shared_ptr<ChannelCredentials> InsecureChannelCredentials() {
+ return std::shared_ptr<ChannelCredentials>(
+ new InsecureChannelCredentialsImpl());
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
index 882d66ee17..0f6db3caa5 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
@@ -1,27 +1,27 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include "src/cpp/client/secure_credentials.h"
+ *
+ */
+
+#include "src/cpp/client/secure_credentials.h"
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
+#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/status.h>
@@ -35,18 +35,18 @@
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/transport/auth_filters.h"
#include "src/core/lib/security/util/json_util.h"
-#include "src/cpp/client/create_channel_internal.h"
-#include "src/cpp/common/secure_auth_context.h"
-
+#include "src/cpp/client/create_channel_internal.h"
+#include "src/cpp/common/secure_auth_context.h"
+
namespace grpc {
-
+
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
-SecureChannelCredentials::SecureChannelCredentials(
- grpc_channel_credentials* c_creds)
- : c_creds_(c_creds) {
- g_gli_initializer.summon();
-}
-
+SecureChannelCredentials::SecureChannelCredentials(
+ grpc_channel_credentials* c_creds)
+ : c_creds_(c_creds) {
+ g_gli_initializer.summon();
+}
+
std::shared_ptr<Channel> SecureChannelCredentials::CreateChannelImpl(
const TString& target, const ChannelArguments& args) {
return CreateChannelWithInterceptors(
@@ -61,60 +61,60 @@ SecureChannelCredentials::CreateChannelWithInterceptors(
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
- grpc_channel_args channel_args;
- args.SetChannelArgs(&channel_args);
+ grpc_channel_args channel_args;
+ args.SetChannelArgs(&channel_args);
return ::grpc::CreateChannelInternal(
- args.GetSslTargetNameOverride(),
- grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args,
+ args.GetSslTargetNameOverride(),
+ grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args,
nullptr),
std::move(interceptor_creators));
-}
-
-SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds)
- : c_creds_(c_creds) {
- g_gli_initializer.summon();
-}
-
-bool SecureCallCredentials::ApplyToCall(grpc_call* call) {
- return grpc_call_set_credentials(call, c_creds_) == GRPC_CALL_OK;
-}
-
-namespace {
-std::shared_ptr<ChannelCredentials> WrapChannelCredentials(
- grpc_channel_credentials* creds) {
+}
+
+SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds)
+ : c_creds_(c_creds) {
+ g_gli_initializer.summon();
+}
+
+bool SecureCallCredentials::ApplyToCall(grpc_call* call) {
+ return grpc_call_set_credentials(call, c_creds_) == GRPC_CALL_OK;
+}
+
+namespace {
+std::shared_ptr<ChannelCredentials> WrapChannelCredentials(
+ grpc_channel_credentials* creds) {
return creds == nullptr ? nullptr
: std::shared_ptr<ChannelCredentials>(
new SecureChannelCredentials(creds));
-}
-
-std::shared_ptr<CallCredentials> WrapCallCredentials(
- grpc_call_credentials* creds) {
+}
+
+std::shared_ptr<CallCredentials> WrapCallCredentials(
+ grpc_call_credentials* creds) {
return creds == nullptr ? nullptr
: std::shared_ptr<CallCredentials>(
new SecureCallCredentials(creds));
-}
-} // namespace
-
-std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() {
+}
+} // namespace
+
+std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
return WrapChannelCredentials(
grpc_google_default_credentials_create(nullptr));
-}
-
-// Builds SSL Credentials given SSL specific options
-std::shared_ptr<ChannelCredentials> SslCredentials(
- const SslCredentialsOptions& options) {
+}
+
+// Builds SSL Credentials given SSL specific options
+std::shared_ptr<ChannelCredentials> SslCredentials(
+ const SslCredentialsOptions& options) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {
- options.pem_private_key.c_str(), options.pem_cert_chain.c_str()};
-
- grpc_channel_credentials* c_creds = grpc_ssl_credentials_create(
- options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
+ grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {
+ options.pem_private_key.c_str(), options.pem_cert_chain.c_str()};
+
+ grpc_channel_credentials* c_creds = grpc_ssl_credentials_create(
+ options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
options.pem_private_key.empty() ? nullptr : &pem_key_cert_pair, nullptr,
nullptr);
- return WrapChannelCredentials(c_creds);
-}
-
+ return WrapChannelCredentials(c_creds);
+}
+
namespace experimental {
namespace {
@@ -296,72 +296,72 @@ std::shared_ptr<ChannelCredentials> TlsCredentials(
} // namespace experimental
-// Builds credentials for use when running in GCE
-std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
+// Builds credentials for use when running in GCE
+std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- return WrapCallCredentials(
- grpc_google_compute_engine_credentials_create(nullptr));
-}
-
-// Builds JWT credentials.
-std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
+ return WrapCallCredentials(
+ grpc_google_compute_engine_credentials_create(nullptr));
+}
+
+// Builds JWT credentials.
+std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
const TString& json_key, long token_lifetime_seconds) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- if (token_lifetime_seconds <= 0) {
- gpr_log(GPR_ERROR,
- "Trying to create JWTCredentials with non-positive lifetime");
- return WrapCallCredentials(nullptr);
- }
- gpr_timespec lifetime =
- gpr_time_from_seconds(token_lifetime_seconds, GPR_TIMESPAN);
- return WrapCallCredentials(grpc_service_account_jwt_access_credentials_create(
- json_key.c_str(), lifetime, nullptr));
-}
-
-// Builds refresh token credentials.
-std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
+ if (token_lifetime_seconds <= 0) {
+ gpr_log(GPR_ERROR,
+ "Trying to create JWTCredentials with non-positive lifetime");
+ return WrapCallCredentials(nullptr);
+ }
+ gpr_timespec lifetime =
+ gpr_time_from_seconds(token_lifetime_seconds, GPR_TIMESPAN);
+ return WrapCallCredentials(grpc_service_account_jwt_access_credentials_create(
+ json_key.c_str(), lifetime, nullptr));
+}
+
+// Builds refresh token credentials.
+std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
const TString& json_refresh_token) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- return WrapCallCredentials(grpc_google_refresh_token_credentials_create(
- json_refresh_token.c_str(), nullptr));
-}
-
-// Builds access token credentials.
-std::shared_ptr<CallCredentials> AccessTokenCredentials(
+ return WrapCallCredentials(grpc_google_refresh_token_credentials_create(
+ json_refresh_token.c_str(), nullptr));
+}
+
+// Builds access token credentials.
+std::shared_ptr<CallCredentials> AccessTokenCredentials(
const TString& access_token) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- return WrapCallCredentials(
- grpc_access_token_credentials_create(access_token.c_str(), nullptr));
-}
-
-// Builds IAM credentials.
-std::shared_ptr<CallCredentials> GoogleIAMCredentials(
+ return WrapCallCredentials(
+ grpc_access_token_credentials_create(access_token.c_str(), nullptr));
+}
+
+// Builds IAM credentials.
+std::shared_ptr<CallCredentials> GoogleIAMCredentials(
const TString& authorization_token,
const TString& authority_selector) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- return WrapCallCredentials(grpc_google_iam_credentials_create(
- authorization_token.c_str(), authority_selector.c_str(), nullptr));
-}
-
-// Combines one channel credentials and one call credentials into a channel
-// composite credentials.
-std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
- const std::shared_ptr<ChannelCredentials>& channel_creds,
- const std::shared_ptr<CallCredentials>& call_creds) {
- // Note that we are not saving shared_ptrs to the two credentials passed in
- // here. This is OK because the underlying C objects (i.e., channel_creds and
- // call_creds) into grpc_composite_credentials_create will see their refcounts
- // incremented.
- SecureChannelCredentials* s_channel_creds =
- channel_creds->AsSecureCredentials();
- SecureCallCredentials* s_call_creds = call_creds->AsSecureCredentials();
- if (s_channel_creds && s_call_creds) {
- return WrapChannelCredentials(grpc_composite_channel_credentials_create(
- s_channel_creds->GetRawCreds(), s_call_creds->GetRawCreds(), nullptr));
- }
- return nullptr;
-}
-
+ return WrapCallCredentials(grpc_google_iam_credentials_create(
+ authorization_token.c_str(), authority_selector.c_str(), nullptr));
+}
+
+// Combines one channel credentials and one call credentials into a channel
+// composite credentials.
+std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
+ const std::shared_ptr<ChannelCredentials>& channel_creds,
+ const std::shared_ptr<CallCredentials>& call_creds) {
+ // Note that we are not saving shared_ptrs to the two credentials passed in
+ // here. This is OK because the underlying C objects (i.e., channel_creds and
+ // call_creds) into grpc_composite_credentials_create will see their refcounts
+ // incremented.
+ SecureChannelCredentials* s_channel_creds =
+ channel_creds->AsSecureCredentials();
+ SecureCallCredentials* s_call_creds = call_creds->AsSecureCredentials();
+ if (s_channel_creds && s_call_creds) {
+ return WrapChannelCredentials(grpc_composite_channel_credentials_create(
+ s_channel_creds->GetRawCreds(), s_call_creds->GetRawCreds(), nullptr));
+ }
+ return nullptr;
+}
+
std::shared_ptr<CallCredentials> CompositeCallCredentials(
const std::shared_ptr<CallCredentials>& creds1,
const std::shared_ptr<CallCredentials>& creds2) {
@@ -390,12 +390,12 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
namespace {
void DeleteWrapper(void* wrapper, grpc_error* /*ignored*/) {
- MetadataCredentialsPluginWrapper* w =
+ MetadataCredentialsPluginWrapper* w =
static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
- delete w;
-}
+ delete w;
+}
} // namespace
-
+
char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) {
GPR_ASSERT(wrapper);
MetadataCredentialsPluginWrapper* w =
@@ -412,21 +412,21 @@ void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) {
}
int MetadataCredentialsPluginWrapper::GetMetadata(
- void* wrapper, grpc_auth_metadata_context context,
+ void* wrapper, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb, void* user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t* num_creds_md, grpc_status_code* status,
const char** error_details) {
- GPR_ASSERT(wrapper);
- MetadataCredentialsPluginWrapper* w =
+ GPR_ASSERT(wrapper);
+ MetadataCredentialsPluginWrapper* w =
static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
- if (!w->plugin_) {
+ if (!w->plugin_) {
*num_creds_md = 0;
*status = GRPC_STATUS_OK;
*error_details = nullptr;
return 1;
- }
- if (w->plugin_->IsBlocking()) {
+ }
+ if (w->plugin_->IsBlocking()) {
// The internals of context may be destroyed if GetMetadata is cancelled.
// Make a copy for InvokePlugin.
grpc_auth_metadata_context context_copy = grpc_auth_metadata_context();
@@ -438,14 +438,14 @@ int MetadataCredentialsPluginWrapper::GetMetadata(
grpc_auth_metadata_context_reset(&context_copy);
});
return 0;
- } else {
+ } else {
// Synchronous return.
w->InvokePlugin(context, cb, user_data, creds_md, num_creds_md, status,
error_details);
return 1;
- }
-}
-
+ }
+}
+
namespace {
void UnrefMetadata(const std::vector<grpc_metadata>& md) {
@@ -457,27 +457,27 @@ void UnrefMetadata(const std::vector<grpc_metadata>& md) {
} // namespace
-void MetadataCredentialsPluginWrapper::InvokePlugin(
- grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb,
+void MetadataCredentialsPluginWrapper::InvokePlugin(
+ grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb,
void* user_data, grpc_metadata creds_md[4], size_t* num_creds_md,
grpc_status_code* status_code, const char** error_details) {
std::multimap<TString, TString> metadata;
-
+
// const_cast is safe since the SecureAuthContext only inc/dec the refcount
// and the object is passed as a const ref to plugin_->GetMetadata.
- SecureAuthContext cpp_channel_auth_context(
+ SecureAuthContext cpp_channel_auth_context(
const_cast<grpc_auth_context*>(context.channel_auth_context));
-
- Status status = plugin_->GetMetadata(context.service_url, context.method_name,
- cpp_channel_auth_context, &metadata);
- std::vector<grpc_metadata> md;
+
+ Status status = plugin_->GetMetadata(context.service_url, context.method_name,
+ cpp_channel_auth_context, &metadata);
+ std::vector<grpc_metadata> md;
for (auto& metadatum : metadata) {
- grpc_metadata md_entry;
+ grpc_metadata md_entry;
md_entry.key = SliceFromCopiedString(metadatum.first);
md_entry.value = SliceFromCopiedString(metadatum.second);
- md_entry.flags = 0;
- md.push_back(md_entry);
- }
+ md_entry.flags = 0;
+ md.push_back(md_entry);
+ }
if (creds_md != nullptr) {
// Synchronous return.
if (md.size() > GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX) {
@@ -504,10 +504,10 @@ void MetadataCredentialsPluginWrapper::InvokePlugin(
status.error_message().c_str());
UnrefMetadata(md);
}
-}
-
-MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
- std::unique_ptr<MetadataCredentialsPlugin> plugin)
- : thread_pool_(CreateDefaultThreadPool()), plugin_(std::move(plugin)) {}
-
-} // namespace grpc
+}
+
+MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
+ std::unique_ptr<MetadataCredentialsPlugin> plugin)
+ : thread_pool_(CreateDefaultThreadPool()), plugin_(std::move(plugin)) {}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.h b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
index 3b7fbaaf02..4fc79346bf 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.h
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
@@ -1,79 +1,79 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
-#define GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
-
-#include <grpc/grpc_security.h>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
+#define GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
+
+#include <grpc/grpc_security.h>
+
#include <grpcpp/security/credentials.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/config.h>
-
+
#include "y_absl/strings/str_cat.h"
#include "src/core/lib/security/credentials/credentials.h"
-#include "src/cpp/server/thread_pool_interface.h"
-
+#include "src/cpp/server/thread_pool_interface.h"
+
namespace grpc {
-
+
class Channel;
-class SecureChannelCredentials final : public ChannelCredentials {
- public:
- explicit SecureChannelCredentials(grpc_channel_credentials* c_creds);
+class SecureChannelCredentials final : public ChannelCredentials {
+ public:
+ explicit SecureChannelCredentials(grpc_channel_credentials* c_creds);
~SecureChannelCredentials() {
if (c_creds_ != nullptr) c_creds_->Unref();
}
- grpc_channel_credentials* GetRawCreds() { return c_creds_; }
-
+ grpc_channel_credentials* GetRawCreds() { return c_creds_; }
+
std::shared_ptr<Channel> CreateChannelImpl(
const TString& target, const ChannelArguments& args) override;
- SecureChannelCredentials* AsSecureCredentials() override { return this; }
-
- private:
+ SecureChannelCredentials* AsSecureCredentials() override { return this; }
+
+ private:
std::shared_ptr<Channel> CreateChannelWithInterceptors(
const TString& target, const ChannelArguments& args,
std::vector<std::unique_ptr<
::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) override;
- grpc_channel_credentials* const c_creds_;
-};
-
-class SecureCallCredentials final : public CallCredentials {
- public:
- explicit SecureCallCredentials(grpc_call_credentials* c_creds);
+ grpc_channel_credentials* const c_creds_;
+};
+
+class SecureCallCredentials final : public CallCredentials {
+ public:
+ explicit SecureCallCredentials(grpc_call_credentials* c_creds);
~SecureCallCredentials() {
if (c_creds_ != nullptr) c_creds_->Unref();
}
- grpc_call_credentials* GetRawCreds() { return c_creds_; }
-
- bool ApplyToCall(grpc_call* call) override;
- SecureCallCredentials* AsSecureCredentials() override { return this; }
+ grpc_call_credentials* GetRawCreds() { return c_creds_; }
+
+ bool ApplyToCall(grpc_call* call) override;
+ SecureCallCredentials* AsSecureCredentials() override { return this; }
TString DebugString() override {
return y_absl::StrCat("SecureCallCredentials{",
TString(c_creds_->debug_string()), "}");
}
-
- private:
- grpc_call_credentials* const c_creds_;
-};
-
+
+ private:
+ grpc_call_credentials* const c_creds_;
+};
+
namespace experimental {
// Transforms C++ STS Credentials options to core options. The pointers of the
@@ -85,8 +85,8 @@ grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
} // namespace experimental
class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
- public:
- static void Destroy(void* wrapper);
+ public:
+ static void Destroy(void* wrapper);
static int GetMetadata(
void* wrapper, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb, void* user_data,
@@ -94,21 +94,21 @@ class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
size_t* num_creds_md, grpc_status_code* status,
const char** error_details);
static char* DebugString(void* wrapper);
-
- explicit MetadataCredentialsPluginWrapper(
- std::unique_ptr<MetadataCredentialsPlugin> plugin);
-
- private:
+
+ explicit MetadataCredentialsPluginWrapper(
+ std::unique_ptr<MetadataCredentialsPlugin> plugin);
+
+ private:
void InvokePlugin(
grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb, void* user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t* num_creds_md, grpc_status_code* status_code,
const char** error_details);
- std::unique_ptr<ThreadPoolInterface> thread_pool_;
- std::unique_ptr<MetadataCredentialsPlugin> plugin_;
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
+ std::unique_ptr<ThreadPoolInterface> thread_pool_;
+ std::unique_ptr<MetadataCredentialsPlugin> plugin_;
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
diff --git a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc b/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
index 5a0375c065..e1e47cbb17 100644
--- a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
+++ b/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/grpc_library.h>
-
-/// Null-initializes the global gRPC variables for the codegen library. These
+
+/// Null-initializes the global gRPC variables for the codegen library. These
/// stay null in the absence of grpc++ library. In this case, no gRPC
-/// features such as the ability to perform calls will be available. Trying to
-/// perform them would result in a segmentation fault when trying to deference
-/// the following nulled globals. These should be associated with actual
-/// as part of the instantiation of a \a grpc::GrpcLibraryInitializer variable.
-
-grpc::CoreCodegenInterface* grpc::g_core_codegen_interface;
-grpc::GrpcLibraryInterface* grpc::g_glip;
+/// features such as the ability to perform calls will be available. Trying to
+/// perform them would result in a segmentation fault when trying to deference
+/// the following nulled globals. These should be associated with actual
+/// as part of the instantiation of a \a grpc::GrpcLibraryInitializer variable.
+
+grpc::CoreCodegenInterface* grpc::g_core_codegen_interface;
+grpc::GrpcLibraryInterface* grpc::g_glip;
diff --git a/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc b/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
index 1184b500ea..fbb18e9915 100644
--- a/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
+++ b/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
@@ -1,70 +1,70 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/security/auth_context.h>
-
-#include <grpc/grpc_security.h>
-
-namespace grpc {
-
-AuthPropertyIterator::AuthPropertyIterator()
- : property_(nullptr), ctx_(nullptr), index_(0), name_(nullptr) {}
-
-AuthPropertyIterator::AuthPropertyIterator(
- const grpc_auth_property* property, const grpc_auth_property_iterator* iter)
- : property_(property),
- ctx_(iter->ctx),
- index_(iter->index),
- name_(iter->name) {}
-
-AuthPropertyIterator::~AuthPropertyIterator() {}
-
-AuthPropertyIterator& AuthPropertyIterator::operator++() {
- grpc_auth_property_iterator iter = {ctx_, index_, name_};
- property_ = grpc_auth_property_iterator_next(&iter);
- ctx_ = iter.ctx;
- index_ = iter.index;
- name_ = iter.name;
- return *this;
-}
-
-AuthPropertyIterator AuthPropertyIterator::operator++(int) {
- AuthPropertyIterator tmp(*this);
- operator++();
- return tmp;
-}
-
-bool AuthPropertyIterator::operator==(const AuthPropertyIterator& rhs) const {
- if (property_ == nullptr || rhs.property_ == nullptr) {
- return property_ == rhs.property_;
- } else {
- return index_ == rhs.index_;
- }
-}
-
-bool AuthPropertyIterator::operator!=(const AuthPropertyIterator& rhs) const {
- return !operator==(rhs);
-}
-
-const AuthProperty AuthPropertyIterator::operator*() {
- return std::pair<grpc::string_ref, grpc::string_ref>(
- property_->name,
- grpc::string_ref(property_->value, property_->value_length));
-}
-
-} // namespace grpc
+
+#include <grpc/grpc_security.h>
+
+namespace grpc {
+
+AuthPropertyIterator::AuthPropertyIterator()
+ : property_(nullptr), ctx_(nullptr), index_(0), name_(nullptr) {}
+
+AuthPropertyIterator::AuthPropertyIterator(
+ const grpc_auth_property* property, const grpc_auth_property_iterator* iter)
+ : property_(property),
+ ctx_(iter->ctx),
+ index_(iter->index),
+ name_(iter->name) {}
+
+AuthPropertyIterator::~AuthPropertyIterator() {}
+
+AuthPropertyIterator& AuthPropertyIterator::operator++() {
+ grpc_auth_property_iterator iter = {ctx_, index_, name_};
+ property_ = grpc_auth_property_iterator_next(&iter);
+ ctx_ = iter.ctx;
+ index_ = iter.index;
+ name_ = iter.name;
+ return *this;
+}
+
+AuthPropertyIterator AuthPropertyIterator::operator++(int) {
+ AuthPropertyIterator tmp(*this);
+ operator++();
+ return tmp;
+}
+
+bool AuthPropertyIterator::operator==(const AuthPropertyIterator& rhs) const {
+ if (property_ == nullptr || rhs.property_ == nullptr) {
+ return property_ == rhs.property_;
+ } else {
+ return index_ == rhs.index_;
+ }
+}
+
+bool AuthPropertyIterator::operator!=(const AuthPropertyIterator& rhs) const {
+ return !operator==(rhs);
+}
+
+const AuthProperty AuthPropertyIterator::operator*() {
+ return std::pair<grpc::string_ref, grpc::string_ref>(
+ property_->name,
+ grpc::string_ref(property_->value, property_->value_length));
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
index 0a045b999d..5a5dd91b5e 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
@@ -1,70 +1,70 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
+ *
+ */
#include <grpcpp/support/channel_arguments.h>
-
-#include <sstream>
-
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/support/log.h>
+
+#include <sstream>
+
+#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/support/log.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/resource_quota.h>
-#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/iomgr/socket_mutator.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/socket_mutator.h"
namespace grpc {
-
-ChannelArguments::ChannelArguments() {
- // This will be ignored if used on the server side.
+
+ChannelArguments::ChannelArguments() {
+ // This will be ignored if used on the server side.
SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, "grpc-c++/" + grpc::Version());
-}
-
-ChannelArguments::ChannelArguments(const ChannelArguments& other)
- : strings_(other.strings_) {
- args_.reserve(other.args_.size());
- auto list_it_dst = strings_.begin();
- auto list_it_src = other.strings_.begin();
+}
+
+ChannelArguments::ChannelArguments(const ChannelArguments& other)
+ : strings_(other.strings_) {
+ args_.reserve(other.args_.size());
+ auto list_it_dst = strings_.begin();
+ auto list_it_src = other.strings_.begin();
for (const auto& a : other.args_) {
- grpc_arg ap;
+ grpc_arg ap;
ap.type = a.type;
GPR_ASSERT(list_it_src->c_str() == a.key);
- ap.key = const_cast<char*>(list_it_dst->c_str());
- ++list_it_src;
- ++list_it_dst;
+ ap.key = const_cast<char*>(list_it_dst->c_str());
+ ++list_it_src;
+ ++list_it_dst;
switch (a.type) {
- case GRPC_ARG_INTEGER:
+ case GRPC_ARG_INTEGER:
ap.value.integer = a.value.integer;
- break;
- case GRPC_ARG_STRING:
+ break;
+ case GRPC_ARG_STRING:
GPR_ASSERT(list_it_src->c_str() == a.value.string);
- ap.value.string = const_cast<char*>(list_it_dst->c_str());
- ++list_it_src;
- ++list_it_dst;
- break;
- case GRPC_ARG_POINTER:
+ ap.value.string = const_cast<char*>(list_it_dst->c_str());
+ ++list_it_src;
+ ++list_it_dst;
+ break;
+ case GRPC_ARG_POINTER:
ap.value.pointer = a.value.pointer;
ap.value.pointer.p = a.value.pointer.vtable->copy(ap.value.pointer.p);
- break;
- }
- args_.push_back(ap);
- }
-}
-
+ break;
+ }
+ args_.push_back(ap);
+ }
+}
+
ChannelArguments::~ChannelArguments() {
grpc_core::ExecCtx exec_ctx;
for (auto& arg : args_) {
@@ -74,26 +74,26 @@ ChannelArguments::~ChannelArguments() {
}
}
-void ChannelArguments::Swap(ChannelArguments& other) {
- args_.swap(other.args_);
- strings_.swap(other.strings_);
-}
-
-void ChannelArguments::SetCompressionAlgorithm(
- grpc_compression_algorithm algorithm) {
- SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, algorithm);
-}
-
+void ChannelArguments::Swap(ChannelArguments& other) {
+ args_.swap(other.args_);
+ strings_.swap(other.strings_);
+}
+
+void ChannelArguments::SetCompressionAlgorithm(
+ grpc_compression_algorithm algorithm) {
+ SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, algorithm);
+}
+
void ChannelArguments::SetGrpclbFallbackTimeout(int fallback_timeout) {
SetInt(GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS, fallback_timeout);
}
-void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) {
- if (!mutator) {
- return;
- }
- grpc_arg mutator_arg = grpc_socket_mutator_to_arg(mutator);
- bool replaced = false;
+void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) {
+ if (!mutator) {
+ return;
+ }
+ grpc_arg mutator_arg = grpc_socket_mutator_to_arg(mutator);
+ bool replaced = false;
grpc_core::ExecCtx exec_ctx;
for (auto& arg : args_) {
if (arg.type == mutator_arg.type &&
@@ -102,26 +102,26 @@ void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) {
arg.value.pointer.vtable->destroy(arg.value.pointer.p);
arg.value.pointer = mutator_arg.value.pointer;
replaced = true;
- }
- }
+ }
+ }
- if (!replaced) {
+ if (!replaced) {
strings_.push_back(TString(mutator_arg.key));
- args_.push_back(mutator_arg);
+ args_.push_back(mutator_arg);
args_.back().key = const_cast<char*>(strings_.back().c_str());
- }
-}
-
-// Note: a second call to this will add in front the result of the first call.
-// An example is calling this on a copy of ChannelArguments which already has a
-// prefix. The user can build up a prefix string by calling this multiple times,
-// each with more significant identifier.
-void ChannelArguments::SetUserAgentPrefix(
+ }
+}
+
+// Note: a second call to this will add in front the result of the first call.
+// An example is calling this on a copy of ChannelArguments which already has a
+// prefix. The user can build up a prefix string by calling this multiple times,
+// each with more significant identifier.
+void ChannelArguments::SetUserAgentPrefix(
const TString& user_agent_prefix) {
- if (user_agent_prefix.empty()) {
- return;
- }
- bool replaced = false;
+ if (user_agent_prefix.empty()) {
+ return;
+ }
+ bool replaced = false;
auto strings_it = strings_.begin();
for (auto& arg : args_) {
++strings_it;
@@ -134,84 +134,84 @@ void ChannelArguments::SetUserAgentPrefix(
break;
}
++strings_it;
- }
- }
- if (!replaced) {
- SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix);
- }
-}
-
-void ChannelArguments::SetResourceQuota(
+ }
+ }
+ if (!replaced) {
+ SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix);
+ }
+}
+
+void ChannelArguments::SetResourceQuota(
const grpc::ResourceQuota& resource_quota) {
- SetPointerWithVtable(GRPC_ARG_RESOURCE_QUOTA,
- resource_quota.c_resource_quota(),
- grpc_resource_quota_arg_vtable());
-}
-
-void ChannelArguments::SetMaxReceiveMessageSize(int size) {
- SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, size);
-}
-
-void ChannelArguments::SetMaxSendMessageSize(int size) {
- SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, size);
-}
-
-void ChannelArguments::SetLoadBalancingPolicyName(
+ SetPointerWithVtable(GRPC_ARG_RESOURCE_QUOTA,
+ resource_quota.c_resource_quota(),
+ grpc_resource_quota_arg_vtable());
+}
+
+void ChannelArguments::SetMaxReceiveMessageSize(int size) {
+ SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, size);
+}
+
+void ChannelArguments::SetMaxSendMessageSize(int size) {
+ SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, size);
+}
+
+void ChannelArguments::SetLoadBalancingPolicyName(
const TString& lb_policy_name) {
- SetString(GRPC_ARG_LB_POLICY_NAME, lb_policy_name);
-}
-
-void ChannelArguments::SetServiceConfigJSON(
+ SetString(GRPC_ARG_LB_POLICY_NAME, lb_policy_name);
+}
+
+void ChannelArguments::SetServiceConfigJSON(
const TString& service_config_json) {
- SetString(GRPC_ARG_SERVICE_CONFIG, service_config_json);
-}
-
+ SetString(GRPC_ARG_SERVICE_CONFIG, service_config_json);
+}
+
void ChannelArguments::SetInt(const TString& key, int value) {
- grpc_arg arg;
- arg.type = GRPC_ARG_INTEGER;
- strings_.push_back(key);
- arg.key = const_cast<char*>(strings_.back().c_str());
- arg.value.integer = value;
-
- args_.push_back(arg);
-}
-
+ grpc_arg arg;
+ arg.type = GRPC_ARG_INTEGER;
+ strings_.push_back(key);
+ arg.key = const_cast<char*>(strings_.back().c_str());
+ arg.value.integer = value;
+
+ args_.push_back(arg);
+}
+
void ChannelArguments::SetPointer(const TString& key, void* value) {
- static const grpc_arg_pointer_vtable vtable = {
- &PointerVtableMembers::Copy, &PointerVtableMembers::Destroy,
- &PointerVtableMembers::Compare};
- SetPointerWithVtable(key, value, &vtable);
-}
-
-void ChannelArguments::SetPointerWithVtable(
+ static const grpc_arg_pointer_vtable vtable = {
+ &PointerVtableMembers::Copy, &PointerVtableMembers::Destroy,
+ &PointerVtableMembers::Compare};
+ SetPointerWithVtable(key, value, &vtable);
+}
+
+void ChannelArguments::SetPointerWithVtable(
const TString& key, void* value,
- const grpc_arg_pointer_vtable* vtable) {
- grpc_arg arg;
- arg.type = GRPC_ARG_POINTER;
- strings_.push_back(key);
- arg.key = const_cast<char*>(strings_.back().c_str());
+ const grpc_arg_pointer_vtable* vtable) {
+ grpc_arg arg;
+ arg.type = GRPC_ARG_POINTER;
+ strings_.push_back(key);
+ arg.key = const_cast<char*>(strings_.back().c_str());
arg.value.pointer.p = vtable->copy(value);
- arg.value.pointer.vtable = vtable;
- args_.push_back(arg);
-}
-
+ arg.value.pointer.vtable = vtable;
+ args_.push_back(arg);
+}
+
void ChannelArguments::SetString(const TString& key,
const TString& value) {
- grpc_arg arg;
- arg.type = GRPC_ARG_STRING;
- strings_.push_back(key);
- arg.key = const_cast<char*>(strings_.back().c_str());
- strings_.push_back(value);
- arg.value.string = const_cast<char*>(strings_.back().c_str());
-
- args_.push_back(arg);
-}
-
-void ChannelArguments::SetChannelArgs(grpc_channel_args* channel_args) const {
- channel_args->num_args = args_.size();
- if (channel_args->num_args > 0) {
- channel_args->args = const_cast<grpc_arg*>(&args_[0]);
- }
-}
-
+ grpc_arg arg;
+ arg.type = GRPC_ARG_STRING;
+ strings_.push_back(key);
+ arg.key = const_cast<char*>(strings_.back().c_str());
+ strings_.push_back(value);
+ arg.value.string = const_cast<char*>(strings_.back().c_str());
+
+ args_.push_back(arg);
+}
+
+void ChannelArguments::SetChannelArgs(grpc_channel_args* channel_args) const {
+ channel_args->num_args = args_.size();
+ if (channel_args->num_args > 0) {
+ channel_args->args = const_cast<grpc_arg*>(&args_[0]);
+ }
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.cc b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
index 7b2a08cca0..8df6c7b98f 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <string.h>
-
-#include "src/core/lib/channel/channel_stack.h"
-#include "src/cpp/common/channel_filter.h"
-
+ *
+ */
+
+#include <string.h>
+
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/cpp/common/channel_filter.h"
+
#include <grpcpp/impl/codegen/slice.h>
-namespace grpc {
-
-// MetadataBatch
-
+namespace grpc {
+
+// MetadataBatch
+
grpc_linked_mdelem* MetadataBatch::AddMetadata(const string& key,
const string& value) {
grpc_linked_mdelem* storage = new grpc_linked_mdelem;
@@ -34,65 +34,65 @@ grpc_linked_mdelem* MetadataBatch::AddMetadata(const string& key,
SliceFromCopiedString(value));
GRPC_LOG_IF_ERROR("MetadataBatch::AddMetadata",
grpc_metadata_batch_link_head(batch_, storage));
- return storage;
-}
-
-// ChannelData
-
+ return storage;
+}
+
+// ChannelData
+
void ChannelData::StartTransportOp(grpc_channel_element* elem,
TransportOp* op) {
grpc_channel_next_op(elem, op->op());
-}
-
+}
+
void ChannelData::GetInfo(grpc_channel_element* elem,
const grpc_channel_info* channel_info) {
grpc_channel_next_get_info(elem, channel_info);
-}
-
-// CallData
-
+}
+
+// CallData
+
void CallData::StartTransportStreamOpBatch(grpc_call_element* elem,
TransportStreamOpBatch* op) {
grpc_call_next_op(elem, op->op());
-}
-
+}
+
void CallData::SetPollsetOrPollsetSet(grpc_call_element* elem,
grpc_polling_entity* pollent) {
grpc_call_stack_ignore_set_pollset_or_pollset_set(elem, pollent);
-}
-
-// internal code used by RegisterChannelFilter()
-
-namespace internal {
-
-// Note: Implicitly initialized to nullptr due to static lifetime.
+}
+
+// internal code used by RegisterChannelFilter()
+
+namespace internal {
+
+// Note: Implicitly initialized to nullptr due to static lifetime.
std::vector<FilterRecord>* channel_filters;
-
-namespace {
-
+
+namespace {
+
bool MaybeAddFilter(grpc_channel_stack_builder* builder, void* arg) {
const FilterRecord& filter = *static_cast<FilterRecord*>(arg);
- if (filter.include_filter) {
+ if (filter.include_filter) {
const grpc_channel_args* args =
- grpc_channel_stack_builder_get_channel_arguments(builder);
- if (!filter.include_filter(*args)) return true;
- }
- return grpc_channel_stack_builder_prepend_filter(builder, &filter.filter,
- nullptr, nullptr);
-}
-
-} // namespace
-
-void ChannelFilterPluginInit() {
- for (size_t i = 0; i < channel_filters->size(); ++i) {
+ grpc_channel_stack_builder_get_channel_arguments(builder);
+ if (!filter.include_filter(*args)) return true;
+ }
+ return grpc_channel_stack_builder_prepend_filter(builder, &filter.filter,
+ nullptr, nullptr);
+}
+
+} // namespace
+
+void ChannelFilterPluginInit() {
+ for (size_t i = 0; i < channel_filters->size(); ++i) {
FilterRecord& filter = (*channel_filters)[i];
- grpc_channel_init_register_stage(filter.stack_type, filter.priority,
+ grpc_channel_init_register_stage(filter.stack_type, filter.priority,
MaybeAddFilter, (void*)&filter);
- }
-}
-
-void ChannelFilterPluginShutdown() {}
-
-} // namespace internal
-
-} // namespace grpc
+ }
+}
+
+void ChannelFilterPluginShutdown() {}
+
+} // namespace internal
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.h b/contrib/libs/grpc/src/cpp/common/channel_filter.h
index 9bb3e5c7f7..5ce720b307 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.h
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.h
@@ -1,137 +1,137 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPCXX_CHANNEL_FILTER_H
-#define GRPCXX_CHANNEL_FILTER_H
-
-#include <grpc/grpc.h>
-#include <grpc/support/alloc.h>
+ *
+ */
+
+#ifndef GRPCXX_CHANNEL_FILTER_H
+#define GRPCXX_CHANNEL_FILTER_H
+
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
#include <grpcpp/impl/codegen/config.h>
-
-#include <functional>
-#include <vector>
-
-#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/surface/channel_init.h"
-#include "src/core/lib/transport/metadata_batch.h"
-
-/// An interface to define filters.
-///
-/// To define a filter, implement a subclass of each of \c CallData and
-/// \c ChannelData. Then register the filter using something like this:
-/// \code{.cpp}
-/// RegisterChannelFilter<MyChannelDataSubclass, MyCallDataSubclass>(
-/// "name-of-filter", GRPC_SERVER_CHANNEL, INT_MAX, nullptr);
-/// \endcode
-
-namespace grpc {
-
-/// A C++ wrapper for the \c grpc_metadata_batch struct.
-class MetadataBatch {
- public:
- /// Borrows a pointer to \a batch, but does NOT take ownership.
- /// The caller must ensure that \a batch continues to exist for as
- /// long as the MetadataBatch object does.
+
+#include <functional>
+#include <vector>
+
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/transport/metadata_batch.h"
+
+/// An interface to define filters.
+///
+/// To define a filter, implement a subclass of each of \c CallData and
+/// \c ChannelData. Then register the filter using something like this:
+/// \code{.cpp}
+/// RegisterChannelFilter<MyChannelDataSubclass, MyCallDataSubclass>(
+/// "name-of-filter", GRPC_SERVER_CHANNEL, INT_MAX, nullptr);
+/// \endcode
+
+namespace grpc {
+
+/// A C++ wrapper for the \c grpc_metadata_batch struct.
+class MetadataBatch {
+ public:
+ /// Borrows a pointer to \a batch, but does NOT take ownership.
+ /// The caller must ensure that \a batch continues to exist for as
+ /// long as the MetadataBatch object does.
explicit MetadataBatch(grpc_metadata_batch* batch) : batch_(batch) {}
-
+
grpc_metadata_batch* batch() const { return batch_; }
-
- /// Adds metadata and returns the newly allocated storage.
- /// The caller takes ownership of the result, which must exist for the
- /// lifetime of the gRPC call.
+
+ /// Adds metadata and returns the newly allocated storage.
+ /// The caller takes ownership of the result, which must exist for the
+ /// lifetime of the gRPC call.
grpc_linked_mdelem* AddMetadata(const string& key, const string& value);
-
- class const_iterator : public std::iterator<std::bidirectional_iterator_tag,
- const grpc_mdelem> {
- public:
+
+ class const_iterator : public std::iterator<std::bidirectional_iterator_tag,
+ const grpc_mdelem> {
+ public:
const grpc_mdelem& operator*() const { return elem_->md; }
const grpc_mdelem operator->() const { return elem_->md; }
-
+
const_iterator& operator++() {
- elem_ = elem_->next;
- return *this;
- }
- const_iterator operator++(int) {
- const_iterator tmp(*this);
- operator++();
- return tmp;
- }
+ elem_ = elem_->next;
+ return *this;
+ }
+ const_iterator operator++(int) {
+ const_iterator tmp(*this);
+ operator++();
+ return tmp;
+ }
const_iterator& operator--() {
- elem_ = elem_->prev;
- return *this;
- }
- const_iterator operator--(int) {
- const_iterator tmp(*this);
- operator--();
- return tmp;
- }
-
+ elem_ = elem_->prev;
+ return *this;
+ }
+ const_iterator operator--(int) {
+ const_iterator tmp(*this);
+ operator--();
+ return tmp;
+ }
+
bool operator==(const const_iterator& other) const {
- return elem_ == other.elem_;
- }
+ return elem_ == other.elem_;
+ }
bool operator!=(const const_iterator& other) const {
- return elem_ != other.elem_;
- }
-
- private:
- friend class MetadataBatch;
+ return elem_ != other.elem_;
+ }
+
+ private:
+ friend class MetadataBatch;
explicit const_iterator(grpc_linked_mdelem* elem) : elem_(elem) {}
-
+
grpc_linked_mdelem* elem_;
- };
-
- const_iterator begin() const { return const_iterator(batch_->list.head); }
- const_iterator end() const { return const_iterator(nullptr); }
-
- private:
+ };
+
+ const_iterator begin() const { return const_iterator(batch_->list.head); }
+ const_iterator end() const { return const_iterator(nullptr); }
+
+ private:
grpc_metadata_batch* batch_; // Not owned.
-};
-
-/// A C++ wrapper for the \c grpc_transport_op struct.
-class TransportOp {
- public:
- /// Borrows a pointer to \a op, but does NOT take ownership.
- /// The caller must ensure that \a op continues to exist for as
- /// long as the TransportOp object does.
+};
+
+/// A C++ wrapper for the \c grpc_transport_op struct.
+class TransportOp {
+ public:
+ /// Borrows a pointer to \a op, but does NOT take ownership.
+ /// The caller must ensure that \a op continues to exist for as
+ /// long as the TransportOp object does.
explicit TransportOp(grpc_transport_op* op) : op_(op) {}
-
+
grpc_transport_op* op() const { return op_; }
-
- // TODO(roth): Add a C++ wrapper for grpc_error?
+
+ // TODO(roth): Add a C++ wrapper for grpc_error?
grpc_error* disconnect_with_error() const {
- return op_->disconnect_with_error;
- }
+ return op_->disconnect_with_error;
+ }
bool send_goaway() const { return op_->goaway_error != GRPC_ERROR_NONE; }
-
- // TODO(roth): Add methods for additional fields as needed.
-
- private:
+
+ // TODO(roth): Add methods for additional fields as needed.
+
+ private:
grpc_transport_op* op_; // Not owned.
-};
-
+};
+
/// A C++ wrapper for the \c grpc_transport_stream_op_batch struct.
class TransportStreamOpBatch {
- public:
- /// Borrows a pointer to \a op, but does NOT take ownership.
- /// The caller must ensure that \a op continues to exist for as
+ public:
+ /// Borrows a pointer to \a op, but does NOT take ownership.
+ /// The caller must ensure that \a op continues to exist for as
/// long as the TransportStreamOpBatch object does.
explicit TransportStreamOpBatch(grpc_transport_stream_op_batch* op)
- : op_(op),
+ : op_(op),
send_initial_metadata_(
op->send_initial_metadata
? op->payload->send_initial_metadata.send_initial_metadata
@@ -148,65 +148,65 @@ class TransportStreamOpBatch {
op->recv_trailing_metadata
? op->payload->recv_trailing_metadata.recv_trailing_metadata
: nullptr) {}
-
+
grpc_transport_stream_op_batch* op() const { return op_; }
-
+
grpc_closure* on_complete() const { return op_->on_complete; }
void set_on_complete(grpc_closure* closure) { op_->on_complete = closure; }
-
+
MetadataBatch* send_initial_metadata() {
return op_->send_initial_metadata ? &send_initial_metadata_ : nullptr;
- }
+ }
MetadataBatch* send_trailing_metadata() {
return op_->send_trailing_metadata ? &send_trailing_metadata_ : nullptr;
- }
+ }
MetadataBatch* recv_initial_metadata() {
return op_->recv_initial_metadata ? &recv_initial_metadata_ : nullptr;
- }
+ }
MetadataBatch* recv_trailing_metadata() {
return op_->recv_trailing_metadata ? &recv_trailing_metadata_ : nullptr;
- }
-
+ }
+
uint32_t* send_initial_metadata_flags() const {
return op_->send_initial_metadata ? &op_->payload->send_initial_metadata
.send_initial_metadata_flags
: nullptr;
- }
-
+ }
+
grpc_closure* recv_initial_metadata_ready() const {
return op_->recv_initial_metadata
? op_->payload->recv_initial_metadata.recv_initial_metadata_ready
: nullptr;
- }
+ }
void set_recv_initial_metadata_ready(grpc_closure* closure) {
op_->payload->recv_initial_metadata.recv_initial_metadata_ready = closure;
- }
-
+ }
+
grpc_core::OrphanablePtr<grpc_core::ByteStream>* send_message() const {
return op_->send_message ? &op_->payload->send_message.send_message
: nullptr;
- }
+ }
void set_send_message(
grpc_core::OrphanablePtr<grpc_core::ByteStream> send_message) {
op_->send_message = true;
op_->payload->send_message.send_message = std::move(send_message);
}
-
+
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message() const {
return op_->recv_message ? op_->payload->recv_message.recv_message
: nullptr;
- }
+ }
void set_recv_message(
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message) {
op_->recv_message = true;
op_->payload->recv_message.recv_message = recv_message;
- }
-
+ }
+
census_context* get_census_context() const {
return static_cast<census_context*>(
op_->payload->context[GRPC_CONTEXT_TRACING].value);
- }
-
+ }
+
const gpr_atm* get_peer_string() const {
if (op_->send_initial_metadata &&
op_->payload->send_initial_metadata.peer_string != nullptr) {
@@ -219,184 +219,184 @@ class TransportStreamOpBatch {
}
}
- private:
+ private:
grpc_transport_stream_op_batch* op_; // Not owned.
- MetadataBatch send_initial_metadata_;
- MetadataBatch send_trailing_metadata_;
- MetadataBatch recv_initial_metadata_;
- MetadataBatch recv_trailing_metadata_;
-};
-
-/// Represents channel data.
-class ChannelData {
- public:
+ MetadataBatch send_initial_metadata_;
+ MetadataBatch send_trailing_metadata_;
+ MetadataBatch recv_initial_metadata_;
+ MetadataBatch recv_trailing_metadata_;
+};
+
+/// Represents channel data.
+class ChannelData {
+ public:
ChannelData() {}
- virtual ~ChannelData() {}
-
+ virtual ~ChannelData() {}
+
// TODO(roth): Come up with a more C++-like API for the channel element.
/// Initializes the channel data.
virtual grpc_error* Init(grpc_channel_element* /*elem*/,
grpc_channel_element_args* /*args*/) {
- return GRPC_ERROR_NONE;
- }
-
+ return GRPC_ERROR_NONE;
+ }
+
// Called before destruction.
virtual void Destroy(grpc_channel_element* /*elem*/) {}
-
+
virtual void StartTransportOp(grpc_channel_element* elem, TransportOp* op);
-
+
virtual void GetInfo(grpc_channel_element* elem,
const grpc_channel_info* channel_info);
-};
-
-/// Represents call data.
-class CallData {
- public:
+};
+
+/// Represents call data.
+class CallData {
+ public:
CallData() {}
- virtual ~CallData() {}
-
+ virtual ~CallData() {}
+
// TODO(roth): Come up with a more C++-like API for the call element.
- /// Initializes the call data.
+ /// Initializes the call data.
virtual grpc_error* Init(grpc_call_element* /*elem*/,
const grpc_call_element_args* /*args*/) {
- return GRPC_ERROR_NONE;
- }
-
+ return GRPC_ERROR_NONE;
+ }
+
// Called before destruction.
virtual void Destroy(grpc_call_element* /*elem*/,
const grpc_call_final_info* /*final_info*/,
grpc_closure* /*then_call_closure*/) {}
-
- /// Starts a new stream operation.
+
+ /// Starts a new stream operation.
virtual void StartTransportStreamOpBatch(grpc_call_element* elem,
TransportStreamOpBatch* op);
-
- /// Sets a pollset or pollset set.
+
+ /// Sets a pollset or pollset set.
virtual void SetPollsetOrPollsetSet(grpc_call_element* elem,
grpc_polling_entity* pollent);
-};
-
-namespace internal {
-
-// Defines static members for passing to C core.
-// Members of this class correspond to the members of the C
-// grpc_channel_filter struct.
-template <typename ChannelDataType, typename CallDataType>
-class ChannelFilter final {
- public:
- static const size_t channel_data_size = sizeof(ChannelDataType);
-
+};
+
+namespace internal {
+
+// Defines static members for passing to C core.
+// Members of this class correspond to the members of the C
+// grpc_channel_filter struct.
+template <typename ChannelDataType, typename CallDataType>
+class ChannelFilter final {
+ public:
+ static const size_t channel_data_size = sizeof(ChannelDataType);
+
static grpc_error* InitChannelElement(grpc_channel_element* elem,
grpc_channel_element_args* args) {
// Construct the object in the already-allocated memory.
ChannelDataType* channel_data = new (elem->channel_data) ChannelDataType();
return channel_data->Init(elem, args);
- }
-
+ }
+
static void DestroyChannelElement(grpc_channel_element* elem) {
ChannelDataType* channel_data =
static_cast<ChannelDataType*>(elem->channel_data);
channel_data->Destroy(elem);
channel_data->~ChannelDataType();
- }
-
+ }
+
static void StartTransportOp(grpc_channel_element* elem,
grpc_transport_op* op) {
ChannelDataType* channel_data =
static_cast<ChannelDataType*>(elem->channel_data);
- TransportOp op_wrapper(op);
+ TransportOp op_wrapper(op);
channel_data->StartTransportOp(elem, &op_wrapper);
- }
-
+ }
+
static void GetChannelInfo(grpc_channel_element* elem,
const grpc_channel_info* channel_info) {
ChannelDataType* channel_data =
static_cast<ChannelDataType*>(elem->channel_data);
channel_data->GetInfo(elem, channel_info);
- }
-
- static const size_t call_data_size = sizeof(CallDataType);
-
+ }
+
+ static const size_t call_data_size = sizeof(CallDataType);
+
static grpc_error* InitCallElement(grpc_call_element* elem,
const grpc_call_element_args* args) {
- // Construct the object in the already-allocated memory.
+ // Construct the object in the already-allocated memory.
CallDataType* call_data = new (elem->call_data) CallDataType();
return call_data->Init(elem, args);
- }
-
+ }
+
static void DestroyCallElement(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* then_call_closure) {
CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
call_data->Destroy(elem, final_info, then_call_closure);
call_data->~CallDataType();
- }
-
+ }
+
static void StartTransportStreamOpBatch(grpc_call_element* elem,
grpc_transport_stream_op_batch* op) {
CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
TransportStreamOpBatch op_wrapper(op);
call_data->StartTransportStreamOpBatch(elem, &op_wrapper);
- }
-
+ }
+
static void SetPollsetOrPollsetSet(grpc_call_element* elem,
grpc_polling_entity* pollent) {
CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
call_data->SetPollsetOrPollsetSet(elem, pollent);
- }
-};
-
-struct FilterRecord {
- grpc_channel_stack_type stack_type;
- int priority;
+ }
+};
+
+struct FilterRecord {
+ grpc_channel_stack_type stack_type;
+ int priority;
std::function<bool(const grpc_channel_args&)> include_filter;
- grpc_channel_filter filter;
-};
+ grpc_channel_filter filter;
+};
extern std::vector<FilterRecord>* channel_filters;
-
-void ChannelFilterPluginInit();
-void ChannelFilterPluginShutdown();
-
-} // namespace internal
-
-/// Registers a new filter.
-/// Must be called by only one thread at a time.
-/// The \a include_filter argument specifies a function that will be called
-/// to determine at run-time whether or not to add the filter. If the
-/// value is nullptr, the filter will be added unconditionally.
+
+void ChannelFilterPluginInit();
+void ChannelFilterPluginShutdown();
+
+} // namespace internal
+
+/// Registers a new filter.
+/// Must be called by only one thread at a time.
+/// The \a include_filter argument specifies a function that will be called
+/// to determine at run-time whether or not to add the filter. If the
+/// value is nullptr, the filter will be added unconditionally.
/// If the channel stack type is GRPC_CLIENT_SUBCHANNEL, the caller should
/// ensure that subchannels with different filter lists will always have
/// different channel args. This requires setting a channel arg in case the
/// registration function relies on some condition other than channel args to
/// decide whether to add a filter or not.
-template <typename ChannelDataType, typename CallDataType>
-void RegisterChannelFilter(
+template <typename ChannelDataType, typename CallDataType>
+void RegisterChannelFilter(
const char* name, grpc_channel_stack_type stack_type, int priority,
std::function<bool(const grpc_channel_args&)> include_filter) {
- // If we haven't been called before, initialize channel_filters and
- // call grpc_register_plugin().
- if (internal::channel_filters == nullptr) {
- grpc_register_plugin(internal::ChannelFilterPluginInit,
- internal::ChannelFilterPluginShutdown);
- internal::channel_filters = new std::vector<internal::FilterRecord>();
- }
- // Add an entry to channel_filters. The filter will be added when the
- // C-core initialization code calls ChannelFilterPluginInit().
- typedef internal::ChannelFilter<ChannelDataType, CallDataType> FilterType;
- internal::FilterRecord filter_record = {
- stack_type,
- priority,
- include_filter,
+ // If we haven't been called before, initialize channel_filters and
+ // call grpc_register_plugin().
+ if (internal::channel_filters == nullptr) {
+ grpc_register_plugin(internal::ChannelFilterPluginInit,
+ internal::ChannelFilterPluginShutdown);
+ internal::channel_filters = new std::vector<internal::FilterRecord>();
+ }
+ // Add an entry to channel_filters. The filter will be added when the
+ // C-core initialization code calls ChannelFilterPluginInit().
+ typedef internal::ChannelFilter<ChannelDataType, CallDataType> FilterType;
+ internal::FilterRecord filter_record = {
+ stack_type,
+ priority,
+ include_filter,
{FilterType::StartTransportStreamOpBatch, FilterType::StartTransportOp,
- FilterType::call_data_size, FilterType::InitCallElement,
- FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement,
- FilterType::channel_data_size, FilterType::InitChannelElement,
+ FilterType::call_data_size, FilterType::InitCallElement,
+ FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement,
+ FilterType::channel_data_size, FilterType::InitChannelElement,
FilterType::DestroyChannelElement, FilterType::GetChannelInfo, name}};
- internal::channel_filters->push_back(filter_record);
-}
-
-} // namespace grpc
-
-#endif // GRPCXX_CHANNEL_FILTER_H
+ internal::channel_filters->push_back(filter_record);
+}
+
+} // namespace grpc
+
+#endif // GRPCXX_CHANNEL_FILTER_H
diff --git a/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc b/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
index f0ad7dc8b1..96a7105eaf 100644
--- a/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
@@ -1,75 +1,75 @@
-/*
+/*
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/completion_queue.h>
-
-#include <memory>
-
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
+
+#include <memory>
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/time.h>
-
+
namespace grpc {
-
+
static internal::GrpcLibraryInitializer g_gli_initializer;
-
+
// 'CompletionQueue' constructor can safely call GrpcLibraryCodegen(false) here
// i.e not have GrpcLibraryCodegen call grpc_init(). This is because, to create
// a 'grpc_completion_queue' instance (which is being passed as the input to
// this constructor), one must have already called grpc_init().
CompletionQueue::CompletionQueue(grpc_completion_queue* take)
: GrpcLibraryCodegen(false), cq_(take) {
- InitialAvalanching();
-}
-
-void CompletionQueue::Shutdown() {
- g_gli_initializer.summon();
+ InitialAvalanching();
+}
+
+void CompletionQueue::Shutdown() {
+ g_gli_initializer.summon();
#ifndef NDEBUG
if (!ServerListEmpty()) {
gpr_log(GPR_ERROR,
"CompletionQueue shutdown being shutdown before its server.");
}
#endif
- CompleteAvalanching();
-}
-
-CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal(
- void** tag, bool* ok, gpr_timespec deadline) {
- for (;;) {
- auto ev = grpc_completion_queue_next(cq_, deadline, nullptr);
- switch (ev.type) {
- case GRPC_QUEUE_TIMEOUT:
- return TIMEOUT;
- case GRPC_QUEUE_SHUTDOWN:
- return SHUTDOWN;
- case GRPC_OP_COMPLETE:
+ CompleteAvalanching();
+}
+
+CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal(
+ void** tag, bool* ok, gpr_timespec deadline) {
+ for (;;) {
+ auto ev = grpc_completion_queue_next(cq_, deadline, nullptr);
+ switch (ev.type) {
+ case GRPC_QUEUE_TIMEOUT:
+ return TIMEOUT;
+ case GRPC_QUEUE_SHUTDOWN:
+ return SHUTDOWN;
+ case GRPC_OP_COMPLETE:
auto core_cq_tag =
static_cast<::grpc::internal::CompletionQueueTag*>(ev.tag);
- *ok = ev.success != 0;
+ *ok = ev.success != 0;
*tag = core_cq_tag;
if (core_cq_tag->FinalizeResult(tag, ok)) {
- return GOT_EVENT;
- }
- break;
- }
- }
-}
-
+ return GOT_EVENT;
+ }
+ break;
+ }
+ }
+}
+
CompletionQueue::CompletionQueueTLSCache::CompletionQueueTLSCache(
CompletionQueue* cq)
: cq_(cq), flushed_(false) {
diff --git a/contrib/libs/grpc/src/cpp/common/core_codegen.cc b/contrib/libs/grpc/src/cpp/common/core_codegen.cc
index fdd353f9f2..75383ed511 100644
--- a/contrib/libs/grpc/src/cpp/common/core_codegen.cc
+++ b/contrib/libs/grpc/src/cpp/common/core_codegen.cc
@@ -1,59 +1,59 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/impl/codegen/core_codegen.h>
-
-#include <stdlib.h>
-
-#include <grpc/byte_buffer.h>
-#include <grpc/byte_buffer_reader.h>
-#include <grpc/grpc.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/port_platform.h>
-#include <grpc/support/sync.h>
+
+#include <stdlib.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/byte_buffer_reader.h>
+#include <grpc/grpc.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
+#include <grpc/support/sync.h>
#include <grpcpp/support/config.h>
-
-#include "src/core/lib/profiling/timers.h"
-
-struct grpc_byte_buffer;
-
-namespace grpc {
-
+
+#include "src/core/lib/profiling/timers.h"
+
+struct grpc_byte_buffer;
+
+namespace grpc {
+
const grpc_completion_queue_factory*
CoreCodegen::grpc_completion_queue_factory_lookup(
const grpc_completion_queue_attributes* attributes) {
return ::grpc_completion_queue_factory_lookup(attributes);
}
-grpc_completion_queue* CoreCodegen::grpc_completion_queue_create(
+grpc_completion_queue* CoreCodegen::grpc_completion_queue_create(
const grpc_completion_queue_factory* factory,
const grpc_completion_queue_attributes* attributes, void* reserved) {
return ::grpc_completion_queue_create(factory, attributes, reserved);
}
grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_next(
- void* reserved) {
+ void* reserved) {
return ::grpc_completion_queue_create_for_next(reserved);
-}
-
+}
+
grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_pluck(
void* reserved) {
return ::grpc_completion_queue_create_for_pluck(reserved);
@@ -63,45 +63,45 @@ void CoreCodegen::grpc_completion_queue_shutdown(grpc_completion_queue* cq) {
::grpc_completion_queue_shutdown(cq);
}
-void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) {
- ::grpc_completion_queue_destroy(cq);
-}
-
-grpc_event CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue* cq,
- void* tag,
- gpr_timespec deadline,
- void* reserved) {
- return ::grpc_completion_queue_pluck(cq, tag, deadline, reserved);
-}
-
-void* CoreCodegen::gpr_malloc(size_t size) { return ::gpr_malloc(size); }
-
-void CoreCodegen::gpr_free(void* p) { return ::gpr_free(p); }
-
+void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) {
+ ::grpc_completion_queue_destroy(cq);
+}
+
+grpc_event CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue* cq,
+ void* tag,
+ gpr_timespec deadline,
+ void* reserved) {
+ return ::grpc_completion_queue_pluck(cq, tag, deadline, reserved);
+}
+
+void* CoreCodegen::gpr_malloc(size_t size) { return ::gpr_malloc(size); }
+
+void CoreCodegen::gpr_free(void* p) { return ::gpr_free(p); }
+
void CoreCodegen::grpc_init() { ::grpc_init(); }
void CoreCodegen::grpc_shutdown() { ::grpc_shutdown(); }
void CoreCodegen::gpr_mu_init(gpr_mu* mu) { ::gpr_mu_init(mu); }
-void CoreCodegen::gpr_mu_destroy(gpr_mu* mu) { ::gpr_mu_destroy(mu); }
-void CoreCodegen::gpr_mu_lock(gpr_mu* mu) { ::gpr_mu_lock(mu); }
-void CoreCodegen::gpr_mu_unlock(gpr_mu* mu) { ::gpr_mu_unlock(mu); }
-void CoreCodegen::gpr_cv_init(gpr_cv* cv) { ::gpr_cv_init(cv); }
-void CoreCodegen::gpr_cv_destroy(gpr_cv* cv) { ::gpr_cv_destroy(cv); }
-int CoreCodegen::gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
- gpr_timespec abs_deadline) {
- return ::gpr_cv_wait(cv, mu, abs_deadline);
-}
-void CoreCodegen::gpr_cv_signal(gpr_cv* cv) { ::gpr_cv_signal(cv); }
-void CoreCodegen::gpr_cv_broadcast(gpr_cv* cv) { ::gpr_cv_broadcast(cv); }
-
+void CoreCodegen::gpr_mu_destroy(gpr_mu* mu) { ::gpr_mu_destroy(mu); }
+void CoreCodegen::gpr_mu_lock(gpr_mu* mu) { ::gpr_mu_lock(mu); }
+void CoreCodegen::gpr_mu_unlock(gpr_mu* mu) { ::gpr_mu_unlock(mu); }
+void CoreCodegen::gpr_cv_init(gpr_cv* cv) { ::gpr_cv_init(cv); }
+void CoreCodegen::gpr_cv_destroy(gpr_cv* cv) { ::gpr_cv_destroy(cv); }
+int CoreCodegen::gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
+ gpr_timespec abs_deadline) {
+ return ::gpr_cv_wait(cv, mu, abs_deadline);
+}
+void CoreCodegen::gpr_cv_signal(gpr_cv* cv) { ::gpr_cv_signal(cv); }
+void CoreCodegen::gpr_cv_broadcast(gpr_cv* cv) { ::gpr_cv_broadcast(cv); }
+
grpc_byte_buffer* CoreCodegen::grpc_byte_buffer_copy(grpc_byte_buffer* bb) {
return ::grpc_byte_buffer_copy(bb);
}
-void CoreCodegen::grpc_byte_buffer_destroy(grpc_byte_buffer* bb) {
- ::grpc_byte_buffer_destroy(bb);
-}
-
+void CoreCodegen::grpc_byte_buffer_destroy(grpc_byte_buffer* bb) {
+ ::grpc_byte_buffer_destroy(bb);
+}
+
size_t CoreCodegen::grpc_byte_buffer_length(grpc_byte_buffer* bb) {
return ::grpc_byte_buffer_length(bb);
}
@@ -127,31 +127,31 @@ const char* CoreCodegen::grpc_call_error_to_string(grpc_call_error error) {
return ::grpc_call_error_to_string(error);
}
-int CoreCodegen::grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
- grpc_byte_buffer* buffer) {
- return ::grpc_byte_buffer_reader_init(reader, buffer);
-}
-
-void CoreCodegen::grpc_byte_buffer_reader_destroy(
- grpc_byte_buffer_reader* reader) {
- ::grpc_byte_buffer_reader_destroy(reader);
-}
-
-int CoreCodegen::grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- grpc_slice* slice) {
- return ::grpc_byte_buffer_reader_next(reader, slice);
-}
-
+int CoreCodegen::grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
+ grpc_byte_buffer* buffer) {
+ return ::grpc_byte_buffer_reader_init(reader, buffer);
+}
+
+void CoreCodegen::grpc_byte_buffer_reader_destroy(
+ grpc_byte_buffer_reader* reader) {
+ ::grpc_byte_buffer_reader_destroy(reader);
+}
+
+int CoreCodegen::grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
+ grpc_slice* slice) {
+ return ::grpc_byte_buffer_reader_next(reader, slice);
+}
+
int CoreCodegen::grpc_byte_buffer_reader_peek(grpc_byte_buffer_reader* reader,
grpc_slice** slice) {
return ::grpc_byte_buffer_reader_peek(reader, slice);
}
-grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice,
- size_t nslices) {
- return ::grpc_raw_byte_buffer_create(slice, nslices);
-}
-
+grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice,
+ size_t nslices) {
+ return ::grpc_raw_byte_buffer_create(slice, nslices);
+}
+
grpc_slice CoreCodegen::grpc_slice_new_with_user_data(void* p, size_t len,
void (*destroy)(void*),
void* user_data) {
@@ -166,22 +166,22 @@ grpc_slice CoreCodegen::grpc_slice_new_with_len(void* p, size_t len,
grpc_slice CoreCodegen::grpc_empty_slice() { return ::grpc_empty_slice(); }
-grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) {
- return ::grpc_slice_malloc(length);
-}
-
-void CoreCodegen::grpc_slice_unref(grpc_slice slice) {
- ::grpc_slice_unref(slice);
-}
-
+grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) {
+ return ::grpc_slice_malloc(length);
+}
+
+void CoreCodegen::grpc_slice_unref(grpc_slice slice) {
+ ::grpc_slice_unref(slice);
+}
+
grpc_slice CoreCodegen::grpc_slice_ref(grpc_slice slice) {
return ::grpc_slice_ref(slice);
}
-grpc_slice CoreCodegen::grpc_slice_split_tail(grpc_slice* s, size_t split) {
- return ::grpc_slice_split_tail(s, split);
-}
-
+grpc_slice CoreCodegen::grpc_slice_split_tail(grpc_slice* s, size_t split) {
+ return ::grpc_slice_split_tail(s, split);
+}
+
grpc_slice CoreCodegen::grpc_slice_split_head(grpc_slice* s, size_t split) {
return ::grpc_slice_split_head(s, split);
}
@@ -201,40 +201,40 @@ grpc_slice CoreCodegen::grpc_slice_from_copied_buffer(const void* buffer,
length);
}
-void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb,
- grpc_slice slice) {
- ::grpc_slice_buffer_add(sb, slice);
-}
-
-void CoreCodegen::grpc_slice_buffer_pop(grpc_slice_buffer* sb) {
- ::grpc_slice_buffer_pop(sb);
-}
-
-void CoreCodegen::grpc_metadata_array_init(grpc_metadata_array* array) {
- ::grpc_metadata_array_init(array);
-}
-
-void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) {
- ::grpc_metadata_array_destroy(array);
-}
-
-const Status& CoreCodegen::ok() { return grpc::Status::OK; }
-
-const Status& CoreCodegen::cancelled() { return grpc::Status::CANCELLED; }
-
-gpr_timespec CoreCodegen::gpr_inf_future(gpr_clock_type type) {
- return ::gpr_inf_future(type);
-}
-
-gpr_timespec CoreCodegen::gpr_time_0(gpr_clock_type type) {
- return ::gpr_time_0(type);
-}
-
+void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb,
+ grpc_slice slice) {
+ ::grpc_slice_buffer_add(sb, slice);
+}
+
+void CoreCodegen::grpc_slice_buffer_pop(grpc_slice_buffer* sb) {
+ ::grpc_slice_buffer_pop(sb);
+}
+
+void CoreCodegen::grpc_metadata_array_init(grpc_metadata_array* array) {
+ ::grpc_metadata_array_init(array);
+}
+
+void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) {
+ ::grpc_metadata_array_destroy(array);
+}
+
+const Status& CoreCodegen::ok() { return grpc::Status::OK; }
+
+const Status& CoreCodegen::cancelled() { return grpc::Status::CANCELLED; }
+
+gpr_timespec CoreCodegen::gpr_inf_future(gpr_clock_type type) {
+ return ::gpr_inf_future(type);
+}
+
+gpr_timespec CoreCodegen::gpr_time_0(gpr_clock_type type) {
+ return ::gpr_time_0(type);
+}
+
void CoreCodegen::assert_fail(const char* failed_assertion, const char* file,
int line) {
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "assertion failed: %s",
failed_assertion);
- abort();
-}
-
-} // namespace grpc
+ abort();
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc b/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
index 9610078682..4e5cbd0372 100644
--- a/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
@@ -1,30 +1,30 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-#include <memory>
-
-#include <grpc/grpc.h>
+ *
+ */
+#include <memory>
+
+#include <grpc/grpc.h>
#include <grpcpp/security/auth_context.h>
-
-namespace grpc {
-
-std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call) {
- (void)call;
- return std::shared_ptr<const AuthContext>();
-}
-
-} // namespace grpc
+
+namespace grpc {
+
+std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call) {
+ (void)call;
+ return std::shared_ptr<const AuthContext>();
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc b/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
index adc70dda33..64abff9633 100644
--- a/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
@@ -1,38 +1,38 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <grpc/grpc.h>
+ *
+ */
+
+#include <grpc/grpc.h>
#include <grpcpp/resource_quota.h>
-
+
namespace grpc {
-
-ResourceQuota::ResourceQuota() : impl_(grpc_resource_quota_create(nullptr)) {}
-
+
+ResourceQuota::ResourceQuota() : impl_(grpc_resource_quota_create(nullptr)) {}
+
ResourceQuota::ResourceQuota(const TString& name)
- : impl_(grpc_resource_quota_create(name.c_str())) {}
-
-ResourceQuota::~ResourceQuota() { grpc_resource_quota_unref(impl_); }
-
-ResourceQuota& ResourceQuota::Resize(size_t new_size) {
- grpc_resource_quota_resize(impl_, new_size);
- return *this;
-}
-
+ : impl_(grpc_resource_quota_create(name.c_str())) {}
+
+ResourceQuota::~ResourceQuota() { grpc_resource_quota_unref(impl_); }
+
+ResourceQuota& ResourceQuota::Resize(size_t new_size) {
+ grpc_resource_quota_resize(impl_, new_size);
+ return *this;
+}
+
ResourceQuota& ResourceQuota::SetMaxThreads(int new_max_threads) {
grpc_resource_quota_set_max_threads(impl_, new_max_threads);
return *this;
diff --git a/contrib/libs/grpc/src/cpp/common/rpc_method.cc b/contrib/libs/grpc/src/cpp/common/rpc_method.cc
index 1f70617fe0..a47dd3e444 100644
--- a/contrib/libs/grpc/src/cpp/common/rpc_method.cc
+++ b/contrib/libs/grpc/src/cpp/common/rpc_method.cc
@@ -1,21 +1,21 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/impl/rpc_method.h>
-
-namespace grpc {} // namespace grpc
+
+namespace grpc {} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc b/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
index 65254c11df..e1f97889c8 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
@@ -1,97 +1,97 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include "src/cpp/common/secure_auth_context.h"
-
-#include <grpc/grpc_security.h>
-
-namespace grpc {
-
-std::vector<grpc::string_ref> SecureAuthContext::GetPeerIdentity() const {
+ *
+ */
+
+#include "src/cpp/common/secure_auth_context.h"
+
+#include <grpc/grpc_security.h>
+
+namespace grpc {
+
+std::vector<grpc::string_ref> SecureAuthContext::GetPeerIdentity() const {
if (ctx_ == nullptr) {
- return std::vector<grpc::string_ref>();
- }
+ return std::vector<grpc::string_ref>();
+ }
grpc_auth_property_iterator iter =
grpc_auth_context_peer_identity(ctx_.get());
- std::vector<grpc::string_ref> identity;
- const grpc_auth_property* property = nullptr;
- while ((property = grpc_auth_property_iterator_next(&iter))) {
- identity.push_back(
- grpc::string_ref(property->value, property->value_length));
- }
- return identity;
-}
-
+ std::vector<grpc::string_ref> identity;
+ const grpc_auth_property* property = nullptr;
+ while ((property = grpc_auth_property_iterator_next(&iter))) {
+ identity.push_back(
+ grpc::string_ref(property->value, property->value_length));
+ }
+ return identity;
+}
+
TString SecureAuthContext::GetPeerIdentityPropertyName() const {
if (ctx_ == nullptr) {
- return "";
- }
+ return "";
+ }
const char* name = grpc_auth_context_peer_identity_property_name(ctx_.get());
- return name == nullptr ? "" : name;
-}
-
-std::vector<grpc::string_ref> SecureAuthContext::FindPropertyValues(
+ return name == nullptr ? "" : name;
+}
+
+std::vector<grpc::string_ref> SecureAuthContext::FindPropertyValues(
const TString& name) const {
if (ctx_ == nullptr) {
- return std::vector<grpc::string_ref>();
- }
- grpc_auth_property_iterator iter =
+ return std::vector<grpc::string_ref>();
+ }
+ grpc_auth_property_iterator iter =
grpc_auth_context_find_properties_by_name(ctx_.get(), name.c_str());
- const grpc_auth_property* property = nullptr;
- std::vector<grpc::string_ref> values;
- while ((property = grpc_auth_property_iterator_next(&iter))) {
- values.push_back(grpc::string_ref(property->value, property->value_length));
- }
- return values;
-}
-
-AuthPropertyIterator SecureAuthContext::begin() const {
+ const grpc_auth_property* property = nullptr;
+ std::vector<grpc::string_ref> values;
+ while ((property = grpc_auth_property_iterator_next(&iter))) {
+ values.push_back(grpc::string_ref(property->value, property->value_length));
+ }
+ return values;
+}
+
+AuthPropertyIterator SecureAuthContext::begin() const {
if (ctx_ != nullptr) {
- grpc_auth_property_iterator iter =
+ grpc_auth_property_iterator iter =
grpc_auth_context_property_iterator(ctx_.get());
- const grpc_auth_property* property =
- grpc_auth_property_iterator_next(&iter);
- return AuthPropertyIterator(property, &iter);
- } else {
- return end();
- }
-}
-
-AuthPropertyIterator SecureAuthContext::end() const {
- return AuthPropertyIterator();
-}
-
+ const grpc_auth_property* property =
+ grpc_auth_property_iterator_next(&iter);
+ return AuthPropertyIterator(property, &iter);
+ } else {
+ return end();
+ }
+}
+
+AuthPropertyIterator SecureAuthContext::end() const {
+ return AuthPropertyIterator();
+}
+
void SecureAuthContext::AddProperty(const TString& key,
- const grpc::string_ref& value) {
+ const grpc::string_ref& value) {
if (ctx_ == nullptr) return;
grpc_auth_context_add_property(ctx_.get(), key.c_str(), value.data(),
value.size());
-}
-
+}
+
bool SecureAuthContext::SetPeerIdentityPropertyName(const TString& name) {
if (ctx_ == nullptr) return false;
return grpc_auth_context_set_peer_identity_property_name(ctx_.get(),
- name.c_str()) != 0;
-}
-
-bool SecureAuthContext::IsPeerAuthenticated() const {
+ name.c_str()) != 0;
+}
+
+bool SecureAuthContext::IsPeerAuthenticated() const {
if (ctx_ == nullptr) return false;
return grpc_auth_context_peer_is_authenticated(ctx_.get()) != 0;
-}
-
-} // namespace grpc
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/secure_auth_context.h b/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
index 8e1d0ee7b1..51013efac7 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
@@ -1,60 +1,60 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
-#define GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
+#define GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
+
#include <grpcpp/security/auth_context.h>
-
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/security/context/security_context.h"
-
-namespace grpc {
-
-class SecureAuthContext final : public AuthContext {
- public:
+
+namespace grpc {
+
+class SecureAuthContext final : public AuthContext {
+ public:
explicit SecureAuthContext(grpc_auth_context* ctx)
: ctx_(ctx != nullptr ? ctx->Ref() : nullptr) {}
-
+
~SecureAuthContext() override = default;
-
- bool IsPeerAuthenticated() const override;
-
- std::vector<grpc::string_ref> GetPeerIdentity() const override;
-
+
+ bool IsPeerAuthenticated() const override;
+
+ std::vector<grpc::string_ref> GetPeerIdentity() const override;
+
TString GetPeerIdentityPropertyName() const override;
-
- std::vector<grpc::string_ref> FindPropertyValues(
+
+ std::vector<grpc::string_ref> FindPropertyValues(
const TString& name) const override;
-
- AuthPropertyIterator begin() const override;
-
- AuthPropertyIterator end() const override;
-
+
+ AuthPropertyIterator begin() const override;
+
+ AuthPropertyIterator end() const override;
+
void AddProperty(const TString& key,
- const grpc::string_ref& value) override;
-
+ const grpc::string_ref& value) override;
+
virtual bool SetPeerIdentityPropertyName(const TString& name) override;
-
- private:
+
+ private:
grpc_core::RefCountedPtr<grpc_auth_context> ctx_;
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc b/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
index 9504bfa8df..844bc627ab 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
@@ -1,39 +1,39 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/support/channel_arguments.h>
-
-#include <grpc/grpc_security.h>
-#include "src/core/lib/channel/channel_args.h"
-
+
+#include <grpc/grpc_security.h>
+#include "src/core/lib/channel/channel_args.h"
+
namespace grpc {
-
+
void ChannelArguments::SetSslTargetNameOverride(const TString& name) {
- SetString(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, name);
-}
-
+ SetString(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, name);
+}
+
TString ChannelArguments::GetSslTargetNameOverride() const {
- for (unsigned int i = 0; i < args_.size(); i++) {
+ for (unsigned int i = 0; i < args_.size(); i++) {
if (TString(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG) == args_[i].key) {
- return args_[i].value.string;
- }
- }
- return "";
-}
-
+ return args_[i].value.string;
+ }
+ }
+ return "";
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc b/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
index 33d6f14cbe..908c46629e 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-#include <memory>
-
-#include <grpc/grpc.h>
-#include <grpc/grpc_security.h>
+ *
+ */
+#include <memory>
+
+#include <grpc/grpc.h>
+#include <grpc/grpc_security.h>
#include <grpcpp/security/auth_context.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
-#include "src/cpp/common/secure_auth_context.h"
-
-namespace grpc {
-
-std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call) {
- if (call == nullptr) {
- return std::shared_ptr<const AuthContext>();
- }
+#include "src/cpp/common/secure_auth_context.h"
+
+namespace grpc {
+
+std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call) {
+ if (call == nullptr) {
+ return std::shared_ptr<const AuthContext>();
+ }
grpc_core::RefCountedPtr<grpc_auth_context> ctx(grpc_call_auth_context(call));
return std::make_shared<SecureAuthContext>(ctx.get());
-}
-
-} // namespace grpc
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/version_cc.cc b/contrib/libs/grpc/src/cpp/common/version_cc.cc
index 0e58eb6c0b..7f4228346a 100644
--- a/contrib/libs/grpc/src/cpp/common/version_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/version_cc.cc
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-/* This file is autogenerated from:
- templates/src/core/surface/version.c.template */
-
+ *
+ */
+
+/* This file is autogenerated from:
+ templates/src/core/surface/version.c.template */
+
#include <grpcpp/grpcpp.h>
-
-namespace grpc {
+
+namespace grpc {
TString Version() { return "1.33.2"; }
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
index 2daec87a4c..1b388210c0 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
@@ -1,212 +1,212 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include <unordered_set>
-#include <vector>
-
+ *
+ */
+
+#include <unordered_set>
+#include <vector>
+
#include <grpcpp/grpcpp.h>
-
-#include "src/cpp/ext/proto_server_reflection.h"
-
-using grpc::Status;
-using grpc::StatusCode;
+
+#include "src/cpp/ext/proto_server_reflection.h"
+
+using grpc::Status;
+using grpc::StatusCode;
using grpc::reflection::v1alpha::ErrorResponse;
using grpc::reflection::v1alpha::ExtensionNumberResponse;
using grpc::reflection::v1alpha::ExtensionRequest;
using grpc::reflection::v1alpha::FileDescriptorResponse;
using grpc::reflection::v1alpha::ListServiceResponse;
-using grpc::reflection::v1alpha::ServerReflectionRequest;
-using grpc::reflection::v1alpha::ServerReflectionResponse;
-using grpc::reflection::v1alpha::ServiceResponse;
-
-namespace grpc {
-
-ProtoServerReflection::ProtoServerReflection()
- : descriptor_pool_(protobuf::DescriptorPool::generated_pool()) {}
-
-void ProtoServerReflection::SetServiceList(
+using grpc::reflection::v1alpha::ServerReflectionRequest;
+using grpc::reflection::v1alpha::ServerReflectionResponse;
+using grpc::reflection::v1alpha::ServiceResponse;
+
+namespace grpc {
+
+ProtoServerReflection::ProtoServerReflection()
+ : descriptor_pool_(protobuf::DescriptorPool::generated_pool()) {}
+
+void ProtoServerReflection::SetServiceList(
const std::vector<TString>* services) {
- services_ = services;
-}
-
-Status ProtoServerReflection::ServerReflectionInfo(
- ServerContext* context,
- ServerReaderWriter<ServerReflectionResponse, ServerReflectionRequest>*
- stream) {
- ServerReflectionRequest request;
- ServerReflectionResponse response;
- Status status;
- while (stream->Read(&request)) {
- switch (request.message_request_case()) {
- case ServerReflectionRequest::MessageRequestCase::kFileByFilename:
- status = GetFileByName(context, request.file_by_filename(), &response);
- break;
- case ServerReflectionRequest::MessageRequestCase::kFileContainingSymbol:
- status = GetFileContainingSymbol(
- context, request.file_containing_symbol(), &response);
- break;
- case ServerReflectionRequest::MessageRequestCase::
- kFileContainingExtension:
- status = GetFileContainingExtension(
- context, &request.file_containing_extension(), &response);
- break;
- case ServerReflectionRequest::MessageRequestCase::
- kAllExtensionNumbersOfType:
- status = GetAllExtensionNumbers(
- context, request.all_extension_numbers_of_type(),
- response.mutable_all_extension_numbers_response());
- break;
- case ServerReflectionRequest::MessageRequestCase::kListServices:
- status =
- ListService(context, response.mutable_list_services_response());
- break;
- default:
- status = Status(StatusCode::UNIMPLEMENTED, "");
- }
-
- if (!status.ok()) {
- FillErrorResponse(status, response.mutable_error_response());
- }
- response.set_valid_host(request.host());
- response.set_allocated_original_request(
- new ServerReflectionRequest(request));
- stream->Write(response);
- }
-
- return Status::OK;
-}
-
-void ProtoServerReflection::FillErrorResponse(const Status& status,
- ErrorResponse* error_response) {
- error_response->set_error_code(status.error_code());
+ services_ = services;
+}
+
+Status ProtoServerReflection::ServerReflectionInfo(
+ ServerContext* context,
+ ServerReaderWriter<ServerReflectionResponse, ServerReflectionRequest>*
+ stream) {
+ ServerReflectionRequest request;
+ ServerReflectionResponse response;
+ Status status;
+ while (stream->Read(&request)) {
+ switch (request.message_request_case()) {
+ case ServerReflectionRequest::MessageRequestCase::kFileByFilename:
+ status = GetFileByName(context, request.file_by_filename(), &response);
+ break;
+ case ServerReflectionRequest::MessageRequestCase::kFileContainingSymbol:
+ status = GetFileContainingSymbol(
+ context, request.file_containing_symbol(), &response);
+ break;
+ case ServerReflectionRequest::MessageRequestCase::
+ kFileContainingExtension:
+ status = GetFileContainingExtension(
+ context, &request.file_containing_extension(), &response);
+ break;
+ case ServerReflectionRequest::MessageRequestCase::
+ kAllExtensionNumbersOfType:
+ status = GetAllExtensionNumbers(
+ context, request.all_extension_numbers_of_type(),
+ response.mutable_all_extension_numbers_response());
+ break;
+ case ServerReflectionRequest::MessageRequestCase::kListServices:
+ status =
+ ListService(context, response.mutable_list_services_response());
+ break;
+ default:
+ status = Status(StatusCode::UNIMPLEMENTED, "");
+ }
+
+ if (!status.ok()) {
+ FillErrorResponse(status, response.mutable_error_response());
+ }
+ response.set_valid_host(request.host());
+ response.set_allocated_original_request(
+ new ServerReflectionRequest(request));
+ stream->Write(response);
+ }
+
+ return Status::OK;
+}
+
+void ProtoServerReflection::FillErrorResponse(const Status& status,
+ ErrorResponse* error_response) {
+ error_response->set_error_code(status.error_code());
error_response->set_error_message(TProtoStringType(status.error_message()));
-}
-
+}
+
Status ProtoServerReflection::ListService(ServerContext* /*context*/,
- ListServiceResponse* response) {
- if (services_ == nullptr) {
- return Status(StatusCode::NOT_FOUND, "Services not found.");
- }
+ ListServiceResponse* response) {
+ if (services_ == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "Services not found.");
+ }
for (const auto& value : *services_) {
- ServiceResponse* service_response = response->add_service();
+ ServiceResponse* service_response = response->add_service();
service_response->set_name(TProtoStringType(value));
- }
- return Status::OK;
-}
-
-Status ProtoServerReflection::GetFileByName(
+ }
+ return Status::OK;
+}
+
+Status ProtoServerReflection::GetFileByName(
ServerContext* /*context*/, const TString& filename,
- ServerReflectionResponse* response) {
- if (descriptor_pool_ == nullptr) {
- return Status::CANCELLED;
- }
-
- const protobuf::FileDescriptor* file_desc =
+ ServerReflectionResponse* response) {
+ if (descriptor_pool_ == nullptr) {
+ return Status::CANCELLED;
+ }
+
+ const protobuf::FileDescriptor* file_desc =
descriptor_pool_->FindFileByName(TProtoStringType(filename));
- if (file_desc == nullptr) {
- return Status(StatusCode::NOT_FOUND, "File not found.");
- }
+ if (file_desc == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "File not found.");
+ }
std::unordered_set<TString> seen_files;
- FillFileDescriptorResponse(file_desc, response, &seen_files);
- return Status::OK;
-}
-
-Status ProtoServerReflection::GetFileContainingSymbol(
+ FillFileDescriptorResponse(file_desc, response, &seen_files);
+ return Status::OK;
+}
+
+Status ProtoServerReflection::GetFileContainingSymbol(
ServerContext* /*context*/, const TString& symbol,
- ServerReflectionResponse* response) {
- if (descriptor_pool_ == nullptr) {
- return Status::CANCELLED;
- }
-
- const protobuf::FileDescriptor* file_desc =
+ ServerReflectionResponse* response) {
+ if (descriptor_pool_ == nullptr) {
+ return Status::CANCELLED;
+ }
+
+ const protobuf::FileDescriptor* file_desc =
descriptor_pool_->FindFileContainingSymbol(TProtoStringType(symbol));
- if (file_desc == nullptr) {
- return Status(StatusCode::NOT_FOUND, "Symbol not found.");
- }
+ if (file_desc == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "Symbol not found.");
+ }
std::unordered_set<TString> seen_files;
- FillFileDescriptorResponse(file_desc, response, &seen_files);
- return Status::OK;
-}
-
-Status ProtoServerReflection::GetFileContainingExtension(
+ FillFileDescriptorResponse(file_desc, response, &seen_files);
+ return Status::OK;
+}
+
+Status ProtoServerReflection::GetFileContainingExtension(
ServerContext* /*context*/, const ExtensionRequest* request,
- ServerReflectionResponse* response) {
- if (descriptor_pool_ == nullptr) {
- return Status::CANCELLED;
- }
-
- const protobuf::Descriptor* desc =
- descriptor_pool_->FindMessageTypeByName(request->containing_type());
- if (desc == nullptr) {
- return Status(StatusCode::NOT_FOUND, "Type not found.");
- }
-
- const protobuf::FieldDescriptor* field_desc =
- descriptor_pool_->FindExtensionByNumber(desc,
- request->extension_number());
- if (field_desc == nullptr) {
- return Status(StatusCode::NOT_FOUND, "Extension not found.");
- }
+ ServerReflectionResponse* response) {
+ if (descriptor_pool_ == nullptr) {
+ return Status::CANCELLED;
+ }
+
+ const protobuf::Descriptor* desc =
+ descriptor_pool_->FindMessageTypeByName(request->containing_type());
+ if (desc == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "Type not found.");
+ }
+
+ const protobuf::FieldDescriptor* field_desc =
+ descriptor_pool_->FindExtensionByNumber(desc,
+ request->extension_number());
+ if (field_desc == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "Extension not found.");
+ }
std::unordered_set<TString> seen_files;
- FillFileDescriptorResponse(field_desc->file(), response, &seen_files);
- return Status::OK;
-}
-
-Status ProtoServerReflection::GetAllExtensionNumbers(
+ FillFileDescriptorResponse(field_desc->file(), response, &seen_files);
+ return Status::OK;
+}
+
+Status ProtoServerReflection::GetAllExtensionNumbers(
ServerContext* /*context*/, const TString& type,
- ExtensionNumberResponse* response) {
- if (descriptor_pool_ == nullptr) {
- return Status::CANCELLED;
- }
-
- const protobuf::Descriptor* desc =
+ ExtensionNumberResponse* response) {
+ if (descriptor_pool_ == nullptr) {
+ return Status::CANCELLED;
+ }
+
+ const protobuf::Descriptor* desc =
descriptor_pool_->FindMessageTypeByName(TProtoStringType(type));
- if (desc == nullptr) {
- return Status(StatusCode::NOT_FOUND, "Type not found.");
- }
-
- std::vector<const protobuf::FieldDescriptor*> extensions;
- descriptor_pool_->FindAllExtensions(desc, &extensions);
+ if (desc == nullptr) {
+ return Status(StatusCode::NOT_FOUND, "Type not found.");
+ }
+
+ std::vector<const protobuf::FieldDescriptor*> extensions;
+ descriptor_pool_->FindAllExtensions(desc, &extensions);
for (const auto& value : extensions) {
response->add_extension_number(value->number());
- }
+ }
response->set_base_type_name(TProtoStringType(type));
- return Status::OK;
-}
-
-void ProtoServerReflection::FillFileDescriptorResponse(
- const protobuf::FileDescriptor* file_desc,
- ServerReflectionResponse* response,
+ return Status::OK;
+}
+
+void ProtoServerReflection::FillFileDescriptorResponse(
+ const protobuf::FileDescriptor* file_desc,
+ ServerReflectionResponse* response,
std::unordered_set<TString>* seen_files) {
- if (seen_files->find(file_desc->name()) != seen_files->end()) {
- return;
- }
- seen_files->insert(file_desc->name());
-
- protobuf::FileDescriptorProto file_desc_proto;
+ if (seen_files->find(file_desc->name()) != seen_files->end()) {
+ return;
+ }
+ seen_files->insert(file_desc->name());
+
+ protobuf::FileDescriptorProto file_desc_proto;
TProtoStringType data;
- file_desc->CopyTo(&file_desc_proto);
- file_desc_proto.SerializeToString(&data);
- response->mutable_file_descriptor_response()->add_file_descriptor_proto(data);
-
- for (int i = 0; i < file_desc->dependency_count(); ++i) {
- FillFileDescriptorResponse(file_desc->dependency(i), response, seen_files);
- }
-}
-
-} // namespace grpc
+ file_desc->CopyTo(&file_desc_proto);
+ file_desc_proto.SerializeToString(&data);
+ response->mutable_file_descriptor_response()->add_file_descriptor_proto(data);
+
+ for (int i = 0; i < file_desc->dependency_count(); ++i) {
+ FillFileDescriptorResponse(file_desc->dependency(i), response, seen_files);
+ }
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
index 8bd562dda1..2d17eed95a 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
@@ -1,80 +1,80 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
-#define GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
-
-#include <unordered_set>
-#include <vector>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
+#define GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
+
+#include <unordered_set>
+#include <vector>
+
#include <grpcpp/grpcpp.h>
-#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
-
-namespace grpc {
-
-class ProtoServerReflection final
- : public reflection::v1alpha::ServerReflection::Service {
- public:
- ProtoServerReflection();
-
- // Add the full names of registered services
+#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
+
+namespace grpc {
+
+class ProtoServerReflection final
+ : public reflection::v1alpha::ServerReflection::Service {
+ public:
+ ProtoServerReflection();
+
+ // Add the full names of registered services
void SetServiceList(const std::vector<TString>* services);
-
- // implementation of ServerReflectionInfo(stream ServerReflectionRequest) rpc
- // in ServerReflection service
- Status ServerReflectionInfo(
- ServerContext* context,
- ServerReaderWriter<reflection::v1alpha::ServerReflectionResponse,
- reflection::v1alpha::ServerReflectionRequest>* stream)
- override;
-
- private:
- Status ListService(ServerContext* context,
- reflection::v1alpha::ListServiceResponse* response);
-
+
+ // implementation of ServerReflectionInfo(stream ServerReflectionRequest) rpc
+ // in ServerReflection service
+ Status ServerReflectionInfo(
+ ServerContext* context,
+ ServerReaderWriter<reflection::v1alpha::ServerReflectionResponse,
+ reflection::v1alpha::ServerReflectionRequest>* stream)
+ override;
+
+ private:
+ Status ListService(ServerContext* context,
+ reflection::v1alpha::ListServiceResponse* response);
+
Status GetFileByName(ServerContext* context, const TString& file_name,
- reflection::v1alpha::ServerReflectionResponse* response);
-
- Status GetFileContainingSymbol(
+ reflection::v1alpha::ServerReflectionResponse* response);
+
+ Status GetFileContainingSymbol(
ServerContext* context, const TString& symbol,
- reflection::v1alpha::ServerReflectionResponse* response);
-
- Status GetFileContainingExtension(
- ServerContext* context,
- const reflection::v1alpha::ExtensionRequest* request,
- reflection::v1alpha::ServerReflectionResponse* response);
-
- Status GetAllExtensionNumbers(
+ reflection::v1alpha::ServerReflectionResponse* response);
+
+ Status GetFileContainingExtension(
+ ServerContext* context,
+ const reflection::v1alpha::ExtensionRequest* request,
+ reflection::v1alpha::ServerReflectionResponse* response);
+
+ Status GetAllExtensionNumbers(
ServerContext* context, const TString& type,
- reflection::v1alpha::ExtensionNumberResponse* response);
-
- void FillFileDescriptorResponse(
- const protobuf::FileDescriptor* file_desc,
- reflection::v1alpha::ServerReflectionResponse* response,
+ reflection::v1alpha::ExtensionNumberResponse* response);
+
+ void FillFileDescriptorResponse(
+ const protobuf::FileDescriptor* file_desc,
+ reflection::v1alpha::ServerReflectionResponse* response,
std::unordered_set<TString>* seen_files);
-
- void FillErrorResponse(const Status& status,
- reflection::v1alpha::ErrorResponse* error_response);
-
- const protobuf::DescriptorPool* descriptor_pool_;
- const std::vector<string>* services_;
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
+
+ void FillErrorResponse(const Status& status,
+ reflection::v1alpha::ErrorResponse* error_response);
+
+ const protobuf::DescriptorPool* descriptor_pool_;
+ const std::vector<string>* services_;
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
index 6e468ba1fd..007193d7f7 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
@@ -1,83 +1,83 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/impl/server_initializer.h>
#include <grpcpp/server.h>
-
-#include "src/cpp/ext/proto_server_reflection.h"
-
+
+#include "src/cpp/ext/proto_server_reflection.h"
+
namespace grpc {
-namespace reflection {
-
-ProtoServerReflectionPlugin::ProtoServerReflectionPlugin()
- : reflection_service_(new grpc::ProtoServerReflection()) {}
-
+namespace reflection {
+
+ProtoServerReflectionPlugin::ProtoServerReflectionPlugin()
+ : reflection_service_(new grpc::ProtoServerReflection()) {}
+
TString ProtoServerReflectionPlugin::name() {
- return "proto_server_reflection";
-}
-
-void ProtoServerReflectionPlugin::InitServer(grpc::ServerInitializer* si) {
- si->RegisterService(reflection_service_);
-}
-
-void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) {
- reflection_service_->SetServiceList(si->GetServiceList());
-}
-
+ return "proto_server_reflection";
+}
+
+void ProtoServerReflectionPlugin::InitServer(grpc::ServerInitializer* si) {
+ si->RegisterService(reflection_service_);
+}
+
+void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) {
+ reflection_service_->SetServiceList(si->GetServiceList());
+}
+
void ProtoServerReflectionPlugin::ChangeArguments(const TString& /*name*/,
void* /*value*/) {}
-
-bool ProtoServerReflectionPlugin::has_sync_methods() const {
- if (reflection_service_) {
- return reflection_service_->has_synchronous_methods();
- }
- return false;
-}
-
-bool ProtoServerReflectionPlugin::has_async_methods() const {
- if (reflection_service_) {
- return reflection_service_->has_async_methods();
- }
- return false;
-}
-
-static std::unique_ptr< ::grpc::ServerBuilderPlugin> CreateProtoReflection() {
- return std::unique_ptr< ::grpc::ServerBuilderPlugin>(
- new ProtoServerReflectionPlugin());
-}
-
-void InitProtoReflectionServerBuilderPlugin() {
+
+bool ProtoServerReflectionPlugin::has_sync_methods() const {
+ if (reflection_service_) {
+ return reflection_service_->has_synchronous_methods();
+ }
+ return false;
+}
+
+bool ProtoServerReflectionPlugin::has_async_methods() const {
+ if (reflection_service_) {
+ return reflection_service_->has_async_methods();
+ }
+ return false;
+}
+
+static std::unique_ptr< ::grpc::ServerBuilderPlugin> CreateProtoReflection() {
+ return std::unique_ptr< ::grpc::ServerBuilderPlugin>(
+ new ProtoServerReflectionPlugin());
+}
+
+void InitProtoReflectionServerBuilderPlugin() {
static struct Initialize {
Initialize() {
::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection);
}
} initializer;
-}
-
-// Force InitProtoReflectionServerBuilderPlugin() to be called at static
-// initialization time.
-struct StaticProtoReflectionPluginInitializer {
- StaticProtoReflectionPluginInitializer() {
- InitProtoReflectionServerBuilderPlugin();
- }
-} static_proto_reflection_plugin_initializer;
-
-} // namespace reflection
+}
+
+// Force InitProtoReflectionServerBuilderPlugin() to be called at static
+// initialization time.
+struct StaticProtoReflectionPluginInitializer {
+ StaticProtoReflectionPluginInitializer() {
+ InitProtoReflectionServerBuilderPlugin();
+ }
+} static_proto_reflection_plugin_initializer;
+
+} // namespace reflection
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/async_generic_service.cc b/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
index a6c901d83c..07697a52d1 100644
--- a/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
@@ -1,33 +1,33 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/generic/async_generic_service.h>
-
+
#include <grpcpp/server.h>
-
-namespace grpc {
-
-void AsyncGenericService::RequestCall(
- GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer,
+
+namespace grpc {
+
+void AsyncGenericService::RequestCall(
+ GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer,
::grpc::CompletionQueue* call_cq,
::grpc::ServerCompletionQueue* notification_cq, void* tag) {
- server_->RequestAsyncGenericCall(ctx, reader_writer, call_cq, notification_cq,
- tag);
-}
-
-} // namespace grpc
+ server_->RequestAsyncGenericCall(ctx, reader_writer, call_cq, notification_cq,
+ tag);
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc b/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
index b682af211f..8ca3e32c2f 100644
--- a/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
+++ b/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
@@ -1,36 +1,36 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <grpc/support/cpu.h>
-
-#include "src/cpp/server/dynamic_thread_pool.h"
-
-#ifndef GRPC_CUSTOM_DEFAULT_THREAD_POOL
-
-namespace grpc {
+ *
+ */
+
+#include <grpc/support/cpu.h>
+
+#include "src/cpp/server/dynamic_thread_pool.h"
+
+#ifndef GRPC_CUSTOM_DEFAULT_THREAD_POOL
+
+namespace grpc {
namespace {
-
+
ThreadPoolInterface* CreateDefaultThreadPoolImpl() {
- int cores = gpr_cpu_num_cores();
- if (!cores) cores = 4;
- return new DynamicThreadPool(cores);
-}
-
+ int cores = gpr_cpu_num_cores();
+ if (!cores) cores = 4;
+ return new DynamicThreadPool(cores);
+}
+
CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPoolImpl;
} // namespace
@@ -39,6 +39,6 @@ ThreadPoolInterface* CreateDefaultThreadPool() { return g_ctp_impl(); }
void SetCreateThreadPool(CreateThreadPoolFunc func) { g_ctp_impl = func; }
-} // namespace grpc
-
-#endif // !GRPC_CUSTOM_DEFAULT_THREAD_POOL
+} // namespace grpc
+
+#endif // !GRPC_CUSTOM_DEFAULT_THREAD_POOL
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
index ffb232c847..77c5d6a263 100644
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
+++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
@@ -1,124 +1,124 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include "src/cpp/server/dynamic_thread_pool.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/sync.h>
-
+
#include "src/core/lib/gprpp/thd.h"
-namespace grpc {
+namespace grpc {
-DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool)
- : pool_(pool),
+DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool)
+ : pool_(pool),
thd_("grpcpp_dynamic_pool",
[](void* th) {
static_cast<DynamicThreadPool::DynamicThread*>(th)->ThreadFunc();
},
this) {
thd_.Start();
-}
+}
DynamicThreadPool::DynamicThread::~DynamicThread() { thd_.Join(); }
-
-void DynamicThreadPool::DynamicThread::ThreadFunc() {
- pool_->ThreadFunc();
- // Now that we have killed ourselves, we should reduce the thread count
+
+void DynamicThreadPool::DynamicThread::ThreadFunc() {
+ pool_->ThreadFunc();
+ // Now that we have killed ourselves, we should reduce the thread count
grpc_core::MutexLock lock(&pool_->mu_);
- pool_->nthreads_--;
- // Move ourselves to dead list
- pool_->dead_threads_.push_back(this);
-
- if ((pool_->shutdown_) && (pool_->nthreads_ == 0)) {
+ pool_->nthreads_--;
+ // Move ourselves to dead list
+ pool_->dead_threads_.push_back(this);
+
+ if ((pool_->shutdown_) && (pool_->nthreads_ == 0)) {
pool_->shutdown_cv_.Signal();
- }
-}
-
-void DynamicThreadPool::ThreadFunc() {
- for (;;) {
- // Wait until work is available or we are shutting down.
+ }
+}
+
+void DynamicThreadPool::ThreadFunc() {
+ for (;;) {
+ // Wait until work is available or we are shutting down.
grpc_core::ReleasableMutexLock lock(&mu_);
- if (!shutdown_ && callbacks_.empty()) {
- // If there are too many threads waiting, then quit this thread
- if (threads_waiting_ >= reserve_threads_) {
- break;
- }
- threads_waiting_++;
+ if (!shutdown_ && callbacks_.empty()) {
+ // If there are too many threads waiting, then quit this thread
+ if (threads_waiting_ >= reserve_threads_) {
+ break;
+ }
+ threads_waiting_++;
cv_.Wait(&mu_);
- threads_waiting_--;
- }
- // Drain callbacks before considering shutdown to ensure all work
- // gets completed.
- if (!callbacks_.empty()) {
- auto cb = callbacks_.front();
- callbacks_.pop();
+ threads_waiting_--;
+ }
+ // Drain callbacks before considering shutdown to ensure all work
+ // gets completed.
+ if (!callbacks_.empty()) {
+ auto cb = callbacks_.front();
+ callbacks_.pop();
lock.Unlock();
- cb();
- } else if (shutdown_) {
- break;
- }
- }
-}
-
-DynamicThreadPool::DynamicThreadPool(int reserve_threads)
- : shutdown_(false),
- reserve_threads_(reserve_threads),
- nthreads_(0),
- threads_waiting_(0) {
- for (int i = 0; i < reserve_threads_; i++) {
+ cb();
+ } else if (shutdown_) {
+ break;
+ }
+ }
+}
+
+DynamicThreadPool::DynamicThreadPool(int reserve_threads)
+ : shutdown_(false),
+ reserve_threads_(reserve_threads),
+ nthreads_(0),
+ threads_waiting_(0) {
+ for (int i = 0; i < reserve_threads_; i++) {
grpc_core::MutexLock lock(&mu_);
- nthreads_++;
- new DynamicThread(this);
- }
-}
-
-void DynamicThreadPool::ReapThreads(std::list<DynamicThread*>* tlist) {
- for (auto t = tlist->begin(); t != tlist->end(); t = tlist->erase(t)) {
- delete *t;
- }
-}
-
-DynamicThreadPool::~DynamicThreadPool() {
+ nthreads_++;
+ new DynamicThread(this);
+ }
+}
+
+void DynamicThreadPool::ReapThreads(std::list<DynamicThread*>* tlist) {
+ for (auto t = tlist->begin(); t != tlist->end(); t = tlist->erase(t)) {
+ delete *t;
+ }
+}
+
+DynamicThreadPool::~DynamicThreadPool() {
grpc_core::MutexLock lock(&mu_);
- shutdown_ = true;
+ shutdown_ = true;
cv_.Broadcast();
- while (nthreads_ != 0) {
+ while (nthreads_ != 0) {
shutdown_cv_.Wait(&mu_);
- }
- ReapThreads(&dead_threads_);
-}
-
-void DynamicThreadPool::Add(const std::function<void()>& callback) {
+ }
+ ReapThreads(&dead_threads_);
+}
+
+void DynamicThreadPool::Add(const std::function<void()>& callback) {
grpc_core::MutexLock lock(&mu_);
- // Add works to the callbacks list
- callbacks_.push(callback);
- // Increase pool size or notify as needed
- if (threads_waiting_ == 0) {
- // Kick off a new thread
- nthreads_++;
- new DynamicThread(this);
- } else {
+ // Add works to the callbacks list
+ callbacks_.push(callback);
+ // Increase pool size or notify as needed
+ if (threads_waiting_ == 0) {
+ // Kick off a new thread
+ nthreads_++;
+ new DynamicThread(this);
+ } else {
cv_.Signal();
- }
- // Also use this chance to harvest dead threads
- if (!dead_threads_.empty()) {
- ReapThreads(&dead_threads_);
- }
-}
-
-} // namespace grpc
+ }
+ // Also use this chance to harvest dead threads
+ if (!dead_threads_.empty()) {
+ ReapThreads(&dead_threads_);
+ }
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
index edf0c56c22..6f9f943bc3 100644
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
+++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
@@ -1,68 +1,68 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
-#define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
-
-#include <list>
-#include <memory>
-#include <queue>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
+#define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
+
+#include <list>
+#include <memory>
+#include <queue>
+
#include <grpcpp/support/config.h>
-
+
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
-#include "src/cpp/server/thread_pool_interface.h"
-
-namespace grpc {
-
-class DynamicThreadPool final : public ThreadPoolInterface {
- public:
- explicit DynamicThreadPool(int reserve_threads);
- ~DynamicThreadPool();
-
- void Add(const std::function<void()>& callback) override;
-
- private:
- class DynamicThread {
- public:
- DynamicThread(DynamicThreadPool* pool);
- ~DynamicThread();
-
- private:
- DynamicThreadPool* pool_;
+#include "src/cpp/server/thread_pool_interface.h"
+
+namespace grpc {
+
+class DynamicThreadPool final : public ThreadPoolInterface {
+ public:
+ explicit DynamicThreadPool(int reserve_threads);
+ ~DynamicThreadPool();
+
+ void Add(const std::function<void()>& callback) override;
+
+ private:
+ class DynamicThread {
+ public:
+ DynamicThread(DynamicThreadPool* pool);
+ ~DynamicThread();
+
+ private:
+ DynamicThreadPool* pool_;
grpc_core::Thread thd_;
- void ThreadFunc();
- };
+ void ThreadFunc();
+ };
grpc_core::Mutex mu_;
grpc_core::CondVar cv_;
grpc_core::CondVar shutdown_cv_;
- bool shutdown_;
- std::queue<std::function<void()>> callbacks_;
- int reserve_threads_;
- int nthreads_;
- int threads_waiting_;
- std::list<DynamicThread*> dead_threads_;
-
- void ThreadFunc();
- static void ReapThreads(std::list<DynamicThread*>* tlist);
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
+ bool shutdown_;
+ std::queue<std::function<void()>> callbacks_;
+ int reserve_threads_;
+ int nthreads_;
+ int threads_waiting_;
+ std::list<DynamicThread*> dead_threads_;
+
+ void ThreadFunc();
+ static void ReapThreads(std::list<DynamicThread*>* tlist);
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
diff --git a/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc b/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
index c592066372..3f33f4e045 100644
--- a/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
@@ -1,44 +1,44 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/security/server_credentials.h>
-
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
-
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+
namespace grpc {
-namespace {
-class InsecureServerCredentialsImpl final : public ServerCredentials {
- public:
+namespace {
+class InsecureServerCredentialsImpl final : public ServerCredentials {
+ public:
int AddPortToServer(const TString& addr, grpc_server* server) override {
- return grpc_server_add_insecure_http2_port(server, addr.c_str());
- }
- void SetAuthMetadataProcessor(
+ return grpc_server_add_insecure_http2_port(server, addr.c_str());
+ }
+ void SetAuthMetadataProcessor(
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) override {
- (void)processor;
- GPR_ASSERT(0); // Should not be called on InsecureServerCredentials.
- }
-};
-} // namespace
-
-std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
- return std::shared_ptr<ServerCredentials>(
- new InsecureServerCredentialsImpl());
-}
-
+ (void)processor;
+ GPR_ASSERT(0); // Should not be called on InsecureServerCredentials.
+ }
+};
+} // namespace
+
+std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
+ return std::shared_ptr<ServerCredentials>(
+ new InsecureServerCredentialsImpl());
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
index 143773a062..732602bcb7 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
@@ -1,130 +1,130 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <functional>
-#include <map>
-#include <memory>
-
+ *
+ */
+
+#include <functional>
+#include <map>
+#include <memory>
+
#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/auth_metadata_processor.h>
-#include "src/cpp/common/secure_auth_context.h"
-#include "src/cpp/server/secure_server_credentials.h"
-
-namespace grpc {
-
-void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) {
+#include "src/cpp/common/secure_auth_context.h"
+#include "src/cpp/server/secure_server_credentials.h"
+
+namespace grpc {
+
+void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) {
auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
- delete w;
-}
-
-void AuthMetadataProcessorAyncWrapper::Process(
- void* wrapper, grpc_auth_context* context, const grpc_metadata* md,
- size_t num_md, grpc_process_auth_metadata_done_cb cb, void* user_data) {
+ delete w;
+}
+
+void AuthMetadataProcessorAyncWrapper::Process(
+ void* wrapper, grpc_auth_context* context, const grpc_metadata* md,
+ size_t num_md, grpc_process_auth_metadata_done_cb cb, void* user_data) {
auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
- if (!w->processor_) {
- // Early exit.
- cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_OK, nullptr);
- return;
- }
- if (w->processor_->IsBlocking()) {
+ if (!w->processor_) {
+ // Early exit.
+ cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_OK, nullptr);
+ return;
+ }
+ if (w->processor_->IsBlocking()) {
w->thread_pool_->Add([w, context, md, num_md, cb, user_data] {
w->AuthMetadataProcessorAyncWrapper::InvokeProcessor(context, md, num_md,
cb, user_data);
});
- } else {
- // invoke directly.
- w->InvokeProcessor(context, md, num_md, cb, user_data);
- }
-}
-
-void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
- grpc_auth_context* ctx, const grpc_metadata* md, size_t num_md,
- grpc_process_auth_metadata_done_cb cb, void* user_data) {
- AuthMetadataProcessor::InputMetadata metadata;
- for (size_t i = 0; i < num_md; i++) {
+ } else {
+ // invoke directly.
+ w->InvokeProcessor(context, md, num_md, cb, user_data);
+ }
+}
+
+void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
+ grpc_auth_context* ctx, const grpc_metadata* md, size_t num_md,
+ grpc_process_auth_metadata_done_cb cb, void* user_data) {
+ AuthMetadataProcessor::InputMetadata metadata;
+ for (size_t i = 0; i < num_md; i++) {
metadata.insert(std::make_pair(StringRefFromSlice(&md[i].key),
StringRefFromSlice(&md[i].value)));
- }
+ }
SecureAuthContext context(ctx);
- AuthMetadataProcessor::OutputMetadata consumed_metadata;
- AuthMetadataProcessor::OutputMetadata response_metadata;
-
- Status status = processor_->Process(metadata, &context, &consumed_metadata,
- &response_metadata);
-
- std::vector<grpc_metadata> consumed_md;
+ AuthMetadataProcessor::OutputMetadata consumed_metadata;
+ AuthMetadataProcessor::OutputMetadata response_metadata;
+
+ Status status = processor_->Process(metadata, &context, &consumed_metadata,
+ &response_metadata);
+
+ std::vector<grpc_metadata> consumed_md;
for (const auto& consumed : consumed_metadata) {
- grpc_metadata md_entry;
+ grpc_metadata md_entry;
md_entry.key = SliceReferencingString(consumed.first);
md_entry.value = SliceReferencingString(consumed.second);
- md_entry.flags = 0;
- consumed_md.push_back(md_entry);
- }
- std::vector<grpc_metadata> response_md;
+ md_entry.flags = 0;
+ consumed_md.push_back(md_entry);
+ }
+ std::vector<grpc_metadata> response_md;
for (const auto& response : response_metadata) {
- grpc_metadata md_entry;
+ grpc_metadata md_entry;
md_entry.key = SliceReferencingString(response.first);
md_entry.value = SliceReferencingString(response.second);
- md_entry.flags = 0;
- response_md.push_back(md_entry);
- }
- auto consumed_md_data = consumed_md.empty() ? nullptr : &consumed_md[0];
- auto response_md_data = response_md.empty() ? nullptr : &response_md[0];
- cb(user_data, consumed_md_data, consumed_md.size(), response_md_data,
- response_md.size(), static_cast<grpc_status_code>(status.error_code()),
- status.error_message().c_str());
-}
-
+ md_entry.flags = 0;
+ response_md.push_back(md_entry);
+ }
+ auto consumed_md_data = consumed_md.empty() ? nullptr : &consumed_md[0];
+ auto response_md_data = response_md.empty() ? nullptr : &response_md[0];
+ cb(user_data, consumed_md_data, consumed_md.size(), response_md_data,
+ response_md.size(), static_cast<grpc_status_code>(status.error_code()),
+ status.error_message().c_str());
+}
+
int SecureServerCredentials::AddPortToServer(const TString& addr,
- grpc_server* server) {
- return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_);
-}
-
-void SecureServerCredentials::SetAuthMetadataProcessor(
+ grpc_server* server) {
+ return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_);
+}
+
+void SecureServerCredentials::SetAuthMetadataProcessor(
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) {
auto* wrapper = new grpc::AuthMetadataProcessorAyncWrapper(processor);
- grpc_server_credentials_set_auth_metadata_processor(
+ grpc_server_credentials_set_auth_metadata_processor(
creds_, {grpc::AuthMetadataProcessorAyncWrapper::Process,
grpc::AuthMetadataProcessorAyncWrapper::Destroy, wrapper});
-}
-
-std::shared_ptr<ServerCredentials> SslServerCredentials(
+}
+
+std::shared_ptr<ServerCredentials> SslServerCredentials(
const grpc::SslServerCredentialsOptions& options) {
- std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs;
+ std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs;
for (const auto& key_cert_pair : options.pem_key_cert_pairs) {
grpc_ssl_pem_key_cert_pair p = {key_cert_pair.private_key.c_str(),
key_cert_pair.cert_chain.c_str()};
- pem_key_cert_pairs.push_back(p);
- }
- grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create_ex(
- options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
- pem_key_cert_pairs.empty() ? nullptr : &pem_key_cert_pairs[0],
- pem_key_cert_pairs.size(),
- options.force_client_auth
- ? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
- : options.client_certificate_request,
- nullptr);
- return std::shared_ptr<ServerCredentials>(
- new SecureServerCredentials(c_creds));
-}
-
+ pem_key_cert_pairs.push_back(p);
+ }
+ grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create_ex(
+ options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
+ pem_key_cert_pairs.empty() ? nullptr : &pem_key_cert_pairs[0],
+ pem_key_cert_pairs.size(),
+ options.force_client_auth
+ ? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
+ : options.client_certificate_request,
+ nullptr);
+ return std::shared_ptr<ServerCredentials>(
+ new SecureServerCredentials(c_creds));
+}
+
namespace experimental {
std::shared_ptr<ServerCredentials> AltsServerCredentials(
diff --git a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
index 1970f6b65e..9e3fb3f9eb 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
@@ -1,79 +1,79 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
-#define GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
-
-#include <memory>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
+#define GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
+
+#include <memory>
+
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/security/tls_credentials_options.h>
-
-#include <grpc/grpc_security.h>
-
-#include "src/cpp/server/thread_pool_interface.h"
-
+
+#include <grpc/grpc_security.h>
+
+#include "src/cpp/server/thread_pool_interface.h"
+
namespace grpc {
class SecureServerCredentials;
-class AuthMetadataProcessorAyncWrapper final {
- public:
- static void Destroy(void* wrapper);
-
- static void Process(void* wrapper, grpc_auth_context* context,
- const grpc_metadata* md, size_t num_md,
- grpc_process_auth_metadata_done_cb cb, void* user_data);
-
- AuthMetadataProcessorAyncWrapper(
- const std::shared_ptr<AuthMetadataProcessor>& processor)
+class AuthMetadataProcessorAyncWrapper final {
+ public:
+ static void Destroy(void* wrapper);
+
+ static void Process(void* wrapper, grpc_auth_context* context,
+ const grpc_metadata* md, size_t num_md,
+ grpc_process_auth_metadata_done_cb cb, void* user_data);
+
+ AuthMetadataProcessorAyncWrapper(
+ const std::shared_ptr<AuthMetadataProcessor>& processor)
: processor_(processor) {
if (processor && processor->IsBlocking()) {
thread_pool_.reset(CreateDefaultThreadPool());
}
}
-
- private:
- void InvokeProcessor(grpc_auth_context* context, const grpc_metadata* md,
- size_t num_md, grpc_process_auth_metadata_done_cb cb,
- void* user_data);
- std::unique_ptr<ThreadPoolInterface> thread_pool_;
- std::shared_ptr<AuthMetadataProcessor> processor_;
-};
-
-class SecureServerCredentials final : public ServerCredentials {
- public:
- explicit SecureServerCredentials(grpc_server_credentials* creds)
- : creds_(creds) {}
- ~SecureServerCredentials() override {
- grpc_server_credentials_release(creds_);
- }
-
+
+ private:
+ void InvokeProcessor(grpc_auth_context* context, const grpc_metadata* md,
+ size_t num_md, grpc_process_auth_metadata_done_cb cb,
+ void* user_data);
+ std::unique_ptr<ThreadPoolInterface> thread_pool_;
+ std::shared_ptr<AuthMetadataProcessor> processor_;
+};
+
+class SecureServerCredentials final : public ServerCredentials {
+ public:
+ explicit SecureServerCredentials(grpc_server_credentials* creds)
+ : creds_(creds) {}
+ ~SecureServerCredentials() override {
+ grpc_server_credentials_release(creds_);
+ }
+
int AddPortToServer(const TString& addr, grpc_server* server) override;
-
- void SetAuthMetadataProcessor(
+
+ void SetAuthMetadataProcessor(
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) override;
-
- private:
- grpc_server_credentials* creds_;
+
+ private:
+ grpc_server_credentials* creds_;
std::unique_ptr<grpc::AuthMetadataProcessorAyncWrapper> processor_;
-};
-
+};
+
} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
+
+#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
diff --git a/contrib/libs/grpc/src/cpp/server/server_builder.cc b/contrib/libs/grpc/src/cpp/server/server_builder.cc
index 842fb7e366..0cc00b365f 100644
--- a/contrib/libs/grpc/src/cpp/server/server_builder.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_builder.cc
@@ -1,107 +1,107 @@
-/*
- *
+/*
+ *
* Copyright 2015-2016 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/server_builder.h>
-
-#include <grpc/support/cpu.h>
-#include <grpc/support/log.h>
+
+#include <grpc/support/cpu.h>
+#include <grpc/support/log.h>
#include <grpcpp/impl/service_type.h>
#include <grpcpp/resource_quota.h>
#include <grpcpp/server.h>
-
+
#include <utility>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/cpp/server/external_connection_acceptor_impl.h"
-#include "src/cpp/server/thread_pool_interface.h"
-
+#include "src/cpp/server/thread_pool_interface.h"
+
namespace grpc {
-
+
static std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>*
- g_plugin_factory_list;
-static gpr_once once_init_plugin_list = GPR_ONCE_INIT;
-
-static void do_plugin_list_init(void) {
- g_plugin_factory_list =
+ g_plugin_factory_list;
+static gpr_once once_init_plugin_list = GPR_ONCE_INIT;
+
+static void do_plugin_list_init(void) {
+ g_plugin_factory_list =
new std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>();
-}
-
-ServerBuilder::ServerBuilder()
+}
+
+ServerBuilder::ServerBuilder()
: max_receive_message_size_(INT_MIN),
max_send_message_size_(INT_MIN),
- sync_server_settings_(SyncServerSettings()),
+ sync_server_settings_(SyncServerSettings()),
resource_quota_(nullptr) {
- gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
+ gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
for (const auto& value : *g_plugin_factory_list) {
plugins_.emplace_back(value());
- }
-
- // all compression algorithms enabled by default.
- enabled_compression_algorithms_bitset_ =
- (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1;
- memset(&maybe_default_compression_level_, 0,
- sizeof(maybe_default_compression_level_));
- memset(&maybe_default_compression_algorithm_, 0,
- sizeof(maybe_default_compression_algorithm_));
-}
-
-ServerBuilder::~ServerBuilder() {
- if (resource_quota_ != nullptr) {
- grpc_resource_quota_unref(resource_quota_);
- }
-}
-
+ }
+
+ // all compression algorithms enabled by default.
+ enabled_compression_algorithms_bitset_ =
+ (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1;
+ memset(&maybe_default_compression_level_, 0,
+ sizeof(maybe_default_compression_level_));
+ memset(&maybe_default_compression_algorithm_, 0,
+ sizeof(maybe_default_compression_algorithm_));
+}
+
+ServerBuilder::~ServerBuilder() {
+ if (resource_quota_ != nullptr) {
+ grpc_resource_quota_unref(resource_quota_);
+ }
+}
+
std::unique_ptr<grpc::ServerCompletionQueue> ServerBuilder::AddCompletionQueue(
- bool is_frequently_polled) {
+ bool is_frequently_polled) {
grpc::ServerCompletionQueue* cq = new grpc::ServerCompletionQueue(
GRPC_CQ_NEXT,
is_frequently_polled ? GRPC_CQ_DEFAULT_POLLING : GRPC_CQ_NON_LISTENING,
nullptr);
- cqs_.push_back(cq);
+ cqs_.push_back(cq);
return std::unique_ptr<grpc::ServerCompletionQueue>(cq);
-}
-
+}
+
ServerBuilder& ServerBuilder::RegisterService(Service* service) {
- services_.emplace_back(new NamedService(service));
- return *this;
-}
-
+ services_.emplace_back(new NamedService(service));
+ return *this;
+}
+
ServerBuilder& ServerBuilder::RegisterService(const TString& addr,
Service* service) {
- services_.emplace_back(new NamedService(addr, service));
- return *this;
-}
-
-ServerBuilder& ServerBuilder::RegisterAsyncGenericService(
+ services_.emplace_back(new NamedService(addr, service));
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::RegisterAsyncGenericService(
AsyncGenericService* service) {
if (generic_service_ || callback_generic_service_) {
- gpr_log(GPR_ERROR,
+ gpr_log(GPR_ERROR,
"Adding multiple generic services is unsupported for now. "
- "Dropping the service %p",
- (void*)service);
- } else {
- generic_service_ = service;
- }
- return *this;
-}
-
+ "Dropping the service %p",
+ (void*)service);
+ } else {
+ generic_service_ = service;
+ }
+ return *this;
+}
+
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
ServerBuilder& ServerBuilder::RegisterCallbackGenericService(
CallbackGenericService* service) {
@@ -143,66 +143,66 @@ ServerBuilder::experimental_type::AddExternalConnectionAcceptor(
return builder_->acceptors_.back()->GetAcceptor();
}
-ServerBuilder& ServerBuilder::SetOption(
+ServerBuilder& ServerBuilder::SetOption(
std::unique_ptr<ServerBuilderOption> option) {
- options_.push_back(std::move(option));
- return *this;
-}
-
-ServerBuilder& ServerBuilder::SetSyncServerOption(
- ServerBuilder::SyncServerOption option, int val) {
- switch (option) {
- case NUM_CQS:
- sync_server_settings_.num_cqs = val;
- break;
- case MIN_POLLERS:
- sync_server_settings_.min_pollers = val;
- break;
- case MAX_POLLERS:
- sync_server_settings_.max_pollers = val;
- break;
- case CQ_TIMEOUT_MSEC:
- sync_server_settings_.cq_timeout_msec = val;
- break;
- }
- return *this;
-}
-
-ServerBuilder& ServerBuilder::SetCompressionAlgorithmSupportStatus(
- grpc_compression_algorithm algorithm, bool enabled) {
- if (enabled) {
- GPR_BITSET(&enabled_compression_algorithms_bitset_, algorithm);
- } else {
- GPR_BITCLEAR(&enabled_compression_algorithms_bitset_, algorithm);
- }
- return *this;
-}
-
-ServerBuilder& ServerBuilder::SetDefaultCompressionLevel(
- grpc_compression_level level) {
+ options_.push_back(std::move(option));
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::SetSyncServerOption(
+ ServerBuilder::SyncServerOption option, int val) {
+ switch (option) {
+ case NUM_CQS:
+ sync_server_settings_.num_cqs = val;
+ break;
+ case MIN_POLLERS:
+ sync_server_settings_.min_pollers = val;
+ break;
+ case MAX_POLLERS:
+ sync_server_settings_.max_pollers = val;
+ break;
+ case CQ_TIMEOUT_MSEC:
+ sync_server_settings_.cq_timeout_msec = val;
+ break;
+ }
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::SetCompressionAlgorithmSupportStatus(
+ grpc_compression_algorithm algorithm, bool enabled) {
+ if (enabled) {
+ GPR_BITSET(&enabled_compression_algorithms_bitset_, algorithm);
+ } else {
+ GPR_BITCLEAR(&enabled_compression_algorithms_bitset_, algorithm);
+ }
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::SetDefaultCompressionLevel(
+ grpc_compression_level level) {
maybe_default_compression_level_.is_set = true;
- maybe_default_compression_level_.level = level;
- return *this;
-}
-
-ServerBuilder& ServerBuilder::SetDefaultCompressionAlgorithm(
- grpc_compression_algorithm algorithm) {
- maybe_default_compression_algorithm_.is_set = true;
- maybe_default_compression_algorithm_.algorithm = algorithm;
- return *this;
-}
-
-ServerBuilder& ServerBuilder::SetResourceQuota(
+ maybe_default_compression_level_.level = level;
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::SetDefaultCompressionAlgorithm(
+ grpc_compression_algorithm algorithm) {
+ maybe_default_compression_algorithm_.is_set = true;
+ maybe_default_compression_algorithm_.algorithm = algorithm;
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::SetResourceQuota(
const grpc::ResourceQuota& resource_quota) {
- if (resource_quota_ != nullptr) {
- grpc_resource_quota_unref(resource_quota_);
- }
- resource_quota_ = resource_quota.c_resource_quota();
- grpc_resource_quota_ref(resource_quota_);
- return *this;
-}
-
-ServerBuilder& ServerBuilder::AddListeningPort(
+ if (resource_quota_ != nullptr) {
+ grpc_resource_quota_unref(resource_quota_);
+ }
+ resource_quota_ = resource_quota.c_resource_quota();
+ grpc_resource_quota_ref(resource_quota_);
+ return *this;
+}
+
+ServerBuilder& ServerBuilder::AddListeningPort(
const TString& addr_uri, std::shared_ptr<ServerCredentials> creds,
int* selected_port) {
const TString uri_scheme = "dns:";
@@ -213,73 +213,73 @@ ServerBuilder& ServerBuilder::AddListeningPort(
addr = addr_uri.substr(pos);
}
Port port = {addr, std::move(creds), selected_port};
- ports_.push_back(port);
- return *this;
-}
-
+ ports_.push_back(port);
+ return *this;
+}
+
std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
grpc::ChannelArguments args;
if (max_receive_message_size_ >= -1) {
- args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_);
- }
+ args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_);
+ }
if (max_send_message_size_ >= -1) {
- args.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, max_send_message_size_);
- }
+ args.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, max_send_message_size_);
+ }
for (const auto& option : options_) {
option->UpdateArguments(&args);
option->UpdatePlugins(&plugins_);
}
- args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
- enabled_compression_algorithms_bitset_);
- if (maybe_default_compression_level_.is_set) {
- args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL,
- maybe_default_compression_level_.level);
- }
- if (maybe_default_compression_algorithm_.is_set) {
- args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM,
- maybe_default_compression_algorithm_.algorithm);
- }
-
- if (resource_quota_ != nullptr) {
- args.SetPointerWithVtable(GRPC_ARG_RESOURCE_QUOTA, resource_quota_,
- grpc_resource_quota_arg_vtable());
- }
-
+ args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
+ enabled_compression_algorithms_bitset_);
+ if (maybe_default_compression_level_.is_set) {
+ args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL,
+ maybe_default_compression_level_.level);
+ }
+ if (maybe_default_compression_algorithm_.is_set) {
+ args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM,
+ maybe_default_compression_algorithm_.algorithm);
+ }
+
+ if (resource_quota_ != nullptr) {
+ args.SetPointerWithVtable(GRPC_ARG_RESOURCE_QUOTA, resource_quota_,
+ grpc_resource_quota_arg_vtable());
+ }
+
for (const auto& plugin : plugins_) {
plugin->UpdateServerBuilder(this);
plugin->UpdateChannelArguments(&args);
}
- // == Determine if the server has any syncrhonous methods ==
- bool has_sync_methods = false;
+ // == Determine if the server has any syncrhonous methods ==
+ bool has_sync_methods = false;
for (const auto& value : services_) {
if (value->service->has_synchronous_methods()) {
- has_sync_methods = true;
- break;
- }
- }
-
- if (!has_sync_methods) {
+ has_sync_methods = true;
+ break;
+ }
+ }
+
+ if (!has_sync_methods) {
for (const auto& value : plugins_) {
if (value->has_sync_methods()) {
- has_sync_methods = true;
- break;
- }
- }
- }
-
- // If this is a Sync server, i.e a server expositing sync API, then the server
- // needs to create some completion queues to listen for incoming requests.
- // 'sync_server_cqs' are those internal completion queues.
- //
- // This is different from the completion queues added to the server via
- // ServerBuilder's AddCompletionQueue() method (those completion queues
- // are in 'cqs_' member variable of ServerBuilder object)
+ has_sync_methods = true;
+ break;
+ }
+ }
+ }
+
+ // If this is a Sync server, i.e a server expositing sync API, then the server
+ // needs to create some completion queues to listen for incoming requests.
+ // 'sync_server_cqs' are those internal completion queues.
+ //
+ // This is different from the completion queues added to the server via
+ // ServerBuilder's AddCompletionQueue() method (those completion queues
+ // are in 'cqs_' member variable of ServerBuilder object)
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
sync_server_cqs(
std::make_shared<
std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>());
-
+
bool has_frequently_polled_cqs = false;
for (const auto& cq : cqs_) {
if (cq->IsFrequentlyPolled()) {
@@ -300,17 +300,17 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
const bool is_hybrid_server = has_sync_methods && has_frequently_polled_cqs;
- if (has_sync_methods) {
+ if (has_sync_methods) {
grpc_cq_polling_type polling_type =
is_hybrid_server ? GRPC_CQ_NON_POLLING : GRPC_CQ_DEFAULT_POLLING;
-
- // Create completion queues to listen to incoming rpc requests
- for (int i = 0; i < sync_server_settings_.num_cqs; i++) {
+
+ // Create completion queues to listen to incoming rpc requests
+ for (int i = 0; i < sync_server_settings_.num_cqs; i++) {
sync_server_cqs->emplace_back(
new grpc::ServerCompletionQueue(GRPC_CQ_NEXT, polling_type, nullptr));
- }
- }
-
+ }
+ }
+
// TODO(vjpai): Add a section here for plugins once they can support callback
// methods
@@ -335,65 +335,65 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
std::move(interceptor_creators_)));
ServerInitializer* initializer = server->initializer();
-
- // Register all the completion queues with the server. i.e
- // 1. sync_server_cqs: internal completion queues created IF this is a sync
- // server
- // 2. cqs_: Completion queues added via AddCompletionQueue() call
-
+
+ // Register all the completion queues with the server. i.e
+ // 1. sync_server_cqs: internal completion queues created IF this is a sync
+ // server
+ // 2. cqs_: Completion queues added via AddCompletionQueue() call
+
for (const auto& cq : *sync_server_cqs) {
grpc_server_register_completion_queue(server->server_, cq->cq(), nullptr);
has_frequently_polled_cqs = true;
- }
-
+ }
+
if (has_callback_methods || callback_generic_service_ != nullptr) {
auto* cq = server->CallbackCQ();
grpc_server_register_completion_queue(server->server_, cq->cq(), nullptr);
}
- // cqs_ contains the completion queue added by calling the ServerBuilder's
- // AddCompletionQueue() API. Some of them may not be frequently polled (i.e by
- // calling Next() or AsyncNext()) and hence are not safe to be used for
- // listening to incoming channels. Such completion queues must be registered
+ // cqs_ contains the completion queue added by calling the ServerBuilder's
+ // AddCompletionQueue() API. Some of them may not be frequently polled (i.e by
+ // calling Next() or AsyncNext()) and hence are not safe to be used for
+ // listening to incoming channels. Such completion queues must be registered
// as non-listening queues. In debug mode, these should have their server list
// tracked since these are provided the user and must be Shutdown by the user
// after the server is shutdown.
for (const auto& cq : cqs_) {
grpc_server_register_completion_queue(server->server_, cq->cq(), nullptr);
cq->RegisterServer(server.get());
- }
-
+ }
+
if (!has_frequently_polled_cqs) {
- gpr_log(GPR_ERROR,
- "At least one of the completion queues must be frequently polled");
- return nullptr;
- }
-
+ gpr_log(GPR_ERROR,
+ "At least one of the completion queues must be frequently polled");
+ return nullptr;
+ }
+
for (const auto& value : services_) {
if (!server->RegisterService(value->host.get(), value->service)) {
- return nullptr;
- }
- }
-
+ return nullptr;
+ }
+ }
+
for (const auto& value : plugins_) {
value->InitServer(initializer);
- }
-
- if (generic_service_) {
- server->RegisterAsyncGenericService(generic_service_);
+ }
+
+ if (generic_service_) {
+ server->RegisterAsyncGenericService(generic_service_);
} else if (callback_generic_service_) {
server->RegisterCallbackGenericService(callback_generic_service_);
- } else {
+ } else {
for (const auto& value : services_) {
if (value->service->has_generic_methods()) {
- gpr_log(GPR_ERROR,
- "Some methods were marked generic but there is no "
- "generic service registered.");
- return nullptr;
- }
- }
- }
-
+ gpr_log(GPR_ERROR,
+ "Some methods were marked generic but there is no "
+ "generic service registered.");
+ return nullptr;
+ }
+ }
+ }
+
for (auto& port : ports_) {
int r = server->AddListeningPort(port.addr, port.creds.get());
if (!r) {
@@ -402,25 +402,25 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
}
if (port.selected_port != nullptr) {
*port.selected_port = r;
- }
- }
-
- auto cqs_data = cqs_.empty() ? nullptr : &cqs_[0];
+ }
+ }
+
+ auto cqs_data = cqs_.empty() ? nullptr : &cqs_[0];
server->Start(cqs_data, cqs_.size());
-
+
for (const auto& value : plugins_) {
value->Finish(initializer);
- }
-
- return server;
-}
-
-void ServerBuilder::InternalAddPluginFactory(
+ }
+
+ return server;
+}
+
+void ServerBuilder::InternalAddPluginFactory(
std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)()) {
- gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
- (*g_plugin_factory_list).push_back(CreatePlugin);
-}
-
+ gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
+ (*g_plugin_factory_list).push_back(CreatePlugin);
+}
+
ServerBuilder& ServerBuilder::EnableWorkaround(grpc_workaround_list id) {
switch (id) {
case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
diff --git a/contrib/libs/grpc/src/cpp/server/server_cc.cc b/contrib/libs/grpc/src/cpp/server/server_cc.cc
index fbd12437e4..c2a911c7f7 100644
--- a/contrib/libs/grpc/src/cpp/server/server_cc.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_cc.cc
@@ -1,31 +1,31 @@
-/*
+/*
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/server.h>
-
+
#include <cstdlib>
-#include <sstream>
+#include <sstream>
#include <type_traits>
-#include <utility>
-
-#include <grpc/grpc.h>
+#include <utility>
+
+#include <grpc/grpc.h>
#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/generic/async_generic_service.h>
#include <grpcpp/impl/codegen/async_unary_call.h>
@@ -41,23 +41,23 @@
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/time.h>
-
+
#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/iomgr/exec_ctx.h"
-#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
#include "src/cpp/client/create_channel_internal.h"
#include "src/cpp/server/external_connection_acceptor_impl.h"
#include "src/cpp/server/health/default_health_check_service.h"
-#include "src/cpp/thread_manager/thread_manager.h"
-
+#include "src/cpp/thread_manager/thread_manager.h"
+
#include <util/stream/str.h>
-namespace grpc {
+namespace grpc {
namespace {
-
+
// The default value for maximum number of threads that can be created in the
// sync server. This value of INT_MAX is chosen to match the default behavior if
// no ResourceQuota is set. To modify the max number of threads in a sync
@@ -65,22 +65,22 @@ namespace {
// max-threads set) to the server builder.
#define DEFAULT_MAX_SYNC_SERVER_THREADS INT_MAX
-class DefaultGlobalCallbacks final : public Server::GlobalCallbacks {
- public:
- ~DefaultGlobalCallbacks() override {}
+class DefaultGlobalCallbacks final : public Server::GlobalCallbacks {
+ public:
+ ~DefaultGlobalCallbacks() override {}
void PreSynchronousRequest(ServerContext* /*context*/) override {}
void PostSynchronousRequest(ServerContext* /*context*/) override {}
-};
-
+};
+
std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
-
+
void InitGlobalCallbacks() {
- if (!g_callbacks) {
- g_callbacks.reset(new DefaultGlobalCallbacks());
- }
-}
-
+ if (!g_callbacks) {
+ g_callbacks.reset(new DefaultGlobalCallbacks());
+ }
+}
+
class ShutdownTag : public internal::CompletionQueueTag {
public:
bool FinalizeResult(void** /*tag*/, bool* /*status*/) { return false; }
@@ -92,13 +92,13 @@ class DummyTag : public internal::CompletionQueueTag {
};
class UnimplementedAsyncRequestContext {
- protected:
- UnimplementedAsyncRequestContext() : generic_stream_(&server_context_) {}
-
- GenericServerContext server_context_;
- GenericServerAsyncReaderWriter generic_stream_;
-};
-
+ protected:
+ UnimplementedAsyncRequestContext() : generic_stream_(&server_context_) {}
+
+ GenericServerContext server_context_;
+ GenericServerAsyncReaderWriter generic_stream_;
+};
+
// TODO(vjpai): Just for this file, use some contents of the experimental
// namespace here to make the code easier to read below. Remove this when
// de-experimentalized fully.
@@ -289,32 +289,32 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
/// of construction, since the public base class should be constructed after the
/// elements belonging to the private base class are constructed. This is not
/// possible using true composition.
-class Server::UnimplementedAsyncRequest final
+class Server::UnimplementedAsyncRequest final
: private grpc::UnimplementedAsyncRequestContext,
- public GenericAsyncRequest {
- public:
+ public GenericAsyncRequest {
+ public:
UnimplementedAsyncRequest(ServerInterface* server,
grpc::ServerCompletionQueue* cq)
- : GenericAsyncRequest(server, &server_context_, &generic_stream_, cq, cq,
+ : GenericAsyncRequest(server, &server_context_, &generic_stream_, cq, cq,
nullptr, false) {}
-
- bool FinalizeResult(void** tag, bool* status) override;
-
+
+ bool FinalizeResult(void** tag, bool* status) override;
+
grpc::ServerContext* context() { return &server_context_; }
grpc::GenericServerAsyncReaderWriter* stream() { return &generic_stream_; }
-};
-
+};
+
/// UnimplementedAsyncResponse should not post user-visible completions to the
/// C++ completion queue, but is generated as a CQ event by the core
-class Server::UnimplementedAsyncResponse final
+class Server::UnimplementedAsyncResponse final
: public grpc::internal::CallOpSet<
grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> {
- public:
- UnimplementedAsyncResponse(UnimplementedAsyncRequest* request);
- ~UnimplementedAsyncResponse() { delete request_; }
-
- bool FinalizeResult(void** tag, bool* status) override {
+ public:
+ UnimplementedAsyncResponse(UnimplementedAsyncRequest* request);
+ ~UnimplementedAsyncResponse() { delete request_; }
+
+ bool FinalizeResult(void** tag, bool* status) override {
if (grpc::internal::CallOpSet<
grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus>::FinalizeResult(tag,
@@ -324,44 +324,44 @@ class Server::UnimplementedAsyncResponse final
// The tag was swallowed due to interception. We will see it again.
}
return false;
- }
-
- private:
- UnimplementedAsyncRequest* const request_;
-};
-
+ }
+
+ private:
+ UnimplementedAsyncRequest* const request_;
+};
+
class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
- public:
+ public:
SyncRequest(grpc::internal::RpcServiceMethod* method, void* method_tag)
- : method_(method),
+ : method_(method),
method_tag_(method_tag),
- in_flight_(false),
+ in_flight_(false),
has_request_payload_(method->method_type() ==
grpc::internal::RpcMethod::NORMAL_RPC ||
method->method_type() ==
grpc::internal::RpcMethod::SERVER_STREAMING),
- call_details_(nullptr),
- cq_(nullptr) {
- grpc_metadata_array_init(&request_metadata_);
- }
-
- ~SyncRequest() {
- if (call_details_) {
- delete call_details_;
- }
- grpc_metadata_array_destroy(&request_metadata_);
- }
-
+ call_details_(nullptr),
+ cq_(nullptr) {
+ grpc_metadata_array_init(&request_metadata_);
+ }
+
+ ~SyncRequest() {
+ if (call_details_) {
+ delete call_details_;
+ }
+ grpc_metadata_array_destroy(&request_metadata_);
+ }
+
void SetupRequest() { cq_ = grpc_completion_queue_create_for_pluck(nullptr); }
-
- void TeardownRequest() {
- grpc_completion_queue_destroy(cq_);
- cq_ = nullptr;
- }
-
- void Request(grpc_server* server, grpc_completion_queue* notify_cq) {
- GPR_ASSERT(cq_ && !in_flight_);
- in_flight_ = true;
+
+ void TeardownRequest() {
+ grpc_completion_queue_destroy(cq_);
+ cq_ = nullptr;
+ }
+
+ void Request(grpc_server* server, grpc_completion_queue* notify_cq) {
+ GPR_ASSERT(cq_ && !in_flight_);
+ in_flight_ = true;
if (method_tag_) {
if (grpc_server_request_registered_call(
server, method_tag_, &call_, &deadline_, &request_metadata_,
@@ -370,20 +370,20 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
TeardownRequest();
return;
}
- } else {
- if (!call_details_) {
- call_details_ = new grpc_call_details;
- grpc_call_details_init(call_details_);
- }
+ } else {
+ if (!call_details_) {
+ call_details_ = new grpc_call_details;
+ grpc_call_details_init(call_details_);
+ }
if (grpc_server_request_call(server, &call_, call_details_,
&request_metadata_, cq_, notify_cq,
this) != GRPC_CALL_OK) {
TeardownRequest();
return;
}
- }
- }
-
+ }
+ }
+
void PostShutdownCleanup() {
if (call_) {
grpc_call_unref(call_);
@@ -396,27 +396,27 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
}
bool FinalizeResult(void** /*tag*/, bool* status) override {
- if (!*status) {
- grpc_completion_queue_destroy(cq_);
+ if (!*status) {
+ grpc_completion_queue_destroy(cq_);
cq_ = nullptr;
- }
- if (call_details_) {
- deadline_ = call_details_->deadline;
- grpc_call_details_destroy(call_details_);
- grpc_call_details_init(call_details_);
- }
- return true;
- }
-
+ }
+ if (call_details_) {
+ deadline_ = call_details_->deadline;
+ grpc_call_details_destroy(call_details_);
+ grpc_call_details_init(call_details_);
+ }
+ return true;
+ }
+
// The CallData class represents a call that is "active" as opposed
// to just being requested. It wraps and takes ownership of the cq from
// the call request
- class CallData final {
- public:
- explicit CallData(Server* server, SyncRequest* mrd)
- : cq_(mrd->cq_),
+ class CallData final {
+ public:
+ explicit CallData(Server* server, SyncRequest* mrd)
+ : cq_(mrd->cq_),
ctx_(mrd->deadline_, &mrd->request_metadata_),
- has_request_payload_(mrd->has_request_payload_),
+ has_request_payload_(mrd->has_request_payload_),
request_payload_(has_request_payload_ ? mrd->request_payload_
: nullptr),
request_(nullptr),
@@ -428,19 +428,19 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
server_(server),
global_callbacks_(nullptr),
resources_(false) {
- ctx_.set_call(mrd->call_);
- ctx_.cq_ = &cq_;
- GPR_ASSERT(mrd->in_flight_);
- mrd->in_flight_ = false;
- mrd->request_metadata_.count = 0;
- }
-
- ~CallData() {
- if (has_request_payload_ && request_payload_) {
- grpc_byte_buffer_destroy(request_payload_);
- }
- }
-
+ ctx_.set_call(mrd->call_);
+ ctx_.cq_ = &cq_;
+ GPR_ASSERT(mrd->in_flight_);
+ mrd->in_flight_ = false;
+ mrd->request_metadata_.count = 0;
+ }
+
+ ~CallData() {
+ if (has_request_payload_ && request_payload_) {
+ grpc_byte_buffer_destroy(request_payload_);
+ }
+ }
+
void Run(const std::shared_ptr<GlobalCallbacks>& global_callbacks,
bool resources) {
global_callbacks_ = global_callbacks;
@@ -474,8 +474,8 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
// There were interceptors to be run, so ContinueRunAfterInterception
// will be run when interceptors are done.
}
- }
-
+ }
+
void ContinueRunAfterInterception() {
{
ctx_.BeginCompletionOp(&call_, nullptr, nullptr);
@@ -499,11 +499,11 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
delete this;
}
- private:
+ private:
grpc::CompletionQueue cq_;
grpc::ServerContext ctx_;
- const bool has_request_payload_;
- grpc_byte_buffer* request_payload_;
+ const bool has_request_payload_;
+ grpc_byte_buffer* request_payload_;
void* request_;
grpc::Status request_status_;
grpc::internal::RpcServiceMethod* const method_;
@@ -512,21 +512,21 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
std::shared_ptr<GlobalCallbacks> global_callbacks_;
bool resources_;
grpc::internal::InterceptorBatchMethodsImpl interceptor_methods_;
- };
-
- private:
+ };
+
+ private:
grpc::internal::RpcServiceMethod* const method_;
void* const method_tag_;
- bool in_flight_;
- const bool has_request_payload_;
- grpc_call* call_;
- grpc_call_details* call_details_;
- gpr_timespec deadline_;
- grpc_metadata_array request_metadata_;
- grpc_byte_buffer* request_payload_;
- grpc_completion_queue* cq_;
-};
-
+ bool in_flight_;
+ const bool has_request_payload_;
+ grpc_call* call_;
+ grpc_call_details* call_details_;
+ gpr_timespec deadline_;
+ grpc_metadata_array request_metadata_;
+ grpc_byte_buffer* request_payload_;
+ grpc_completion_queue* cq_;
+};
+
template <class ServerContextType>
class Server::CallbackRequest final
: public grpc::internal::CompletionQueueTag {
@@ -743,52 +743,52 @@ const char* Server::CallbackRequest<
return ctx_.method().c_str();
}
-// Implementation of ThreadManager. Each instance of SyncRequestThreadManager
-// manages a pool of threads that poll for incoming Sync RPCs and call the
-// appropriate RPC handlers
+// Implementation of ThreadManager. Each instance of SyncRequestThreadManager
+// manages a pool of threads that poll for incoming Sync RPCs and call the
+// appropriate RPC handlers
class Server::SyncRequestThreadManager : public grpc::ThreadManager {
- public:
+ public:
SyncRequestThreadManager(Server* server, grpc::CompletionQueue* server_cq,
- std::shared_ptr<GlobalCallbacks> global_callbacks,
+ std::shared_ptr<GlobalCallbacks> global_callbacks,
grpc_resource_quota* rq, int min_pollers,
int max_pollers, int cq_timeout_msec)
: ThreadManager("SyncServer", rq, min_pollers, max_pollers),
- server_(server),
- server_cq_(server_cq),
- cq_timeout_msec_(cq_timeout_msec),
+ server_(server),
+ server_cq_(server_cq),
+ cq_timeout_msec_(cq_timeout_msec),
global_callbacks_(std::move(global_callbacks)) {}
-
- WorkStatus PollForWork(void** tag, bool* ok) override {
- *tag = nullptr;
+
+ WorkStatus PollForWork(void** tag, bool* ok) override {
+ *tag = nullptr;
// TODO(ctiller): workaround for GPR_TIMESPAN based deadlines not working
// right now
- gpr_timespec deadline =
+ gpr_timespec deadline =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN));
-
- switch (server_cq_->AsyncNext(tag, ok, deadline)) {
+
+ switch (server_cq_->AsyncNext(tag, ok, deadline)) {
case grpc::CompletionQueue::TIMEOUT:
- return TIMEOUT;
+ return TIMEOUT;
case grpc::CompletionQueue::SHUTDOWN:
- return SHUTDOWN;
+ return SHUTDOWN;
case grpc::CompletionQueue::GOT_EVENT:
- return WORK_FOUND;
- }
-
- GPR_UNREACHABLE_CODE(return TIMEOUT);
- }
-
+ return WORK_FOUND;
+ }
+
+ GPR_UNREACHABLE_CODE(return TIMEOUT);
+ }
+
void DoWork(void* tag, bool ok, bool resources) override {
- SyncRequest* sync_req = static_cast<SyncRequest*>(tag);
-
- if (!sync_req) {
- // No tag. Nothing to work on. This is an unlikley scenario and possibly a
- // bug in RPC Manager implementation.
- gpr_log(GPR_ERROR, "Sync server. DoWork() was called with NULL tag");
- return;
- }
-
- if (ok) {
+ SyncRequest* sync_req = static_cast<SyncRequest*>(tag);
+
+ if (!sync_req) {
+ // No tag. Nothing to work on. This is an unlikley scenario and possibly a
+ // bug in RPC Manager implementation.
+ gpr_log(GPR_ERROR, "Sync server. DoWork() was called with NULL tag");
+ return;
+ }
+
+ if (ok) {
// Calldata takes ownership of the completion queue and interceptors
// inside sync_req
auto* cd = new SyncRequest::CallData(server_, sync_req);
@@ -796,41 +796,41 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
if (!IsShutdown()) {
sync_req->SetupRequest(); // Create new completion queue for sync_req
sync_req->Request(server_->c_server(), server_cq_->cq());
- }
-
- GPR_TIMER_SCOPE("cd.Run()", 0);
+ }
+
+ GPR_TIMER_SCOPE("cd.Run()", 0);
cd->Run(global_callbacks_, resources);
- }
- // TODO (sreek) If ok is false here (which it isn't in case of
- // grpc_request_registered_call), we should still re-queue the request
- // object
- }
-
+ }
+ // TODO (sreek) If ok is false here (which it isn't in case of
+ // grpc_request_registered_call), we should still re-queue the request
+ // object
+ }
+
void AddSyncMethod(grpc::internal::RpcServiceMethod* method, void* tag) {
- sync_requests_.emplace_back(new SyncRequest(method, tag));
- }
-
- void AddUnknownSyncMethod() {
- if (!sync_requests_.empty()) {
+ sync_requests_.emplace_back(new SyncRequest(method, tag));
+ }
+
+ void AddUnknownSyncMethod() {
+ if (!sync_requests_.empty()) {
unknown_method_.reset(new grpc::internal::RpcServiceMethod(
"unknown", grpc::internal::RpcMethod::BIDI_STREAMING,
new grpc::internal::UnknownMethodHandler));
- sync_requests_.emplace_back(
- new SyncRequest(unknown_method_.get(), nullptr));
- }
- }
-
+ sync_requests_.emplace_back(
+ new SyncRequest(unknown_method_.get(), nullptr));
+ }
+ }
+
void Shutdown() override {
ThreadManager::Shutdown();
- server_cq_->Shutdown();
+ server_cq_->Shutdown();
}
-
+
void Wait() override {
ThreadManager::Wait();
- // Drain any pending items from the queue
- void* tag;
- bool ok;
- while (server_cq_->Next(&tag, &ok)) {
+ // Drain any pending items from the queue
+ void* tag;
+ bool ok;
+ while (server_cq_->Next(&tag, &ok)) {
if (ok) {
// If a request was pulled off the queue, it means that the thread
// handling the request added it to the completion queue after shutdown
@@ -842,34 +842,34 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
SyncRequest* sync_req = static_cast<SyncRequest*>(tag);
sync_req->PostShutdownCleanup();
}
- }
- }
-
- void Start() {
- if (!sync_requests_.empty()) {
+ }
+ }
+
+ void Start() {
+ if (!sync_requests_.empty()) {
for (const auto& value : sync_requests_) {
value->SetupRequest();
value->Request(server_->c_server(), server_cq_->cq());
- }
-
- Initialize(); // ThreadManager's Initialize()
- }
- }
-
- private:
- Server* server_;
+ }
+
+ Initialize(); // ThreadManager's Initialize()
+ }
+ }
+
+ private:
+ Server* server_;
grpc::CompletionQueue* server_cq_;
- int cq_timeout_msec_;
- std::vector<std::unique_ptr<SyncRequest>> sync_requests_;
+ int cq_timeout_msec_;
+ std::vector<std::unique_ptr<SyncRequest>> sync_requests_;
std::unique_ptr<grpc::internal::RpcServiceMethod> unknown_method_;
- std::shared_ptr<Server::GlobalCallbacks> global_callbacks_;
-};
-
+ std::shared_ptr<Server::GlobalCallbacks> global_callbacks_;
+};
+
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
-Server::Server(
+Server::Server(
grpc::ChannelArguments* args,
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
- sync_server_cqs,
+ sync_server_cqs,
int min_pollers, int max_pollers, int sync_cq_timeout_msec,
std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
acceptors,
@@ -881,17 +881,17 @@ Server::Server(
interceptor_creators_(std::move(interceptor_creators)),
max_receive_message_size_(INT_MIN),
sync_server_cqs_(std::move(sync_server_cqs)),
- started_(false),
- shutdown_(false),
- shutdown_notified_(false),
- server_(nullptr),
+ started_(false),
+ shutdown_(false),
+ shutdown_notified_(false),
+ server_(nullptr),
server_initializer_(new ServerInitializer(this)),
health_check_service_disabled_(false) {
- g_gli_initializer.summon();
+ g_gli_initializer.summon();
gpr_once_init(&grpc::g_once_init_callbacks, grpc::InitGlobalCallbacks);
global_callbacks_ = grpc::g_callbacks;
- global_callbacks_->UpdateArguments(args);
-
+ global_callbacks_->UpdateArguments(args);
+
if (sync_server_cqs_ != nullptr) {
bool default_rq_created = false;
if (server_rq == nullptr) {
@@ -910,15 +910,15 @@ Server::Server(
if (default_rq_created) {
grpc_resource_quota_unref(server_rq);
}
- }
-
+ }
+
for (auto& acceptor : acceptors_) {
acceptor->SetToChannelArgs(args);
}
- grpc_channel_args channel_args;
- args->SetChannelArgs(&channel_args);
-
+ grpc_channel_args channel_args;
+ args->SetChannelArgs(&channel_args);
+
for (size_t i = 0; i < channel_args.num_args; i++) {
if (0 == strcmp(channel_args.args[i].key,
grpc::kHealthCheckServiceInterfaceArg)) {
@@ -935,41 +935,41 @@ Server::Server(
max_receive_message_size_ = channel_args.args[i].value.integer;
}
}
- server_ = grpc_server_create(&channel_args, nullptr);
-}
-
-Server::~Server() {
- {
+ server_ = grpc_server_create(&channel_args, nullptr);
+}
+
+Server::~Server() {
+ {
grpc::internal::ReleasableMutexLock lock(&mu_);
- if (started_ && !shutdown_) {
+ if (started_ && !shutdown_) {
lock.Unlock();
- Shutdown();
- } else if (!started_) {
- // Shutdown the completion queues
+ Shutdown();
+ } else if (!started_) {
+ // Shutdown the completion queues
for (const auto& value : sync_req_mgrs_) {
value->Shutdown();
- }
+ }
if (callback_cq_ != nullptr) {
callback_cq_->Shutdown();
callback_cq_ = nullptr;
}
- }
- }
+ }
+ }
// Destroy health check service before we destroy the C server so that
// it does not call grpc_server_request_registered_call() after the C
// server has been destroyed.
health_check_service_.reset();
- grpc_server_destroy(server_);
-}
-
-void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) {
+ grpc_server_destroy(server_);
+}
+
+void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) {
GPR_ASSERT(!grpc::g_callbacks);
- GPR_ASSERT(callbacks);
+ GPR_ASSERT(callbacks);
grpc::g_callbacks.reset(callbacks);
-}
-
-grpc_server* Server::c_server() { return server_; }
-
+}
+
+grpc_server* Server::c_server() { return server_; }
+
std::shared_ptr<grpc::Channel> Server::InProcessChannel(
const grpc::ChannelArguments& args) {
grpc_channel_args channel_args = args.c_channel_args();
@@ -992,50 +992,50 @@ Server::experimental_type::InProcessChannelWithInterceptors(
std::move(interceptor_creators));
}
-static grpc_server_register_method_payload_handling PayloadHandlingForMethod(
+static grpc_server_register_method_payload_handling PayloadHandlingForMethod(
grpc::internal::RpcServiceMethod* method) {
- switch (method->method_type()) {
+ switch (method->method_type()) {
case grpc::internal::RpcMethod::NORMAL_RPC:
case grpc::internal::RpcMethod::SERVER_STREAMING:
- return GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER;
+ return GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER;
case grpc::internal::RpcMethod::CLIENT_STREAMING:
case grpc::internal::RpcMethod::BIDI_STREAMING:
- return GRPC_SRM_PAYLOAD_NONE;
- }
- GPR_UNREACHABLE_CODE(return GRPC_SRM_PAYLOAD_NONE;);
-}
-
+ return GRPC_SRM_PAYLOAD_NONE;
+ }
+ GPR_UNREACHABLE_CODE(return GRPC_SRM_PAYLOAD_NONE;);
+}
+
bool Server::RegisterService(const TString* host, grpc::Service* service) {
- bool has_async_methods = service->has_async_methods();
- if (has_async_methods) {
- GPR_ASSERT(service->server_ == nullptr &&
- "Can only register an asynchronous service against one server.");
- service->server_ = this;
- }
-
- const char* method_name = nullptr;
+ bool has_async_methods = service->has_async_methods();
+ if (has_async_methods) {
+ GPR_ASSERT(service->server_ == nullptr &&
+ "Can only register an asynchronous service against one server.");
+ service->server_ = this;
+ }
+
+ const char* method_name = nullptr;
for (const auto& method : service->methods_) {
if (method.get() == nullptr) { // Handled by generic service if any.
- continue;
- }
-
+ continue;
+ }
+
void* method_registration_tag = grpc_server_register_method(
- server_, method->name(), host ? host->c_str() : nullptr,
+ server_, method->name(), host ? host->c_str() : nullptr,
PayloadHandlingForMethod(method.get()), 0);
if (method_registration_tag == nullptr) {
- gpr_log(GPR_DEBUG, "Attempt to register %s multiple times",
- method->name());
- return false;
- }
-
+ gpr_log(GPR_DEBUG, "Attempt to register %s multiple times",
+ method->name());
+ return false;
+ }
+
if (method->handler() == nullptr) { // Async method without handler
method->set_server_tag(method_registration_tag);
} else if (method->api_type() ==
grpc::internal::RpcServiceMethod::ApiType::SYNC) {
for (const auto& value : sync_req_mgrs_) {
value->AddSyncMethod(method.get(), method_registration_tag);
- }
+ }
} else {
has_callback_methods_ = true;
grpc::internal::RpcServiceMethod* method_value = method.get();
@@ -1047,30 +1047,30 @@ bool Server::RegisterService(const TString* host, grpc::Service* service) {
cq, &result);
return result;
});
- }
-
- method_name = method->name();
- }
-
- // Parse service name.
- if (method_name != nullptr) {
- std::stringstream ss(method_name);
+ }
+
+ method_name = method->name();
+ }
+
+ // Parse service name.
+ if (method_name != nullptr) {
+ std::stringstream ss(method_name);
std::string service_name;
- if (std::getline(ss, service_name, '/') &&
- std::getline(ss, service_name, '/')) {
+ if (std::getline(ss, service_name, '/') &&
+ std::getline(ss, service_name, '/')) {
services_.push_back(service_name.c_str());
- }
- }
- return true;
-}
-
+ }
+ }
+ return true;
+}
+
void Server::RegisterAsyncGenericService(grpc::AsyncGenericService* service) {
- GPR_ASSERT(service->server_ == nullptr &&
- "Can only register an async generic service against one server.");
- service->server_ = this;
+ GPR_ASSERT(service->server_ == nullptr &&
+ "Can only register an async generic service against one server.");
+ service->server_ = this;
has_async_generic_service_ = true;
-}
-
+}
+
void Server::RegisterCallbackGenericService(
grpc::CallbackGenericService* service) {
GPR_ASSERT(
@@ -1090,12 +1090,12 @@ void Server::RegisterCallbackGenericService(
int Server::AddListeningPort(const TString& addr,
grpc::ServerCredentials* creds) {
- GPR_ASSERT(!started_);
+ GPR_ASSERT(!started_);
int port = creds->AddPortToServer(addr, server_);
global_callbacks_->AddPort(this, addr, creds, port);
return port;
-}
-
+}
+
void Server::Ref() {
shutdown_refs_outstanding_.fetch_add(1, std::memory_order_relaxed);
}
@@ -1122,9 +1122,9 @@ void Server::UnrefAndWaitLocked() {
}
void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
- GPR_ASSERT(!started_);
+ GPR_ASSERT(!started_);
global_callbacks_->PreServerStart(this);
- started_ = true;
+ started_ = true;
// Only create default health check service when user did not provide an
// explicit one.
@@ -1167,23 +1167,23 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
}
#endif
- grpc_server_start(server_);
-
+ grpc_server_start(server_);
+
if (!has_async_generic_service_ && !has_callback_generic_service_) {
for (const auto& value : sync_req_mgrs_) {
value->AddUnknownSyncMethod();
- }
-
- for (size_t i = 0; i < num_cqs; i++) {
- if (cqs[i]->IsFrequentlyPolled()) {
- new UnimplementedAsyncRequest(this, cqs[i]);
- }
- }
+ }
+
+ for (size_t i = 0; i < num_cqs; i++) {
+ if (cqs[i]->IsFrequentlyPolled()) {
+ new UnimplementedAsyncRequest(this, cqs[i]);
+ }
+ }
if (health_check_cq != nullptr) {
new UnimplementedAsyncRequest(this, health_check_cq);
}
- }
-
+ }
+
// If this server has any support for synchronous methods (has any sync
// server CQs), make sure that we have a ResourceExhausted handler
// to deal with the case of thread exhaustion
@@ -1194,7 +1194,7 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
for (const auto& value : sync_req_mgrs_) {
value->Start();
- }
+ }
if (default_health_check_service_impl != nullptr) {
default_health_check_service_impl->StartServingThread();
@@ -1203,16 +1203,16 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
for (auto& acceptor : acceptors_) {
acceptor->Start();
}
-}
-
-void Server::ShutdownInternal(gpr_timespec deadline) {
+}
+
+void Server::ShutdownInternal(gpr_timespec deadline) {
grpc::internal::MutexLock lock(&mu_);
if (shutdown_) {
return;
}
-
+
shutdown_ = true;
-
+
for (auto& acceptor : acceptors_) {
acceptor->Shutdown();
}
@@ -1221,14 +1221,14 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
grpc::CompletionQueue shutdown_cq;
grpc::ShutdownTag shutdown_tag; // Dummy shutdown tag
grpc_server_shutdown_and_notify(server_, shutdown_cq.cq(), &shutdown_tag);
-
+
shutdown_cq.Shutdown();
-
+
void* tag;
bool ok;
grpc::CompletionQueue::NextStatus status =
shutdown_cq.AsyncNext(&tag, &ok, deadline);
-
+
// If this timed out, it means we are done with the grace period for a clean
// shutdown. We should force a shutdown now by cancelling all inflight calls
if (status == grpc::CompletionQueue::NextStatus::TIMEOUT) {
@@ -1236,18 +1236,18 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
}
// Else in case of SHUTDOWN or GOT_EVENT, it means that the server has
// successfully shutdown
-
+
// Shutdown all ThreadManagers. This will try to gracefully stop all the
// threads in the ThreadManagers (once they process any inflight requests)
for (const auto& value : sync_req_mgrs_) {
value->Shutdown(); // ThreadManager's Shutdown()
}
-
+
// Wait for threads in all ThreadManagers to terminate
for (const auto& value : sync_req_mgrs_) {
value->Wait();
}
-
+
// Drop the shutdown ref and wait for all other refs to drop as well.
UnrefAndWaitLocked();
@@ -1275,22 +1275,22 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
}
cq_list_.clear();
#endif
-}
-
-void Server::Wait() {
+}
+
+void Server::Wait() {
grpc::internal::MutexLock lock(&mu_);
- while (started_ && !shutdown_notified_) {
+ while (started_ && !shutdown_notified_) {
shutdown_cv_.Wait(&mu_);
- }
-}
-
+ }
+}
+
void Server::PerformOpsOnCall(grpc::internal::CallOpSetInterface* ops,
grpc::internal::Call* call) {
ops->FillOps(call);
-}
-
-bool Server::UnimplementedAsyncRequest::FinalizeResult(void** tag,
- bool* status) {
+}
+
+bool Server::UnimplementedAsyncRequest::FinalizeResult(void** tag,
+ bool* status) {
if (GenericAsyncRequest::FinalizeResult(tag, status)) {
// We either had no interceptors run or we are done intercepting
if (*status) {
@@ -1301,24 +1301,24 @@ bool Server::UnimplementedAsyncRequest::FinalizeResult(void** tag,
} else {
delete this;
}
- } else {
+ } else {
// The tag was swallowed due to interception. We will see it again.
- }
- return false;
-}
-
-Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse(
- UnimplementedAsyncRequest* request)
- : request_(request) {
+ }
+ return false;
+}
+
+Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse(
+ UnimplementedAsyncRequest* request)
+ : request_(request) {
grpc::Status status(grpc::StatusCode::UNIMPLEMENTED, "");
grpc::internal::UnknownMethodHandler::FillOps(request_->context(), this);
- request_->stream()->call_.PerformOps(this);
-}
-
+ request_->stream()->call_.PerformOps(this);
+}
+
grpc::ServerInitializer* Server::initializer() {
return server_initializer_.get();
}
-
+
grpc::CompletionQueue* Server::CallbackCQ() {
// TODO(vjpai): Consider using a single global CQ for the default CQ
// if there is no explicit per-server CQ registered
diff --git a/contrib/libs/grpc/src/cpp/server/server_context.cc b/contrib/libs/grpc/src/cpp/server/server_context.cc
index 60ba0f46b3..458ac20d87 100644
--- a/contrib/libs/grpc/src/cpp/server/server_context.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_context.cc
@@ -1,61 +1,61 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/impl/codegen/server_context.h>
-
+
#include <algorithm>
#include <utility>
-
-#include <grpc/compression.h>
-#include <grpc/grpc.h>
+
+#include <grpc/compression.h>
+#include <grpc/grpc.h>
#include <grpc/load_reporting.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/support/server_callback.h>
#include <grpcpp/support/time.h>
-
+
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/surface/call.h"
-
+#include "src/core/lib/surface/call.h"
+
namespace grpc {
-
-// CompletionOp
-
+
+// CompletionOp
+
class ServerContextBase::CompletionOp final
: public internal::CallOpSetInterface {
- public:
- // initial refs: one in the server context, one in the cq
+ public:
+ // initial refs: one in the server context, one in the cq
// must ref the call before calling constructor and after deleting this
CompletionOp(internal::Call* call,
::grpc::internal::ServerCallbackCall* callback_controller)
: call_(*call),
callback_controller_(callback_controller),
has_tag_(false),
- tag_(nullptr),
+ tag_(nullptr),
core_cq_tag_(this),
- refs_(2),
- finalized_(false),
+ refs_(2),
+ finalized_(false),
cancelled_(0),
done_intercepting_(false) {}
-
+
// CompletionOp isn't copyable or movable
CompletionOp(const CompletionOp&) = delete;
CompletionOp& operator=(const CompletionOp&) = delete;
@@ -87,25 +87,25 @@ class ServerContextBase::CompletionOp final
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { assert(0); }
- bool FinalizeResult(void** tag, bool* status) override;
-
- bool CheckCancelled(CompletionQueue* cq) {
- cq->TryPluck(this);
- return CheckCancelledNoPluck();
- }
- bool CheckCancelledAsync() { return CheckCancelledNoPluck(); }
-
- void set_tag(void* tag) {
- has_tag_ = true;
- tag_ = tag;
- }
-
+ bool FinalizeResult(void** tag, bool* status) override;
+
+ bool CheckCancelled(CompletionQueue* cq) {
+ cq->TryPluck(this);
+ return CheckCancelledNoPluck();
+ }
+ bool CheckCancelledAsync() { return CheckCancelledNoPluck(); }
+
+ void set_tag(void* tag) {
+ has_tag_ = true;
+ tag_ = tag;
+ }
+
void set_core_cq_tag(void* core_cq_tag) { core_cq_tag_ = core_cq_tag; }
void* core_cq_tag() override { return core_cq_tag_; }
- void Unref();
-
+ void Unref();
+
// This will be called while interceptors are run if the RPC is a hijacked
// RPC. This should set hijacking state for each of the ops.
void SetHijackingState() override {
@@ -130,33 +130,33 @@ class ServerContextBase::CompletionOp final
nullptr) == GRPC_CALL_OK);
}
- private:
- bool CheckCancelledNoPluck() {
+ private:
+ bool CheckCancelledNoPluck() {
grpc_core::MutexLock lock(&mu_);
- return finalized_ ? (cancelled_ != 0) : false;
- }
-
+ return finalized_ ? (cancelled_ != 0) : false;
+ }
+
internal::Call call_;
::grpc::internal::ServerCallbackCall* const callback_controller_;
- bool has_tag_;
- void* tag_;
+ bool has_tag_;
+ void* tag_;
void* core_cq_tag_;
grpc_core::RefCount refs_;
grpc_core::Mutex mu_;
- bool finalized_;
+ bool finalized_;
int cancelled_; // This is an int (not bool) because it is passed to core
bool done_intercepting_;
internal::InterceptorBatchMethodsImpl interceptor_methods_;
-};
-
+};
+
void ServerContextBase::CompletionOp::Unref() {
if (refs_.Unref()) {
grpc_call* call = call_.call();
- delete this;
+ delete this;
grpc_call_unref(call);
- }
-}
-
+ }
+}
+
void ServerContextBase::CompletionOp::FillOps(internal::Call* call) {
grpc_op ops;
ops.op = GRPC_OP_RECV_CLOSE_ON_SERVER;
@@ -171,8 +171,8 @@ void ServerContextBase::CompletionOp::FillOps(internal::Call* call) {
GPR_ASSERT(grpc_call_start_batch(call->call(), &ops, 1, core_cq_tag_,
nullptr) == GRPC_CALL_OK);
/* No interceptors to run here */
-}
-
+}
+
bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
// Decide whether to call the cancel callback within the lock
bool call_cancel;
@@ -199,11 +199,11 @@ bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
call_cancel = (cancelled_ != 0);
// Release the lock since we may call a callback and interceptors.
- }
+ }
if (call_cancel && callback_controller_ != nullptr) {
callback_controller_->MaybeCallOnCancel();
- }
+ }
/* Add interception point and run through interceptors */
interceptor_methods_.AddInterceptionHookPoint(
experimental::InterceptionHookPoints::POST_RECV_CLOSE);
@@ -218,19 +218,19 @@ bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
}
// There are interceptors to be run. Return false for now.
return false;
-}
-
+}
+
// ServerContextBase body
-
+
ServerContextBase::ServerContextBase()
: deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)) {}
-
+
ServerContextBase::ServerContextBase(gpr_timespec deadline,
grpc_metadata_array* arr)
: deadline_(deadline) {
std::swap(*client_metadata_.arr(), *arr);
-}
-
+}
+
void ServerContextBase::BindDeadlineAndMetadata(gpr_timespec deadline,
grpc_metadata_array* arr) {
deadline_ = deadline;
@@ -238,17 +238,17 @@ void ServerContextBase::BindDeadlineAndMetadata(gpr_timespec deadline,
}
ServerContextBase::~ServerContextBase() {
- if (completion_op_) {
- completion_op_->Unref();
- }
+ if (completion_op_) {
+ completion_op_->Unref();
+ }
if (rpc_info_) {
rpc_info_->Unref();
}
if (default_reactor_used_.load(std::memory_order_relaxed)) {
reinterpret_cast<Reactor*>(&default_reactor_)->~Reactor();
}
-}
-
+}
+
ServerContextBase::CallWrapper::~CallWrapper() {
if (call) {
// If the ServerContext is part of the call's arena, this could free the
@@ -260,7 +260,7 @@ ServerContextBase::CallWrapper::~CallWrapper() {
void ServerContextBase::BeginCompletionOp(
internal::Call* call, std::function<void(bool)> callback,
::grpc::internal::ServerCallbackCall* callback_controller) {
- GPR_ASSERT(!completion_op_);
+ GPR_ASSERT(!completion_op_);
if (rpc_info_) {
rpc_info_->Ref();
}
@@ -274,25 +274,25 @@ void ServerContextBase::BeginCompletionOp(
completion_op_->set_core_cq_tag(&completion_tag_);
completion_op_->set_tag(completion_op_);
} else if (has_notify_when_done_tag_) {
- completion_op_->set_tag(async_notify_when_done_tag_);
- }
- call->PerformOps(completion_op_);
-}
-
+ completion_op_->set_tag(async_notify_when_done_tag_);
+ }
+ call->PerformOps(completion_op_);
+}
+
internal::CompletionQueueTag* ServerContextBase::GetCompletionOpTag() {
return static_cast<internal::CompletionQueueTag*>(completion_op_);
}
void ServerContextBase::AddInitialMetadata(const TString& key,
const TString& value) {
- initial_metadata_.insert(std::make_pair(key, value));
-}
-
+ initial_metadata_.insert(std::make_pair(key, value));
+}
+
void ServerContextBase::AddTrailingMetadata(const TString& key,
const TString& value) {
- trailing_metadata_.insert(std::make_pair(key, value));
-}
-
+ trailing_metadata_.insert(std::make_pair(key, value));
+}
+
void ServerContextBase::TryCancel() const {
internal::CancelInterceptorBatchMethods cancel_methods;
if (rpc_info_) {
@@ -303,53 +303,53 @@ void ServerContextBase::TryCancel() const {
grpc_call_error err =
grpc_call_cancel_with_status(call_.call, GRPC_STATUS_CANCELLED,
"Cancelled on the server side", nullptr);
- if (err != GRPC_CALL_OK) {
- gpr_log(GPR_ERROR, "TryCancel failed with: %d", err);
- }
-}
-
+ if (err != GRPC_CALL_OK) {
+ gpr_log(GPR_ERROR, "TryCancel failed with: %d", err);
+ }
+}
+
bool ServerContextBase::IsCancelled() const {
if (completion_tag_) {
// When using callback API, this result is always valid.
return completion_op_->CheckCancelledAsync();
} else if (has_notify_when_done_tag_) {
// When using async API, the result is only valid
- // if the tag has already been delivered at the completion queue
- return completion_op_ && completion_op_->CheckCancelledAsync();
- } else {
+ // if the tag has already been delivered at the completion queue
+ return completion_op_ && completion_op_->CheckCancelledAsync();
+ } else {
// when using sync API, the result is always valid
- return completion_op_ && completion_op_->CheckCancelled(cq_);
- }
-}
-
+ return completion_op_ && completion_op_->CheckCancelled(cq_);
+ }
+}
+
void ServerContextBase::set_compression_algorithm(
- grpc_compression_algorithm algorithm) {
+ grpc_compression_algorithm algorithm) {
compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
- if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
- gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
- algorithm);
- abort();
- }
+ if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
+ gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
+ algorithm);
+ abort();
+ }
GPR_ASSERT(algorithm_name != nullptr);
- AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
-}
-
+ AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
+}
+
TString ServerContextBase::peer() const {
TString peer;
if (call_.call) {
char* c_peer = grpc_call_get_peer(call_.call);
- peer = c_peer;
- gpr_free(c_peer);
- }
- return peer;
-}
-
+ peer = c_peer;
+ gpr_free(c_peer);
+ }
+ return peer;
+}
+
const struct census_context* ServerContextBase::census_context() const {
return call_.call == nullptr ? nullptr
: grpc_census_call_get_context(call_.call);
-}
-
+}
+
void ServerContextBase::SetLoadReportingCosts(
const std::vector<TString>& cost_data) {
if (call_.call == nullptr) return;
diff --git a/contrib/libs/grpc/src/cpp/server/server_credentials.cc b/contrib/libs/grpc/src/cpp/server/server_credentials.cc
index a0f7c48999..c3b3a8b379 100644
--- a/contrib/libs/grpc/src/cpp/server/server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_credentials.cc
@@ -1,25 +1,25 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/security/server_credentials.h>
-
+
namespace grpc {
-
-ServerCredentials::~ServerCredentials() {}
-
+
+ServerCredentials::~ServerCredentials() {}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/server_posix.cc b/contrib/libs/grpc/src/cpp/server/server_posix.cc
index 99bc6a1606..c3d40d4fa2 100644
--- a/contrib/libs/grpc/src/cpp/server/server_posix.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_posix.cc
@@ -1,33 +1,33 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/server_posix.h>
-
-#include <grpc/grpc_posix.h>
-
+
+#include <grpc/grpc_posix.h>
+
namespace grpc {
-
-#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
-
+
+#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
+
void AddInsecureChannelFromFd(grpc::Server* server, int fd) {
grpc_server_add_insecure_channel_from_fd(server->c_server(), nullptr, fd);
-}
-
-#endif // GPR_SUPPORT_CHANNELS_FROM_FD
-
+}
+
+#endif // GPR_SUPPORT_CHANNELS_FROM_FD
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h b/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
index 4bc12345dd..028842a776 100644
--- a/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
+++ b/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
@@ -1,43 +1,43 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
-#define GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
-
-#include <functional>
-
-namespace grpc {
-
-// A thread pool interface for running callbacks.
-class ThreadPoolInterface {
- public:
- virtual ~ThreadPoolInterface() {}
-
- // Schedule the given callback for execution.
- virtual void Add(const std::function<void()>& callback) = 0;
-};
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
+#define GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
+
+#include <functional>
+
+namespace grpc {
+
+// A thread pool interface for running callbacks.
+class ThreadPoolInterface {
+ public:
+ virtual ~ThreadPoolInterface() {}
+
+ // Schedule the given callback for execution.
+ virtual void Add(const std::function<void()>& callback) = 0;
+};
+
// Allows different codebases to use their own thread pool impls
typedef ThreadPoolInterface* (*CreateThreadPoolFunc)(void);
void SetCreateThreadPool(CreateThreadPoolFunc func);
-ThreadPoolInterface* CreateDefaultThreadPool();
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
+ThreadPoolInterface* CreateDefaultThreadPool();
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
diff --git a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
index 29113e48f4..c8560aa81d 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
@@ -1,32 +1,32 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#include "src/cpp/thread_manager/thread_manager.h"
-
-#include <climits>
-
-#include <grpc/support/log.h>
+ *
+ */
+
+#include "src/cpp/thread_manager/thread_manager.h"
+
+#include <climits>
+
+#include <grpc/support/log.h>
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/exec_ctx.h"
-namespace grpc {
-
-ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr)
+namespace grpc {
+
+ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr)
: thd_mgr_(thd_mgr) {
// Make thread creation exclusive with respect to its join happening in
// ~WorkerThread().
@@ -38,92 +38,92 @@ ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr)
gpr_log(GPR_ERROR, "Could not create grpc_sync_server worker-thread");
}
}
-
-void ThreadManager::WorkerThread::Run() {
- thd_mgr_->MainWorkLoop();
- thd_mgr_->MarkAsCompleted(this);
-}
-
+
+void ThreadManager::WorkerThread::Run() {
+ thd_mgr_->MainWorkLoop();
+ thd_mgr_->MarkAsCompleted(this);
+}
+
ThreadManager::WorkerThread::~WorkerThread() {
// Don't join until the thread is fully constructed.
thd_.Join();
}
-
+
ThreadManager::ThreadManager(const char* name,
grpc_resource_quota* resource_quota,
int min_pollers, int max_pollers)
- : shutdown_(false),
- num_pollers_(0),
- min_pollers_(min_pollers),
- max_pollers_(max_pollers == -1 ? INT_MAX : max_pollers),
+ : shutdown_(false),
+ num_pollers_(0),
+ min_pollers_(min_pollers),
+ max_pollers_(max_pollers == -1 ? INT_MAX : max_pollers),
num_threads_(0),
max_active_threads_sofar_(0) {
resource_user_ = grpc_resource_user_create(resource_quota, name);
}
-
-ThreadManager::~ThreadManager() {
- {
+
+ThreadManager::~ThreadManager() {
+ {
grpc_core::MutexLock lock(&mu_);
- GPR_ASSERT(num_threads_ == 0);
- }
-
+ GPR_ASSERT(num_threads_ == 0);
+ }
+
grpc_core::ExecCtx exec_ctx; // grpc_resource_user_unref needs an exec_ctx
grpc_resource_user_unref(resource_user_);
- CleanupCompletedThreads();
-}
-
-void ThreadManager::Wait() {
+ CleanupCompletedThreads();
+}
+
+void ThreadManager::Wait() {
grpc_core::MutexLock lock(&mu_);
- while (num_threads_ != 0) {
+ while (num_threads_ != 0) {
shutdown_cv_.Wait(&mu_);
- }
-}
-
-void ThreadManager::Shutdown() {
+ }
+}
+
+void ThreadManager::Shutdown() {
grpc_core::MutexLock lock(&mu_);
- shutdown_ = true;
-}
-
-bool ThreadManager::IsShutdown() {
+ shutdown_ = true;
+}
+
+bool ThreadManager::IsShutdown() {
grpc_core::MutexLock lock(&mu_);
- return shutdown_;
-}
-
+ return shutdown_;
+}
+
int ThreadManager::GetMaxActiveThreadsSoFar() {
grpc_core::MutexLock list_lock(&list_mu_);
return max_active_threads_sofar_;
}
-void ThreadManager::MarkAsCompleted(WorkerThread* thd) {
- {
+void ThreadManager::MarkAsCompleted(WorkerThread* thd) {
+ {
grpc_core::MutexLock list_lock(&list_mu_);
- completed_threads_.push_back(thd);
- }
-
+ completed_threads_.push_back(thd);
+ }
+
{
grpc_core::MutexLock lock(&mu_);
num_threads_--;
if (num_threads_ == 0) {
shutdown_cv_.Signal();
}
- }
+ }
// Give a thread back to the resource quota
grpc_resource_user_free_threads(resource_user_, 1);
-}
-
-void ThreadManager::CleanupCompletedThreads() {
+}
+
+void ThreadManager::CleanupCompletedThreads() {
std::list<WorkerThread*> completed_threads;
{
// swap out the completed threads list: allows other threads to clean up
// more quickly
grpc_core::MutexLock lock(&list_mu_);
completed_threads.swap(completed_threads_);
- }
+ }
for (auto thd : completed_threads) delete thd;
-}
-
-void ThreadManager::Initialize() {
+}
+
+void ThreadManager::Initialize() {
if (!grpc_resource_user_allocate_threads(resource_user_, min_pollers_)) {
gpr_log(GPR_ERROR,
"No thread quota available to even create the minimum required "
@@ -137,21 +137,21 @@ void ThreadManager::Initialize() {
num_pollers_ = min_pollers_;
num_threads_ = min_pollers_;
max_active_threads_sofar_ = min_pollers_;
- }
-
+ }
+
for (int i = 0; i < min_pollers_; i++) {
WorkerThread* worker = new WorkerThread(this);
GPR_ASSERT(worker->created()); // Must be able to create the minimum
worker->Start();
- }
-}
-
-void ThreadManager::MainWorkLoop() {
+ }
+}
+
+void ThreadManager::MainWorkLoop() {
while (true) {
void* tag;
bool ok;
- WorkStatus work_status = PollForWork(&tag, &ok);
-
+ WorkStatus work_status = PollForWork(&tag, &ok);
+
grpc_core::ReleasableMutexLock lock(&mu_);
// Reduce the number of pollers by 1 and check what happened with the poll
num_pollers_--;
@@ -161,7 +161,7 @@ void ThreadManager::MainWorkLoop() {
// If we timed out and we have more pollers than we need (or we are
// shutdown), finish this thread
if (shutdown_ || num_pollers_ > max_pollers_) done = true;
- break;
+ break;
case SHUTDOWN:
// If the thread manager is shutdown, finish this thread
done = true;
@@ -216,10 +216,10 @@ void ThreadManager::MainWorkLoop() {
// If we're shutdown, we should finish at this point.
if (shutdown_) done = true;
break;
- }
+ }
// If we decided to finish the thread, break out of the while loop
if (done) break;
-
+
// Otherwise go back to polling as long as it doesn't exceed max_pollers_
//
// **WARNING**:
@@ -251,15 +251,15 @@ void ThreadManager::MainWorkLoop() {
num_pollers_++;
} else {
break;
- }
+ }
};
-
+
// This thread is exiting. Do some cleanup work i.e delete already completed
// worker threads
- CleanupCompletedThreads();
-
- // If we are here, either ThreadManager is shutting down or it already has
- // enough threads.
-}
-
-} // namespace grpc
+ CleanupCompletedThreads();
+
+ // If we are here, either ThreadManager is shutting down or it already has
+ // enough threads.
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
index 32592a7280..43f1fd5585 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
@@ -1,104 +1,104 @@
-/*
- *
+/*
+ *
* Copyright 2016 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.
- *
- */
-
-#ifndef GRPC_INTERNAL_CPP_THREAD_MANAGER_H
-#define GRPC_INTERNAL_CPP_THREAD_MANAGER_H
-
-#include <list>
-#include <memory>
-
+ *
+ */
+
+#ifndef GRPC_INTERNAL_CPP_THREAD_MANAGER_H
+#define GRPC_INTERNAL_CPP_THREAD_MANAGER_H
+
+#include <list>
+#include <memory>
+
#include <grpcpp/support/config.h>
-
+
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/resource_quota.h"
-namespace grpc {
-
-class ThreadManager {
- public:
+namespace grpc {
+
+class ThreadManager {
+ public:
explicit ThreadManager(const char* name, grpc_resource_quota* resource_quota,
int min_pollers, int max_pollers);
- virtual ~ThreadManager();
-
- // Initializes and Starts the Rpc Manager threads
- void Initialize();
-
- // The return type of PollForWork() function
- enum WorkStatus { WORK_FOUND, SHUTDOWN, TIMEOUT };
-
- // "Polls" for new work.
- // If the return value is WORK_FOUND:
- // - The implementaion of PollForWork() MAY set some opaque identifier to
- // (identify the work item found) via the '*tag' parameter
- // - The implementaion MUST set the value of 'ok' to 'true' or 'false'. A
- // value of 'false' indicates some implemenation specific error (that is
- // neither SHUTDOWN nor TIMEOUT)
- // - ThreadManager does not interpret the values of 'tag' and 'ok'
- // - ThreadManager WILL call DoWork() and pass '*tag' and 'ok' as input to
- // DoWork()
- //
- // If the return value is SHUTDOWN:,
+ virtual ~ThreadManager();
+
+ // Initializes and Starts the Rpc Manager threads
+ void Initialize();
+
+ // The return type of PollForWork() function
+ enum WorkStatus { WORK_FOUND, SHUTDOWN, TIMEOUT };
+
+ // "Polls" for new work.
+ // If the return value is WORK_FOUND:
+ // - The implementaion of PollForWork() MAY set some opaque identifier to
+ // (identify the work item found) via the '*tag' parameter
+ // - The implementaion MUST set the value of 'ok' to 'true' or 'false'. A
+ // value of 'false' indicates some implemenation specific error (that is
+ // neither SHUTDOWN nor TIMEOUT)
+ // - ThreadManager does not interpret the values of 'tag' and 'ok'
+ // - ThreadManager WILL call DoWork() and pass '*tag' and 'ok' as input to
+ // DoWork()
+ //
+ // If the return value is SHUTDOWN:,
// - ThreadManager WILL NOT call DoWork() and terminates the thread
- //
- // If the return value is TIMEOUT:,
- // - ThreadManager WILL NOT call DoWork()
- // - ThreadManager MAY terminate the thread depending on the current number
- // of active poller threads and mix_pollers/max_pollers settings
- // - Also, the value of timeout is specific to the derived class
- // implementation
- virtual WorkStatus PollForWork(void** tag, bool* ok) = 0;
-
- // The implementation of DoWork() is supposed to perform the work found by
- // PollForWork(). The tag and ok parameters are the same as returned by
+ //
+ // If the return value is TIMEOUT:,
+ // - ThreadManager WILL NOT call DoWork()
+ // - ThreadManager MAY terminate the thread depending on the current number
+ // of active poller threads and mix_pollers/max_pollers settings
+ // - Also, the value of timeout is specific to the derived class
+ // implementation
+ virtual WorkStatus PollForWork(void** tag, bool* ok) = 0;
+
+ // The implementation of DoWork() is supposed to perform the work found by
+ // PollForWork(). The tag and ok parameters are the same as returned by
// PollForWork(). The resources parameter indicates that the call actually
// has the resources available for performing the RPC's work. If it doesn't,
// the implementation should fail it appropriately.
- //
- // The implementation of DoWork() should also do any setup needed to ensure
- // that the next call to PollForWork() (not necessarily by the current thread)
- // actually finds some work
+ //
+ // The implementation of DoWork() should also do any setup needed to ensure
+ // that the next call to PollForWork() (not necessarily by the current thread)
+ // actually finds some work
virtual void DoWork(void* tag, bool ok, bool resources) = 0;
-
- // Mark the ThreadManager as shutdown and begin draining the work. This is a
- // non-blocking call and the caller should call Wait(), a blocking call which
- // returns only once the shutdown is complete
+
+ // Mark the ThreadManager as shutdown and begin draining the work. This is a
+ // non-blocking call and the caller should call Wait(), a blocking call which
+ // returns only once the shutdown is complete
virtual void Shutdown();
-
- // Has Shutdown() been called
- bool IsShutdown();
-
- // A blocking call that returns only after the ThreadManager has shutdown and
- // all the threads have drained all the outstanding work
+
+ // Has Shutdown() been called
+ bool IsShutdown();
+
+ // A blocking call that returns only after the ThreadManager has shutdown and
+ // all the threads have drained all the outstanding work
virtual void Wait();
-
+
// Max number of concurrent threads that were ever active in this thread
// manager so far. This is useful for debugging purposes (and in unit tests)
// to check if resource_quota is properly being enforced.
int GetMaxActiveThreadsSoFar();
- private:
+ private:
// Helper wrapper class around grpc_core::Thread. Takes a ThreadManager object
// and starts a new grpc_core::Thread to calls the Run() function.
- //
- // The Run() function calls ThreadManager::MainWorkLoop() function and once
- // that completes, it marks the WorkerThread completed by calling
- // ThreadManager::MarkAsCompleted()
+ //
+ // The Run() function calls ThreadManager::MainWorkLoop() function and once
+ // that completes, it marks the WorkerThread completed by calling
+ // ThreadManager::MarkAsCompleted()
//
// WHY IS THIS NEEDED?:
// When a thread terminates, some other thread *must* call Join() on that
@@ -117,37 +117,37 @@ class ThreadManager {
//
// TODO(sreek): Consider creating the threads 'detached' so that Join() need
// not be called (and the need for this WorkerThread class is eliminated)
- class WorkerThread {
- public:
- WorkerThread(ThreadManager* thd_mgr);
- ~WorkerThread();
-
+ class WorkerThread {
+ public:
+ WorkerThread(ThreadManager* thd_mgr);
+ ~WorkerThread();
+
bool created() const { return created_; }
void Start() { thd_.Start(); }
- private:
- // Calls thd_mgr_->MainWorkLoop() and once that completes, calls
- // thd_mgr_>MarkAsCompleted(this) to mark the thread as completed
- void Run();
-
+ private:
+ // Calls thd_mgr_->MainWorkLoop() and once that completes, calls
+ // thd_mgr_>MarkAsCompleted(this) to mark the thread as completed
+ void Run();
+
ThreadManager* const thd_mgr_;
grpc_core::Thread thd_;
bool created_;
- };
-
+ };
+
// The main function in ThreadManager
- void MainWorkLoop();
-
- void MarkAsCompleted(WorkerThread* thd);
- void CleanupCompletedThreads();
-
+ void MainWorkLoop();
+
+ void MarkAsCompleted(WorkerThread* thd);
+ void CleanupCompletedThreads();
+
// Protects shutdown_, num_pollers_, num_threads_ and
// max_active_threads_sofar_
grpc_core::Mutex mu_;
-
- bool shutdown_;
+
+ bool shutdown_;
grpc_core::CondVar shutdown_cv_;
-
+
// The resource user object to use when requesting quota to create threads
//
// Note: The user of this ThreadManager object must create grpc_resource_quota
@@ -156,26 +156,26 @@ class ThreadManager {
// created
grpc_resource_user* resource_user_;
- // Number of threads doing polling
- int num_pollers_;
-
- // The minimum and maximum number of threads that should be doing polling
- int min_pollers_;
- int max_pollers_;
-
+ // Number of threads doing polling
+ int num_pollers_;
+
+ // The minimum and maximum number of threads that should be doing polling
+ int min_pollers_;
+ int max_pollers_;
+
// The total number of threads currently active (includes threads includes the
// threads that are currently polling i.e num_pollers_)
- int num_threads_;
-
+ int num_threads_;
+
// See GetMaxActiveThreadsSoFar()'s description.
// To be more specific, this variable tracks the max value num_threads_ was
// ever set so far
int max_active_threads_sofar_;
grpc_core::Mutex list_mu_;
- std::list<WorkerThread*> completed_threads_;
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_THREAD_MANAGER_H
+ std::list<WorkerThread*> completed_threads_;
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_THREAD_MANAGER_H
diff --git a/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc b/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
index 8ac84b83ce..fb70590645 100644
--- a/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
@@ -1,46 +1,46 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpc/byte_buffer.h>
-#include <grpc/byte_buffer_reader.h>
+#include <grpc/byte_buffer_reader.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/byte_buffer.h>
-
-namespace grpc {
-
+
+namespace grpc {
+
static internal::GrpcLibraryInitializer g_gli_initializer;
-
-Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
- slices->clear();
- if (!buffer_) {
- return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized");
- }
- grpc_byte_buffer_reader reader;
- if (!grpc_byte_buffer_reader_init(&reader, buffer_)) {
- return Status(StatusCode::INTERNAL,
- "Couldn't initialize byte buffer reader");
- }
- grpc_slice s;
- while (grpc_byte_buffer_reader_next(&reader, &s)) {
- slices->push_back(Slice(s, Slice::STEAL_REF));
- }
- grpc_byte_buffer_reader_destroy(&reader);
- return Status::OK;
-}
-
-} // namespace grpc
+
+Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
+ slices->clear();
+ if (!buffer_) {
+ return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized");
+ }
+ grpc_byte_buffer_reader reader;
+ if (!grpc_byte_buffer_reader_init(&reader, buffer_)) {
+ return Status(StatusCode::INTERNAL,
+ "Couldn't initialize byte buffer reader");
+ }
+ grpc_slice s;
+ while (grpc_byte_buffer_reader_next(&reader, &s)) {
+ slices->push_back(Slice(s, Slice::STEAL_REF));
+ }
+ grpc_byte_buffer_reader_destroy(&reader);
+ return Status::OK;
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/util/status.cc b/contrib/libs/grpc/src/cpp/util/status.cc
index 47c381400d..93696d8126 100644
--- a/contrib/libs/grpc/src/cpp/util/status.cc
+++ b/contrib/libs/grpc/src/cpp/util/status.cc
@@ -1,26 +1,26 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/support/status.h>
-
-namespace grpc {
-
-const Status& Status::OK = Status();
-const Status& Status::CANCELLED = Status(StatusCode::CANCELLED, "");
-
-} // namespace grpc
+
+namespace grpc {
+
+const Status& Status::OK = Status();
+const Status& Status::CANCELLED = Status(StatusCode::CANCELLED, "");
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/util/string_ref.cc b/contrib/libs/grpc/src/cpp/util/string_ref.cc
index 64882969ae..8b09a82a63 100644
--- a/contrib/libs/grpc/src/cpp/util/string_ref.cc
+++ b/contrib/libs/grpc/src/cpp/util/string_ref.cc
@@ -1,25 +1,25 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
+ *
+ */
+
#include <grpcpp/support/string_ref.h>
-
-namespace grpc {
-
-const size_t string_ref::npos = size_t(-1);
-
-} // namespace grpc
+
+namespace grpc {
+
+const size_t string_ref::npos = size_t(-1);
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/util/time_cc.cc b/contrib/libs/grpc/src/cpp/util/time_cc.cc
index 5401bf0da5..6c9c228d7c 100644
--- a/contrib/libs/grpc/src/cpp/util/time_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/time_cc.cc
@@ -1,75 +1,75 @@
-/*
- *
+/*
+ *
* 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.
- *
- */
-
-#include <grpc/support/time.h>
+ *
+ */
+
+#include <grpc/support/time.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/time.h>
-
-using std::chrono::duration_cast;
+
+using std::chrono::duration_cast;
using std::chrono::high_resolution_clock;
-using std::chrono::nanoseconds;
-using std::chrono::seconds;
-using std::chrono::system_clock;
-
-namespace grpc {
-
-void Timepoint2Timespec(const system_clock::time_point& from,
- gpr_timespec* to) {
- system_clock::duration deadline = from.time_since_epoch();
- seconds secs = duration_cast<seconds>(deadline);
- if (from == system_clock::time_point::max() ||
- secs.count() >= gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec ||
- secs.count() < 0) {
- *to = gpr_inf_future(GPR_CLOCK_REALTIME);
- return;
- }
- nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
+using std::chrono::nanoseconds;
+using std::chrono::seconds;
+using std::chrono::system_clock;
+
+namespace grpc {
+
+void Timepoint2Timespec(const system_clock::time_point& from,
+ gpr_timespec* to) {
+ system_clock::duration deadline = from.time_since_epoch();
+ seconds secs = duration_cast<seconds>(deadline);
+ if (from == system_clock::time_point::max() ||
+ secs.count() >= gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec ||
+ secs.count() < 0) {
+ *to = gpr_inf_future(GPR_CLOCK_REALTIME);
+ return;
+ }
+ nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
to->tv_sec = static_cast<int64_t>(secs.count());
to->tv_nsec = static_cast<int32_t>(nsecs.count());
- to->clock_type = GPR_CLOCK_REALTIME;
-}
-
-void TimepointHR2Timespec(const high_resolution_clock::time_point& from,
- gpr_timespec* to) {
- high_resolution_clock::duration deadline = from.time_since_epoch();
- seconds secs = duration_cast<seconds>(deadline);
- if (from == high_resolution_clock::time_point::max() ||
- secs.count() >= gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec ||
- secs.count() < 0) {
- *to = gpr_inf_future(GPR_CLOCK_REALTIME);
- return;
- }
- nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
+ to->clock_type = GPR_CLOCK_REALTIME;
+}
+
+void TimepointHR2Timespec(const high_resolution_clock::time_point& from,
+ gpr_timespec* to) {
+ high_resolution_clock::duration deadline = from.time_since_epoch();
+ seconds secs = duration_cast<seconds>(deadline);
+ if (from == high_resolution_clock::time_point::max() ||
+ secs.count() >= gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec ||
+ secs.count() < 0) {
+ *to = gpr_inf_future(GPR_CLOCK_REALTIME);
+ return;
+ }
+ nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
to->tv_sec = static_cast<int64_t>(secs.count());
to->tv_nsec = static_cast<int32_t>(nsecs.count());
- to->clock_type = GPR_CLOCK_REALTIME;
-}
-
-system_clock::time_point Timespec2Timepoint(gpr_timespec t) {
- if (gpr_time_cmp(t, gpr_inf_future(t.clock_type)) == 0) {
- return system_clock::time_point::max();
- }
- t = gpr_convert_clock_type(t, GPR_CLOCK_REALTIME);
- system_clock::time_point tp;
- tp += duration_cast<system_clock::time_point::duration>(seconds(t.tv_sec));
- tp +=
- duration_cast<system_clock::time_point::duration>(nanoseconds(t.tv_nsec));
- return tp;
-}
-
-} // namespace grpc
+ to->clock_type = GPR_CLOCK_REALTIME;
+}
+
+system_clock::time_point Timespec2Timepoint(gpr_timespec t) {
+ if (gpr_time_cmp(t, gpr_inf_future(t.clock_type)) == 0) {
+ return system_clock::time_point::max();
+ }
+ t = gpr_convert_clock_type(t, GPR_CLOCK_REALTIME);
+ system_clock::time_point tp;
+ tp += duration_cast<system_clock::time_point::duration>(seconds(t.tv_sec));
+ tp +=
+ duration_cast<system_clock::time_point::duration>(nanoseconds(t.tv_nsec));
+ return tp;
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/proto/grpc/binary_log/v1alpha/log.proto b/contrib/libs/grpc/src/proto/grpc/binary_log/v1alpha/log.proto
index 747a20c9ec..77100ebbef 100644
--- a/contrib/libs/grpc/src/proto/grpc/binary_log/v1alpha/log.proto
+++ b/contrib/libs/grpc/src/proto/grpc/binary_log/v1alpha/log.proto
@@ -1,93 +1,93 @@
// Copyright 2016 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.
-
-syntax = "proto3";
-
-import "google/protobuf/timestamp.proto";
-
-package grpc.binary_log.v1alpha;
-
-enum Direction {
- SERVER_SEND = 0;
- SERVER_RECV = 1;
- CLIENT_SEND = 2;
- CLIENT_RECV = 3;
-}
-
-message KeyValuePair {
- string key = 1;
- string value = 2;
-}
-
-// Any sort of metadata that may be sent in either direction during a call
-message Metadata {
- // Cryptographically unique identifier, generated on the client and sent
- // to the server.
- uint64 rpc_id = 1;
- // Timestamp of logging the metadata
- google.protobuf.Timestamp timestamp = 2;
- Direction direction = 3;
- // The actual metadata that is being sent
- repeated KeyValuePair metadata = 4;
-
- // Initial metadata sent by the client to initiate a request
- message ClientInitialMetadata {
- // The full method name that is being called
- string method_name = 1;
- // The call's deadline
- google.protobuf.Timestamp deadline = 2;
- // The address of the connected peer
- string peer = 3;
- }
-
- // Arbitrary key/value pairs specified by the user that are not sent over
- // the network but are nonetheless useful to log
- message UserData {
- }
-
- // Initial metadata response sent by the server after accepting the request
- message ServerInitialMetadata {
- }
-
- // Status sent by the server when closing the call on the server side
- message ServerStatus {
- // The status code
- uint32 code = 1;
- // The status details
- string details = 2;
- }
-
- oneof kind {
- ClientInitialMetadata client_initial_metadata = 5;
- UserData user_data = 6;
- ServerInitialMetadata server_initial_metadata = 7;
- ServerStatus server_status = 8;
- }
-}
-
-// A message that is sent during a call
-message Message {
- // Cryptographically unique identifier, generated on the client and sent
- // to the server.
- uint64 rpc_id = 1;
- // The sequence number of the message. Messages sent by the client and by the
- // server should have independently incrementing sequence numbers.
- uint32 sequence_number = 2;
- Direction direction = 3;
- // The length of the complete message.
- uint32 length = 4;
- // The contents of the message. May be a prefix instead of the complete
- // message.
- bytes data = 5;
-}
+
+syntax = "proto3";
+
+import "google/protobuf/timestamp.proto";
+
+package grpc.binary_log.v1alpha;
+
+enum Direction {
+ SERVER_SEND = 0;
+ SERVER_RECV = 1;
+ CLIENT_SEND = 2;
+ CLIENT_RECV = 3;
+}
+
+message KeyValuePair {
+ string key = 1;
+ string value = 2;
+}
+
+// Any sort of metadata that may be sent in either direction during a call
+message Metadata {
+ // Cryptographically unique identifier, generated on the client and sent
+ // to the server.
+ uint64 rpc_id = 1;
+ // Timestamp of logging the metadata
+ google.protobuf.Timestamp timestamp = 2;
+ Direction direction = 3;
+ // The actual metadata that is being sent
+ repeated KeyValuePair metadata = 4;
+
+ // Initial metadata sent by the client to initiate a request
+ message ClientInitialMetadata {
+ // The full method name that is being called
+ string method_name = 1;
+ // The call's deadline
+ google.protobuf.Timestamp deadline = 2;
+ // The address of the connected peer
+ string peer = 3;
+ }
+
+ // Arbitrary key/value pairs specified by the user that are not sent over
+ // the network but are nonetheless useful to log
+ message UserData {
+ }
+
+ // Initial metadata response sent by the server after accepting the request
+ message ServerInitialMetadata {
+ }
+
+ // Status sent by the server when closing the call on the server side
+ message ServerStatus {
+ // The status code
+ uint32 code = 1;
+ // The status details
+ string details = 2;
+ }
+
+ oneof kind {
+ ClientInitialMetadata client_initial_metadata = 5;
+ UserData user_data = 6;
+ ServerInitialMetadata server_initial_metadata = 7;
+ ServerStatus server_status = 8;
+ }
+}
+
+// A message that is sent during a call
+message Message {
+ // Cryptographically unique identifier, generated on the client and sent
+ // to the server.
+ uint64 rpc_id = 1;
+ // The sequence number of the message. Messages sent by the client and by the
+ // server should have independently incrementing sequence numbers.
+ uint32 sequence_number = 2;
+ Direction direction = 3;
+ // The length of the complete message.
+ uint32 length = 4;
+ // The contents of the message. May be a prefix instead of the complete
+ // message.
+ bytes data = 5;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/health/v1/health.proto b/contrib/libs/grpc/src/proto/grpc/health/v1/health.proto
index 7edc88bc10..38843ff1e7 100644
--- a/contrib/libs/grpc/src/proto/grpc/health/v1/health.proto
+++ b/contrib/libs/grpc/src/proto/grpc/health/v1/health.proto
@@ -1,48 +1,48 @@
// Copyright 2015 The 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.
-
+
// The canonical version of this proto can be found at
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
-syntax = "proto3";
-
-package grpc.health.v1;
+syntax = "proto3";
+
+package grpc.health.v1;
-option csharp_namespace = "Grpc.Health.V1";
+option csharp_namespace = "Grpc.Health.V1";
option go_package = "google.golang.org/grpc/health/grpc_health_v1";
option java_multiple_files = true;
option java_outer_classname = "HealthProto";
option java_package = "io.grpc.health.v1";
-
-message HealthCheckRequest {
- string service = 1;
-}
-
-message HealthCheckResponse {
- enum ServingStatus {
- UNKNOWN = 0;
- SERVING = 1;
- NOT_SERVING = 2;
+
+message HealthCheckRequest {
+ string service = 1;
+}
+
+message HealthCheckResponse {
+ enum ServingStatus {
+ UNKNOWN = 0;
+ SERVING = 1;
+ NOT_SERVING = 2;
SERVICE_UNKNOWN = 3; // Used only by the Watch method.
- }
- ServingStatus status = 1;
-}
-
-service Health {
+ }
+ ServingStatus status = 1;
+}
+
+service Health {
// If the requested service is unknown, the call will fail with status
// NOT_FOUND.
- rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
+ rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
// Performs a watch for the serving status of the requested service.
// The server will immediately send back a message indicating the current
@@ -60,4 +60,4 @@ service Health {
// call. If the call terminates with any other status (including OK),
// clients should retry the call with appropriate exponential backoff.
rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
-}
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.options b/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.options
index 980a9d398c..7fbd44b9de 100644
--- a/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.options
+++ b/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.options
@@ -1,5 +1,5 @@
-grpc.lb.v1.InitialLoadBalanceRequest.name max_size:128
-grpc.lb.v1.InitialLoadBalanceResponse.load_balancer_delegate max_size:64
-grpc.lb.v1.Server.ip_address max_size:16
-grpc.lb.v1.Server.load_balance_token max_size:50
-load_balancer.proto no_unions:true
+grpc.lb.v1.InitialLoadBalanceRequest.name max_size:128
+grpc.lb.v1.InitialLoadBalanceResponse.load_balancer_delegate max_size:64
+grpc.lb.v1.Server.ip_address max_size:16
+grpc.lb.v1.Server.load_balance_token max_size:50
+load_balancer.proto no_unions:true
diff --git a/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.proto b/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.proto
index 7a8066d053..ccf2efd629 100644
--- a/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.proto
+++ b/contrib/libs/grpc/src/proto/grpc/lb/v1/load_balancer.proto
@@ -1,57 +1,57 @@
// Copyright 2015 The 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.
-
+
// This file defines the GRPCLB LoadBalancing protocol.
//
// The canonical version of this proto can be found at
// https://github.com/grpc/grpc-proto/blob/master/grpc/lb/v1/load_balancer.proto
-syntax = "proto3";
-
-package grpc.lb.v1;
-
+syntax = "proto3";
+
+package grpc.lb.v1;
+
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
-
+
option go_package = "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1";
option java_multiple_files = true;
option java_outer_classname = "LoadBalancerProto";
option java_package = "io.grpc.grpclb";
-
-service LoadBalancer {
- // Bidirectional rpc to get a list of servers.
+
+service LoadBalancer {
+ // Bidirectional rpc to get a list of servers.
rpc BalanceLoad(stream LoadBalanceRequest) returns (stream LoadBalanceResponse);
-}
-
-message LoadBalanceRequest {
- oneof load_balance_request_type {
- // This message should be sent on the first request to the load balancer.
- InitialLoadBalanceRequest initial_request = 1;
-
- // The client stats should be periodically reported to the load balancer
- // based on the duration defined in the InitialLoadBalanceResponse.
- ClientStats client_stats = 2;
- }
-}
-
-message InitialLoadBalanceRequest {
+}
+
+message LoadBalanceRequest {
+ oneof load_balance_request_type {
+ // This message should be sent on the first request to the load balancer.
+ InitialLoadBalanceRequest initial_request = 1;
+
+ // The client stats should be periodically reported to the load balancer
+ // based on the duration defined in the InitialLoadBalanceResponse.
+ ClientStats client_stats = 2;
+ }
+}
+
+message InitialLoadBalanceRequest {
// The name of the load balanced service (e.g., service.googleapis.com). Its
- // length should be less than 256 bytes.
+ // length should be less than 256 bytes.
// The name might include a port number. How to handle the port number is up
// to the balancer.
- string name = 1;
-}
-
+ string name = 1;
+}
+
// Contains the number of calls finished for a particular load balance token.
message ClientStatsPerToken {
// See Server.load_balance_token.
@@ -61,15 +61,15 @@ message ClientStatsPerToken {
int64 num_calls = 2;
}
-// Contains client level statistics that are useful to load balancing. Each
+// Contains client level statistics that are useful to load balancing. Each
// count except the timestamp should be reset to zero after reporting the stats.
-message ClientStats {
+message ClientStats {
// The timestamp of generating the report.
google.protobuf.Timestamp timestamp = 1;
-
+
// The total number of RPCs that started.
int64 num_calls_started = 2;
-
+
// The total number of RPCs that finished.
int64 num_calls_finished = 3;
@@ -84,74 +84,74 @@ message ClientStats {
repeated ClientStatsPerToken calls_finished_with_drop = 8;
reserved 4, 5;
-}
-
-message LoadBalanceResponse {
- oneof load_balance_response_type {
- // This message should be sent on the first response to the client.
- InitialLoadBalanceResponse initial_response = 1;
-
- // Contains the list of servers selected by the load balancer. The client
- // should send requests to these servers in the specified order.
- ServerList server_list = 2;
+}
+
+message LoadBalanceResponse {
+ oneof load_balance_response_type {
+ // This message should be sent on the first response to the client.
+ InitialLoadBalanceResponse initial_response = 1;
+
+ // Contains the list of servers selected by the load balancer. The client
+ // should send requests to these servers in the specified order.
+ ServerList server_list = 2;
// If this field is set, then the client should eagerly enter fallback
// mode (even if there are existing, healthy connections to backends).
// See go/grpclb-explicit-fallback for more details.
FallbackResponse fallback_response = 3;
- }
-}
-
-message InitialLoadBalanceResponse {
- // This is an application layer redirect that indicates the client should use
- // the specified server for load balancing. When this field is non-empty in
- // the response, the client should open a separate connection to the
- // load_balancer_delegate and call the BalanceLoad method. Its length should
- // be less than 64 bytes.
- string load_balancer_delegate = 1;
-
- // This interval defines how often the client should send the client stats
- // to the load balancer. Stats should only be reported when the duration is
- // positive.
+ }
+}
+
+message InitialLoadBalanceResponse {
+ // This is an application layer redirect that indicates the client should use
+ // the specified server for load balancing. When this field is non-empty in
+ // the response, the client should open a separate connection to the
+ // load_balancer_delegate and call the BalanceLoad method. Its length should
+ // be less than 64 bytes.
+ string load_balancer_delegate = 1;
+
+ // This interval defines how often the client should send the client stats
+ // to the load balancer. Stats should only be reported when the duration is
+ // positive.
google.protobuf.Duration client_stats_report_interval = 2;
-}
-
-message ServerList {
- // Contains a list of servers selected by the load balancer. The list will
- // be updated when server resolutions change or as needed to balance load
- // across more servers. The client should consume the server list in order
- // unless instructed otherwise via the client_config.
- repeated Server servers = 1;
-
+}
+
+message ServerList {
+ // Contains a list of servers selected by the load balancer. The list will
+ // be updated when server resolutions change or as needed to balance load
+ // across more servers. The client should consume the server list in order
+ // unless instructed otherwise via the client_config.
+ repeated Server servers = 1;
+
// Was google.protobuf.Duration expiration_interval.
reserved 3;
-}
-
+}
+
// Contains server information. When the drop field is not true, use the other
// fields.
-message Server {
- // A resolved address for the server, serialized in network-byte-order. It may
- // either be an IPv4 or IPv6 address.
- bytes ip_address = 1;
-
- // A resolved port number for the server.
- int32 port = 2;
-
+message Server {
+ // A resolved address for the server, serialized in network-byte-order. It may
+ // either be an IPv4 or IPv6 address.
+ bytes ip_address = 1;
+
+ // A resolved port number for the server.
+ int32 port = 2;
+
// An opaque but printable token for load reporting. The client must include
// the token of the picked server into the initial metadata when it starts a
// call to that server. The token is used by the server to verify the request
// and to allow the server to report load to the gRPC LB system. The token is
// also used in client stats for reporting dropped calls.
- //
+ //
// Its length can be variable but must be less than 50 bytes.
- string load_balance_token = 3;
-
+ string load_balance_token = 3;
+
// Indicates whether this particular request should be dropped by the client.
// If the request is dropped, there will be a corresponding entry in
// ClientStats.calls_finished_with_drop.
bool drop = 4;
reserved 5;
-}
+}
message FallbackResponse {}
diff --git a/contrib/libs/grpc/src/proto/grpc/reflection/v1alpha/reflection.proto b/contrib/libs/grpc/src/proto/grpc/reflection/v1alpha/reflection.proto
index 2e19fca632..816852f825 100644
--- a/contrib/libs/grpc/src/proto/grpc/reflection/v1alpha/reflection.proto
+++ b/contrib/libs/grpc/src/proto/grpc/reflection/v1alpha/reflection.proto
@@ -1,136 +1,136 @@
// Copyright 2016 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.
-
-// Service exported by server reflection
-
-syntax = "proto3";
-
-package grpc.reflection.v1alpha;
-
-service ServerReflection {
- // The reflection service is structured as a bidirectional stream, ensuring
- // all related requests go to a single server.
- rpc ServerReflectionInfo(stream ServerReflectionRequest)
- returns (stream ServerReflectionResponse);
-}
-
-// The message sent by the client when calling ServerReflectionInfo method.
-message ServerReflectionRequest {
- string host = 1;
- // To use reflection service, the client should set one of the following
- // fields in message_request. The server distinguishes requests by their
- // defined field and then handles them using corresponding methods.
- oneof message_request {
- // Find a proto file by the file name.
- string file_by_filename = 3;
-
- // Find the proto file that declares the given fully-qualified symbol name.
- // This field should be a fully-qualified symbol name
- // (e.g. <package>.<service>[.<method>] or <package>.<type>).
- string file_containing_symbol = 4;
-
- // Find the proto file which defines an extension extending the given
- // message type with the given field number.
- ExtensionRequest file_containing_extension = 5;
-
- // Finds the tag numbers used by all known extensions of the given message
- // type, and appends them to ExtensionNumberResponse in an undefined order.
- // Its corresponding method is best-effort: it's not guaranteed that the
- // reflection service will implement this method, and it's not guaranteed
- // that this method will provide all extensions. Returns
- // StatusCode::UNIMPLEMENTED if it's not implemented.
- // This field should be a fully-qualified type name. The format is
- // <package>.<type>
- string all_extension_numbers_of_type = 6;
-
- // List the full names of registered services. The content will not be
- // checked.
- string list_services = 7;
- }
-}
-
-// The type name and extension number sent by the client when requesting
-// file_containing_extension.
-message ExtensionRequest {
- // Fully-qualified type name. The format should be <package>.<type>
- string containing_type = 1;
- int32 extension_number = 2;
-}
-
-// The message sent by the server to answer ServerReflectionInfo method.
-message ServerReflectionResponse {
- string valid_host = 1;
- ServerReflectionRequest original_request = 2;
- // The server set one of the following fields accroding to the message_request
- // in the request.
- oneof message_response {
- // This message is used to answer file_by_filename, file_containing_symbol,
- // file_containing_extension requests with transitive dependencies. As
- // the repeated label is not allowed in oneof fields, we use a
- // FileDescriptorResponse message to encapsulate the repeated fields.
- // The reflection service is allowed to avoid sending FileDescriptorProtos
- // that were previously sent in response to earlier requests in the stream.
- FileDescriptorResponse file_descriptor_response = 4;
-
- // This message is used to answer all_extension_numbers_of_type requst.
- ExtensionNumberResponse all_extension_numbers_response = 5;
-
- // This message is used to answer list_services request.
- ListServiceResponse list_services_response = 6;
-
- // This message is used when an error occurs.
- ErrorResponse error_response = 7;
- }
-}
-
-// Serialized FileDescriptorProto messages sent by the server answering
-// a file_by_filename, file_containing_symbol, or file_containing_extension
-// request.
-message FileDescriptorResponse {
- // Serialized FileDescriptorProto messages. We avoid taking a dependency on
- // descriptor.proto, which uses proto2 only features, by making them opaque
- // bytes instead.
- repeated bytes file_descriptor_proto = 1;
-}
-
-// A list of extension numbers sent by the server answering
-// all_extension_numbers_of_type request.
-message ExtensionNumberResponse {
- // Full name of the base type, including the package name. The format
- // is <package>.<type>
- string base_type_name = 1;
- repeated int32 extension_number = 2;
-}
-
-// A list of ServiceResponse sent by the server answering list_services request.
-message ListServiceResponse {
- // The information of each service may be expanded in the future, so we use
- // ServiceResponse message to encapsulate it.
- repeated ServiceResponse service = 1;
-}
-
-// The information of a single service used by ListServiceResponse to answer
-// list_services request.
-message ServiceResponse {
- // Full name of a registered service, including its package name. The format
- // is <package>.<service>
- string name = 1;
-}
-
-// The error code and error message sent by the server when an error occurs.
-message ErrorResponse {
- // This field uses the error codes defined in grpc::StatusCode.
- int32 error_code = 1;
- string error_message = 2;
-}
+
+// Service exported by server reflection
+
+syntax = "proto3";
+
+package grpc.reflection.v1alpha;
+
+service ServerReflection {
+ // The reflection service is structured as a bidirectional stream, ensuring
+ // all related requests go to a single server.
+ rpc ServerReflectionInfo(stream ServerReflectionRequest)
+ returns (stream ServerReflectionResponse);
+}
+
+// The message sent by the client when calling ServerReflectionInfo method.
+message ServerReflectionRequest {
+ string host = 1;
+ // To use reflection service, the client should set one of the following
+ // fields in message_request. The server distinguishes requests by their
+ // defined field and then handles them using corresponding methods.
+ oneof message_request {
+ // Find a proto file by the file name.
+ string file_by_filename = 3;
+
+ // Find the proto file that declares the given fully-qualified symbol name.
+ // This field should be a fully-qualified symbol name
+ // (e.g. <package>.<service>[.<method>] or <package>.<type>).
+ string file_containing_symbol = 4;
+
+ // Find the proto file which defines an extension extending the given
+ // message type with the given field number.
+ ExtensionRequest file_containing_extension = 5;
+
+ // Finds the tag numbers used by all known extensions of the given message
+ // type, and appends them to ExtensionNumberResponse in an undefined order.
+ // Its corresponding method is best-effort: it's not guaranteed that the
+ // reflection service will implement this method, and it's not guaranteed
+ // that this method will provide all extensions. Returns
+ // StatusCode::UNIMPLEMENTED if it's not implemented.
+ // This field should be a fully-qualified type name. The format is
+ // <package>.<type>
+ string all_extension_numbers_of_type = 6;
+
+ // List the full names of registered services. The content will not be
+ // checked.
+ string list_services = 7;
+ }
+}
+
+// The type name and extension number sent by the client when requesting
+// file_containing_extension.
+message ExtensionRequest {
+ // Fully-qualified type name. The format should be <package>.<type>
+ string containing_type = 1;
+ int32 extension_number = 2;
+}
+
+// The message sent by the server to answer ServerReflectionInfo method.
+message ServerReflectionResponse {
+ string valid_host = 1;
+ ServerReflectionRequest original_request = 2;
+ // The server set one of the following fields accroding to the message_request
+ // in the request.
+ oneof message_response {
+ // This message is used to answer file_by_filename, file_containing_symbol,
+ // file_containing_extension requests with transitive dependencies. As
+ // the repeated label is not allowed in oneof fields, we use a
+ // FileDescriptorResponse message to encapsulate the repeated fields.
+ // The reflection service is allowed to avoid sending FileDescriptorProtos
+ // that were previously sent in response to earlier requests in the stream.
+ FileDescriptorResponse file_descriptor_response = 4;
+
+ // This message is used to answer all_extension_numbers_of_type requst.
+ ExtensionNumberResponse all_extension_numbers_response = 5;
+
+ // This message is used to answer list_services request.
+ ListServiceResponse list_services_response = 6;
+
+ // This message is used when an error occurs.
+ ErrorResponse error_response = 7;
+ }
+}
+
+// Serialized FileDescriptorProto messages sent by the server answering
+// a file_by_filename, file_containing_symbol, or file_containing_extension
+// request.
+message FileDescriptorResponse {
+ // Serialized FileDescriptorProto messages. We avoid taking a dependency on
+ // descriptor.proto, which uses proto2 only features, by making them opaque
+ // bytes instead.
+ repeated bytes file_descriptor_proto = 1;
+}
+
+// A list of extension numbers sent by the server answering
+// all_extension_numbers_of_type request.
+message ExtensionNumberResponse {
+ // Full name of the base type, including the package name. The format
+ // is <package>.<type>
+ string base_type_name = 1;
+ repeated int32 extension_number = 2;
+}
+
+// A list of ServiceResponse sent by the server answering list_services request.
+message ListServiceResponse {
+ // The information of each service may be expanded in the future, so we use
+ // ServiceResponse message to encapsulate it.
+ repeated ServiceResponse service = 1;
+}
+
+// The information of a single service used by ListServiceResponse to answer
+// list_services request.
+message ServiceResponse {
+ // Full name of a registered service, including its package name. The format
+ // is <package>.<service>
+ string name = 1;
+}
+
+// The error code and error message sent by the server when an error occurs.
+message ErrorResponse {
+ // This field uses the error codes defined in grpc::StatusCode.
+ int32 error_code = 1;
+ string error_message = 2;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/compiler_test.proto b/contrib/libs/grpc/src/proto/grpc/testing/compiler_test.proto
index 0cbbc0df1a..9fa5590a59 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/compiler_test.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/compiler_test.proto
@@ -1,52 +1,52 @@
// Copyright 2016 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.
-
-// File detached comment 1
-
-// File detached comment 2
-
-// File leading comment 1
-syntax = "proto3";
-
-// Ignored detached comment
+
+// File detached comment 1
+
+// File detached comment 2
+
+// File leading comment 1
+syntax = "proto3";
+
+// Ignored detached comment
// The comments in this file are not meant for readability
// but rather to test to make sure that the code generator
// properly preserves comments on files, services, and RPCs
-
-// Ignored package leading comment
-package grpc.testing;
-
-message Request {
-}
-message Response {
-}
-
-// ServiceA detached comment 1
-
-// ServiceA detached comment 2
-
-// ServiceA leading comment 1
-service ServiceA {
- // MethodA1 leading comment 1
- rpc MethodA1(Request) returns (Response); // MethodA1 trailing comment 1
-
- // MethodA2 detached leading comment 1
-
- // Method A2 leading comment 1
- // Method A2 leading comment 2
- rpc MethodA2(stream Request) returns (Response);
- // MethodA2 trailing comment 1
+
+// Ignored package leading comment
+package grpc.testing;
+
+message Request {
+}
+message Response {
+}
+
+// ServiceA detached comment 1
+
+// ServiceA detached comment 2
+
+// ServiceA leading comment 1
+service ServiceA {
+ // MethodA1 leading comment 1
+ rpc MethodA1(Request) returns (Response); // MethodA1 trailing comment 1
+
+ // MethodA2 detached leading comment 1
+
+ // Method A2 leading comment 1
+ // Method A2 leading comment 2
+ rpc MethodA2(stream Request) returns (Response);
+ // MethodA2 trailing comment 1
// Method A3 leading comment 1
rpc MethodA3(Request) returns (stream Response);
@@ -55,17 +55,17 @@ service ServiceA {
// Method A4 leading comment 1
rpc MethodA4(stream Request) returns (stream Response);
// Method A4 trailing comment 1
-}
-// Ignored ServiceA trailing comment 1
-
-// ServiceB leading comment 1
-service ServiceB {
- // ServiceB trailing comment 1
-
- // MethodB1 leading comment 1
- rpc MethodB1(Request) returns (Response);
- // MethodB1 trailing comment 1
-}
-// Ignored ServiceB trailing comment 2
-
-// Ignored file trailing comment
+}
+// Ignored ServiceA trailing comment 1
+
+// ServiceB leading comment 1
+service ServiceB {
+ // ServiceB trailing comment 1
+
+ // MethodB1 leading comment 1
+ rpc MethodB1(Request) returns (Response);
+ // MethodB1 trailing comment 1
+}
+// Ignored ServiceB trailing comment 2
+
+// Ignored file trailing comment
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/control.proto b/contrib/libs/grpc/src/proto/grpc/testing/control.proto
index 0356a4266a..742b21926e 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/control.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/control.proto
@@ -1,109 +1,109 @@
// 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.
-
-syntax = "proto3";
-
-import "src/proto/grpc/testing/payloads.proto";
-import "src/proto/grpc/testing/stats.proto";
-
-package grpc.testing;
-
-enum ClientType {
- // Many languages support a basic distinction between using
- // sync or async client, and this allows the specification
- SYNC_CLIENT = 0;
- ASYNC_CLIENT = 1;
- OTHER_CLIENT = 2; // used for some language-specific variants
+
+syntax = "proto3";
+
+import "src/proto/grpc/testing/payloads.proto";
+import "src/proto/grpc/testing/stats.proto";
+
+package grpc.testing;
+
+enum ClientType {
+ // Many languages support a basic distinction between using
+ // sync or async client, and this allows the specification
+ SYNC_CLIENT = 0;
+ ASYNC_CLIENT = 1;
+ OTHER_CLIENT = 2; // used for some language-specific variants
CALLBACK_CLIENT = 3;
-}
-
-enum ServerType {
- SYNC_SERVER = 0;
- ASYNC_SERVER = 1;
- ASYNC_GENERIC_SERVER = 2;
- OTHER_SERVER = 3; // used for some language-specific variants
+}
+
+enum ServerType {
+ SYNC_SERVER = 0;
+ ASYNC_SERVER = 1;
+ ASYNC_GENERIC_SERVER = 2;
+ OTHER_SERVER = 3; // used for some language-specific variants
CALLBACK_SERVER = 4;
-}
-
-enum RpcType {
- UNARY = 0;
- STREAMING = 1;
+}
+
+enum RpcType {
+ UNARY = 0;
+ STREAMING = 1;
STREAMING_FROM_CLIENT = 2;
STREAMING_FROM_SERVER = 3;
STREAMING_BOTH_WAYS = 4;
-}
-
-// Parameters of poisson process distribution, which is a good representation
-// of activity coming in from independent identical stationary sources.
-message PoissonParams {
- // The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
- double offered_load = 1;
-}
-
-// Once an RPC finishes, immediately start a new one.
-// No configuration parameters needed.
-message ClosedLoopParams {}
-
-message LoadParams {
- oneof load {
- ClosedLoopParams closed_loop = 1;
- PoissonParams poisson = 2;
- };
-}
-
-// presence of SecurityParams implies use of TLS
-message SecurityParams {
- bool use_test_ca = 1;
- string server_host_override = 2;
+}
+
+// Parameters of poisson process distribution, which is a good representation
+// of activity coming in from independent identical stationary sources.
+message PoissonParams {
+ // The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
+ double offered_load = 1;
+}
+
+// Once an RPC finishes, immediately start a new one.
+// No configuration parameters needed.
+message ClosedLoopParams {}
+
+message LoadParams {
+ oneof load {
+ ClosedLoopParams closed_loop = 1;
+ PoissonParams poisson = 2;
+ };
+}
+
+// presence of SecurityParams implies use of TLS
+message SecurityParams {
+ bool use_test_ca = 1;
+ string server_host_override = 2;
string cred_type = 3;
-}
-
-message ChannelArg {
- string name = 1;
- oneof value {
- string str_value = 2;
- int32 int_value = 3;
- }
-}
-
-message ClientConfig {
- // List of targets to connect to. At least one target needs to be specified.
- repeated string server_targets = 1;
- ClientType client_type = 2;
- SecurityParams security_params = 3;
- // How many concurrent RPCs to start for each channel.
- // For synchronous client, use a separate thread for each outstanding RPC.
- int32 outstanding_rpcs_per_channel = 4;
- // Number of independent client channels to create.
- // i-th channel will connect to server_target[i % server_targets.size()]
- int32 client_channels = 5;
- // Only for async client. Number of threads to use to start/manage RPCs.
- int32 async_client_threads = 7;
- RpcType rpc_type = 8;
- // The requested load for the entire client (aggregated over all the threads).
- LoadParams load_params = 10;
- PayloadConfig payload_config = 11;
- HistogramParams histogram_params = 12;
-
- // Specify the cores we should run the client on, if desired
- repeated int32 core_list = 13;
- int32 core_limit = 14;
-
- // If we use an OTHER_CLIENT client_type, this string gives more detail
- string other_client_api = 15;
-
- repeated ChannelArg channel_args = 16;
+}
+
+message ChannelArg {
+ string name = 1;
+ oneof value {
+ string str_value = 2;
+ int32 int_value = 3;
+ }
+}
+
+message ClientConfig {
+ // List of targets to connect to. At least one target needs to be specified.
+ repeated string server_targets = 1;
+ ClientType client_type = 2;
+ SecurityParams security_params = 3;
+ // How many concurrent RPCs to start for each channel.
+ // For synchronous client, use a separate thread for each outstanding RPC.
+ int32 outstanding_rpcs_per_channel = 4;
+ // Number of independent client channels to create.
+ // i-th channel will connect to server_target[i % server_targets.size()]
+ int32 client_channels = 5;
+ // Only for async client. Number of threads to use to start/manage RPCs.
+ int32 async_client_threads = 7;
+ RpcType rpc_type = 8;
+ // The requested load for the entire client (aggregated over all the threads).
+ LoadParams load_params = 10;
+ PayloadConfig payload_config = 11;
+ HistogramParams histogram_params = 12;
+
+ // Specify the cores we should run the client on, if desired
+ repeated int32 core_list = 13;
+ int32 core_limit = 14;
+
+ // If we use an OTHER_CLIENT client_type, this string gives more detail
+ string other_client_api = 15;
+
+ repeated ChannelArg channel_args = 16;
// Number of threads that share each completion queue
int32 threads_per_cq = 17;
@@ -120,143 +120,143 @@ message ClientConfig {
// Number of client processes. 0 indicates no restriction.
int32 client_processes = 21;
-}
-
-message ClientStatus { ClientStats stats = 1; }
-
-// Request current stats
-message Mark {
- // if true, the stats will be reset after taking their snapshot.
- bool reset = 1;
-}
-
-message ClientArgs {
- oneof argtype {
- ClientConfig setup = 1;
- Mark mark = 2;
- }
-}
-
-message ServerConfig {
- ServerType server_type = 1;
- SecurityParams security_params = 2;
- // Port on which to listen. Zero means pick unused port.
- int32 port = 4;
- // Only for async server. Number of threads used to serve the requests.
- int32 async_server_threads = 7;
- // Specify the number of cores to limit server to, if desired
- int32 core_limit = 8;
+}
+
+message ClientStatus { ClientStats stats = 1; }
+
+// Request current stats
+message Mark {
+ // if true, the stats will be reset after taking their snapshot.
+ bool reset = 1;
+}
+
+message ClientArgs {
+ oneof argtype {
+ ClientConfig setup = 1;
+ Mark mark = 2;
+ }
+}
+
+message ServerConfig {
+ ServerType server_type = 1;
+ SecurityParams security_params = 2;
+ // Port on which to listen. Zero means pick unused port.
+ int32 port = 4;
+ // Only for async server. Number of threads used to serve the requests.
+ int32 async_server_threads = 7;
+ // Specify the number of cores to limit server to, if desired
+ int32 core_limit = 8;
// payload config, used in generic server.
// Note this must NOT be used in proto (non-generic) servers. For proto servers,
// 'response sizes' must be configured from the 'response_size' field of the
// 'SimpleRequest' objects in RPC requests.
- PayloadConfig payload_config = 9;
-
- // Specify the cores we should run the server on, if desired
- repeated int32 core_list = 10;
-
- // If we use an OTHER_SERVER client_type, this string gives more detail
- string other_server_api = 11;
-
+ PayloadConfig payload_config = 9;
+
+ // Specify the cores we should run the server on, if desired
+ repeated int32 core_list = 10;
+
+ // If we use an OTHER_SERVER client_type, this string gives more detail
+ string other_server_api = 11;
+
// Number of threads that share each completion queue
int32 threads_per_cq = 12;
- // c++-only options (for now) --------------------------------
-
- // Buffer pool size (no buffer pool specified if unset)
- int32 resource_quota_size = 1001;
+ // c++-only options (for now) --------------------------------
+
+ // Buffer pool size (no buffer pool specified if unset)
+ int32 resource_quota_size = 1001;
repeated ChannelArg channel_args = 1002;
// Number of server processes. 0 indicates no restriction.
int32 server_processes = 21;
-}
-
-message ServerArgs {
- oneof argtype {
- ServerConfig setup = 1;
- Mark mark = 2;
- }
-}
-
-message ServerStatus {
- ServerStats stats = 1;
- // the port bound by the server
- int32 port = 2;
- // Number of cores available to the server
- int32 cores = 3;
-}
-
-message CoreRequest {
-}
-
-message CoreResponse {
- // Number of cores available on the server
- int32 cores = 1;
-}
-
-message Void {
-}
-
-// A single performance scenario: input to qps_json_driver
-message Scenario {
- // Human readable name for this scenario
- string name = 1;
- // Client configuration
- ClientConfig client_config = 2;
- // Number of clients to start for the test
- int32 num_clients = 3;
- // Server configuration
- ServerConfig server_config = 4;
- // Number of servers to start for the test
- int32 num_servers = 5;
- // Warmup period, in seconds
- int32 warmup_seconds = 6;
- // Benchmark time, in seconds
- int32 benchmark_seconds = 7;
- // Number of workers to spawn locally (usually zero)
- int32 spawn_local_worker_count = 8;
-}
-
-// A set of scenarios to be run with qps_json_driver
-message Scenarios {
- repeated Scenario scenarios = 1;
-}
-
-// Basic summary that can be computed from ClientStats and ServerStats
-// once the scenario has finished.
-message ScenarioResultSummary
-{
+}
+
+message ServerArgs {
+ oneof argtype {
+ ServerConfig setup = 1;
+ Mark mark = 2;
+ }
+}
+
+message ServerStatus {
+ ServerStats stats = 1;
+ // the port bound by the server
+ int32 port = 2;
+ // Number of cores available to the server
+ int32 cores = 3;
+}
+
+message CoreRequest {
+}
+
+message CoreResponse {
+ // Number of cores available on the server
+ int32 cores = 1;
+}
+
+message Void {
+}
+
+// A single performance scenario: input to qps_json_driver
+message Scenario {
+ // Human readable name for this scenario
+ string name = 1;
+ // Client configuration
+ ClientConfig client_config = 2;
+ // Number of clients to start for the test
+ int32 num_clients = 3;
+ // Server configuration
+ ServerConfig server_config = 4;
+ // Number of servers to start for the test
+ int32 num_servers = 5;
+ // Warmup period, in seconds
+ int32 warmup_seconds = 6;
+ // Benchmark time, in seconds
+ int32 benchmark_seconds = 7;
+ // Number of workers to spawn locally (usually zero)
+ int32 spawn_local_worker_count = 8;
+}
+
+// A set of scenarios to be run with qps_json_driver
+message Scenarios {
+ repeated Scenario scenarios = 1;
+}
+
+// Basic summary that can be computed from ClientStats and ServerStats
+// once the scenario has finished.
+message ScenarioResultSummary
+{
// Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios:
// For unary benchmarks, an operation is processing of a single unary RPC.
// For streaming benchmarks, an operation is processing of a single ping pong of request and response.
- double qps = 1;
+ double qps = 1;
// QPS per server core.
- double qps_per_server_core = 2;
+ double qps_per_server_core = 2;
// The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core.
// For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server
// processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores.
// Same explanation for the total client cpu load below.
- double server_system_time = 3;
+ double server_system_time = 3;
// The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%)
- double server_user_time = 4;
+ double server_user_time = 4;
// The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%)
- double client_system_time = 5;
+ double client_system_time = 5;
// The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%)
- double client_user_time = 6;
-
- // X% latency percentiles (in nanoseconds)
- double latency_50 = 7;
- double latency_90 = 8;
- double latency_95 = 9;
- double latency_99 = 10;
- double latency_999 = 11;
-
- // server cpu usage percentage
- double server_cpu_usage = 12;
-
- // Number of requests that succeeded/failed
- double successful_requests_per_second = 13;
- double failed_requests_per_second = 14;
+ double client_user_time = 6;
+
+ // X% latency percentiles (in nanoseconds)
+ double latency_50 = 7;
+ double latency_90 = 8;
+ double latency_95 = 9;
+ double latency_99 = 10;
+ double latency_999 = 11;
+
+ // server cpu usage percentage
+ double server_cpu_usage = 12;
+
+ // Number of requests that succeeded/failed
+ double successful_requests_per_second = 13;
+ double failed_requests_per_second = 14;
// Number of polls called inside completion queue per request
double client_polls_per_request = 15;
@@ -265,25 +265,25 @@ message ScenarioResultSummary
// Queries per CPU-sec over all servers or clients
double server_queries_per_cpu_sec = 17;
double client_queries_per_cpu_sec = 18;
-}
-
-// Results of a single benchmark scenario.
-message ScenarioResult {
- // Inputs used to run the scenario.
- Scenario scenario = 1;
- // Histograms from all clients merged into one histogram.
- HistogramData latencies = 2;
- // Client stats for each client
- repeated ClientStats client_stats = 3;
- // Server stats for each server
- repeated ServerStats server_stats = 4;
- // Number of cores available to each server
- repeated int32 server_cores = 5;
- // An after-the-fact computed summary
- ScenarioResultSummary summary = 6;
- // Information on success or failure of each worker
- repeated bool client_success = 7;
- repeated bool server_success = 8;
- // Number of failed requests (one row per status code seen)
- repeated RequestResultCount request_results = 9;
-}
+}
+
+// Results of a single benchmark scenario.
+message ScenarioResult {
+ // Inputs used to run the scenario.
+ Scenario scenario = 1;
+ // Histograms from all clients merged into one histogram.
+ HistogramData latencies = 2;
+ // Client stats for each client
+ repeated ClientStats client_stats = 3;
+ // Server stats for each server
+ repeated ServerStats server_stats = 4;
+ // Number of cores available to each server
+ repeated int32 server_cores = 5;
+ // An after-the-fact computed summary
+ ScenarioResultSummary summary = 6;
+ // Information on success or failure of each worker
+ repeated bool client_success = 7;
+ repeated bool server_success = 8;
+ // Number of failed requests (one row per status code seen)
+ repeated RequestResultCount request_results = 9;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/duplicate/echo_duplicate.proto b/contrib/libs/grpc/src/proto/grpc/testing/duplicate/echo_duplicate.proto
index ac093217d9..24b7ee0a24 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/duplicate/echo_duplicate.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/duplicate/echo_duplicate.proto
@@ -1,27 +1,27 @@
-
+
// 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.
-
-// This is a partial copy of echo.proto with a different package name.
-
-syntax = "proto3";
-
-import "src/proto/grpc/testing/echo_messages.proto";
-
-package grpc.testing.duplicate;
-
-service EchoTestService {
- rpc Echo(grpc.testing.EchoRequest) returns (grpc.testing.EchoResponse);
- rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
-}
+
+// This is a partial copy of echo.proto with a different package name.
+
+syntax = "proto3";
+
+import "src/proto/grpc/testing/echo_messages.proto";
+
+package grpc.testing.duplicate;
+
+service EchoTestService {
+ rpc Echo(grpc.testing.EchoRequest) returns (grpc.testing.EchoResponse);
+ rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/echo.proto b/contrib/libs/grpc/src/proto/grpc/testing/echo.proto
index bffd53ade5..33db111864 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/echo.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/echo.proto
@@ -1,27 +1,27 @@
-
+
// 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.
-
-syntax = "proto3";
-
+
+syntax = "proto3";
+
package grpc.testing;
-import "src/proto/grpc/testing/echo_messages.proto";
+import "src/proto/grpc/testing/echo_messages.proto";
import "src/proto/grpc/testing/simple_messages.proto";
-
-service EchoTestService {
- rpc Echo(EchoRequest) returns (EchoResponse);
+
+service EchoTestService {
+ rpc Echo(EchoRequest) returns (EchoResponse);
rpc Echo1(EchoRequest) returns (EchoResponse);
rpc Echo2(EchoRequest) returns (EchoResponse);
rpc CheckDeadlineUpperBound(SimpleRequest42) returns (StringValue);
@@ -29,12 +29,12 @@ service EchoTestService {
// A service which checks that the initial metadata sent over contains some
// expected key value pair
rpc CheckClientInitialMetadata(SimpleRequest42) returns (SimpleResponse42);
- rpc RequestStream(stream EchoRequest) returns (EchoResponse);
- rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
- rpc BidiStream(stream EchoRequest) returns (stream EchoResponse);
- rpc Unimplemented(EchoRequest) returns (EchoResponse);
-}
-
+ rpc RequestStream(stream EchoRequest) returns (EchoResponse);
+ rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
+ rpc BidiStream(stream EchoRequest) returns (stream EchoResponse);
+ rpc Unimplemented(EchoRequest) returns (EchoResponse);
+}
+
service EchoTest1Service {
rpc Echo(EchoRequest) returns (EchoResponse);
rpc Echo1(EchoRequest) returns (EchoResponse);
@@ -61,9 +61,9 @@ service EchoTest2Service {
rpc Unimplemented(EchoRequest) returns (EchoResponse);
}
-service UnimplementedEchoService {
- rpc Unimplemented(EchoRequest) returns (EchoResponse);
-}
-
-// A service without any rpc defined to test coverage.
+service UnimplementedEchoService {
+ rpc Unimplemented(EchoRequest) returns (EchoResponse);
+}
+
+// A service without any rpc defined to test coverage.
service NoRpcService {}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/echo_messages.proto b/contrib/libs/grpc/src/proto/grpc/testing/echo_messages.proto
index 45b435feac..6f1e5f3404 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/echo_messages.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/echo_messages.proto
@@ -1,30 +1,30 @@
-
+
// 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.
-
-syntax = "proto3";
-
-package grpc.testing;
-
+
+syntax = "proto3";
+
+package grpc.testing;
+
option cc_enable_arenas = true;
-// Message to be echoed back serialized in trailer.
-message DebugInfo {
- repeated string stack_entries = 1;
- string detail = 2;
-}
-
+// Message to be echoed back serialized in trailer.
+message DebugInfo {
+ repeated string stack_entries = 1;
+ string detail = 2;
+}
+
// Error status client expects to see.
message ErrorStatus {
int32 code = 1;
@@ -32,18 +32,18 @@ message ErrorStatus {
string binary_error_details = 3;
}
-message RequestParams {
- bool echo_deadline = 1;
- int32 client_cancel_after_us = 2;
- int32 server_cancel_after_us = 3;
- bool echo_metadata = 4;
- bool check_auth_context = 5;
- int32 response_message_length = 6;
- bool echo_peer = 7;
- string expected_client_identity = 8; // will force check_auth_context.
- bool skip_cancelled_check = 9;
- string expected_transport_security_type = 10;
- DebugInfo debug_info = 11;
+message RequestParams {
+ bool echo_deadline = 1;
+ int32 client_cancel_after_us = 2;
+ int32 server_cancel_after_us = 3;
+ bool echo_metadata = 4;
+ bool check_auth_context = 5;
+ int32 response_message_length = 6;
+ bool echo_peer = 7;
+ string expected_client_identity = 8; // will force check_auth_context.
+ bool skip_cancelled_check = 9;
+ string expected_transport_security_type = 10;
+ DebugInfo debug_info = 11;
bool server_die = 12; // Server should not see a request with this set.
string binary_error_details = 13;
ErrorStatus expected_error = 14;
@@ -51,20 +51,20 @@ message RequestParams {
int32 backend_channel_idx = 16; // which backend to send request to
bool echo_metadata_initially = 17;
bool server_notify_client_when_started = 18;
-}
-
-message EchoRequest {
- string message = 1;
- RequestParams param = 2;
-}
-
-message ResponseParams {
- int64 request_deadline = 1;
- string host = 2;
- string peer = 3;
-}
-
-message EchoResponse {
- string message = 1;
- ResponseParams param = 2;
-}
+}
+
+message EchoRequest {
+ string message = 1;
+ RequestParams param = 2;
+}
+
+message ResponseParams {
+ int64 request_deadline = 1;
+ string host = 2;
+ string peer = 3;
+}
+
+message EchoResponse {
+ string message = 1;
+ ResponseParams param = 2;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/empty.proto b/contrib/libs/grpc/src/proto/grpc/testing/empty.proto
index c469ca12d4..6a0aa88dfd 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/empty.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/empty.proto
@@ -1,28 +1,28 @@
-
+
// 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.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-// An empty message that you can re-use to avoid defining duplicated empty
-// messages in your project. A typical example is to use it as argument or the
-// return value of a service API. For instance:
-//
-// service Foo {
-// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
-// };
-//
-message Empty {}
+
+syntax = "proto3";
+
+package grpc.testing;
+
+// An empty message that you can re-use to avoid defining duplicated empty
+// messages in your project. A typical example is to use it as argument or the
+// return value of a service API. For instance:
+//
+// service Foo {
+// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
+// };
+//
+message Empty {}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/messages.proto b/contrib/libs/grpc/src/proto/grpc/testing/messages.proto
index d1e3cefe98..70e3427760 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/messages.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/messages.proto
@@ -1,53 +1,53 @@
-
+
// Copyright 2015-2016 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.
-
-// Message definitions to be used by integration test service definitions.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-// TODO(dgq): Go back to using well-known types once
-// https://github.com/grpc/grpc/issues/6980 has been fixed.
-// import "google/protobuf/wrappers.proto";
-message BoolValue {
- // The bool value.
- bool value = 1;
-}
-
-// The type of payload that should be returned.
-enum PayloadType {
- // Compressable text format.
- COMPRESSABLE = 0;
-}
-
-// A block of data, to simply increase gRPC message size.
-message Payload {
- // The type of data in body.
- PayloadType type = 1;
- // Primary contents of payload.
- bytes body = 2;
-}
-
-// A protobuf representation for grpc status. This is used by test
-// clients to specify a status that the server should attempt to return.
-message EchoStatus {
- int32 code = 1;
- string message = 2;
-}
-
+
+// Message definitions to be used by integration test service definitions.
+
+syntax = "proto3";
+
+package grpc.testing;
+
+// TODO(dgq): Go back to using well-known types once
+// https://github.com/grpc/grpc/issues/6980 has been fixed.
+// import "google/protobuf/wrappers.proto";
+message BoolValue {
+ // The bool value.
+ bool value = 1;
+}
+
+// The type of payload that should be returned.
+enum PayloadType {
+ // Compressable text format.
+ COMPRESSABLE = 0;
+}
+
+// A block of data, to simply increase gRPC message size.
+message Payload {
+ // The type of data in body.
+ PayloadType type = 1;
+ // Primary contents of payload.
+ bytes body = 2;
+}
+
+// A protobuf representation for grpc status. This is used by test
+// clients to specify a status that the server should attempt to return.
+message EchoStatus {
+ int32 code = 1;
+ string message = 2;
+}
+
// The type of route that a client took to reach a server w.r.t. gRPCLB.
// The server must fill in "fallback" if it detects that the RPC reached
// the server via the "gRPCLB fallback" path, and "backend" if it detects
@@ -63,52 +63,52 @@ enum GrpclbRouteType {
GRPCLB_ROUTE_TYPE_BACKEND = 2;
}
-// Unary request.
-message SimpleRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, server randomly chooses one from other formats.
- PayloadType response_type = 1;
-
- // Desired payload size in the response from the server.
- int32 response_size = 2;
-
- // Optional input payload sent along with the request.
- Payload payload = 3;
-
- // Whether SimpleResponse should include username.
- bool fill_username = 4;
-
- // Whether SimpleResponse should include OAuth scope.
- bool fill_oauth_scope = 5;
-
- // Whether to request the server to compress the response. This field is
- // "nullable" in order to interoperate seamlessly with clients not able to
- // implement the full compression tests by introspecting the call to verify
- // the response's compression status.
- BoolValue response_compressed = 6;
-
- // Whether server should return a given status
- EchoStatus response_status = 7;
-
- // Whether the server should expect this request to be compressed.
- BoolValue expect_compressed = 8;
+// Unary request.
+message SimpleRequest {
+ // Desired payload type in the response from the server.
+ // If response_type is RANDOM, server randomly chooses one from other formats.
+ PayloadType response_type = 1;
+
+ // Desired payload size in the response from the server.
+ int32 response_size = 2;
+
+ // Optional input payload sent along with the request.
+ Payload payload = 3;
+
+ // Whether SimpleResponse should include username.
+ bool fill_username = 4;
+
+ // Whether SimpleResponse should include OAuth scope.
+ bool fill_oauth_scope = 5;
+
+ // Whether to request the server to compress the response. This field is
+ // "nullable" in order to interoperate seamlessly with clients not able to
+ // implement the full compression tests by introspecting the call to verify
+ // the response's compression status.
+ BoolValue response_compressed = 6;
+
+ // Whether server should return a given status
+ EchoStatus response_status = 7;
+
+ // Whether the server should expect this request to be compressed.
+ BoolValue expect_compressed = 8;
// Whether SimpleResponse should include server_id.
bool fill_server_id = 9;
// Whether SimpleResponse should include grpclb_route_type.
bool fill_grpclb_route_type = 10;
-}
-
-// Unary response, as configured by the request.
-message SimpleResponse {
- // Payload to increase message size.
- Payload payload = 1;
- // The user the request came from, for verifying authentication was
- // successful when the client expected it.
- string username = 2;
- // OAuth scope.
- string oauth_scope = 3;
+}
+
+// Unary response, as configured by the request.
+message SimpleResponse {
+ // Payload to increase message size.
+ Payload payload = 1;
+ // The user the request came from, for verifying authentication was
+ // successful when the client expected it.
+ string username = 2;
+ // OAuth scope.
+ string oauth_scope = 3;
// Server ID. This must be unique among different server instances,
// but the same across all RPC's made to a particular server instance.
@@ -118,81 +118,81 @@ message SimpleResponse {
// Server hostname.
string hostname = 6;
-}
-
-// Client-streaming request.
-message StreamingInputCallRequest {
- // Optional input payload sent along with the request.
- Payload payload = 1;
-
- // Whether the server should expect this request to be compressed. This field
- // is "nullable" in order to interoperate seamlessly with servers not able to
- // implement the full compression tests by introspecting the call to verify
- // the request's compression status.
- BoolValue expect_compressed = 2;
-
- // Not expecting any payload from the response.
-}
-
-// Client-streaming response.
-message StreamingInputCallResponse {
- // Aggregated size of payloads received from the client.
- int32 aggregated_payload_size = 1;
-}
-
-// Configuration for a particular response.
-message ResponseParameters {
- // Desired payload sizes in responses from the server.
- int32 size = 1;
-
- // Desired interval between consecutive responses in the response stream in
- // microseconds.
- int32 interval_us = 2;
-
- // Whether to request the server to compress the response. This field is
- // "nullable" in order to interoperate seamlessly with clients not able to
- // implement the full compression tests by introspecting the call to verify
- // the response's compression status.
- BoolValue compressed = 3;
-}
-
-// Server-streaming request.
-message StreamingOutputCallRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, the payload from each response in the stream
- // might be of different types. This is to simulate a mixed type of payload
- // stream.
- PayloadType response_type = 1;
-
- // Configuration for each expected response message.
- repeated ResponseParameters response_parameters = 2;
-
- // Optional input payload sent along with the request.
- Payload payload = 3;
-
- // Whether server should return a given status
- EchoStatus response_status = 7;
-}
-
-// Server-streaming response, as configured by the request and parameters.
-message StreamingOutputCallResponse {
- // Payload to increase response size.
- Payload payload = 1;
-}
-
-// For reconnect interop test only.
-// Client tells server what reconnection parameters it used.
-message ReconnectParams {
- int32 max_reconnect_backoff_ms = 1;
-}
-
-// For reconnect interop test only.
-// Server tells client whether its reconnects are following the spec and the
-// reconnect backoffs it saw.
-message ReconnectInfo {
- bool passed = 1;
- repeated int32 backoff_ms = 2;
-}
+}
+
+// Client-streaming request.
+message StreamingInputCallRequest {
+ // Optional input payload sent along with the request.
+ Payload payload = 1;
+
+ // Whether the server should expect this request to be compressed. This field
+ // is "nullable" in order to interoperate seamlessly with servers not able to
+ // implement the full compression tests by introspecting the call to verify
+ // the request's compression status.
+ BoolValue expect_compressed = 2;
+
+ // Not expecting any payload from the response.
+}
+
+// Client-streaming response.
+message StreamingInputCallResponse {
+ // Aggregated size of payloads received from the client.
+ int32 aggregated_payload_size = 1;
+}
+
+// Configuration for a particular response.
+message ResponseParameters {
+ // Desired payload sizes in responses from the server.
+ int32 size = 1;
+
+ // Desired interval between consecutive responses in the response stream in
+ // microseconds.
+ int32 interval_us = 2;
+
+ // Whether to request the server to compress the response. This field is
+ // "nullable" in order to interoperate seamlessly with clients not able to
+ // implement the full compression tests by introspecting the call to verify
+ // the response's compression status.
+ BoolValue compressed = 3;
+}
+
+// Server-streaming request.
+message StreamingOutputCallRequest {
+ // Desired payload type in the response from the server.
+ // If response_type is RANDOM, the payload from each response in the stream
+ // might be of different types. This is to simulate a mixed type of payload
+ // stream.
+ PayloadType response_type = 1;
+
+ // Configuration for each expected response message.
+ repeated ResponseParameters response_parameters = 2;
+
+ // Optional input payload sent along with the request.
+ Payload payload = 3;
+
+ // Whether server should return a given status
+ EchoStatus response_status = 7;
+}
+
+// Server-streaming response, as configured by the request and parameters.
+message StreamingOutputCallResponse {
+ // Payload to increase response size.
+ Payload payload = 1;
+}
+
+// For reconnect interop test only.
+// Client tells server what reconnection parameters it used.
+message ReconnectParams {
+ int32 max_reconnect_backoff_ms = 1;
+}
+
+// For reconnect interop test only.
+// Server tells client whether its reconnects are following the spec and the
+// reconnect backoffs it saw.
+message ReconnectInfo {
+ bool passed = 1;
+ repeated int32 backoff_ms = 2;
+}
message LoadBalancerStatsRequest {
// Request stats for the next num_rpcs sent by client.
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/metrics.proto b/contrib/libs/grpc/src/proto/grpc/testing/metrics.proto
index 0b225ffe50..6950400643 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/metrics.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/metrics.proto
@@ -1,49 +1,49 @@
// Copyright 2015-2016 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.
-
-// Contains the definitions for a metrics service and the type of metrics
-// exposed by the service.
-//
-// Currently, 'Gauge' (i.e a metric that represents the measured value of
-// something at an instant of time) is the only metric type supported by the
-// service.
-syntax = "proto3";
-
-package grpc.testing;
-
+
+// Contains the definitions for a metrics service and the type of metrics
+// exposed by the service.
+//
+// Currently, 'Gauge' (i.e a metric that represents the measured value of
+// something at an instant of time) is the only metric type supported by the
+// service.
+syntax = "proto3";
+
+package grpc.testing;
+
// Response message containing the gauge name and value
-message GaugeResponse {
- string name = 1;
- oneof value {
- int64 long_value = 2;
- double double_value = 3;
- string string_value = 4;
- }
-}
-
-// Request message containing the gauge name
-message GaugeRequest {
- string name = 1;
-}
-
-message EmptyMessage {}
-
-service MetricsService {
- // Returns the values of all the gauges that are currently being maintained by
- // the service
- rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse);
-
- // Returns the value of one gauge
- rpc GetGauge(GaugeRequest) returns (GaugeResponse);
-}
+message GaugeResponse {
+ string name = 1;
+ oneof value {
+ int64 long_value = 2;
+ double double_value = 3;
+ string string_value = 4;
+ }
+}
+
+// Request message containing the gauge name
+message GaugeRequest {
+ string name = 1;
+}
+
+message EmptyMessage {}
+
+service MetricsService {
+ // Returns the values of all the gauges that are currently being maintained by
+ // the service
+ rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse);
+
+ // Returns the value of one gauge
+ rpc GetGauge(GaugeRequest) returns (GaugeResponse);
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/payloads.proto b/contrib/libs/grpc/src/proto/grpc/testing/payloads.proto
index cbbc815e4c..4feab92eab 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/payloads.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/payloads.proto
@@ -1,40 +1,40 @@
// 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.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-message ByteBufferParams {
- int32 req_size = 1;
- int32 resp_size = 2;
-}
-
-message SimpleProtoParams {
- int32 req_size = 1;
- int32 resp_size = 2;
-}
-
-message ComplexProtoParams {
- // TODO (vpai): Fill this in once the details of complex, representative
- // protos are decided
-}
-
-message PayloadConfig {
- oneof payload {
- ByteBufferParams bytebuf_params = 1;
- SimpleProtoParams simple_params = 2;
- ComplexProtoParams complex_params = 3;
- }
-}
+
+syntax = "proto3";
+
+package grpc.testing;
+
+message ByteBufferParams {
+ int32 req_size = 1;
+ int32 resp_size = 2;
+}
+
+message SimpleProtoParams {
+ int32 req_size = 1;
+ int32 resp_size = 2;
+}
+
+message ComplexProtoParams {
+ // TODO (vpai): Fill this in once the details of complex, representative
+ // protos are decided
+}
+
+message PayloadConfig {
+ oneof payload {
+ ByteBufferParams bytebuf_params = 1;
+ SimpleProtoParams simple_params = 2;
+ ComplexProtoParams complex_params = 3;
+ }
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2.proto b/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2.proto
index e02f336874..666862e6c2 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2.proto
@@ -1,22 +1,22 @@
-
+
// Copyright 2016 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.
-
-syntax = "proto2";
-
-package grpc.testing.proto2;
-
-message EmptyWithExtensions {
- extensions 100 to 999;
-}
+
+syntax = "proto2";
+
+package grpc.testing.proto2;
+
+message EmptyWithExtensions {
+ extensions 100 to 999;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2_extensions.proto b/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2_extensions.proto
index d9e7f71451..fca59f68c9 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2_extensions.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/proto2/empty2_extensions.proto
@@ -1,28 +1,28 @@
// Copyright 2016 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.
-
-syntax = "proto2";
-
-import "src/proto/grpc/testing/proto2/empty2.proto";
-
-package grpc.testing.proto2;
-
-// Fill emptiness with music.
-extend grpc.testing.proto2.EmptyWithExtensions {
- optional int64 Deadmau5 = 124;
- optional float Madeon = 125;
- optional string AboveAndBeyond = 126;
- optional bool Tycho = 127;
- optional fixed64 Pendulum = 128;
-}
+
+syntax = "proto2";
+
+import "src/proto/grpc/testing/proto2/empty2.proto";
+
+package grpc.testing.proto2;
+
+// Fill emptiness with music.
+extend grpc.testing.proto2.EmptyWithExtensions {
+ optional int64 Deadmau5 = 124;
+ optional float Madeon = 125;
+ optional string AboveAndBeyond = 126;
+ optional bool Tycho = 127;
+ optional fixed64 Pendulum = 128;
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/stats.proto b/contrib/libs/grpc/src/proto/grpc/testing/stats.proto
index 0bf9be7a9e..a0f84ddbce 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/stats.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/stats.proto
@@ -1,83 +1,83 @@
// 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.
-
-syntax = "proto3";
-
-package grpc.testing;
-
+
+syntax = "proto3";
+
+package grpc.testing;
+
import "src/proto/grpc/core/stats.proto";
-message ServerStats {
- // wall clock time change in seconds since last reset
- double time_elapsed = 1;
-
- // change in user time (in seconds) used by the server since last reset
- double time_user = 2;
-
- // change in server time (in seconds) used by the server process and all
- // threads since last reset
- double time_system = 3;
-
- // change in total cpu time of the server (data from proc/stat)
- uint64 total_cpu_time = 4;
-
- // change in idle time of the server (data from proc/stat)
- uint64 idle_cpu_time = 5;
+message ServerStats {
+ // wall clock time change in seconds since last reset
+ double time_elapsed = 1;
+
+ // change in user time (in seconds) used by the server since last reset
+ double time_user = 2;
+
+ // change in server time (in seconds) used by the server process and all
+ // threads since last reset
+ double time_system = 3;
+
+ // change in total cpu time of the server (data from proc/stat)
+ uint64 total_cpu_time = 4;
+
+ // change in idle time of the server (data from proc/stat)
+ uint64 idle_cpu_time = 5;
// Number of polls called inside completion queue
uint64 cq_poll_count = 6;
// Core library stats
grpc.core.Stats core_stats = 7;
-}
-
-// Histogram params based on grpc/support/histogram.c
-message HistogramParams {
- double resolution = 1; // first bucket is [0, 1 + resolution)
- double max_possible = 2; // use enough buckets to allow this value
-}
-
-// Histogram data based on grpc/support/histogram.c
-message HistogramData {
- repeated uint32 bucket = 1;
- double min_seen = 2;
- double max_seen = 3;
- double sum = 4;
- double sum_of_squares = 5;
- double count = 6;
-}
-
-message RequestResultCount {
- int32 status_code = 1;
- int64 count = 2;
-}
-
-message ClientStats {
- // Latency histogram. Data points are in nanoseconds.
- HistogramData latencies = 1;
-
- // See ServerStats for details.
- double time_elapsed = 2;
- double time_user = 3;
- double time_system = 4;
-
- // Number of failed requests (one row per status code seen)
- repeated RequestResultCount request_results = 5;
+}
+
+// Histogram params based on grpc/support/histogram.c
+message HistogramParams {
+ double resolution = 1; // first bucket is [0, 1 + resolution)
+ double max_possible = 2; // use enough buckets to allow this value
+}
+
+// Histogram data based on grpc/support/histogram.c
+message HistogramData {
+ repeated uint32 bucket = 1;
+ double min_seen = 2;
+ double max_seen = 3;
+ double sum = 4;
+ double sum_of_squares = 5;
+ double count = 6;
+}
+
+message RequestResultCount {
+ int32 status_code = 1;
+ int64 count = 2;
+}
+
+message ClientStats {
+ // Latency histogram. Data points are in nanoseconds.
+ HistogramData latencies = 1;
+
+ // See ServerStats for details.
+ double time_elapsed = 2;
+ double time_user = 3;
+ double time_system = 4;
+
+ // Number of failed requests (one row per status code seen)
+ repeated RequestResultCount request_results = 5;
// Number of polls called inside completion queue
uint64 cq_poll_count = 6;
// Core library stats
grpc.core.Stats core_stats = 7;
-}
+}
diff --git a/contrib/libs/grpc/src/proto/grpc/testing/test.proto b/contrib/libs/grpc/src/proto/grpc/testing/test.proto
index 7cf561f7d3..1da43f4898 100644
--- a/contrib/libs/grpc/src/proto/grpc/testing/test.proto
+++ b/contrib/libs/grpc/src/proto/grpc/testing/test.proto
@@ -1,82 +1,82 @@
-
+
// Copyright 2015-2016 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 "src/proto/grpc/testing/empty.proto";
-import "src/proto/grpc/testing/messages.proto";
-
-package grpc.testing;
-
-// A simple service to test the various types of RPCs and experiment with
-// performance with various types of payload.
-service TestService {
- // One empty request followed by one empty response.
- rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);
-
- // One request followed by one response.
- rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by one response. Response has cache control
- // headers set such that a caching HTTP proxy (such as GFE) can
- // satisfy subsequent requests.
- rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by a sequence of responses (streamed download).
- // The server returns the payload with client desired type and sizes.
- rpc StreamingOutputCall(StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by one response (streamed upload).
- // The server returns the aggregated size of client payload as the result.
- rpc StreamingInputCall(stream StreamingInputCallRequest)
- returns (StreamingInputCallResponse);
-
- // A sequence of requests with each request served by the server immediately.
- // As one request could lead to multiple responses, this interface
- // demonstrates the idea of full duplexing.
- rpc FullDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by a sequence of responses.
- // The server buffers all the client requests and then serves them in order. A
- // stream of responses are returned to the client when the server starts with
- // first request.
- rpc HalfDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // The test server will not implement this method. It will be used
- // to test the behavior when clients call unimplemented methods.
- rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
-}
-
-// A simple service NOT implemented at servers so clients can test for
-// that case.
-service UnimplementedService {
- // A call that no server should implement
- rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
-}
-
-// A service used to control reconnect server.
-service ReconnectService {
- rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty);
- rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
-}
+
+// An integration test service that covers all the method signature permutations
+// of unary/streaming requests/responses.
+
+syntax = "proto3";
+
+import "src/proto/grpc/testing/empty.proto";
+import "src/proto/grpc/testing/messages.proto";
+
+package grpc.testing;
+
+// A simple service to test the various types of RPCs and experiment with
+// performance with various types of payload.
+service TestService {
+ // One empty request followed by one empty response.
+ rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);
+
+ // One request followed by one response.
+ rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
+
+ // One request followed by one response. Response has cache control
+ // headers set such that a caching HTTP proxy (such as GFE) can
+ // satisfy subsequent requests.
+ rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse);
+
+ // One request followed by a sequence of responses (streamed download).
+ // The server returns the payload with client desired type and sizes.
+ rpc StreamingOutputCall(StreamingOutputCallRequest)
+ returns (stream StreamingOutputCallResponse);
+
+ // A sequence of requests followed by one response (streamed upload).
+ // The server returns the aggregated size of client payload as the result.
+ rpc StreamingInputCall(stream StreamingInputCallRequest)
+ returns (StreamingInputCallResponse);
+
+ // A sequence of requests with each request served by the server immediately.
+ // As one request could lead to multiple responses, this interface
+ // demonstrates the idea of full duplexing.
+ rpc FullDuplexCall(stream StreamingOutputCallRequest)
+ returns (stream StreamingOutputCallResponse);
+
+ // A sequence of requests followed by a sequence of responses.
+ // The server buffers all the client requests and then serves them in order. A
+ // stream of responses are returned to the client when the server starts with
+ // first request.
+ rpc HalfDuplexCall(stream StreamingOutputCallRequest)
+ returns (stream StreamingOutputCallResponse);
+
+ // The test server will not implement this method. It will be used
+ // to test the behavior when clients call unimplemented methods.
+ rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
+}
+
+// A simple service NOT implemented at servers so clients can test for
+// that case.
+service UnimplementedService {
+ // A call that no server should implement
+ rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
+}
+
+// A service used to control reconnect server.
+service ReconnectService {
+ rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty);
+ rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
+}
// A service used to obtain stats for verifying LB behavior.
service LoadBalancerStatsService {
diff --git a/contrib/libs/grpc/src/proto/math/math.proto b/contrib/libs/grpc/src/proto/math/math.proto
index e72270310a..e60ba0d7cd 100644
--- a/contrib/libs/grpc/src/proto/math/math.proto
+++ b/contrib/libs/grpc/src/proto/math/math.proto
@@ -1,65 +1,65 @@
-
+
// 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.
-
-syntax = "proto3";
-
-package math;
-
-message DivArgs {
- int64 dividend = 1;
- int64 divisor = 2;
-}
-
-message DivReply {
- int64 quotient = 1;
- int64 remainder = 2;
-}
-
-message FibArgs {
- int64 limit = 1;
-}
-
-message Num {
- int64 num = 1;
-}
-
-message FibReply {
- int64 count = 1;
-}
-
-service Math {
- // Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
- // and remainder.
- rpc Div (DivArgs) returns (DivReply) {
- }
-
- // DivMany accepts an arbitrary number of division args from the client stream
- // and sends back the results in the reply stream. The stream continues until
- // the client closes its end; the server does the same after sending all the
- // replies. The stream ends immediately if either end aborts.
- rpc DivMany (stream DivArgs) returns (stream DivReply) {
- }
-
- // Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
- // generates up to limit numbers; otherwise it continues until the call is
- // canceled. Unlike Fib above, Fib has no final FibReply.
- rpc Fib (FibArgs) returns (stream Num) {
- }
-
- // Sum sums a stream of numbers, returning the final result once the stream
- // is closed.
- rpc Sum (stream Num) returns (Num) {
- }
-}
+
+syntax = "proto3";
+
+package math;
+
+message DivArgs {
+ int64 dividend = 1;
+ int64 divisor = 2;
+}
+
+message DivReply {
+ int64 quotient = 1;
+ int64 remainder = 2;
+}
+
+message FibArgs {
+ int64 limit = 1;
+}
+
+message Num {
+ int64 num = 1;
+}
+
+message FibReply {
+ int64 count = 1;
+}
+
+service Math {
+ // Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
+ // and remainder.
+ rpc Div (DivArgs) returns (DivReply) {
+ }
+
+ // DivMany accepts an arbitrary number of division args from the client stream
+ // and sends back the results in the reply stream. The stream continues until
+ // the client closes its end; the server does the same after sending all the
+ // replies. The stream ends immediately if either end aborts.
+ rpc DivMany (stream DivArgs) returns (stream DivReply) {
+ }
+
+ // Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
+ // generates up to limit numbers; otherwise it continues until the call is
+ // canceled. Unlike Fib above, Fib has no final FibReply.
+ rpc Fib (FibArgs) returns (stream Num) {
+ }
+
+ // Sum sums a stream of numbers, returning the final result once the stream
+ // is closed.
+ rpc Sum (stream Num) returns (Num) {
+ }
+}
diff --git a/contrib/libs/grpc/src/python/grpcio/README.rst b/contrib/libs/grpc/src/python/grpcio/README.rst
index fc053a673a..fe34ad5adf 100644
--- a/contrib/libs/grpc/src/python/grpcio/README.rst
+++ b/contrib/libs/grpc/src/python/grpcio/README.rst
@@ -1,10 +1,10 @@
-gRPC Python
-===========
-
+gRPC Python
+===========
+
|compat_check_pypi|
-Package for gRPC Python.
-
+Package for gRPC Python.
+
.. |compat_check_pypi| image:: https://python-compatibility-tools.appspot.com/one_badge_image?package=grpcio
:target: https://python-compatibility-tools.appspot.com/one_badge_target?package=grpcio
@@ -12,104 +12,104 @@ Supported Python Versions
-------------------------
Python >= 3.5
-Installation
-------------
-
+Installation
+------------
+
gRPC Python is available for Linux, macOS, and Windows.
-
+
Installing From PyPI
~~~~~~~~~~~~~~~~~~~~
-
-If you are installing locally...
-
-::
-
- $ pip install grpcio
-
-Else system wide (on Ubuntu)...
-
-::
-
- $ sudo pip install grpcio
-
-If you're on Windows make sure that you installed the :code:`pip.exe` component
-when you installed Python (if not go back and install it!) then invoke:
-
-::
-
- $ pip.exe install grpcio
-
-Windows users may need to invoke :code:`pip.exe` from a command line ran as
-administrator.
-
-n.b. On Windows and on Mac OS X one *must* have a recent release of :code:`pip`
-to retrieve the proper wheel from PyPI. Be sure to upgrade to the latest
-version!
-
+
+If you are installing locally...
+
+::
+
+ $ pip install grpcio
+
+Else system wide (on Ubuntu)...
+
+::
+
+ $ sudo pip install grpcio
+
+If you're on Windows make sure that you installed the :code:`pip.exe` component
+when you installed Python (if not go back and install it!) then invoke:
+
+::
+
+ $ pip.exe install grpcio
+
+Windows users may need to invoke :code:`pip.exe` from a command line ran as
+administrator.
+
+n.b. On Windows and on Mac OS X one *must* have a recent release of :code:`pip`
+to retrieve the proper wheel from PyPI. Be sure to upgrade to the latest
+version!
+
Installing From Source
~~~~~~~~~~~~~~~~~~~~~~
-
-Building from source requires that you have the Python headers (usually a
-package named :code:`python-dev`).
-
-::
-
- $ export REPO_ROOT=grpc # REPO_ROOT can be any directory of your choice
+
+Building from source requires that you have the Python headers (usually a
+package named :code:`python-dev`).
+
+::
+
+ $ export REPO_ROOT=grpc # REPO_ROOT can be any directory of your choice
$ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc $REPO_ROOT
- $ cd $REPO_ROOT
- $ git submodule update --init
-
- # For the next two commands do `sudo pip install` if you get permission-denied errors
- $ pip install -rrequirements.txt
- $ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
-
-You cannot currently install Python from source on Windows. Things might work
-out for you in MSYS2 (follow the Linux instructions), but it isn't officially
-supported at the moment.
-
-Troubleshooting
-~~~~~~~~~~~~~~~
-
-Help, I ...
-
-* **... see a** :code:`pkg_resources.VersionConflict` **when I try to install
- grpc**
-
- This is likely because :code:`pip` doesn't own the offending dependency,
- which in turn is likely because your operating system's package manager owns
- it. You'll need to force the installation of the dependency:
-
- :code:`pip install --ignore-installed $OFFENDING_DEPENDENCY`
-
- For example, if you get an error like the following:
-
- ::
-
- Traceback (most recent call last):
- File "<string>", line 17, in <module>
- ...
- File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 509, in find
- raise VersionConflict(dist, req)
- pkg_resources.VersionConflict: (six 1.8.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.10'))
-
- You can fix it by doing:
-
- ::
-
- sudo pip install --ignore-installed six
-
-* **... see the following error on some platforms**
-
- ::
-
- /tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory
- #include "Python.h"
- ^
- compilation terminated.
-
- You can fix it by installing `python-dev` package. i.e
-
- ::
-
- sudo apt-get install python-dev
-
+ $ cd $REPO_ROOT
+ $ git submodule update --init
+
+ # For the next two commands do `sudo pip install` if you get permission-denied errors
+ $ pip install -rrequirements.txt
+ $ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
+
+You cannot currently install Python from source on Windows. Things might work
+out for you in MSYS2 (follow the Linux instructions), but it isn't officially
+supported at the moment.
+
+Troubleshooting
+~~~~~~~~~~~~~~~
+
+Help, I ...
+
+* **... see a** :code:`pkg_resources.VersionConflict` **when I try to install
+ grpc**
+
+ This is likely because :code:`pip` doesn't own the offending dependency,
+ which in turn is likely because your operating system's package manager owns
+ it. You'll need to force the installation of the dependency:
+
+ :code:`pip install --ignore-installed $OFFENDING_DEPENDENCY`
+
+ For example, if you get an error like the following:
+
+ ::
+
+ Traceback (most recent call last):
+ File "<string>", line 17, in <module>
+ ...
+ File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 509, in find
+ raise VersionConflict(dist, req)
+ pkg_resources.VersionConflict: (six 1.8.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.10'))
+
+ You can fix it by doing:
+
+ ::
+
+ sudo pip install --ignore-installed six
+
+* **... see the following error on some platforms**
+
+ ::
+
+ /tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory
+ #include "Python.h"
+ ^
+ compilation terminated.
+
+ You can fix it by installing `python-dev` package. i.e
+
+ ::
+
+ sudo apt-get install python-dev
+
diff --git a/contrib/libs/grpc/src/python/grpcio/_spawn_patch.py b/contrib/libs/grpc/src/python/grpcio/_spawn_patch.py
index 240b648744..377cc7a9f3 100644
--- a/contrib/libs/grpc/src/python/grpcio/_spawn_patch.py
+++ b/contrib/libs/grpc/src/python/grpcio/_spawn_patch.py
@@ -1,60 +1,60 @@
# Copyright 2016 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.
-"""Patches the spawn() command for windows compilers.
-
-Windows has an 8191 character command line limit, but some compilers
-support an @command_file directive where command_file is a file
-containing the full command line.
-"""
-
-from distutils import ccompiler
-import os
-import os.path
-import shutil
-import sys
-import tempfile
-
-MAX_COMMAND_LENGTH = 8191
-
-_classic_spawn = ccompiler.CCompiler.spawn
-
-
-def _commandfile_spawn(self, command):
- command_length = sum([len(arg) for arg in command])
- if os.name == 'nt' and command_length > MAX_COMMAND_LENGTH:
- # Even if this command doesn't support the @command_file, it will
- # fail as is so we try blindly
- print('Command line length exceeded, using command file')
- print(' '.join(command))
- temporary_directory = tempfile.mkdtemp()
- command_filename = os.path.abspath(
- os.path.join(temporary_directory, 'command'))
- with open(command_filename, 'w') as command_file:
- escaped_args = [
- '"' + arg.replace('\\', '\\\\') + '"' for arg in command[1:]
- ]
- command_file.write(' '.join(escaped_args))
- modified_command = command[:1] + ['@{}'.format(command_filename)]
- try:
- _classic_spawn(self, modified_command)
- finally:
- shutil.rmtree(temporary_directory)
- else:
- _classic_spawn(self, command)
-
-
-def monkeypatch_spawn():
- """Monkeypatching is dumb, but it's either that or we become maintainers of
- something much, much bigger."""
- ccompiler.CCompiler.spawn = _commandfile_spawn
+"""Patches the spawn() command for windows compilers.
+
+Windows has an 8191 character command line limit, but some compilers
+support an @command_file directive where command_file is a file
+containing the full command line.
+"""
+
+from distutils import ccompiler
+import os
+import os.path
+import shutil
+import sys
+import tempfile
+
+MAX_COMMAND_LENGTH = 8191
+
+_classic_spawn = ccompiler.CCompiler.spawn
+
+
+def _commandfile_spawn(self, command):
+ command_length = sum([len(arg) for arg in command])
+ if os.name == 'nt' and command_length > MAX_COMMAND_LENGTH:
+ # Even if this command doesn't support the @command_file, it will
+ # fail as is so we try blindly
+ print('Command line length exceeded, using command file')
+ print(' '.join(command))
+ temporary_directory = tempfile.mkdtemp()
+ command_filename = os.path.abspath(
+ os.path.join(temporary_directory, 'command'))
+ with open(command_filename, 'w') as command_file:
+ escaped_args = [
+ '"' + arg.replace('\\', '\\\\') + '"' for arg in command[1:]
+ ]
+ command_file.write(' '.join(escaped_args))
+ modified_command = command[:1] + ['@{}'.format(command_filename)]
+ try:
+ _classic_spawn(self, modified_command)
+ finally:
+ shutil.rmtree(temporary_directory)
+ else:
+ _classic_spawn(self, command)
+
+
+def monkeypatch_spawn():
+ """Monkeypatching is dumb, but it's either that or we become maintainers of
+ something much, much bigger."""
+ ccompiler.CCompiler.spawn = _commandfile_spawn
diff --git a/contrib/libs/grpc/src/python/grpcio/commands.py b/contrib/libs/grpc/src/python/grpcio/commands.py
index a662dc0ff7..8240beb295 100644
--- a/contrib/libs/grpc/src/python/grpcio/commands.py
+++ b/contrib/libs/grpc/src/python/grpcio/commands.py
@@ -1,101 +1,101 @@
# 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.
-"""Provides distutils command classes for the GRPC Python setup process."""
-
+"""Provides distutils command classes for the GRPC Python setup process."""
+
from __future__ import print_function
-import distutils
-import glob
-import os
-import os.path
-import platform
-import re
-import shutil
-import subprocess
-import sys
-import traceback
-
-import setuptools
-from setuptools.command import build_ext
-from setuptools.command import build_py
-from setuptools.command import easy_install
-from setuptools.command import install
-from setuptools.command import test
-
-import support
-
-PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
-GRPC_STEM = os.path.abspath(PYTHON_STEM + '../../../../')
-PROTO_STEM = os.path.join(GRPC_STEM, 'src', 'proto')
-PROTO_GEN_STEM = os.path.join(GRPC_STEM, 'src', 'python', 'gens')
-CYTHON_STEM = os.path.join(PYTHON_STEM, 'grpc', '_cython')
-
-
-class CommandError(Exception):
- """Simple exception class for GRPC custom commands."""
-
-
-# TODO(atash): Remove this once PyPI has better Linux bdist support. See
-# https://bitbucket.org/pypa/pypi/issues/120/binary-wheels-for-linux-are-not-supported
-def _get_grpc_custom_bdist(decorated_basename, target_bdist_basename):
- """Returns a string path to a bdist file for Linux to install.
-
- If we can retrieve a pre-compiled bdist from online, uses it. Else, emits a
- warning and builds from source.
- """
- # TODO(atash): somehow the name that's returned from `wheel` is different
- # between different versions of 'wheel' (but from a compatibility standpoint,
- # the names are compatible); we should have some way of determining name
- # compatibility in the same way `wheel` does to avoid having to rename all of
- # the custom wheels that we build/upload to GCS.
-
- # Break import style to ensure that setup.py has had a chance to install the
- # relevant package.
- from six.moves.urllib import request
- decorated_path = decorated_basename + GRPC_CUSTOM_BDIST_EXT
- try:
- url = BINARIES_REPOSITORY + '/{target}'.format(target=decorated_path)
- bdist_data = request.urlopen(url).read()
- except IOError as error:
- raise CommandError('{}\n\nCould not find the bdist {}: {}'.format(
- traceback.format_exc(), decorated_path, error.message))
- # Our chosen local bdist path.
- bdist_path = target_bdist_basename + GRPC_CUSTOM_BDIST_EXT
- try:
- with open(bdist_path, 'w') as bdist_file:
- bdist_file.write(bdist_data)
- except IOError as error:
+import distutils
+import glob
+import os
+import os.path
+import platform
+import re
+import shutil
+import subprocess
+import sys
+import traceback
+
+import setuptools
+from setuptools.command import build_ext
+from setuptools.command import build_py
+from setuptools.command import easy_install
+from setuptools.command import install
+from setuptools.command import test
+
+import support
+
+PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
+GRPC_STEM = os.path.abspath(PYTHON_STEM + '../../../../')
+PROTO_STEM = os.path.join(GRPC_STEM, 'src', 'proto')
+PROTO_GEN_STEM = os.path.join(GRPC_STEM, 'src', 'python', 'gens')
+CYTHON_STEM = os.path.join(PYTHON_STEM, 'grpc', '_cython')
+
+
+class CommandError(Exception):
+ """Simple exception class for GRPC custom commands."""
+
+
+# TODO(atash): Remove this once PyPI has better Linux bdist support. See
+# https://bitbucket.org/pypa/pypi/issues/120/binary-wheels-for-linux-are-not-supported
+def _get_grpc_custom_bdist(decorated_basename, target_bdist_basename):
+ """Returns a string path to a bdist file for Linux to install.
+
+ If we can retrieve a pre-compiled bdist from online, uses it. Else, emits a
+ warning and builds from source.
+ """
+ # TODO(atash): somehow the name that's returned from `wheel` is different
+ # between different versions of 'wheel' (but from a compatibility standpoint,
+ # the names are compatible); we should have some way of determining name
+ # compatibility in the same way `wheel` does to avoid having to rename all of
+ # the custom wheels that we build/upload to GCS.
+
+ # Break import style to ensure that setup.py has had a chance to install the
+ # relevant package.
+ from six.moves.urllib import request
+ decorated_path = decorated_basename + GRPC_CUSTOM_BDIST_EXT
+ try:
+ url = BINARIES_REPOSITORY + '/{target}'.format(target=decorated_path)
+ bdist_data = request.urlopen(url).read()
+ except IOError as error:
+ raise CommandError('{}\n\nCould not find the bdist {}: {}'.format(
+ traceback.format_exc(), decorated_path, error.message))
+ # Our chosen local bdist path.
+ bdist_path = target_bdist_basename + GRPC_CUSTOM_BDIST_EXT
+ try:
+ with open(bdist_path, 'w') as bdist_file:
+ bdist_file.write(bdist_data)
+ except IOError as error:
raise CommandError('{}\n\nCould not write grpcio bdist: {}'.format(
traceback.format_exc(), error.message))
- return bdist_path
-
-
-class SphinxDocumentation(setuptools.Command):
- """Command to generate documentation via sphinx."""
-
- description = 'generate sphinx documentation'
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- # We import here to ensure that setup.py has had a chance to install the
- # relevant package eggs first.
+ return bdist_path
+
+
+class SphinxDocumentation(setuptools.Command):
+ """Command to generate documentation via sphinx."""
+
+ description = 'generate sphinx documentation'
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ # We import here to ensure that setup.py has had a chance to install the
+ # relevant package eggs first.
import sphinx.cmd.build
source_dir = os.path.join(GRPC_STEM, 'doc', 'python', 'sphinx')
target_dir = os.path.join(GRPC_STEM, 'doc', 'build')
@@ -104,114 +104,114 @@ class SphinxDocumentation(setuptools.Command):
if exit_code != 0:
raise CommandError(
"Documentation generation has warnings or errors")
-
-
-class BuildProjectMetadata(setuptools.Command):
- """Command to generate project metadata in a module."""
-
- description = 'build grpcio project metadata files'
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- with open(os.path.join(PYTHON_STEM, 'grpc/_grpcio_metadata.py'),
- 'w') as module_file:
- module_file.write('__version__ = """{}"""'.format(
- self.distribution.get_version()))
-
-
-class BuildPy(build_py.build_py):
- """Custom project build command."""
-
- def run(self):
- self.run_command('build_project_metadata')
- build_py.build_py.run(self)
-
-
-def _poison_extensions(extensions, message):
- """Includes a file that will always fail to compile in all extensions."""
- poison_filename = os.path.join(PYTHON_STEM, 'poison.c')
- with open(poison_filename, 'w') as poison:
- poison.write('#error {}'.format(message))
- for extension in extensions:
- extension.sources = [poison_filename]
-
-
-def check_and_update_cythonization(extensions):
- """Replace .pyx files with their generated counterparts and return whether or
- not cythonization still needs to occur."""
- for extension in extensions:
- generated_pyx_sources = []
- other_sources = []
- for source in extension.sources:
- base, file_ext = os.path.splitext(source)
- if file_ext == '.pyx':
+
+
+class BuildProjectMetadata(setuptools.Command):
+ """Command to generate project metadata in a module."""
+
+ description = 'build grpcio project metadata files'
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ with open(os.path.join(PYTHON_STEM, 'grpc/_grpcio_metadata.py'),
+ 'w') as module_file:
+ module_file.write('__version__ = """{}"""'.format(
+ self.distribution.get_version()))
+
+
+class BuildPy(build_py.build_py):
+ """Custom project build command."""
+
+ def run(self):
+ self.run_command('build_project_metadata')
+ build_py.build_py.run(self)
+
+
+def _poison_extensions(extensions, message):
+ """Includes a file that will always fail to compile in all extensions."""
+ poison_filename = os.path.join(PYTHON_STEM, 'poison.c')
+ with open(poison_filename, 'w') as poison:
+ poison.write('#error {}'.format(message))
+ for extension in extensions:
+ extension.sources = [poison_filename]
+
+
+def check_and_update_cythonization(extensions):
+ """Replace .pyx files with their generated counterparts and return whether or
+ not cythonization still needs to occur."""
+ for extension in extensions:
+ generated_pyx_sources = []
+ other_sources = []
+ for source in extension.sources:
+ base, file_ext = os.path.splitext(source)
+ if file_ext == '.pyx':
generated_pyx_source = next((base + gen_ext for gen_ext in (
'.c',
'.cpp',
) if os.path.isfile(base + gen_ext)), None)
- if generated_pyx_source:
- generated_pyx_sources.append(generated_pyx_source)
- else:
- sys.stderr.write('Cython-generated files are missing...\n')
- return False
- else:
- other_sources.append(source)
- extension.sources = generated_pyx_sources + other_sources
- sys.stderr.write('Found cython-generated files...\n')
- return True
-
-
-def try_cythonize(extensions, linetracing=False, mandatory=True):
- """Attempt to cythonize the extensions.
-
- Args:
- extensions: A list of `distutils.extension.Extension`.
- linetracing: A bool indicating whether or not to enable linetracing.
- mandatory: Whether or not having Cython-generated files is mandatory. If it
- is, extensions will be poisoned when they can't be fully generated.
- """
- try:
- # Break import style to ensure we have access to Cython post-setup_requires
- import Cython.Build
- except ImportError:
- if mandatory:
- sys.stderr.write(
- "This package needs to generate C files with Cython but it cannot. "
- "Poisoning extension sources to disallow extension commands...")
- _poison_extensions(
- extensions,
- "Extensions have been poisoned due to missing Cython-generated code."
- )
- return extensions
- cython_compiler_directives = {}
- if linetracing:
- additional_define_macros = [('CYTHON_TRACE_NOGIL', '1')]
- cython_compiler_directives['linetrace'] = True
- return Cython.Build.cythonize(
- extensions,
- include_path=[
+ if generated_pyx_source:
+ generated_pyx_sources.append(generated_pyx_source)
+ else:
+ sys.stderr.write('Cython-generated files are missing...\n')
+ return False
+ else:
+ other_sources.append(source)
+ extension.sources = generated_pyx_sources + other_sources
+ sys.stderr.write('Found cython-generated files...\n')
+ return True
+
+
+def try_cythonize(extensions, linetracing=False, mandatory=True):
+ """Attempt to cythonize the extensions.
+
+ Args:
+ extensions: A list of `distutils.extension.Extension`.
+ linetracing: A bool indicating whether or not to enable linetracing.
+ mandatory: Whether or not having Cython-generated files is mandatory. If it
+ is, extensions will be poisoned when they can't be fully generated.
+ """
+ try:
+ # Break import style to ensure we have access to Cython post-setup_requires
+ import Cython.Build
+ except ImportError:
+ if mandatory:
+ sys.stderr.write(
+ "This package needs to generate C files with Cython but it cannot. "
+ "Poisoning extension sources to disallow extension commands...")
+ _poison_extensions(
+ extensions,
+ "Extensions have been poisoned due to missing Cython-generated code."
+ )
+ return extensions
+ cython_compiler_directives = {}
+ if linetracing:
+ additional_define_macros = [('CYTHON_TRACE_NOGIL', '1')]
+ cython_compiler_directives['linetrace'] = True
+ return Cython.Build.cythonize(
+ extensions,
+ include_path=[
include_dir for extension in extensions
- for include_dir in extension.include_dirs
- ] + [CYTHON_STEM],
- compiler_directives=cython_compiler_directives)
-
-
-class BuildExt(build_ext.build_ext):
- """Custom build_ext command to enable compiler-specific flags."""
-
- C_OPTIONS = {
+ for include_dir in extension.include_dirs
+ ] + [CYTHON_STEM],
+ compiler_directives=cython_compiler_directives)
+
+
+class BuildExt(build_ext.build_ext):
+ """Custom build_ext command to enable compiler-specific flags."""
+
+ C_OPTIONS = {
'unix': ('-pthread',),
- 'msvc': (),
- }
- LINK_OPTIONS = {}
-
- def build_extensions(self):
+ 'msvc': (),
+ }
+ LINK_OPTIONS = {}
+
+ def build_extensions(self):
def compiler_ok_with_extra_std():
"""Test if default compiler is okay with specifying c++ version
@@ -249,49 +249,49 @@ class BuildExt(build_ext.build_ext):
self.compiler._compile = new_compile
- compiler = self.compiler.compiler_type
- if compiler in BuildExt.C_OPTIONS:
- for extension in self.extensions:
- extension.extra_compile_args += list(
- BuildExt.C_OPTIONS[compiler])
- if compiler in BuildExt.LINK_OPTIONS:
- for extension in self.extensions:
- extension.extra_link_args += list(
- BuildExt.LINK_OPTIONS[compiler])
- if not check_and_update_cythonization(self.extensions):
- self.extensions = try_cythonize(self.extensions)
- try:
- build_ext.build_ext.build_extensions(self)
- except Exception as error:
- formatted_exception = traceback.format_exc()
- support.diagnose_build_ext_error(self, error, formatted_exception)
- raise CommandError(
- "Failed `build_ext` step:\n{}".format(formatted_exception))
-
-
-class Gather(setuptools.Command):
- """Command to gather project dependencies."""
-
- description = 'gather dependencies for grpcio'
+ compiler = self.compiler.compiler_type
+ if compiler in BuildExt.C_OPTIONS:
+ for extension in self.extensions:
+ extension.extra_compile_args += list(
+ BuildExt.C_OPTIONS[compiler])
+ if compiler in BuildExt.LINK_OPTIONS:
+ for extension in self.extensions:
+ extension.extra_link_args += list(
+ BuildExt.LINK_OPTIONS[compiler])
+ if not check_and_update_cythonization(self.extensions):
+ self.extensions = try_cythonize(self.extensions)
+ try:
+ build_ext.build_ext.build_extensions(self)
+ except Exception as error:
+ formatted_exception = traceback.format_exc()
+ support.diagnose_build_ext_error(self, error, formatted_exception)
+ raise CommandError(
+ "Failed `build_ext` step:\n{}".format(formatted_exception))
+
+
+class Gather(setuptools.Command):
+ """Command to gather project dependencies."""
+
+ description = 'gather dependencies for grpcio'
user_options = [
('test', 't', 'flag indicating to gather test dependencies'),
('install', 'i', 'flag indicating to gather install dependencies')
]
-
- def initialize_options(self):
- self.test = False
- self.install = False
-
- def finalize_options(self):
- # distutils requires this override.
- pass
-
- def run(self):
- if self.install and self.distribution.install_requires:
- self.distribution.fetch_build_eggs(
- self.distribution.install_requires)
- if self.test and self.distribution.tests_require:
- self.distribution.fetch_build_eggs(self.distribution.tests_require)
+
+ def initialize_options(self):
+ self.test = False
+ self.install = False
+
+ def finalize_options(self):
+ # distutils requires this override.
+ pass
+
+ def run(self):
+ if self.install and self.distribution.install_requires:
+ self.distribution.fetch_build_eggs(
+ self.distribution.install_requires)
+ if self.test and self.distribution.tests_require:
+ self.distribution.fetch_build_eggs(self.distribution.tests_require)
class Clean(setuptools.Command):
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/__init__.py
index e362fe258b..abe87458c4 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/__init__.py
@@ -1,28 +1,28 @@
# Copyright 2015-2016 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.
-"""gRPC's Python API."""
-
-import abc
+"""gRPC's Python API."""
+
+import abc
import contextlib
-import enum
+import enum
import logging
-import sys
-import six
-
-from grpc._cython import cygrpc as _cygrpc
+import sys
+import six
+
+from grpc._cython import cygrpc as _cygrpc
from grpc import _compression
-
+
logging.getLogger(__name__).addHandler(logging.NullHandler())
try:
@@ -30,30 +30,30 @@ try:
except ImportError:
__version__ = "dev0"
-############################## Future Interface ###############################
-
-
-class FutureTimeoutError(Exception):
- """Indicates that a method call on a Future timed out."""
-
-
-class FutureCancelledError(Exception):
- """Indicates that the computation underlying a Future was cancelled."""
-
-
-class Future(six.with_metaclass(abc.ABCMeta)):
- """A representation of a computation in another control flow.
-
+############################## Future Interface ###############################
+
+
+class FutureTimeoutError(Exception):
+ """Indicates that a method call on a Future timed out."""
+
+
+class FutureCancelledError(Exception):
+ """Indicates that the computation underlying a Future was cancelled."""
+
+
+class Future(six.with_metaclass(abc.ABCMeta)):
+ """A representation of a computation in another control flow.
+
Computations represented by a Future may be yet to be begun,
may be ongoing, or may have already completed.
"""
-
- @abc.abstractmethod
- def cancel(self):
- """Attempts to cancel the computation.
-
+
+ @abc.abstractmethod
+ def cancel(self):
+ """Attempts to cancel the computation.
+
This method does not block.
-
+
Returns:
bool:
Returns True if the computation was canceled.
@@ -65,14 +65,14 @@ class Future(six.with_metaclass(abc.ABCMeta)):
3. computation is scheduled for execution and it is impossible
to determine its state without blocking.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def cancelled(self):
- """Describes whether the computation was cancelled.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def cancelled(self):
+ """Describes whether the computation was cancelled.
+
This method does not block.
-
+
Returns:
bool:
Returns True if the computation was cancelled before its result became
@@ -83,28 +83,28 @@ class Future(six.with_metaclass(abc.ABCMeta)):
1. computation was not cancelled.
2. computation's result is available.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def running(self):
- """Describes whether the computation is taking place.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def running(self):
+ """Describes whether the computation is taking place.
+
This method does not block.
-
+
Returns:
Returns True if the computation is scheduled for execution or
currently executing.
Returns False if the computation already executed or was cancelled.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def done(self):
- """Describes whether the computation has taken place.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def done(self):
+ """Describes whether the computation has taken place.
+
This method does not block.
-
+
Returns:
bool:
Returns True if the computation already executed or was cancelled.
@@ -112,22 +112,22 @@ class Future(six.with_metaclass(abc.ABCMeta)):
currently executing.
This is exactly opposite of the running() method's result.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def result(self, timeout=None):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def result(self, timeout=None):
"""Returns the result of the computation or raises its exception.
-
+
This method may return immediately or may block.
-
+
Args:
timeout: The length of time in seconds to wait for the computation to
finish or be cancelled. If None, the call will block until the
computations's termination.
-
+
Returns:
The return value of the computation.
-
+
Raises:
FutureTimeoutError: If a timeout value is passed and the computation
does not terminate within the allotted time.
@@ -135,79 +135,79 @@ class Future(six.with_metaclass(abc.ABCMeta)):
Exception: If the computation raised an exception, this call will
raise the same exception.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def exception(self, timeout=None):
- """Return the exception raised by the computation.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def exception(self, timeout=None):
+ """Return the exception raised by the computation.
+
This method may return immediately or may block.
-
+
Args:
timeout: The length of time in seconds to wait for the computation to
terminate or be cancelled. If None, the call will block until the
computations's termination.
-
+
Returns:
The exception raised by the computation, or None if the computation
did not raise an exception.
-
+
Raises:
FutureTimeoutError: If a timeout value is passed and the computation
does not terminate within the allotted time.
FutureCancelledError: If the computation was cancelled.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def traceback(self, timeout=None):
- """Access the traceback of the exception raised by the computation.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def traceback(self, timeout=None):
+ """Access the traceback of the exception raised by the computation.
+
This method may return immediately or may block.
-
+
Args:
timeout: The length of time in seconds to wait for the computation
to terminate or be cancelled. If None, the call will block until
the computation's termination.
-
+
Returns:
The traceback of the exception raised by the computation, or None
if the computation did not raise an exception.
-
+
Raises:
FutureTimeoutError: If a timeout value is passed and the computation
does not terminate within the allotted time.
FutureCancelledError: If the computation was cancelled.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_done_callback(self, fn):
- """Adds a function to be called at completion of the computation.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_done_callback(self, fn):
+ """Adds a function to be called at completion of the computation.
+
The callback will be passed this Future object describing the outcome
of the computation. Callbacks will be invoked after the future is
terminated, whether successfully or not.
-
+
If the computation has already completed, the callback will be called
immediately.
-
+
Exceptions raised in the callback will be logged at ERROR level, but
will not terminate any threads of execution.
Args:
fn: A callable taking this Future object as its single parameter.
"""
- raise NotImplementedError()
-
-
-################################ gRPC Enums ##################################
-
-
-@enum.unique
-class ChannelConnectivity(enum.Enum):
- """Mirrors grpc_connectivity_state in the gRPC Core.
-
+ raise NotImplementedError()
+
+
+################################ gRPC Enums ##################################
+
+
+@enum.unique
+class ChannelConnectivity(enum.Enum):
+ """Mirrors grpc_connectivity_state in the gRPC Core.
+
Attributes:
IDLE: The channel is idle.
CONNECTING: The channel is connecting.
@@ -216,16 +216,16 @@ class ChannelConnectivity(enum.Enum):
to recover.
SHUTDOWN: The channel has seen a failure from which it cannot recover.
"""
- IDLE = (_cygrpc.ConnectivityState.idle, 'idle')
- CONNECTING = (_cygrpc.ConnectivityState.connecting, 'connecting')
- READY = (_cygrpc.ConnectivityState.ready, 'ready')
- TRANSIENT_FAILURE = (_cygrpc.ConnectivityState.transient_failure,
- 'transient failure')
- SHUTDOWN = (_cygrpc.ConnectivityState.shutdown, 'shutdown')
-
-
-@enum.unique
-class StatusCode(enum.Enum):
+ IDLE = (_cygrpc.ConnectivityState.idle, 'idle')
+ CONNECTING = (_cygrpc.ConnectivityState.connecting, 'connecting')
+ READY = (_cygrpc.ConnectivityState.ready, 'ready')
+ TRANSIENT_FAILURE = (_cygrpc.ConnectivityState.transient_failure,
+ 'transient failure')
+ SHUTDOWN = (_cygrpc.ConnectivityState.shutdown, 'shutdown')
+
+
+@enum.unique
+class StatusCode(enum.Enum):
"""Mirrors grpc_status_code in the gRPC Core.
Attributes:
@@ -253,29 +253,29 @@ class StatusCode(enum.Enum):
UNAVAILABLE: The service is currently unavailable.
DATA_LOSS: Unrecoverable data loss or corruption.
"""
- OK = (_cygrpc.StatusCode.ok, 'ok')
- CANCELLED = (_cygrpc.StatusCode.cancelled, 'cancelled')
- UNKNOWN = (_cygrpc.StatusCode.unknown, 'unknown')
- INVALID_ARGUMENT = (_cygrpc.StatusCode.invalid_argument, 'invalid argument')
- DEADLINE_EXCEEDED = (_cygrpc.StatusCode.deadline_exceeded,
- 'deadline exceeded')
- NOT_FOUND = (_cygrpc.StatusCode.not_found, 'not found')
- ALREADY_EXISTS = (_cygrpc.StatusCode.already_exists, 'already exists')
- PERMISSION_DENIED = (_cygrpc.StatusCode.permission_denied,
- 'permission denied')
- RESOURCE_EXHAUSTED = (_cygrpc.StatusCode.resource_exhausted,
- 'resource exhausted')
- FAILED_PRECONDITION = (_cygrpc.StatusCode.failed_precondition,
- 'failed precondition')
- ABORTED = (_cygrpc.StatusCode.aborted, 'aborted')
- OUT_OF_RANGE = (_cygrpc.StatusCode.out_of_range, 'out of range')
- UNIMPLEMENTED = (_cygrpc.StatusCode.unimplemented, 'unimplemented')
- INTERNAL = (_cygrpc.StatusCode.internal, 'internal')
- UNAVAILABLE = (_cygrpc.StatusCode.unavailable, 'unavailable')
- DATA_LOSS = (_cygrpc.StatusCode.data_loss, 'data loss')
- UNAUTHENTICATED = (_cygrpc.StatusCode.unauthenticated, 'unauthenticated')
-
-
+ OK = (_cygrpc.StatusCode.ok, 'ok')
+ CANCELLED = (_cygrpc.StatusCode.cancelled, 'cancelled')
+ UNKNOWN = (_cygrpc.StatusCode.unknown, 'unknown')
+ INVALID_ARGUMENT = (_cygrpc.StatusCode.invalid_argument, 'invalid argument')
+ DEADLINE_EXCEEDED = (_cygrpc.StatusCode.deadline_exceeded,
+ 'deadline exceeded')
+ NOT_FOUND = (_cygrpc.StatusCode.not_found, 'not found')
+ ALREADY_EXISTS = (_cygrpc.StatusCode.already_exists, 'already exists')
+ PERMISSION_DENIED = (_cygrpc.StatusCode.permission_denied,
+ 'permission denied')
+ RESOURCE_EXHAUSTED = (_cygrpc.StatusCode.resource_exhausted,
+ 'resource exhausted')
+ FAILED_PRECONDITION = (_cygrpc.StatusCode.failed_precondition,
+ 'failed precondition')
+ ABORTED = (_cygrpc.StatusCode.aborted, 'aborted')
+ OUT_OF_RANGE = (_cygrpc.StatusCode.out_of_range, 'out of range')
+ UNIMPLEMENTED = (_cygrpc.StatusCode.unimplemented, 'unimplemented')
+ INTERNAL = (_cygrpc.StatusCode.internal, 'internal')
+ UNAVAILABLE = (_cygrpc.StatusCode.unavailable, 'unavailable')
+ DATA_LOSS = (_cygrpc.StatusCode.data_loss, 'data loss')
+ UNAUTHENTICATED = (_cygrpc.StatusCode.unauthenticated, 'unauthenticated')
+
+
############################# gRPC Status ################################
@@ -292,108 +292,108 @@ class Status(six.with_metaclass(abc.ABCMeta)):
"""
-############################# gRPC Exceptions ################################
-
-
-class RpcError(Exception):
- """Raised by the gRPC library to indicate non-OK-status RPC termination."""
-
-
-############################## Shared Context ################################
-
-
-class RpcContext(six.with_metaclass(abc.ABCMeta)):
- """Provides RPC-related information and action."""
-
- @abc.abstractmethod
- def is_active(self):
+############################# gRPC Exceptions ################################
+
+
+class RpcError(Exception):
+ """Raised by the gRPC library to indicate non-OK-status RPC termination."""
+
+
+############################## Shared Context ################################
+
+
+class RpcContext(six.with_metaclass(abc.ABCMeta)):
+ """Provides RPC-related information and action."""
+
+ @abc.abstractmethod
+ def is_active(self):
"""Describes whether the RPC is active or has terminated.
Returns:
bool:
True if RPC is active, False otherwise.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the RPC.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the RPC.
+
Returns:
A nonnegative float indicating the length of allowed time in seconds
remaining for the RPC to complete before it is considered to have
timed out, or None if no deadline was specified for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def cancel(self):
- """Cancels the RPC.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the RPC.
+
Idempotent and has no effect if the RPC has already terminated.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_callback(self, callback):
- """Registers a callback to be called on RPC termination.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_callback(self, callback):
+ """Registers a callback to be called on RPC termination.
+
Args:
callback: A no-parameter callable to be called on RPC termination.
-
+
Returns:
True if the callback was added and will be called later; False if
the callback was not added and will not be called (because the RPC
already terminated or some other reason).
"""
- raise NotImplementedError()
-
-
-######################### Invocation-Side Context ############################
-
-
-class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """Invocation-side utility object for an RPC."""
-
- @abc.abstractmethod
- def initial_metadata(self):
+ raise NotImplementedError()
+
+
+######################### Invocation-Side Context ############################
+
+
+class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
+ """Invocation-side utility object for an RPC."""
+
+ @abc.abstractmethod
+ def initial_metadata(self):
"""Accesses the initial metadata sent by the server.
-
+
This method blocks until the value is available.
-
+
Returns:
The initial :term:`metadata`.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def trailing_metadata(self):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def trailing_metadata(self):
"""Accesses the trailing metadata sent by the server.
-
+
This method blocks until the value is available.
-
+
Returns:
The trailing :term:`metadata`.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def code(self):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def code(self):
"""Accesses the status code sent by the server.
-
+
This method blocks until the value is available.
-
+
Returns:
The StatusCode value for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def details(self):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def details(self):
"""Accesses the details sent by the server.
-
+
This method blocks until the value is available.
-
+
Returns:
The details string of the RPC.
"""
@@ -418,7 +418,7 @@ class ClientCallDetails(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
- """
+ """
class UnaryUnaryClientInterceptor(six.with_metaclass(abc.ABCMeta)):
@@ -455,9 +455,9 @@ class UnaryUnaryClientInterceptor(six.with_metaclass(abc.ABCMeta)):
Should the event terminate with non-OK status, the returned
Call-Future's exception value will be an RpcError.
"""
- raise NotImplementedError()
-
-
+ raise NotImplementedError()
+
+
class UnaryStreamClientInterceptor(six.with_metaclass(abc.ABCMeta)):
"""Affords intercepting unary-stream invocations.
@@ -567,89 +567,89 @@ class StreamStreamClientInterceptor(six.with_metaclass(abc.ABCMeta)):
raise NotImplementedError()
-############ Authentication & Authorization Interfaces & Classes #############
-
-
-class ChannelCredentials(object):
+############ Authentication & Authorization Interfaces & Classes #############
+
+
+class ChannelCredentials(object):
"""An encapsulation of the data required to create a secure Channel.
-
+
This class has no supported interface - it exists to define the type of its
instances and its instances exist to be passed to other functions. For
example, ssl_channel_credentials returns an instance of this class and
secure_channel requires an instance of this class.
"""
-
- def __init__(self, credentials):
- self._credentials = credentials
-
-
-class CallCredentials(object):
+
+ def __init__(self, credentials):
+ self._credentials = credentials
+
+
+class CallCredentials(object):
"""An encapsulation of the data required to assert an identity over a call.
-
+
A CallCredentials has to be used with secure Channel, otherwise the
metadata will not be transmitted to the server.
A CallCredentials may be composed with ChannelCredentials to always assert
identity for every call over that Channel.
-
+
This class has no supported interface - it exists to define the type of its
instances and its instances exist to be passed to other functions.
"""
-
- def __init__(self, credentials):
- self._credentials = credentials
-
-
-class AuthMetadataContext(six.with_metaclass(abc.ABCMeta)):
- """Provides information to call credentials metadata plugins.
-
+
+ def __init__(self, credentials):
+ self._credentials = credentials
+
+
+class AuthMetadataContext(six.with_metaclass(abc.ABCMeta)):
+ """Provides information to call credentials metadata plugins.
+
Attributes:
service_url: A string URL of the service being called into.
method_name: A string of the fully qualified method name being called.
"""
-
-
-class AuthMetadataPluginCallback(six.with_metaclass(abc.ABCMeta)):
- """Callback object received by a metadata plugin."""
-
- def __call__(self, metadata, error):
+
+
+class AuthMetadataPluginCallback(six.with_metaclass(abc.ABCMeta)):
+ """Callback object received by a metadata plugin."""
+
+ def __call__(self, metadata, error):
"""Passes to the gRPC runtime authentication metadata for an RPC.
-
+
Args:
metadata: The :term:`metadata` used to construct the CallCredentials.
error: An Exception to indicate error or None to indicate success.
"""
- raise NotImplementedError()
-
-
-class AuthMetadataPlugin(six.with_metaclass(abc.ABCMeta)):
- """A specification for custom authentication."""
-
- def __call__(self, context, callback):
- """Implements authentication by passing metadata to a callback.
-
+ raise NotImplementedError()
+
+
+class AuthMetadataPlugin(six.with_metaclass(abc.ABCMeta)):
+ """A specification for custom authentication."""
+
+ def __call__(self, context, callback):
+ """Implements authentication by passing metadata to a callback.
+
This method will be invoked asynchronously in a separate thread.
-
+
Args:
context: An AuthMetadataContext providing information on the RPC that
the plugin is being called to authenticate.
callback: An AuthMetadataPluginCallback to be invoked either
synchronously or asynchronously.
"""
- raise NotImplementedError()
-
-
-class ServerCredentials(object):
+ raise NotImplementedError()
+
+
+class ServerCredentials(object):
"""An encapsulation of the data required to open a secure port on a Server.
-
+
This class has no supported interface - it exists to define the type of its
instances and its instances exist to be passed to other functions.
"""
-
- def __init__(self, credentials):
- self._credentials = credentials
-
-
+
+ def __init__(self, credentials):
+ self._credentials = credentials
+
+
class ServerCertificateConfiguration(object):
"""A certificate configuration for use with an SSL-enabled Server.
@@ -665,13 +665,13 @@ class ServerCertificateConfiguration(object):
self._certificate_configuration = certificate_configuration
-######################## Multi-Callable Interfaces ###########################
-
-
-class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
+######################## Multi-Callable Interfaces ###########################
+
+
+class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a unary-unary RPC from client-side."""
-
- @abc.abstractmethod
+
+ @abc.abstractmethod
def __call__(self,
request,
timeout=None,
@@ -679,8 +679,8 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
credentials=None,
wait_for_ready=None,
compression=None):
- """Synchronously invokes the underlying RPC.
-
+ """Synchronously invokes the underlying RPC.
+
Args:
request: The request value for the RPC.
timeout: An optional duration of time in seconds to allow
@@ -693,18 +693,18 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
The response value for the RPC.
-
+
Raises:
RpcError: Indicating that the RPC terminated with non-OK status. The
raised RpcError will also be a Call for the RPC affording the RPC's
metadata, status code, and details.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
+ raise NotImplementedError()
+
+ @abc.abstractmethod
def with_call(self,
request,
timeout=None,
@@ -712,8 +712,8 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
credentials=None,
wait_for_ready=None,
compression=None):
- """Synchronously invokes the underlying RPC.
-
+ """Synchronously invokes the underlying RPC.
+
Args:
request: The request value for the RPC.
timeout: An optional durating of time in seconds to allow for
@@ -726,18 +726,18 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
The response value for the RPC and a Call value for the RPC.
-
+
Raises:
RpcError: Indicating that the RPC terminated with non-OK status. The
raised RpcError will also be a Call for the RPC affording the RPC's
metadata, status code, and details.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
+ raise NotImplementedError()
+
+ @abc.abstractmethod
def future(self,
request,
timeout=None,
@@ -745,8 +745,8 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
credentials=None,
wait_for_ready=None,
compression=None):
- """Asynchronously invokes the underlying RPC.
-
+ """Asynchronously invokes the underlying RPC.
+
Args:
request: The request value for the RPC.
timeout: An optional duration of time in seconds to allow for
@@ -759,7 +759,7 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
An object that is both a Call for the RPC and a Future.
In the event of RPC completion, the return Call-Future's result
@@ -767,13 +767,13 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Should the event terminate with non-OK status,
the returned Call-Future's exception value will be an RpcError.
"""
- raise NotImplementedError()
-
-
-class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ raise NotImplementedError()
+
+
+class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a unary-stream RPC from client-side."""
-
- @abc.abstractmethod
+
+ @abc.abstractmethod
def __call__(self,
request,
timeout=None,
@@ -781,8 +781,8 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
credentials=None,
wait_for_ready=None,
compression=None):
- """Invokes the underlying RPC.
-
+ """Invokes the underlying RPC.
+
Args:
request: The request value for the RPC.
timeout: An optional duration of time in seconds to allow for
@@ -795,29 +795,29 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
An object that is both a Call for the RPC and an iterator of
response values. Drawing response values from the returned
Call-iterator may raise RpcError indicating termination of the
RPC with non-OK status.
"""
- raise NotImplementedError()
-
-
-class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ raise NotImplementedError()
+
+
+class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a stream-unary RPC from client-side."""
-
- @abc.abstractmethod
- def __call__(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
- """Synchronously invokes the underlying RPC.
-
+ """Synchronously invokes the underlying RPC.
+
Args:
request_iterator: An iterator that yields request values for
the RPC.
@@ -831,27 +831,27 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
The response value for the RPC.
-
+
Raises:
RpcError: Indicating that the RPC terminated with non-OK status. The
raised RpcError will also implement grpc.Call, affording methods
such as metadata, code, and details.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def with_call(self,
- request_iterator,
- timeout=None,
- metadata=None,
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def with_call(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
"""Synchronously invokes the underlying RPC on the client.
-
+
Args:
request_iterator: An iterator that yields request values for
the RPC.
@@ -865,27 +865,27 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
The response value for the RPC and a Call object for the RPC.
-
+
Raises:
RpcError: Indicating that the RPC terminated with non-OK status. The
raised RpcError will also be a Call for the RPC affording the RPC's
metadata, status code, and details.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future(self,
- request_iterator,
- timeout=None,
- metadata=None,
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
"""Asynchronously invokes the underlying RPC on the client.
-
+
Args:
request_iterator: An iterator that yields request values for the RPC.
timeout: An optional duration of time in seconds to allow for
@@ -898,7 +898,7 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
An object that is both a Call for the RPC and a Future.
In the event of RPC completion, the return Call-Future's result value
@@ -906,22 +906,22 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
with non-OK status, the returned Call-Future's exception value will
be an RpcError.
"""
- raise NotImplementedError()
-
-
-class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ raise NotImplementedError()
+
+
+class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a stream-stream RPC on client-side."""
-
- @abc.abstractmethod
- def __call__(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
"""Invokes the underlying RPC on the client.
-
+
Args:
request_iterator: An iterator that yields request values for the RPC.
timeout: An optional duration of time in seconds to allow for
@@ -934,30 +934,30 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
flag to enable :term:`wait_for_ready` mechanism.
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This is an EXPERIMENTAL option.
-
+
Returns:
An object that is both a Call for the RPC and an iterator of
response values. Drawing response values from the returned
Call-iterator may raise RpcError indicating termination of the
RPC with non-OK status.
"""
- raise NotImplementedError()
-
-
-############################# Channel Interface ##############################
-
-
-class Channel(six.with_metaclass(abc.ABCMeta)):
+ raise NotImplementedError()
+
+
+############################# Channel Interface ##############################
+
+
+class Channel(six.with_metaclass(abc.ABCMeta)):
"""Affords RPC invocation via generic methods on client-side.
-
+
Channel objects implement the Context Manager type, although they need not
support being entered and exited multiple times.
"""
- @abc.abstractmethod
- def subscribe(self, callback, try_to_connect=False):
+ @abc.abstractmethod
+ def subscribe(self, callback, try_to_connect=False):
"""Subscribe to this Channel's connectivity state machine.
-
+
A Channel may be in any of the states described by ChannelConnectivity.
This method allows application to monitor the state transitions.
The typical use case is to debug or gain better visibility into gRPC
@@ -973,25 +973,25 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
should attempt to connect immediately. If set to False, gRPC
runtime decides when to connect.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def unsubscribe(self, callback):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def unsubscribe(self, callback):
"""Unsubscribes a subscribed callback from this Channel's connectivity.
-
+
Args:
callback: A callable previously registered with this Channel from
having been passed to its "subscribe" method.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def unary_unary(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- """Creates a UnaryUnaryMultiCallable for a unary-unary method.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def unary_unary(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ """Creates a UnaryUnaryMultiCallable for a unary-unary method.
+
Args:
method: The name of the RPC method.
request_serializer: Optional :term:`serializer` for serializing the request
@@ -999,19 +999,19 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
response_deserializer: Optional :term:`deserializer` for deserializing the
response message. Response goes undeserialized in case None
is passed.
-
+
Returns:
A UnaryUnaryMultiCallable value for the named unary-unary method.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def unary_stream(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- """Creates a UnaryStreamMultiCallable for a unary-stream method.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def unary_stream(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ """Creates a UnaryStreamMultiCallable for a unary-stream method.
+
Args:
method: The name of the RPC method.
request_serializer: Optional :term:`serializer` for serializing the request
@@ -1019,19 +1019,19 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
response_deserializer: Optional :term:`deserializer` for deserializing the
response message. Response goes undeserialized in case None is
passed.
-
+
Returns:
A UnaryStreamMultiCallable value for the name unary-stream method.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stream_unary(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- """Creates a StreamUnaryMultiCallable for a stream-unary method.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stream_unary(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ """Creates a StreamUnaryMultiCallable for a stream-unary method.
+
Args:
method: The name of the RPC method.
request_serializer: Optional :term:`serializer` for serializing the request
@@ -1039,19 +1039,19 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
response_deserializer: Optional :term:`deserializer` for deserializing the
response message. Response goes undeserialized in case None is
passed.
-
+
Returns:
A StreamUnaryMultiCallable value for the named stream-unary method.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stream_stream(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- """Creates a StreamStreamMultiCallable for a stream-stream method.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stream_stream(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ """Creates a StreamStreamMultiCallable for a stream-stream method.
+
Args:
method: The name of the RPC method.
request_serializer: Optional :term:`serializer` for serializing the request
@@ -1059,16 +1059,16 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
response_deserializer: Optional :term:`deserializer` for deserializing the
response message. Response goes undeserialized in case None
is passed.
-
+
Returns:
A StreamStreamMultiCallable value for the named stream-stream method.
"""
- raise NotImplementedError()
-
+ raise NotImplementedError()
+
@abc.abstractmethod
def close(self):
"""Closes this Channel and releases all resources held by it.
-
+
Closing the Channel will immediately terminate all RPCs active with the
Channel and it is not valid to invoke new RPCs with the Channel.
@@ -1085,32 +1085,32 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
raise NotImplementedError()
-########################## Service-Side Context ##############################
-
-
-class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """A context object passed to method implementations."""
-
- @abc.abstractmethod
- def invocation_metadata(self):
+########################## Service-Side Context ##############################
+
+
+class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
+ """A context object passed to method implementations."""
+
+ @abc.abstractmethod
+ def invocation_metadata(self):
"""Accesses the metadata from the sent by the client.
-
+
Returns:
The invocation :term:`metadata`.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def peer(self):
- """Identifies the peer that invoked the RPC being serviced.
-
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def peer(self):
+ """Identifies the peer that invoked the RPC being serviced.
+
Returns:
A string identifying the peer that invoked the RPC being serviced.
The string format is determined by gRPC runtime.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
+ raise NotImplementedError()
+
+ @abc.abstractmethod
def peer_identities(self):
"""Gets one or more peer identity(s).
@@ -1157,21 +1157,21 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
raise NotImplementedError()
@abc.abstractmethod
- def send_initial_metadata(self, initial_metadata):
+ def send_initial_metadata(self, initial_metadata):
"""Sends the initial metadata value to the client.
-
+
This method need not be called by implementations if they have no
metadata to add to what the gRPC runtime will transmit.
-
+
Args:
initial_metadata: The initial :term:`metadata`.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def set_trailing_metadata(self, trailing_metadata):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def set_trailing_metadata(self, trailing_metadata):
"""Sets the trailing metadata for the RPC.
-
+
Sets the trailing metadata to be sent upon completion of the RPC.
If this method is invoked multiple times throughout the lifetime of an
@@ -1180,13 +1180,13 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
This method need not be called by implementations if they have no
metadata to add to what the gRPC runtime will transmit.
-
+
Args:
trailing_metadata: The trailing :term:`metadata`.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
+ raise NotImplementedError()
+
+ @abc.abstractmethod
def abort(self, code, details):
"""Raises an exception to terminate the RPC with a non-OK status.
@@ -1225,33 +1225,33 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
raise NotImplementedError()
@abc.abstractmethod
- def set_code(self, code):
+ def set_code(self, code):
"""Sets the value to be used as status code upon RPC completion.
-
+
This method need not be called by method implementations if they wish
the gRPC runtime to determine the status code of the RPC.
-
+
Args:
code: A StatusCode object to be sent to the client.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def set_details(self, details):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def set_details(self, details):
"""Sets the value to be used as detail string upon RPC completion.
-
+
This method need not be called by method implementations if they have
no details to transmit.
-
+
Args:
details: A UTF-8-encodable string to be sent to the client upon
termination of the RPC.
"""
- raise NotImplementedError()
-
+ raise NotImplementedError()
+
def disable_next_message_compression(self):
"""Disables compression for the next response message.
-
+
This is an EXPERIMENTAL method.
This method will override any compression configuration set during
@@ -1260,12 +1260,12 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
raise NotImplementedError()
-##################### Service-Side Handler Interfaces ########################
-
-
-class RpcMethodHandler(six.with_metaclass(abc.ABCMeta)):
- """An implementation of a single RPC method.
-
+##################### Service-Side Handler Interfaces ########################
+
+
+class RpcMethodHandler(six.with_metaclass(abc.ABCMeta)):
+ """An implementation of a single RPC method.
+
Attributes:
request_streaming: Whether the RPC supports exactly one request message
or any arbitrary number of request messages.
@@ -1297,48 +1297,48 @@ class RpcMethodHandler(six.with_metaclass(abc.ABCMeta)):
Only non-None if request_streaming and response_streaming are both
True.
"""
-
-
-class HandlerCallDetails(six.with_metaclass(abc.ABCMeta)):
- """Describes an RPC that has just arrived for service.
+
+
+class HandlerCallDetails(six.with_metaclass(abc.ABCMeta)):
+ """Describes an RPC that has just arrived for service.
Attributes:
method: The method name of the RPC.
invocation_metadata: The :term:`metadata` sent by the client.
"""
-
-
-class GenericRpcHandler(six.with_metaclass(abc.ABCMeta)):
- """An implementation of arbitrarily many RPC methods."""
-
- @abc.abstractmethod
- def service(self, handler_call_details):
+
+
+class GenericRpcHandler(six.with_metaclass(abc.ABCMeta)):
+ """An implementation of arbitrarily many RPC methods."""
+
+ @abc.abstractmethod
+ def service(self, handler_call_details):
"""Returns the handler for servicing the RPC.
-
+
Args:
handler_call_details: A HandlerCallDetails describing the RPC.
-
+
Returns:
An RpcMethodHandler with which the RPC may be serviced if the
implementation chooses to service this RPC, or None otherwise.
"""
- raise NotImplementedError()
-
-
-class ServiceRpcHandler(six.with_metaclass(abc.ABCMeta, GenericRpcHandler)):
- """An implementation of RPC methods belonging to a service.
-
+ raise NotImplementedError()
+
+
+class ServiceRpcHandler(six.with_metaclass(abc.ABCMeta, GenericRpcHandler)):
+ """An implementation of RPC methods belonging to a service.
+
A service handles RPC methods with structured names of the form
'/Service.Name/Service.Method', where 'Service.Name' is the value
returned by service_name(), and 'Service.Method' is the method
name. A service can have multiple method names, but only a single
service name.
"""
-
- @abc.abstractmethod
- def service_name(self):
+
+ @abc.abstractmethod
+ def service_name(self):
"""Returns this service's name.
-
+
Returns:
The service name.
"""
@@ -1352,7 +1352,7 @@ class ServerInterceptor(six.with_metaclass(abc.ABCMeta)):
"""Affords intercepting incoming RPCs on the service-side.
This is an EXPERIMENTAL API.
- """
+ """
@abc.abstractmethod
def intercept_service(self, continuation, handler_call_details):
@@ -1370,71 +1370,71 @@ class ServerInterceptor(six.with_metaclass(abc.ABCMeta)):
An RpcMethodHandler with which the RPC may be serviced if the
interceptor chooses to service this RPC, or None otherwise.
"""
- raise NotImplementedError()
-
-
-############################# Server Interface ###############################
-
-
-class Server(six.with_metaclass(abc.ABCMeta)):
- """Services RPCs."""
-
- @abc.abstractmethod
- def add_generic_rpc_handlers(self, generic_rpc_handlers):
- """Registers GenericRpcHandlers with this Server.
-
+ raise NotImplementedError()
+
+
+############################# Server Interface ###############################
+
+
+class Server(six.with_metaclass(abc.ABCMeta)):
+ """Services RPCs."""
+
+ @abc.abstractmethod
+ def add_generic_rpc_handlers(self, generic_rpc_handlers):
+ """Registers GenericRpcHandlers with this Server.
+
This method is only safe to call before the server is started.
-
+
Args:
generic_rpc_handlers: An iterable of GenericRpcHandlers that will be
used to service RPCs.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_insecure_port(self, address):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_insecure_port(self, address):
"""Opens an insecure port for accepting RPCs.
-
+
This method may only be called before starting the server.
-
+
Args:
address: The address for which to open a port. If the port is 0,
or not specified in the address, then gRPC runtime will choose a port.
-
+
Returns:
An integer port on which server will accept RPC requests.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_secure_port(self, address, server_credentials):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_secure_port(self, address, server_credentials):
"""Opens a secure port for accepting RPCs.
-
+
This method may only be called before starting the server.
-
+
Args:
address: The address for which to open a port.
if the port is 0, or not specified in the address, then gRPC
runtime will choose a port.
server_credentials: A ServerCredentials object.
-
+
Returns:
An integer port on which server will accept RPC requests.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def start(self):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def start(self):
"""Starts this Server.
-
+
This method may only be called once. (i.e. it is not idempotent).
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stop(self, grace):
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stop(self, grace):
"""Stops this Server.
-
+
This method immediately stop service of new RPCs in all cases.
If a grace period is specified, this method returns immediately
@@ -1442,7 +1442,7 @@ class Server(six.with_metaclass(abc.ABCMeta)):
If a grace period is not specified (by passing None for `grace`),
all existing RPCs are aborted immediately and this method
blocks until the last RPC handler terminates.
-
+
This method is idempotent and may be called at any time.
Passing a smaller grace value in a subsequent call will have
the effect of stopping the Server sooner (passing None will
@@ -1450,20 +1450,20 @@ class Server(six.with_metaclass(abc.ABCMeta)):
a larger grace value in a subsequent call *will not* have the
effect of stopping the server later (i.e. the most restrictive
grace value is used).
-
+
Args:
grace: A duration of time in seconds or None.
-
+
Returns:
A threading.Event that will be set when this Server has completely
stopped, i.e. when running RPCs either complete or are aborted and
all handlers have terminated.
"""
- raise NotImplementedError()
-
+ raise NotImplementedError()
+
def wait_for_termination(self, timeout=None):
"""Block current thread until the server stops.
-
+
This is an EXPERIMENTAL API.
The wait will not consume computational resources during blocking, and
@@ -1485,111 +1485,111 @@ class Server(six.with_metaclass(abc.ABCMeta)):
raise NotImplementedError()
-################################# Functions ################################
-
-
-def unary_unary_rpc_method_handler(behavior,
- request_deserializer=None,
- response_serializer=None):
- """Creates an RpcMethodHandler for a unary-unary RPC method.
-
+################################# Functions ################################
+
+
+def unary_unary_rpc_method_handler(behavior,
+ request_deserializer=None,
+ response_serializer=None):
+ """Creates an RpcMethodHandler for a unary-unary RPC method.
+
Args:
behavior: The implementation of an RPC that accepts one request
and returns one response.
request_deserializer: An optional :term:`deserializer` for request deserialization.
response_serializer: An optional :term:`serializer` for response serialization.
-
+
Returns:
An RpcMethodHandler object that is typically used by grpc.Server.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.RpcMethodHandler(False, False, request_deserializer,
- response_serializer, behavior, None,
- None, None)
-
-
-def unary_stream_rpc_method_handler(behavior,
- request_deserializer=None,
- response_serializer=None):
- """Creates an RpcMethodHandler for a unary-stream RPC method.
-
+ return _utilities.RpcMethodHandler(False, False, request_deserializer,
+ response_serializer, behavior, None,
+ None, None)
+
+
+def unary_stream_rpc_method_handler(behavior,
+ request_deserializer=None,
+ response_serializer=None):
+ """Creates an RpcMethodHandler for a unary-stream RPC method.
+
Args:
behavior: The implementation of an RPC that accepts one request
and returns an iterator of response values.
request_deserializer: An optional :term:`deserializer` for request deserialization.
response_serializer: An optional :term:`serializer` for response serialization.
-
+
Returns:
An RpcMethodHandler object that is typically used by grpc.Server.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.RpcMethodHandler(False, True, request_deserializer,
- response_serializer, None, behavior,
- None, None)
-
-
-def stream_unary_rpc_method_handler(behavior,
- request_deserializer=None,
- response_serializer=None):
- """Creates an RpcMethodHandler for a stream-unary RPC method.
-
+ return _utilities.RpcMethodHandler(False, True, request_deserializer,
+ response_serializer, None, behavior,
+ None, None)
+
+
+def stream_unary_rpc_method_handler(behavior,
+ request_deserializer=None,
+ response_serializer=None):
+ """Creates an RpcMethodHandler for a stream-unary RPC method.
+
Args:
behavior: The implementation of an RPC that accepts an iterator of
request values and returns a single response value.
request_deserializer: An optional :term:`deserializer` for request deserialization.
response_serializer: An optional :term:`serializer` for response serialization.
-
+
Returns:
An RpcMethodHandler object that is typically used by grpc.Server.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.RpcMethodHandler(True, False, request_deserializer,
- response_serializer, None, None,
- behavior, None)
-
-
-def stream_stream_rpc_method_handler(behavior,
- request_deserializer=None,
- response_serializer=None):
- """Creates an RpcMethodHandler for a stream-stream RPC method.
-
+ return _utilities.RpcMethodHandler(True, False, request_deserializer,
+ response_serializer, None, None,
+ behavior, None)
+
+
+def stream_stream_rpc_method_handler(behavior,
+ request_deserializer=None,
+ response_serializer=None):
+ """Creates an RpcMethodHandler for a stream-stream RPC method.
+
Args:
behavior: The implementation of an RPC that accepts an iterator of
request values and returns an iterator of response values.
request_deserializer: An optional :term:`deserializer` for request deserialization.
response_serializer: An optional :term:`serializer` for response serialization.
-
+
Returns:
An RpcMethodHandler object that is typically used by grpc.Server.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.RpcMethodHandler(True, True, request_deserializer,
- response_serializer, None, None, None,
- behavior)
-
-
-def method_handlers_generic_handler(service, method_handlers):
+ return _utilities.RpcMethodHandler(True, True, request_deserializer,
+ response_serializer, None, None, None,
+ behavior)
+
+
+def method_handlers_generic_handler(service, method_handlers):
"""Creates a GenericRpcHandler from RpcMethodHandlers.
-
+
Args:
service: The name of the service that is implemented by the
method_handlers.
method_handlers: A dictionary that maps method names to corresponding
RpcMethodHandler.
-
+
Returns:
A GenericRpcHandler. This is typically added to the grpc.Server object
with add_generic_rpc_handlers() before starting the server.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.DictionaryGenericHandler(service, method_handlers)
-
-
-def ssl_channel_credentials(root_certificates=None,
- private_key=None,
- certificate_chain=None):
- """Creates a ChannelCredentials for use with an SSL-enabled Channel.
-
+ return _utilities.DictionaryGenericHandler(service, method_handlers)
+
+
+def ssl_channel_credentials(root_certificates=None,
+ private_key=None,
+ certificate_chain=None):
+ """Creates a ChannelCredentials for use with an SSL-enabled Channel.
+
Args:
root_certificates: The PEM-encoded root certificates as a byte string,
or None to retrieve them from a default location chosen by gRPC
@@ -1598,38 +1598,38 @@ def ssl_channel_credentials(root_certificates=None,
private key should be used.
certificate_chain: The PEM-encoded certificate chain as a byte string
to use or None if no certificate chain should be used.
-
+
Returns:
A ChannelCredentials for use with an SSL-enabled Channel.
"""
- return ChannelCredentials(
+ return ChannelCredentials(
_cygrpc.SSLChannelCredentials(root_certificates, private_key,
certificate_chain))
-
-
-def metadata_call_credentials(metadata_plugin, name=None):
- """Construct CallCredentials from an AuthMetadataPlugin.
-
+
+
+def metadata_call_credentials(metadata_plugin, name=None):
+ """Construct CallCredentials from an AuthMetadataPlugin.
+
Args:
metadata_plugin: An AuthMetadataPlugin to use for authentication.
name: An optional name for the plugin.
-
+
Returns:
A CallCredentials.
"""
from grpc import _plugin_wrapping # pylint: disable=cyclic-import
return _plugin_wrapping.metadata_plugin_call_credentials(
metadata_plugin, name)
-
-
-def access_token_call_credentials(access_token):
- """Construct CallCredentials from an access token.
-
+
+
+def access_token_call_credentials(access_token):
+ """Construct CallCredentials from an access token.
+
Args:
access_token: A string to place directly in the http request
authorization header, for example
"authorization: Bearer <access_token>".
-
+
Returns:
A CallCredentials.
"""
@@ -1637,46 +1637,46 @@ def access_token_call_credentials(access_token):
from grpc import _plugin_wrapping # pylint: disable=cyclic-import
return _plugin_wrapping.metadata_plugin_call_credentials(
_auth.AccessTokenAuthMetadataPlugin(access_token), None)
-
-
-def composite_call_credentials(*call_credentials):
- """Compose multiple CallCredentials to make a new CallCredentials.
-
+
+
+def composite_call_credentials(*call_credentials):
+ """Compose multiple CallCredentials to make a new CallCredentials.
+
Args:
*call_credentials: At least two CallCredentials objects.
-
+
Returns:
A CallCredentials object composed of the given CallCredentials objects.
"""
- return CallCredentials(
+ return CallCredentials(
_cygrpc.CompositeCallCredentials(
tuple(single_call_credentials._credentials
for single_call_credentials in call_credentials)))
-
-
-def composite_channel_credentials(channel_credentials, *call_credentials):
- """Compose a ChannelCredentials and one or more CallCredentials objects.
-
+
+
+def composite_channel_credentials(channel_credentials, *call_credentials):
+ """Compose a ChannelCredentials and one or more CallCredentials objects.
+
Args:
channel_credentials: A ChannelCredentials object.
*call_credentials: One or more CallCredentials objects.
-
+
Returns:
A ChannelCredentials composed of the given ChannelCredentials and
CallCredentials objects.
"""
- return ChannelCredentials(
+ return ChannelCredentials(
_cygrpc.CompositeChannelCredentials(
tuple(single_call_credentials._credentials
for single_call_credentials in call_credentials),
channel_credentials._credentials))
-
-
-def ssl_server_credentials(private_key_certificate_chain_pairs,
- root_certificates=None,
- require_client_auth=False):
- """Creates a ServerCredentials for use with an SSL-enabled Server.
-
+
+
+def ssl_server_credentials(private_key_certificate_chain_pairs,
+ root_certificates=None,
+ require_client_auth=False):
+ """Creates a ServerCredentials for use with an SSL-enabled Server.
+
Args:
private_key_certificate_chain_pairs: A list of pairs of the form
[PEM-encoded private key, PEM-encoded certificate chain].
@@ -1686,26 +1686,26 @@ def ssl_server_credentials(private_key_certificate_chain_pairs,
require_client_auth: A boolean indicating whether or not to require
clients to be authenticated. May only be True if root_certificates
is not None.
-
+
Returns:
A ServerCredentials for use with an SSL-enabled Server. Typically, this
object is an argument to add_secure_port() method during server setup.
"""
if not private_key_certificate_chain_pairs:
- raise ValueError(
- 'At least one private key-certificate chain pair is required!')
- elif require_client_auth and root_certificates is None:
- raise ValueError(
- 'Illegal to require client auth without providing root certificates!'
- )
- else:
- return ServerCredentials(
- _cygrpc.server_credentials_ssl(root_certificates, [
- _cygrpc.SslPemKeyCertPair(key, pem)
- for key, pem in private_key_certificate_chain_pairs
- ], require_client_auth))
-
-
+ raise ValueError(
+ 'At least one private key-certificate chain pair is required!')
+ elif require_client_auth and root_certificates is None:
+ raise ValueError(
+ 'Illegal to require client auth without providing root certificates!'
+ )
+ else:
+ return ServerCredentials(
+ _cygrpc.server_credentials_ssl(root_certificates, [
+ _cygrpc.SslPemKeyCertPair(key, pem)
+ for key, pem in private_key_certificate_chain_pairs
+ ], require_client_auth))
+
+
def ssl_server_certificate_configuration(private_key_certificate_chain_pairs,
root_certificates=None):
"""Creates a ServerCertificateConfiguration for use with a Server.
@@ -1885,26 +1885,26 @@ def compute_engine_channel_credentials(call_credentials):
call_credentials._credentials))
-def channel_ready_future(channel):
+def channel_ready_future(channel):
"""Creates a Future that tracks when a Channel is ready.
-
+
Cancelling the Future does not affect the channel's state machine.
It merely decouples the Future from channel state machine.
-
+
Args:
channel: A Channel object.
-
+
Returns:
A Future object that matures when the channel connectivity is
- ChannelConnectivity.READY.
+ ChannelConnectivity.READY.
"""
from grpc import _utilities # pylint: disable=cyclic-import
- return _utilities.channel_ready_future(channel)
-
-
+ return _utilities.channel_ready_future(channel)
+
+
def insecure_channel(target, options=None, compression=None):
- """Creates an insecure Channel to a server.
-
+ """Creates an insecure Channel to a server.
+
The returned Channel is thread-safe.
Args:
@@ -1913,18 +1913,18 @@ def insecure_channel(target, options=None, compression=None):
in gRPC Core runtime) to configure the channel.
compression: An optional value indicating the compression method to be
used over the lifetime of the channel. This is an EXPERIMENTAL option.
-
+
Returns:
A Channel.
"""
from grpc import _channel # pylint: disable=cyclic-import
return _channel.Channel(target, () if options is None else options, None,
compression)
-
-
+
+
def secure_channel(target, credentials, options=None, compression=None):
- """Creates a secure Channel to a server.
-
+ """Creates a secure Channel to a server.
+
The returned Channel is thread-safe.
Args:
@@ -1934,7 +1934,7 @@ def secure_channel(target, credentials, options=None, compression=None):
in gRPC Core runtime) to configure the channel.
compression: An optional value indicating the compression method to be
used over the lifetime of the channel. This is an EXPERIMENTAL option.
-
+
Returns:
A Channel.
"""
@@ -1944,10 +1944,10 @@ def secure_channel(target, credentials, options=None, compression=None):
raise ValueError(
"secure_channel cannot be called with insecure credentials." +
" Call insecure_channel instead.")
- return _channel.Channel(target, () if options is None else options,
+ return _channel.Channel(target, () if options is None else options,
credentials._credentials, compression)
-
-
+
+
def intercept_channel(channel, *interceptors):
"""Intercepts a channel through a set of interceptors.
@@ -1982,8 +1982,8 @@ def server(thread_pool,
options=None,
maximum_concurrent_rpcs=None,
compression=None):
- """Creates a Server with which RPCs can be serviced.
-
+ """Creates a Server with which RPCs can be serviced.
+
Args:
thread_pool: A futures.ThreadPoolExecutor to be used by the Server
to execute RPC handlers.
@@ -2002,7 +2002,7 @@ def server(thread_pool,
compression: An element of grpc.compression, e.g.
grpc.compression.Gzip. This compression algorithm will be used for the
lifetime of the server unless overridden. This is an EXPERIMENTAL option.
-
+
Returns:
A Server object.
"""
@@ -2012,8 +2012,8 @@ def server(thread_pool,
() if interceptors is None else interceptors,
() if options is None else options,
maximum_concurrent_rpcs, compression)
-
-
+
+
@contextlib.contextmanager
def _create_servicer_context(rpc_event, state, request_deserializer):
from grpc import _server # pylint: disable=cyclic-import
@@ -2040,8 +2040,8 @@ class Compression(enum.IntEnum):
from grpc._runtime_protos import protos, services, protos_and_services # pylint: disable=wrong-import-position
-################################### __all__ #################################
-
+################################### __all__ #################################
+
__all__ = (
'FutureTimeoutError',
'FutureCancelledError',
@@ -2104,25 +2104,25 @@ __all__ = (
'services',
'protos_and_services',
)
-
-############################### Extension Shims ################################
-
-# Here to maintain backwards compatibility; avoid using these in new code!
-try:
- import grpc_tools
- sys.modules.update({'grpc.tools': grpc_tools})
-except ImportError:
- pass
-try:
- import grpc_health
- sys.modules.update({'grpc.health': grpc_health})
-except ImportError:
- pass
-try:
- import grpc_reflection
- sys.modules.update({'grpc.reflection': grpc_reflection})
-except ImportError:
- pass
+
+############################### Extension Shims ################################
+
+# Here to maintain backwards compatibility; avoid using these in new code!
+try:
+ import grpc_tools
+ sys.modules.update({'grpc.tools': grpc_tools})
+except ImportError:
+ pass
+try:
+ import grpc_health
+ sys.modules.update({'grpc.health': grpc_health})
+except ImportError:
+ pass
+try:
+ import grpc_reflection
+ sys.modules.update({'grpc.reflection': grpc_reflection})
+except ImportError:
+ pass
# Prevents import order issue in the case of renamed path.
if sys.version_info >= (3, 6) and __name__ == "grpc":
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_auth.py b/contrib/libs/grpc/src/python/grpcio/grpc/_auth.py
index 55a95ef036..2d38320aff 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_auth.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_auth.py
@@ -1,39 +1,39 @@
# Copyright 2016 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.
-"""GRPCAuthMetadataPlugins for standard authentication."""
-
-import inspect
-
-import grpc
-
-
-def _sign_request(callback, token, error):
- metadata = (('authorization', 'Bearer {}'.format(token)),)
- callback(metadata, error)
-
-
-class GoogleCallCredentials(grpc.AuthMetadataPlugin):
- """Metadata wrapper for GoogleCredentials from the oauth2client library."""
-
- def __init__(self, credentials):
- self._credentials = credentials
- # Hack to determine if these are JWT creds and we need to pass
- # additional_claims when getting a token
+"""GRPCAuthMetadataPlugins for standard authentication."""
+
+import inspect
+
+import grpc
+
+
+def _sign_request(callback, token, error):
+ metadata = (('authorization', 'Bearer {}'.format(token)),)
+ callback(metadata, error)
+
+
+class GoogleCallCredentials(grpc.AuthMetadataPlugin):
+ """Metadata wrapper for GoogleCredentials from the oauth2client library."""
+
+ def __init__(self, credentials):
+ self._credentials = credentials
+ # Hack to determine if these are JWT creds and we need to pass
+ # additional_claims when getting a token
self._is_jwt = 'additional_claims' in inspect.getargspec( # pylint: disable=deprecated-method
credentials.get_access_token).args
-
- def __call__(self, context, callback):
+
+ def __call__(self, context, callback):
try:
if self._is_jwt:
access_token = self._credentials.get_access_token(
@@ -44,15 +44,15 @@ class GoogleCallCredentials(grpc.AuthMetadataPlugin):
access_token = self._credentials.get_access_token().access_token
except Exception as exception: # pylint: disable=broad-except
_sign_request(callback, None, exception)
- else:
+ else:
_sign_request(callback, access_token, None)
-
-
+
+
class AccessTokenAuthMetadataPlugin(grpc.AuthMetadataPlugin):
- """Metadata wrapper for raw access token credentials."""
-
- def __init__(self, access_token):
- self._access_token = access_token
-
- def __call__(self, context, callback):
- _sign_request(callback, self._access_token, None)
+ """Metadata wrapper for raw access token credentials."""
+
+ def __init__(self, access_token):
+ self._access_token = access_token
+
+ def __call__(self, context, callback):
+ _sign_request(callback, self._access_token, None)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_channel.py b/contrib/libs/grpc/src/python/grpcio/grpc/_channel.py
index ddd861ad42..11921d7883 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_channel.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_channel.py
@@ -1,39 +1,39 @@
# Copyright 2016 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.
-"""Invocation-side implementation of gRPC Python."""
-
+"""Invocation-side implementation of gRPC Python."""
+
import copy
import functools
import logging
import os
-import sys
-import threading
-import time
-
-import grpc
+import sys
+import threading
+import time
+
+import grpc
import grpc.experimental
from grpc import _compression
-from grpc import _common
-from grpc import _grpcio_metadata
-from grpc._cython import cygrpc
-
+from grpc import _common
+from grpc import _grpcio_metadata
+from grpc._cython import cygrpc
+
_LOGGER = logging.getLogger(__name__)
-_USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__)
-
-_EMPTY_FLAGS = 0
-
+_USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__)
+
+_EMPTY_FLAGS = 0
+
# NOTE(rbellevi): No guarantees are given about the maintenance of this
# environment variable.
_DEFAULT_SINGLE_THREADED_UNARY_STREAM = os.getenv(
@@ -65,15 +65,15 @@ _STREAM_STREAM_INITIAL_DUE = (
cygrpc.OperationType.receive_initial_metadata,
cygrpc.OperationType.receive_status_on_client,
)
-
-_CHANNEL_SUBSCRIPTION_CALLBACK_ERROR_LOG_MESSAGE = (
- 'Exception calling channel subscription callback!')
-
+
+_CHANNEL_SUBSCRIPTION_CALLBACK_ERROR_LOG_MESSAGE = (
+ 'Exception calling channel subscription callback!')
+
_OK_RENDEZVOUS_REPR_FORMAT = ('<{} of RPC that terminated with:\n'
'\tstatus = {}\n'
'\tdetails = "{}"\n'
'>')
-
+
_NON_OK_RENDEZVOUS_REPR_FORMAT = ('<{} of RPC that terminated with:\n'
'\tstatus = {}\n'
'\tdetails = "{}"\n'
@@ -81,92 +81,92 @@ _NON_OK_RENDEZVOUS_REPR_FORMAT = ('<{} of RPC that terminated with:\n'
'>')
-def _deadline(timeout):
+def _deadline(timeout):
return None if timeout is None else time.time() + timeout
-
-
-def _unknown_code_details(unknown_cygrpc_code, details):
- return 'Server sent unknown code {} and details "{}"'.format(
- unknown_cygrpc_code, details)
-
-
-class _RPCState(object):
-
- def __init__(self, due, initial_metadata, trailing_metadata, code, details):
- self.condition = threading.Condition()
- # The cygrpc.OperationType objects representing events due from the RPC's
- # completion queue.
- self.due = set(due)
- self.initial_metadata = initial_metadata
- self.response = None
- self.trailing_metadata = trailing_metadata
- self.code = code
- self.details = details
+
+
+def _unknown_code_details(unknown_cygrpc_code, details):
+ return 'Server sent unknown code {} and details "{}"'.format(
+ unknown_cygrpc_code, details)
+
+
+class _RPCState(object):
+
+ def __init__(self, due, initial_metadata, trailing_metadata, code, details):
+ self.condition = threading.Condition()
+ # The cygrpc.OperationType objects representing events due from the RPC's
+ # completion queue.
+ self.due = set(due)
+ self.initial_metadata = initial_metadata
+ self.response = None
+ self.trailing_metadata = trailing_metadata
+ self.code = code
+ self.details = details
self.debug_error_string = None
- # The semantics of grpc.Future.cancel and grpc.Future.cancelled are
- # slightly wonky, so they have to be tracked separately from the rest of the
- # result of the RPC. This field tracks whether cancellation was requested
- # prior to termination of the RPC.
- self.cancelled = False
- self.callbacks = []
+ # The semantics of grpc.Future.cancel and grpc.Future.cancelled are
+ # slightly wonky, so they have to be tracked separately from the rest of the
+ # result of the RPC. This field tracks whether cancellation was requested
+ # prior to termination of the RPC.
+ self.cancelled = False
+ self.callbacks = []
self.fork_epoch = cygrpc.get_fork_epoch()
-
+
def reset_postfork_child(self):
self.condition = threading.Condition()
-
-def _abort(state, code, details):
- if state.code is None:
- state.code = code
- state.details = details
- if state.initial_metadata is None:
+
+def _abort(state, code, details):
+ if state.code is None:
+ state.code = code
+ state.details = details
+ if state.initial_metadata is None:
state.initial_metadata = ()
state.trailing_metadata = ()
-
-
-def _handle_event(event, state, response_deserializer):
- callbacks = []
- for batch_operation in event.batch_operations:
+
+
+def _handle_event(event, state, response_deserializer):
+ callbacks = []
+ for batch_operation in event.batch_operations:
operation_type = batch_operation.type()
- state.due.remove(operation_type)
- if operation_type == cygrpc.OperationType.receive_initial_metadata:
+ state.due.remove(operation_type)
+ if operation_type == cygrpc.OperationType.receive_initial_metadata:
state.initial_metadata = batch_operation.initial_metadata()
- elif operation_type == cygrpc.OperationType.receive_message:
+ elif operation_type == cygrpc.OperationType.receive_message:
serialized_response = batch_operation.message()
- if serialized_response is not None:
- response = _common.deserialize(serialized_response,
- response_deserializer)
- if response is None:
- details = 'Exception deserializing response!'
- _abort(state, grpc.StatusCode.INTERNAL, details)
- else:
- state.response = response
- elif operation_type == cygrpc.OperationType.receive_status_on_client:
+ if serialized_response is not None:
+ response = _common.deserialize(serialized_response,
+ response_deserializer)
+ if response is None:
+ details = 'Exception deserializing response!'
+ _abort(state, grpc.StatusCode.INTERNAL, details)
+ else:
+ state.response = response
+ elif operation_type == cygrpc.OperationType.receive_status_on_client:
state.trailing_metadata = batch_operation.trailing_metadata()
- if state.code is None:
- code = _common.CYGRPC_STATUS_CODE_TO_STATUS_CODE.get(
+ if state.code is None:
+ code = _common.CYGRPC_STATUS_CODE_TO_STATUS_CODE.get(
batch_operation.code())
- if code is None:
- state.code = grpc.StatusCode.UNKNOWN
- state.details = _unknown_code_details(
+ if code is None:
+ state.code = grpc.StatusCode.UNKNOWN
+ state.details = _unknown_code_details(
code, batch_operation.details())
- else:
- state.code = code
+ else:
+ state.code = code
state.details = batch_operation.details()
state.debug_error_string = batch_operation.error_string()
- callbacks.extend(state.callbacks)
- state.callbacks = None
- return callbacks
-
-
+ callbacks.extend(state.callbacks)
+ state.callbacks = None
+ return callbacks
+
+
def _event_handler(state, response_deserializer):
-
- def handle_event(event):
- with state.condition:
- callbacks = _handle_event(event, state, response_deserializer)
- state.condition.notify_all()
- done = not state.due
- for callback in callbacks:
+
+ def handle_event(event):
+ with state.condition:
+ callbacks = _handle_event(event, state, response_deserializer)
+ state.condition.notify_all()
+ done = not state.due
+ for callback in callbacks:
try:
callback()
except Exception as e: # pylint: disable=broad-except
@@ -175,26 +175,26 @@ def _event_handler(state, response_deserializer):
logging.error('Exception in callback %s: %s',
repr(callback.func), repr(e))
return done and state.fork_epoch >= cygrpc.get_fork_epoch()
-
- return handle_event
-
-
+
+ return handle_event
+
+
#pylint: disable=too-many-statements
def _consume_request_iterator(request_iterator, state, call, request_serializer,
event_handler):
"""Consume a request iterator supplied by the user."""
-
+
def consume_request_iterator(): # pylint: disable=too-many-branches
# Iterate over the request iterator until it is exhausted or an error
# condition is encountered.
- while True:
+ while True:
return_from_user_request_generator_invoked = False
- try:
+ try:
# The thread may die in user-code. Do not block fork for this.
cygrpc.enter_user_request_generator()
- request = next(request_iterator)
- except StopIteration:
- break
+ request = next(request_iterator)
+ except StopIteration:
+ break
except Exception: # pylint: disable=broad-except
cygrpc.return_from_user_request_generator()
return_from_user_request_generator_invoked = True
@@ -204,24 +204,24 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer,
call.cancel(_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[code],
details)
_abort(state, code, details)
- return
+ return
finally:
if not return_from_user_request_generator_invoked:
cygrpc.return_from_user_request_generator()
- serialized_request = _common.serialize(request, request_serializer)
- with state.condition:
- if state.code is None and not state.cancelled:
- if serialized_request is None:
+ serialized_request = _common.serialize(request, request_serializer)
+ with state.condition:
+ if state.code is None and not state.cancelled:
+ if serialized_request is None:
code = grpc.StatusCode.INTERNAL
- details = 'Exception serializing request!'
+ details = 'Exception serializing request!'
call.cancel(
_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[code],
details)
_abort(state, code, details)
- return
- else:
+ return
+ else:
operations = (cygrpc.SendMessageOperation(
- serialized_request, _EMPTY_FLAGS),)
+ serialized_request, _EMPTY_FLAGS),)
operating = call.operate(operations, event_handler)
if operating:
state.due.add(cygrpc.OperationType.send_message)
@@ -240,22 +240,22 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer,
state))
if state.code is not None:
return
- else:
- return
- with state.condition:
- if state.code is None:
- operations = (
+ else:
+ return
+ with state.condition:
+ if state.code is None:
+ operations = (
cygrpc.SendCloseFromClientOperation(_EMPTY_FLAGS),)
operating = call.operate(operations, event_handler)
if operating:
state.due.add(cygrpc.OperationType.send_close_from_client)
-
+
consumption_thread = cygrpc.ForkManagedThread(
target=consume_request_iterator)
consumption_thread.setDaemon(True)
- consumption_thread.start()
-
-
+ consumption_thread.start()
+
+
def _rpc_state_string(class_name, rpc_state):
"""Calculates error string for RPC."""
with rpc_state.condition:
@@ -268,7 +268,7 @@ def _rpc_state_string(class_name, rpc_state):
return _NON_OK_RENDEZVOUS_REPR_FORMAT.format(
class_name, rpc_state.code, rpc_state.details,
rpc_state.debug_error_string)
-
+
class _InactiveRpcError(grpc.RpcError, grpc.Call, grpc.Future):
"""An RPC error not tied to the execution of a particular RPC.
@@ -362,13 +362,13 @@ class _Rendezvous(grpc.RpcError, grpc.RpcContext):
possibly None, to represent an RPC with no deadline at all.
"""
- def __init__(self, state, call, response_deserializer, deadline):
- super(_Rendezvous, self).__init__()
- self._state = state
- self._call = call
- self._response_deserializer = response_deserializer
- self._deadline = deadline
-
+ def __init__(self, state, call, response_deserializer, deadline):
+ super(_Rendezvous, self).__init__()
+ self._state = state
+ self._call = call
+ self._response_deserializer = response_deserializer
+ self._deadline = deadline
+
def is_active(self):
"""See grpc.RpcContext.is_active"""
with self._state.condition:
@@ -382,21 +382,21 @@ class _Rendezvous(grpc.RpcError, grpc.RpcContext):
else:
return max(self._deadline - time.time(), 0)
- def cancel(self):
+ def cancel(self):
"""See grpc.RpcContext.cancel"""
- with self._state.condition:
- if self._state.code is None:
+ with self._state.condition:
+ if self._state.code is None:
code = grpc.StatusCode.CANCELLED
details = 'Locally cancelled by application!'
self._call.cancel(
_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[code], details)
- self._state.cancelled = True
+ self._state.cancelled = True
_abort(self._state, code, details)
- self._state.condition.notify_all()
+ self._state.condition.notify_all()
return True
else:
return False
-
+
def add_callback(self, callback):
"""See grpc.RpcContext.add_callback"""
with self._state.condition:
@@ -687,27 +687,27 @@ class _MultiThreadedRendezvous(_Rendezvous, grpc.Call, grpc.Future): # pylint:
_common.wait(self._state.condition.wait, _done)
return _common.decode(self._state.debug_error_string)
- def cancelled(self):
- with self._state.condition:
- return self._state.cancelled
-
- def running(self):
- with self._state.condition:
- return self._state.code is None
-
- def done(self):
- with self._state.condition:
- return self._state.code is not None
-
+ def cancelled(self):
+ with self._state.condition:
+ return self._state.cancelled
+
+ def running(self):
+ with self._state.condition:
+ return self._state.code is None
+
+ def done(self):
+ with self._state.condition:
+ return self._state.code is not None
+
def _is_complete(self):
return self._state.code is not None
- def result(self, timeout=None):
+ def result(self, timeout=None):
"""Returns the result of the computation or raises its exception.
See grpc.Future.result for the full API contract.
"""
- with self._state.condition:
+ with self._state.condition:
timed_out = _common.wait(self._state.condition.wait,
self._is_complete,
timeout=timeout)
@@ -715,18 +715,18 @@ class _MultiThreadedRendezvous(_Rendezvous, grpc.Call, grpc.Future): # pylint:
raise grpc.FutureTimeoutError()
else:
if self._state.code is grpc.StatusCode.OK:
- return self._state.response
- elif self._state.cancelled:
- raise grpc.FutureCancelledError()
- else:
- raise self
-
- def exception(self, timeout=None):
+ return self._state.response
+ elif self._state.cancelled:
+ raise grpc.FutureCancelledError()
+ else:
+ raise self
+
+ def exception(self, timeout=None):
"""Return the exception raised by the computation.
See grpc.Future.exception for the full API contract.
"""
- with self._state.condition:
+ with self._state.condition:
timed_out = _common.wait(self._state.condition.wait,
self._is_complete,
timeout=timeout)
@@ -734,18 +734,18 @@ class _MultiThreadedRendezvous(_Rendezvous, grpc.Call, grpc.Future): # pylint:
raise grpc.FutureTimeoutError()
else:
if self._state.code is grpc.StatusCode.OK:
- return None
- elif self._state.cancelled:
- raise grpc.FutureCancelledError()
- else:
- return self
-
- def traceback(self, timeout=None):
+ return None
+ elif self._state.cancelled:
+ raise grpc.FutureCancelledError()
+ else:
+ return self
+
+ def traceback(self, timeout=None):
"""Access the traceback of the exception raised by the computation.
See grpc.future.traceback for the full API contract.
"""
- with self._state.condition:
+ with self._state.condition:
timed_out = _common.wait(self._state.condition.wait,
self._is_complete,
timeout=timeout)
@@ -753,44 +753,44 @@ class _MultiThreadedRendezvous(_Rendezvous, grpc.Call, grpc.Future): # pylint:
raise grpc.FutureTimeoutError()
else:
if self._state.code is grpc.StatusCode.OK:
- return None
- elif self._state.cancelled:
- raise grpc.FutureCancelledError()
- else:
- try:
- raise self
- except grpc.RpcError:
- return sys.exc_info()[2]
-
- def add_done_callback(self, fn):
- with self._state.condition:
- if self._state.code is None:
+ return None
+ elif self._state.cancelled:
+ raise grpc.FutureCancelledError()
+ else:
+ try:
+ raise self
+ except grpc.RpcError:
+ return sys.exc_info()[2]
+
+ def add_done_callback(self, fn):
+ with self._state.condition:
+ if self._state.code is None:
self._state.callbacks.append(functools.partial(fn, self))
- return
-
- fn(self)
-
- def _next(self):
- with self._state.condition:
- if self._state.code is None:
+ return
+
+ fn(self)
+
+ def _next(self):
+ with self._state.condition:
+ if self._state.code is None:
event_handler = _event_handler(self._state,
- self._response_deserializer)
+ self._response_deserializer)
operating = self._call.operate(
(cygrpc.ReceiveMessageOperation(_EMPTY_FLAGS),),
- event_handler)
+ event_handler)
if operating:
self._state.due.add(cygrpc.OperationType.receive_message)
- elif self._state.code is grpc.StatusCode.OK:
- raise StopIteration()
- else:
- raise self
-
+ elif self._state.code is grpc.StatusCode.OK:
+ raise StopIteration()
+ else:
+ raise self
+
def _response_ready():
return (
self._state.response is not None or
(cygrpc.OperationType.receive_message not in self._state.due
and self._state.code is not None))
-
+
_common.wait(self._state.condition.wait, _response_ready)
if self._state.response is not None:
response = self._state.response
@@ -801,31 +801,31 @@ class _MultiThreadedRendezvous(_Rendezvous, grpc.Call, grpc.Future): # pylint:
raise StopIteration()
elif self._state.code is not None:
raise self
-
-
-def _start_unary_request(request, timeout, request_serializer):
+
+
+def _start_unary_request(request, timeout, request_serializer):
deadline = _deadline(timeout)
- serialized_request = _common.serialize(request, request_serializer)
- if serialized_request is None:
+ serialized_request = _common.serialize(request, request_serializer)
+ if serialized_request is None:
state = _RPCState((), (), (), grpc.StatusCode.INTERNAL,
- 'Exception serializing request!')
+ 'Exception serializing request!')
error = _InactiveRpcError(state)
return deadline, None, error
- else:
+ else:
return deadline, serialized_request, None
-
-
+
+
def _end_unary_response_blocking(state, call, with_call, deadline):
- if state.code is grpc.StatusCode.OK:
- if with_call:
+ if state.code is grpc.StatusCode.OK:
+ if with_call:
rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
- return state.response, rendezvous
- else:
- return state.response
- else:
+ return state.response, rendezvous
+ else:
+ return state.response
+ else:
raise _InactiveRpcError(state)
-
-
+
+
def _stream_unary_invocation_operationses(metadata, initial_metadata_flags):
return (
(
@@ -859,18 +859,18 @@ def _determine_deadline(user_deadline):
return min(parent_deadline, user_deadline)
-class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
-
+class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
+
# pylint: disable=too-many-arguments
- def __init__(self, channel, managed_call, method, request_serializer,
- response_deserializer):
- self._channel = channel
- self._managed_call = managed_call
- self._method = method
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
+ def __init__(self, channel, managed_call, method, request_serializer,
+ response_deserializer):
+ self._channel = channel
+ self._managed_call = managed_call
+ self._method = method
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
self._context = cygrpc.build_census_context()
-
+
def _prepare(self, request, timeout, metadata, wait_for_ready, compression):
deadline, serialized_request, rendezvous = _start_unary_request(
request, timeout, self._request_serializer)
@@ -878,11 +878,11 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
wait_for_ready)
augmented_metadata = _compression.augment_metadata(
metadata, compression)
- if serialized_request is None:
+ if serialized_request is None:
return None, None, None, rendezvous
- else:
- state = _RPCState(_UNARY_UNARY_INITIAL_DUE, None, None, None, None)
- operations = (
+ else:
+ state = _RPCState(_UNARY_UNARY_INITIAL_DUE, None, None, None, None)
+ operations = (
cygrpc.SendInitialMetadataOperation(augmented_metadata,
initial_metadata_flags),
cygrpc.SendMessageOperation(serialized_request, _EMPTY_FLAGS),
@@ -892,14 +892,14 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
cygrpc.ReceiveStatusOnClientOperation(_EMPTY_FLAGS),
)
return state, operations, deadline, None
-
+
def _blocking(self, request, timeout, metadata, credentials, wait_for_ready,
compression):
state, operations, deadline, rendezvous = self._prepare(
request, timeout, metadata, wait_for_ready, compression)
if state is None:
raise rendezvous # pylint: disable-msg=raising-bad-type
- else:
+ else:
call = self._channel.segregated_call(
cygrpc.PropagationConstants.GRPC_PROPAGATE_DEFAULTS,
self._method, None, _determine_deadline(deadline), metadata,
@@ -910,7 +910,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
event = call.next_event()
_handle_event(event, state, self._response_deserializer)
return state, call
-
+
def __call__(self,
request,
timeout=None,
@@ -921,7 +921,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
state, call, = self._blocking(request, timeout, metadata, credentials,
wait_for_ready, compression)
return _end_unary_response_blocking(state, call, False, None)
-
+
def with_call(self,
request,
timeout=None,
@@ -932,7 +932,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
state, call, = self._blocking(request, timeout, metadata, credentials,
wait_for_ready, compression)
return _end_unary_response_blocking(state, call, True, None)
-
+
def future(self,
request,
timeout=None,
@@ -944,7 +944,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
request, timeout, metadata, wait_for_ready, compression)
if state is None:
raise rendezvous # pylint: disable-msg=raising-bad-type
- else:
+ else:
event_handler = _event_handler(state, self._response_deserializer)
call = self._managed_call(
cygrpc.PropagationConstants.GRPC_PROPAGATE_DEFAULTS,
@@ -954,8 +954,8 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
return _MultiThreadedRendezvous(state, call,
self._response_deserializer,
deadline)
-
-
+
+
class _SingleThreadedUnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
# pylint: disable=too-many-arguments
@@ -1006,18 +1006,18 @@ class _SingleThreadedUnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
self._response_deserializer, deadline)
-class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
-
+class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
+
# pylint: disable=too-many-arguments
- def __init__(self, channel, managed_call, method, request_serializer,
- response_deserializer):
- self._channel = channel
- self._managed_call = managed_call
- self._method = method
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
+ def __init__(self, channel, managed_call, method, request_serializer,
+ response_deserializer):
+ self._channel = channel
+ self._managed_call = managed_call
+ self._method = method
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
self._context = cygrpc.build_census_context()
-
+
def __call__( # pylint: disable=too-many-locals
self,
request,
@@ -1030,12 +1030,12 @@ class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
request, timeout, self._request_serializer)
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
- if serialized_request is None:
+ if serialized_request is None:
raise rendezvous # pylint: disable-msg=raising-bad-type
- else:
+ else:
augmented_metadata = _compression.augment_metadata(
metadata, compression)
- state = _RPCState(_UNARY_STREAM_INITIAL_DUE, None, None, None, None)
+ state = _RPCState(_UNARY_STREAM_INITIAL_DUE, None, None, None, None)
operationses = (
(
cygrpc.SendInitialMetadataOperation(augmented_metadata,
@@ -1057,24 +1057,24 @@ class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
return _MultiThreadedRendezvous(state, call,
self._response_deserializer,
deadline)
-
-
-class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable):
-
+
+
+class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable):
+
# pylint: disable=too-many-arguments
- def __init__(self, channel, managed_call, method, request_serializer,
- response_deserializer):
- self._channel = channel
- self._managed_call = managed_call
- self._method = method
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
+ def __init__(self, channel, managed_call, method, request_serializer,
+ response_deserializer):
+ self._channel = channel
+ self._managed_call = managed_call
+ self._method = method
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
self._context = cygrpc.build_census_context()
-
+
def _blocking(self, request_iterator, timeout, metadata, credentials,
wait_for_ready, compression):
deadline = _deadline(timeout)
- state = _RPCState(_STREAM_UNARY_INITIAL_DUE, None, None, None, None)
+ state = _RPCState(_STREAM_UNARY_INITIAL_DUE, None, None, None, None)
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
augmented_metadata = _compression.augment_metadata(
@@ -1087,46 +1087,46 @@ class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable):
augmented_metadata, initial_metadata_flags), self._context)
_consume_request_iterator(request_iterator, state, call,
self._request_serializer, None)
- while True:
+ while True:
event = call.next_event()
- with state.condition:
- _handle_event(event, state, self._response_deserializer)
- state.condition.notify_all()
- if not state.due:
- break
+ with state.condition:
+ _handle_event(event, state, self._response_deserializer)
+ state.condition.notify_all()
+ if not state.due:
+ break
return state, call
-
- def __call__(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ def __call__(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
state, call, = self._blocking(request_iterator, timeout, metadata,
credentials, wait_for_ready, compression)
return _end_unary_response_blocking(state, call, False, None)
-
- def with_call(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ def with_call(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
state, call, = self._blocking(request_iterator, timeout, metadata,
credentials, wait_for_ready, compression)
return _end_unary_response_blocking(state, call, True, None)
-
- def future(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ def future(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
deadline = _deadline(timeout)
- state = _RPCState(_STREAM_UNARY_INITIAL_DUE, None, None, None, None)
+ state = _RPCState(_STREAM_UNARY_INITIAL_DUE, None, None, None, None)
event_handler = _event_handler(state, self._response_deserializer)
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
@@ -1143,29 +1143,29 @@ class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable):
self._request_serializer, event_handler)
return _MultiThreadedRendezvous(state, call,
self._response_deserializer, deadline)
-
-
-class _StreamStreamMultiCallable(grpc.StreamStreamMultiCallable):
-
+
+
+class _StreamStreamMultiCallable(grpc.StreamStreamMultiCallable):
+
# pylint: disable=too-many-arguments
- def __init__(self, channel, managed_call, method, request_serializer,
- response_deserializer):
- self._channel = channel
- self._managed_call = managed_call
- self._method = method
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
+ def __init__(self, channel, managed_call, method, request_serializer,
+ response_deserializer):
+ self._channel = channel
+ self._managed_call = managed_call
+ self._method = method
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
self._context = cygrpc.build_census_context()
-
- def __call__(self,
- request_iterator,
- timeout=None,
- metadata=None,
+
+ def __call__(self,
+ request_iterator,
+ timeout=None,
+ metadata=None,
credentials=None,
wait_for_ready=None,
compression=None):
deadline = _deadline(timeout)
- state = _RPCState(_STREAM_STREAM_INITIAL_DUE, None, None, None, None)
+ state = _RPCState(_STREAM_STREAM_INITIAL_DUE, None, None, None, None)
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
augmented_metadata = _compression.augment_metadata(
@@ -1188,8 +1188,8 @@ class _StreamStreamMultiCallable(grpc.StreamStreamMultiCallable):
self._request_serializer, event_handler)
return _MultiThreadedRendezvous(state, call,
self._response_deserializer, deadline)
-
-
+
+
class _InitialMetadataFlags(int):
"""Stores immutable initial metadata flags"""
@@ -1208,17 +1208,17 @@ class _InitialMetadataFlags(int):
return self
-class _ChannelCallState(object):
-
- def __init__(self, channel):
- self.lock = threading.Lock()
- self.channel = channel
+class _ChannelCallState(object):
+
+ def __init__(self, channel):
+ self.lock = threading.Lock()
+ self.channel = channel
self.managed_calls = 0
self.threading = False
-
+
def reset_postfork_child(self):
self.managed_calls = 0
-
+
def __del__(self):
try:
self.channel.close(cygrpc.StatusCode.cancelled,
@@ -1227,33 +1227,33 @@ class _ChannelCallState(object):
pass
-def _run_channel_spin_thread(state):
-
- def channel_spin():
- while True:
+def _run_channel_spin_thread(state):
+
+ def channel_spin():
+ while True:
cygrpc.block_if_fork_in_progress(state)
event = state.channel.next_call_event()
if event.completion_type == cygrpc.CompletionType.queue_timeout:
continue
call_completed = event.tag(event)
if call_completed:
- with state.lock:
+ with state.lock:
state.managed_calls -= 1
if state.managed_calls == 0:
- return
-
+ return
+
channel_spin_thread = cygrpc.ForkManagedThread(target=channel_spin)
channel_spin_thread.setDaemon(True)
- channel_spin_thread.start()
-
-
-def _channel_managed_call_management(state):
-
+ channel_spin_thread.start()
+
+
+def _channel_managed_call_management(state):
+
# pylint: disable=too-many-arguments
def create(flags, method, host, deadline, metadata, credentials,
operationses, event_handler, context):
"""Creates a cygrpc.IntegratedCall.
-
+
Args:
flags: An integer bitfield of call flags.
method: The RPC method.
@@ -1284,60 +1284,60 @@ def _channel_managed_call_management(state):
else:
state.managed_calls += 1
return call
-
- return create
-
-
-class _ChannelConnectivityState(object):
-
- def __init__(self, channel):
+
+ return create
+
+
+class _ChannelConnectivityState(object):
+
+ def __init__(self, channel):
self.lock = threading.RLock()
- self.channel = channel
- self.polling = False
- self.connectivity = None
- self.try_to_connect = False
- self.callbacks_and_connectivities = []
- self.delivering = False
-
+ self.channel = channel
+ self.polling = False
+ self.connectivity = None
+ self.try_to_connect = False
+ self.callbacks_and_connectivities = []
+ self.delivering = False
+
def reset_postfork_child(self):
self.polling = False
self.connectivity = None
self.try_to_connect = False
self.callbacks_and_connectivities = []
self.delivering = False
-
-
-def _deliveries(state):
- callbacks_needing_update = []
- for callback_and_connectivity in state.callbacks_and_connectivities:
- callback, callback_connectivity, = callback_and_connectivity
- if callback_connectivity is not state.connectivity:
- callbacks_needing_update.append(callback)
- callback_and_connectivity[1] = state.connectivity
- return callbacks_needing_update
-
-
-def _deliver(state, initial_connectivity, initial_callbacks):
- connectivity = initial_connectivity
- callbacks = initial_callbacks
- while True:
- for callback in callbacks:
+
+
+def _deliveries(state):
+ callbacks_needing_update = []
+ for callback_and_connectivity in state.callbacks_and_connectivities:
+ callback, callback_connectivity, = callback_and_connectivity
+ if callback_connectivity is not state.connectivity:
+ callbacks_needing_update.append(callback)
+ callback_and_connectivity[1] = state.connectivity
+ return callbacks_needing_update
+
+
+def _deliver(state, initial_connectivity, initial_callbacks):
+ connectivity = initial_connectivity
+ callbacks = initial_callbacks
+ while True:
+ for callback in callbacks:
cygrpc.block_if_fork_in_progress(state)
try:
callback(connectivity)
except Exception: # pylint: disable=broad-except
_LOGGER.exception(
_CHANNEL_SUBSCRIPTION_CALLBACK_ERROR_LOG_MESSAGE)
- with state.lock:
- callbacks = _deliveries(state)
- if callbacks:
- connectivity = state.connectivity
- else:
- state.delivering = False
- return
-
-
-def _spawn_delivery(state, callbacks):
+ with state.lock:
+ callbacks = _deliveries(state)
+ if callbacks:
+ connectivity = state.connectivity
+ else:
+ state.delivering = False
+ return
+
+
+def _spawn_delivery(state, callbacks):
delivering_thread = cygrpc.ForkManagedThread(target=_deliver,
args=(
state,
@@ -1345,85 +1345,85 @@ def _spawn_delivery(state, callbacks):
callbacks,
))
delivering_thread.setDaemon(True)
- delivering_thread.start()
- state.delivering = True
-
-
-# NOTE(https://github.com/grpc/grpc/issues/3064): We'd rather not poll.
-def _poll_connectivity(state, channel, initial_try_to_connect):
- try_to_connect = initial_try_to_connect
- connectivity = channel.check_connectivity_state(try_to_connect)
- with state.lock:
- state.connectivity = (
+ delivering_thread.start()
+ state.delivering = True
+
+
+# NOTE(https://github.com/grpc/grpc/issues/3064): We'd rather not poll.
+def _poll_connectivity(state, channel, initial_try_to_connect):
+ try_to_connect = initial_try_to_connect
+ connectivity = channel.check_connectivity_state(try_to_connect)
+ with state.lock:
+ state.connectivity = (
_common.
CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[connectivity])
callbacks = tuple(
callback for callback, unused_but_known_to_be_none_connectivity in
state.callbacks_and_connectivities)
- for callback_and_connectivity in state.callbacks_and_connectivities:
- callback_and_connectivity[1] = state.connectivity
- if callbacks:
- _spawn_delivery(state, callbacks)
- while True:
+ for callback_and_connectivity in state.callbacks_and_connectivities:
+ callback_and_connectivity[1] = state.connectivity
+ if callbacks:
+ _spawn_delivery(state, callbacks)
+ while True:
event = channel.watch_connectivity_state(connectivity,
time.time() + 0.2)
cygrpc.block_if_fork_in_progress(state)
- with state.lock:
- if not state.callbacks_and_connectivities and not state.try_to_connect:
- state.polling = False
- state.connectivity = None
- break
- try_to_connect = state.try_to_connect
- state.try_to_connect = False
- if event.success or try_to_connect:
- connectivity = channel.check_connectivity_state(try_to_connect)
- with state.lock:
- state.connectivity = (
- _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[
- connectivity])
- if not state.delivering:
+ with state.lock:
+ if not state.callbacks_and_connectivities and not state.try_to_connect:
+ state.polling = False
+ state.connectivity = None
+ break
+ try_to_connect = state.try_to_connect
+ state.try_to_connect = False
+ if event.success or try_to_connect:
+ connectivity = channel.check_connectivity_state(try_to_connect)
+ with state.lock:
+ state.connectivity = (
+ _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[
+ connectivity])
+ if not state.delivering:
callbacks = _deliveries(state)
- if callbacks:
- _spawn_delivery(state, callbacks)
-
-
-def _subscribe(state, callback, try_to_connect):
- with state.lock:
- if not state.callbacks_and_connectivities and not state.polling:
+ if callbacks:
+ _spawn_delivery(state, callbacks)
+
+
+def _subscribe(state, callback, try_to_connect):
+ with state.lock:
+ if not state.callbacks_and_connectivities and not state.polling:
polling_thread = cygrpc.ForkManagedThread(
- target=_poll_connectivity,
- args=(state, state.channel, bool(try_to_connect)))
+ target=_poll_connectivity,
+ args=(state, state.channel, bool(try_to_connect)))
polling_thread.setDaemon(True)
- polling_thread.start()
- state.polling = True
- state.callbacks_and_connectivities.append([callback, None])
- elif not state.delivering and state.connectivity is not None:
- _spawn_delivery(state, (callback,))
- state.try_to_connect |= bool(try_to_connect)
- state.callbacks_and_connectivities.append(
- [callback, state.connectivity])
- else:
- state.try_to_connect |= bool(try_to_connect)
- state.callbacks_and_connectivities.append([callback, None])
-
-
-def _unsubscribe(state, callback):
- with state.lock:
+ polling_thread.start()
+ state.polling = True
+ state.callbacks_and_connectivities.append([callback, None])
+ elif not state.delivering and state.connectivity is not None:
+ _spawn_delivery(state, (callback,))
+ state.try_to_connect |= bool(try_to_connect)
+ state.callbacks_and_connectivities.append(
+ [callback, state.connectivity])
+ else:
+ state.try_to_connect |= bool(try_to_connect)
+ state.callbacks_and_connectivities.append([callback, None])
+
+
+def _unsubscribe(state, callback):
+ with state.lock:
for index, (subscribed_callback, unused_connectivity) in enumerate(
state.callbacks_and_connectivities):
- if callback == subscribed_callback:
- state.callbacks_and_connectivities.pop(index)
- break
-
-
+ if callback == subscribed_callback:
+ state.callbacks_and_connectivities.pop(index)
+ break
+
+
def _augment_options(base_options, compression):
compression_option = _compression.create_channel_option(compression)
return tuple(base_options) + compression_option + ((
cygrpc.ChannelArgKey.primary_user_agent_string,
_USER_AGENT,
),)
-
-
+
+
def _separate_channel_options(options):
"""Separates core channel options from Python channel options."""
core_options = []
@@ -1436,12 +1436,12 @@ def _separate_channel_options(options):
return python_options, core_options
-class Channel(grpc.Channel):
- """A cygrpc.Channel-backed implementation of grpc.Channel."""
-
+class Channel(grpc.Channel):
+ """A cygrpc.Channel-backed implementation of grpc.Channel."""
+
def __init__(self, target, options, credentials, compression):
- """Constructor.
-
+ """Constructor.
+
Args:
target: The target to which to connect.
options: Configuration options for the channel.
@@ -1452,37 +1452,37 @@ class Channel(grpc.Channel):
python_options, core_options = _separate_channel_options(options)
self._single_threaded_unary_stream = _DEFAULT_SINGLE_THREADED_UNARY_STREAM
self._process_python_options(python_options)
- self._channel = cygrpc.Channel(
+ self._channel = cygrpc.Channel(
_common.encode(target), _augment_options(core_options, compression),
credentials)
- self._call_state = _ChannelCallState(self._channel)
- self._connectivity_state = _ChannelConnectivityState(self._channel)
+ self._call_state = _ChannelCallState(self._channel)
+ self._connectivity_state = _ChannelConnectivityState(self._channel)
cygrpc.fork_register_channel(self)
-
+
def _process_python_options(self, python_options):
"""Sets channel attributes according to python-only channel options."""
for pair in python_options:
if pair[0] == grpc.experimental.ChannelOptions.SingleThreadedUnaryStream:
self._single_threaded_unary_stream = True
- def subscribe(self, callback, try_to_connect=None):
- _subscribe(self._connectivity_state, callback, try_to_connect)
-
- def unsubscribe(self, callback):
- _unsubscribe(self._connectivity_state, callback)
-
- def unary_unary(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- return _UnaryUnaryMultiCallable(
+ def subscribe(self, callback, try_to_connect=None):
+ _subscribe(self._connectivity_state, callback, try_to_connect)
+
+ def unsubscribe(self, callback):
+ _unsubscribe(self._connectivity_state, callback)
+
+ def unary_unary(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ return _UnaryUnaryMultiCallable(
self._channel, _channel_managed_call_management(self._call_state),
- _common.encode(method), request_serializer, response_deserializer)
-
- def unary_stream(self,
- method,
- request_serializer=None,
- response_deserializer=None):
+ _common.encode(method), request_serializer, response_deserializer)
+
+ def unary_stream(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
# NOTE(rbellevi): Benchmarks have shown that running a unary-stream RPC
# on a single Python thread results in an appreciable speed-up. However,
# due to slight differences in capability, the multi-threaded variant
@@ -1497,23 +1497,23 @@ class Channel(grpc.Channel):
_channel_managed_call_management(self._call_state),
_common.encode(method), request_serializer,
response_deserializer)
-
- def stream_unary(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- return _StreamUnaryMultiCallable(
+
+ def stream_unary(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ return _StreamUnaryMultiCallable(
self._channel, _channel_managed_call_management(self._call_state),
- _common.encode(method), request_serializer, response_deserializer)
-
- def stream_stream(self,
- method,
- request_serializer=None,
- response_deserializer=None):
- return _StreamStreamMultiCallable(
+ _common.encode(method), request_serializer, response_deserializer)
+
+ def stream_stream(self,
+ method,
+ request_serializer=None,
+ response_deserializer=None):
+ return _StreamStreamMultiCallable(
self._channel, _channel_managed_call_management(self._call_state),
- _common.encode(method), request_serializer, response_deserializer)
-
+ _common.encode(method), request_serializer, response_deserializer)
+
def _unsubscribe_all(self):
state = self._connectivity_state
if state:
@@ -1540,7 +1540,7 @@ class Channel(grpc.Channel):
def close(self):
self._close()
- def __del__(self):
+ def __del__(self):
# TODO(https://github.com/grpc/grpc/issues/12531): Several releases
# after 1.12 (1.16 or thereabouts?) add a "self._channel.close" call
# here (or more likely, call self._close() here). We don't do this today
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_common.py b/contrib/libs/grpc/src/python/grpcio/grpc/_common.py
index ddf4512541..128124c325 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_common.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_common.py
@@ -1,105 +1,105 @@
# Copyright 2016 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.
-"""Shared implementation."""
-
-import logging
+"""Shared implementation."""
+
+import logging
import time
-import six
-
-import grpc
-from grpc._cython import cygrpc
-
+import six
+
+import grpc
+from grpc._cython import cygrpc
+
_LOGGER = logging.getLogger(__name__)
-CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
- cygrpc.ConnectivityState.idle:
+CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = {
+ cygrpc.ConnectivityState.idle:
grpc.ChannelConnectivity.IDLE,
- cygrpc.ConnectivityState.connecting:
+ cygrpc.ConnectivityState.connecting:
grpc.ChannelConnectivity.CONNECTING,
- cygrpc.ConnectivityState.ready:
+ cygrpc.ConnectivityState.ready:
grpc.ChannelConnectivity.READY,
- cygrpc.ConnectivityState.transient_failure:
+ cygrpc.ConnectivityState.transient_failure:
grpc.ChannelConnectivity.TRANSIENT_FAILURE,
- cygrpc.ConnectivityState.shutdown:
+ cygrpc.ConnectivityState.shutdown:
grpc.ChannelConnectivity.SHUTDOWN,
-}
-
-CYGRPC_STATUS_CODE_TO_STATUS_CODE = {
- cygrpc.StatusCode.ok: grpc.StatusCode.OK,
- cygrpc.StatusCode.cancelled: grpc.StatusCode.CANCELLED,
- cygrpc.StatusCode.unknown: grpc.StatusCode.UNKNOWN,
- cygrpc.StatusCode.invalid_argument: grpc.StatusCode.INVALID_ARGUMENT,
- cygrpc.StatusCode.deadline_exceeded: grpc.StatusCode.DEADLINE_EXCEEDED,
- cygrpc.StatusCode.not_found: grpc.StatusCode.NOT_FOUND,
- cygrpc.StatusCode.already_exists: grpc.StatusCode.ALREADY_EXISTS,
- cygrpc.StatusCode.permission_denied: grpc.StatusCode.PERMISSION_DENIED,
- cygrpc.StatusCode.unauthenticated: grpc.StatusCode.UNAUTHENTICATED,
- cygrpc.StatusCode.resource_exhausted: grpc.StatusCode.RESOURCE_EXHAUSTED,
- cygrpc.StatusCode.failed_precondition: grpc.StatusCode.FAILED_PRECONDITION,
- cygrpc.StatusCode.aborted: grpc.StatusCode.ABORTED,
- cygrpc.StatusCode.out_of_range: grpc.StatusCode.OUT_OF_RANGE,
- cygrpc.StatusCode.unimplemented: grpc.StatusCode.UNIMPLEMENTED,
- cygrpc.StatusCode.internal: grpc.StatusCode.INTERNAL,
- cygrpc.StatusCode.unavailable: grpc.StatusCode.UNAVAILABLE,
- cygrpc.StatusCode.data_loss: grpc.StatusCode.DATA_LOSS,
-}
-STATUS_CODE_TO_CYGRPC_STATUS_CODE = {
+}
+
+CYGRPC_STATUS_CODE_TO_STATUS_CODE = {
+ cygrpc.StatusCode.ok: grpc.StatusCode.OK,
+ cygrpc.StatusCode.cancelled: grpc.StatusCode.CANCELLED,
+ cygrpc.StatusCode.unknown: grpc.StatusCode.UNKNOWN,
+ cygrpc.StatusCode.invalid_argument: grpc.StatusCode.INVALID_ARGUMENT,
+ cygrpc.StatusCode.deadline_exceeded: grpc.StatusCode.DEADLINE_EXCEEDED,
+ cygrpc.StatusCode.not_found: grpc.StatusCode.NOT_FOUND,
+ cygrpc.StatusCode.already_exists: grpc.StatusCode.ALREADY_EXISTS,
+ cygrpc.StatusCode.permission_denied: grpc.StatusCode.PERMISSION_DENIED,
+ cygrpc.StatusCode.unauthenticated: grpc.StatusCode.UNAUTHENTICATED,
+ cygrpc.StatusCode.resource_exhausted: grpc.StatusCode.RESOURCE_EXHAUSTED,
+ cygrpc.StatusCode.failed_precondition: grpc.StatusCode.FAILED_PRECONDITION,
+ cygrpc.StatusCode.aborted: grpc.StatusCode.ABORTED,
+ cygrpc.StatusCode.out_of_range: grpc.StatusCode.OUT_OF_RANGE,
+ cygrpc.StatusCode.unimplemented: grpc.StatusCode.UNIMPLEMENTED,
+ cygrpc.StatusCode.internal: grpc.StatusCode.INTERNAL,
+ cygrpc.StatusCode.unavailable: grpc.StatusCode.UNAVAILABLE,
+ cygrpc.StatusCode.data_loss: grpc.StatusCode.DATA_LOSS,
+}
+STATUS_CODE_TO_CYGRPC_STATUS_CODE = {
grpc_code: cygrpc_code for cygrpc_code, grpc_code in six.iteritems(
- CYGRPC_STATUS_CODE_TO_STATUS_CODE)
-}
-
+ CYGRPC_STATUS_CODE_TO_STATUS_CODE)
+}
+
MAXIMUM_WAIT_TIMEOUT = 0.1
-
+
_ERROR_MESSAGE_PORT_BINDING_FAILED = 'Failed to bind to address %s; set ' \
'GRPC_VERBOSITY=debug environment variable to see detailed error message.'
-def encode(s):
- if isinstance(s, bytes):
- return s
- else:
+def encode(s):
+ if isinstance(s, bytes):
+ return s
+ else:
return s.encode('utf8')
-
-
-def decode(b):
+
+
+def decode(b):
if isinstance(b, bytes):
return b.decode('utf-8', 'replace')
return b
-
-
-def _transform(message, transformer, exception_message):
- if transformer is None:
- return message
- else:
- try:
- return transformer(message)
- except Exception: # pylint: disable=broad-except
+
+
+def _transform(message, transformer, exception_message):
+ if transformer is None:
+ return message
+ else:
+ try:
+ return transformer(message)
+ except Exception: # pylint: disable=broad-except
_LOGGER.exception(exception_message)
- return None
-
-
-def serialize(message, serializer):
- return _transform(message, serializer, 'Exception serializing message!')
-
-
-def deserialize(serialized_message, deserializer):
- return _transform(serialized_message, deserializer,
- 'Exception deserializing message!')
-
-
-def fully_qualified_method(group, method):
- return '/{}/{}'.format(group, method)
+ return None
+
+
+def serialize(message, serializer):
+ return _transform(message, serializer, 'Exception serializing message!')
+
+
+def deserialize(serialized_message, deserializer):
+ return _transform(serialized_message, deserializer,
+ 'Exception deserializing message!')
+
+
+def fully_qualified_method(group, method):
+ return '/{}/{}'.format(group, method)
def _wait_once(wait_fn, timeout, spin_cb):
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/README.rst b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/README.rst
index f39a14397e..c0e66734e8 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/README.rst
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/README.rst
@@ -1,52 +1,52 @@
-GRPC Python Cython layer
-========================
-
-Package for the GRPC Python Cython layer.
-
-What is Cython?
----------------
-
-Cython is both a superset of the Python language with extensions for dealing
-with C types and a tool that transpiles this superset into C code. It provides
-convenient means of statically typing expressions and of converting Python
-strings to pointers (among other niceties), thus dramatically smoothing the
-Python/C interop by allowing fluid use of APIs in both from the same source.
-See the wonderful `Cython website`_.
-
-Why Cython?
------------
-
-- **Python 2 and 3 support**
- Cython generated C code has precompiler macros to target both Python 2 and
- Python 3 C APIs, even while acting as a superset of just the Python 2
- language (e.g. using ``basestring``).
-- **Significantly less semantic noise**
- A lot of CPython code is just glue, especially human-error-prone
- ``Py_INCREF``-ing and ``Py_DECREF``-ing around error handlers and such.
- Cython takes care of that automagically.
-- **Possible PyPy support**
- One of the major developments in Cython over the past few years was the
- addition of support for PyPy. We might soon be able to provide such support
- ourselves through our use of Cython.
-- **Less Python glue code**
- There existed several adapter layers in and around the original CPython code
- to smooth the surface exposed to Python due to how much trouble it was to
- make such a smooth surface via the CPython API alone. Cython makes writing
- such a surface incredibly easy, so these adapter layers may be removed.
-
-Implications for Users
-----------------------
-
-Nothing additional will be required for users. PyPI packages will contain
-Cython generated C code and thus not necessitate a Cython installation.
-
-Implications for GRPC Developers
---------------------------------
-
-A typical edit-compile-debug cycle now requires Cython. We install Cython in
-the ``virtualenv`` generated for the Python tests in this repository, so
-initial test runs may take an extra 2+ minutes to complete. Subsequent test
-runs won't reinstall ``Cython`` (unless required versions change and the
-``virtualenv`` doesn't have installed versions that satisfy the change).
-
-.. _`Cython website`: http://cython.org/
+GRPC Python Cython layer
+========================
+
+Package for the GRPC Python Cython layer.
+
+What is Cython?
+---------------
+
+Cython is both a superset of the Python language with extensions for dealing
+with C types and a tool that transpiles this superset into C code. It provides
+convenient means of statically typing expressions and of converting Python
+strings to pointers (among other niceties), thus dramatically smoothing the
+Python/C interop by allowing fluid use of APIs in both from the same source.
+See the wonderful `Cython website`_.
+
+Why Cython?
+-----------
+
+- **Python 2 and 3 support**
+ Cython generated C code has precompiler macros to target both Python 2 and
+ Python 3 C APIs, even while acting as a superset of just the Python 2
+ language (e.g. using ``basestring``).
+- **Significantly less semantic noise**
+ A lot of CPython code is just glue, especially human-error-prone
+ ``Py_INCREF``-ing and ``Py_DECREF``-ing around error handlers and such.
+ Cython takes care of that automagically.
+- **Possible PyPy support**
+ One of the major developments in Cython over the past few years was the
+ addition of support for PyPy. We might soon be able to provide such support
+ ourselves through our use of Cython.
+- **Less Python glue code**
+ There existed several adapter layers in and around the original CPython code
+ to smooth the surface exposed to Python due to how much trouble it was to
+ make such a smooth surface via the CPython API alone. Cython makes writing
+ such a surface incredibly easy, so these adapter layers may be removed.
+
+Implications for Users
+----------------------
+
+Nothing additional will be required for users. PyPI packages will contain
+Cython generated C code and thus not necessitate a Cython installation.
+
+Implications for GRPC Developers
+--------------------------------
+
+A typical edit-compile-debug cycle now requires Cython. We install Cython in
+the ``virtualenv`` generated for the Python tests in this repository, so
+initial test runs may take an extra 2+ minutes to complete. Subsequent test
+runs won't reinstall ``Cython`` (unless required versions change and the
+``virtualenv`` doesn't have installed versions that satisfy the change).
+
+.. _`Cython website`: http://cython.org/
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pxd.pxi
index 2c03670aba..8babeb4536 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pxd.pxi
@@ -1,20 +1,20 @@
# 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.
-
-
-cdef class Call:
-
- cdef grpc_call *c_call
- cdef list references
-
+
+
+cdef class Call:
+
+ cdef grpc_call *c_call
+ cdef list references
+
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi
index c5fcf4e37a..bdd155bea9 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi
@@ -1,97 +1,97 @@
# 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.
-
-
-cdef class Call:
-
- def __cinit__(self):
- # Create an *empty* call
+
+
+cdef class Call:
+
+ def __cinit__(self):
+ # Create an *empty* call
fork_handlers_and_grpc_init()
- self.c_call = NULL
- self.references = []
-
- def _start_batch(self, operations, tag, retain_self):
- if not self.is_valid:
- raise ValueError("invalid call object cannot be used from Python")
+ self.c_call = NULL
+ self.references = []
+
+ def _start_batch(self, operations, tag, retain_self):
+ if not self.is_valid:
+ raise ValueError("invalid call object cannot be used from Python")
cdef _BatchOperationTag batch_operation_tag = _BatchOperationTag(
tag, operations, self if retain_self else None)
batch_operation_tag.prepare()
cpython.Py_INCREF(batch_operation_tag)
cdef grpc_call_error error
- with nogil:
+ with nogil:
error = grpc_call_start_batch(
self.c_call, batch_operation_tag.c_ops, batch_operation_tag.c_nops,
<cpython.PyObject *>batch_operation_tag, NULL)
return error
-
- def start_client_batch(self, operations, tag):
- # We don't reference this call in the operations tag because
- # it should be cancelled when it goes out of scope
- return self._start_batch(operations, tag, False)
-
- def start_server_batch(self, operations, tag):
- return self._start_batch(operations, tag, True)
-
- def cancel(
- self, grpc_status_code error_code=GRPC_STATUS__DO_NOT_USE,
- details=None):
- details = str_to_bytes(details)
- if not self.is_valid:
- raise ValueError("invalid call object cannot be used from Python")
- if (details is None) != (error_code == GRPC_STATUS__DO_NOT_USE):
- raise ValueError("if error_code is specified, so must details "
- "(and vice-versa)")
- cdef grpc_call_error result
- cdef char *c_details = NULL
- if error_code != GRPC_STATUS__DO_NOT_USE:
- self.references.append(details)
- c_details = details
- with nogil:
- result = grpc_call_cancel_with_status(
- self.c_call, error_code, c_details, NULL)
- return result
- else:
- with nogil:
- result = grpc_call_cancel(self.c_call, NULL)
- return result
-
+
+ def start_client_batch(self, operations, tag):
+ # We don't reference this call in the operations tag because
+ # it should be cancelled when it goes out of scope
+ return self._start_batch(operations, tag, False)
+
+ def start_server_batch(self, operations, tag):
+ return self._start_batch(operations, tag, True)
+
+ def cancel(
+ self, grpc_status_code error_code=GRPC_STATUS__DO_NOT_USE,
+ details=None):
+ details = str_to_bytes(details)
+ if not self.is_valid:
+ raise ValueError("invalid call object cannot be used from Python")
+ if (details is None) != (error_code == GRPC_STATUS__DO_NOT_USE):
+ raise ValueError("if error_code is specified, so must details "
+ "(and vice-versa)")
+ cdef grpc_call_error result
+ cdef char *c_details = NULL
+ if error_code != GRPC_STATUS__DO_NOT_USE:
+ self.references.append(details)
+ c_details = details
+ with nogil:
+ result = grpc_call_cancel_with_status(
+ self.c_call, error_code, c_details, NULL)
+ return result
+ else:
+ with nogil:
+ result = grpc_call_cancel(self.c_call, NULL)
+ return result
+
def set_credentials(self, CallCredentials call_credentials not None):
cdef grpc_call_credentials *c_call_credentials = call_credentials.c()
cdef grpc_call_error call_error = grpc_call_set_credentials(
self.c_call, c_call_credentials)
grpc_call_credentials_release(c_call_credentials)
return call_error
-
- def peer(self):
- cdef char *peer = NULL
- with nogil:
- peer = grpc_call_get_peer(self.c_call)
- result = <bytes>peer
- with nogil:
- gpr_free(peer)
- return result
-
- def __dealloc__(self):
+
+ def peer(self):
+ cdef char *peer = NULL
+ with nogil:
+ peer = grpc_call_get_peer(self.c_call)
+ result = <bytes>peer
+ with nogil:
+ gpr_free(peer)
+ return result
+
+ def __dealloc__(self):
with nogil:
if self.c_call != NULL:
grpc_call_unref(self.c_call)
grpc_shutdown_blocking()
-
- # The object *should* always be valid from Python. Used for debugging.
- @property
- def is_valid(self):
- return self.c_call != NULL
-
+
+ # The object *should* always be valid from Python. Used for debugging.
+ @property
+ def is_valid(self):
+ return self.c_call != NULL
+
def _custom_op_on_c_call(self, int op):
return _custom_op_on_c_call(op, self.c_call)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
index 1c38d29bee..eb27f2df7a 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
@@ -1,18 +1,18 @@
# 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.
-
-
+
+
cdef _check_call_error_no_metadata(c_call_error)
@@ -66,8 +66,8 @@ cdef class SegregatedCall:
cdef grpc_completion_queue *_c_completion_queue
-cdef class Channel:
-
+cdef class Channel:
+
cdef _ChannelState _state
# TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
index 1de48a3690..74c7f6c140 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
@@ -1,18 +1,18 @@
# 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.
-
-
+
+
_INTERNAL_CALL_ERROR_MESSAGE_FORMAT = (
'Internal gRPC call error %d. ' +
'Please report to https://github.com/grpc/grpc/issues')
@@ -438,8 +438,8 @@ cdef _calls_drained(_ChannelState state):
return not (state.integrated_call_states or state.segregated_call_states or
state.connectivity_due)
-cdef class Channel:
-
+cdef class Channel:
+
def __cinit__(
self, bytes target, object arguments,
ChannelCredentials channel_credentials):
@@ -452,15 +452,15 @@ cdef class Channel:
grpc_completion_queue_create_for_next(NULL))
self._arguments = arguments
cdef _ChannelArgs channel_args = _ChannelArgs(arguments)
- if channel_credentials is None:
+ if channel_credentials is None:
self._state.c_channel = grpc_insecure_channel_create(
<char *>target, channel_args.c_args(), NULL)
- else:
+ else:
c_channel_credentials = channel_credentials.c()
self._state.c_channel = grpc_secure_channel_create(
c_channel_credentials, <char *>target, channel_args.c_args(), NULL)
grpc_channel_credentials_release(c_channel_credentials)
-
+
def target(self):
cdef char *c_target
with self._state.condition:
@@ -468,7 +468,7 @@ cdef class Channel:
target = <bytes>c_target
gpr_free(c_target)
return target
-
+
def integrated_call(
self, int flags, method, host, object deadline, object metadata,
CallCredentials credentials, operationses_and_tags,
@@ -499,18 +499,18 @@ cdef class Channel:
self._state, flags, method, host, deadline, metadata, credentials,
operationses_and_tags, context)
- def check_connectivity_state(self, bint try_to_connect):
+ def check_connectivity_state(self, bint try_to_connect):
with self._state.condition:
if self._state.open:
return grpc_channel_check_connectivity_state(
self._state.c_channel, try_to_connect)
else:
raise ValueError('Cannot invoke RPC: %s' % self._state.closed_reason)
-
- def watch_connectivity_state(
+
+ def watch_connectivity_state(
self, grpc_connectivity_state last_observed_state, object deadline):
return _watch_connectivity_state(self._state, last_observed_state, deadline)
-
+
def close(self, code, details):
_close(self, code, details, False)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi
index 303d5b3bd1..0307f74cbe 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi
@@ -1,28 +1,28 @@
# 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.
-
-
+
+
cdef grpc_event _next(grpc_completion_queue *c_completion_queue, deadline) except *
cdef _interpret_event(grpc_event c_event)
-cdef class CompletionQueue:
-
- cdef grpc_completion_queue *c_completion_queue
- cdef bint is_shutting_down
- cdef bint is_shutdown
-
+cdef class CompletionQueue:
+
+ cdef grpc_completion_queue *c_completion_queue
+ cdef bint is_shutting_down
+ cdef bint is_shutdown
+
cdef _interpret_event(self, grpc_event c_event)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi
index 816e88b69c..a47403ac51 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi
@@ -1,21 +1,21 @@
# 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.
-
-
-cdef int _INTERRUPT_CHECK_PERIOD_MS = 200
-
-
+
+
+cdef int _INTERRUPT_CHECK_PERIOD_MS = 200
+
+
cdef grpc_event _next(grpc_completion_queue *c_completion_queue, deadline) except *:
cdef gpr_timespec c_increment
cdef gpr_timespec c_timeout
@@ -64,8 +64,8 @@ cdef _latent_event(grpc_completion_queue *c_completion_queue, object deadline):
return _interpret_event(c_event)
-cdef class CompletionQueue:
-
+cdef class CompletionQueue:
+
def __cinit__(self, shutdown_cq=False):
cdef grpc_completion_queue_attributes c_attrs
fork_handlers_and_grpc_init()
@@ -77,42 +77,42 @@ cdef class CompletionQueue:
grpc_completion_queue_factory_lookup(&c_attrs), &c_attrs, NULL);
else:
self.c_completion_queue = grpc_completion_queue_create_for_next(NULL)
- self.is_shutting_down = False
- self.is_shutdown = False
-
+ self.is_shutting_down = False
+ self.is_shutdown = False
+
cdef _interpret_event(self, grpc_event c_event):
unused_tag, event = _interpret_event(c_event)
if event.completion_type == GRPC_QUEUE_SHUTDOWN:
- self.is_shutdown = True
+ self.is_shutdown = True
return event
-
+
# We name this 'poll' to avoid problems with CPython's expectations for
# 'special' methods (like next and __next__).
def poll(self, deadline=None):
return self._interpret_event(_next(self.c_completion_queue, deadline))
-
- def shutdown(self):
- with nogil:
- grpc_completion_queue_shutdown(self.c_completion_queue)
- self.is_shutting_down = True
-
- def clear(self):
- if not self.is_shutting_down:
- raise ValueError('queue must be shutting down to be cleared')
- while self.poll().type != GRPC_QUEUE_SHUTDOWN:
- pass
-
- def __dealloc__(self):
- cdef gpr_timespec c_deadline
- c_deadline = gpr_inf_future(GPR_CLOCK_REALTIME)
- if self.c_completion_queue != NULL:
- # Ensure shutdown
- if not self.is_shutting_down:
- grpc_completion_queue_shutdown(self.c_completion_queue)
- # Pump the queue (All outstanding calls should have been cancelled)
- while not self.is_shutdown:
- event = grpc_completion_queue_next(
- self.c_completion_queue, c_deadline, NULL)
- self._interpret_event(event)
- grpc_completion_queue_destroy(self.c_completion_queue)
+
+ def shutdown(self):
+ with nogil:
+ grpc_completion_queue_shutdown(self.c_completion_queue)
+ self.is_shutting_down = True
+
+ def clear(self):
+ if not self.is_shutting_down:
+ raise ValueError('queue must be shutting down to be cleared')
+ while self.poll().type != GRPC_QUEUE_SHUTDOWN:
+ pass
+
+ def __dealloc__(self):
+ cdef gpr_timespec c_deadline
+ c_deadline = gpr_inf_future(GPR_CLOCK_REALTIME)
+ if self.c_completion_queue != NULL:
+ # Ensure shutdown
+ if not self.is_shutting_down:
+ grpc_completion_queue_shutdown(self.c_completion_queue)
+ # Pump the queue (All outstanding calls should have been cancelled)
+ while not self.is_shutdown:
+ event = grpc_completion_queue_next(
+ self.c_completion_queue, c_deadline, NULL)
+ self._interpret_event(event)
+ grpc_completion_queue_destroy(self.c_completion_queue)
grpc_shutdown_blocking()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
index 8c71da02a8..ddaedb30bd 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
@@ -1,20 +1,20 @@
# 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.
-
-
+
+
cdef class CallCredentials:
-
+
cdef grpc_call_credentials *c(self) except *
# TODO(https://github.com/grpc/grpc/issues/12531): remove.
@@ -49,44 +49,44 @@ cdef class CompositeCallCredentials(CallCredentials):
cdef grpc_call_credentials *c(self) except *
-cdef class ChannelCredentials:
-
+cdef class ChannelCredentials:
+
cdef grpc_channel_credentials *c(self) except *
-
+
cdef class SSLSessionCacheLRU:
cdef grpc_ssl_session_cache *_cache
cdef class SSLChannelCredentials(ChannelCredentials):
-
+
cdef readonly object _pem_root_certificates
cdef readonly object _private_key
cdef readonly object _certificate_chain
-
+
cdef grpc_channel_credentials *c(self) except *
-
-
+
+
cdef class CompositeChannelCredentials(ChannelCredentials):
-
+
cdef readonly tuple _call_credentialses
cdef readonly ChannelCredentials _channel_credentials
-
+
cdef grpc_channel_credentials *c(self) except *
-
-
+
+
cdef class ServerCertificateConfig:
-
+
cdef grpc_ssl_server_certificate_config *c_cert_config
cdef const char *c_pem_root_certs
cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
cdef size_t c_ssl_pem_key_cert_pairs_count
cdef list references
-
-
+
+
cdef class ServerCredentials:
-
+
cdef grpc_server_credentials *c_credentials
cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
cdef size_t c_ssl_pem_key_cert_pairs_count
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
index 4a2e1d324b..c75579cc04 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
@@ -1,18 +1,18 @@
# 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.
-
-
+
+
def _spawn_callback_in_thread(cb_func, args):
t = ForkManagedThread(target=cb_func, args=args)
t.setDaemon(True)
@@ -29,11 +29,11 @@ def _spawn_callback_async(callback, args):
cdef class CallCredentials:
-
+
cdef grpc_call_credentials *c(self) except *:
raise NotImplementedError()
-
-
+
+
cdef int _get_metadata(void *state,
grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
@@ -54,19 +54,19 @@ cdef int _get_metadata(void *state,
args = context.service_url, context.method_name, callback,
_spawn_callback_async(<object>state, args)
return 0 # Asynchronous return
-
-
+
+
cdef void _destroy(void *state) except * with gil:
cpython.Py_DECREF(<object>state)
grpc_shutdown_blocking()
-
-
+
+
cdef class MetadataPluginCallCredentials(CallCredentials):
-
+
def __cinit__(self, metadata_plugin, name):
self._metadata_plugin = metadata_plugin
self._name = name
-
+
cdef grpc_call_credentials *c(self) except *:
cdef grpc_metadata_credentials_plugin c_metadata_plugin
c_metadata_plugin.get_metadata = _get_metadata
@@ -78,8 +78,8 @@ cdef class MetadataPluginCallCredentials(CallCredentials):
# TODO(yihuazhang): Expose min_security_level via the Python API so that
# applications can decide what minimum security level their plugins require.
return grpc_metadata_credentials_create_from_plugin(c_metadata_plugin, GRPC_PRIVACY_AND_INTEGRITY, NULL)
-
-
+
+
cdef grpc_call_credentials *_composition(call_credentialses):
call_credentials_iterator = iter(call_credentialses)
cdef CallCredentials composition = next(call_credentials_iterator)
@@ -95,23 +95,23 @@ cdef grpc_call_credentials *_composition(call_credentialses):
grpc_call_credentials_release(c_additional_call_credentials)
c_composition = c_next_composition
return c_composition
-
-
+
+
cdef class CompositeCallCredentials(CallCredentials):
-
+
def __cinit__(self, call_credentialses):
self._call_credentialses = call_credentialses
-
+
cdef grpc_call_credentials *c(self) except *:
return _composition(self._call_credentialses)
-
-
+
+
cdef class ChannelCredentials:
-
+
cdef grpc_channel_credentials *c(self) except *:
raise NotImplementedError()
-
-
+
+
cdef class SSLSessionCacheLRU:
def __cinit__(self, capacity):
@@ -128,14 +128,14 @@ cdef class SSLSessionCacheLRU:
cdef class SSLChannelCredentials(ChannelCredentials):
-
+
def __cinit__(self, pem_root_certificates, private_key, certificate_chain):
if pem_root_certificates is not None and not isinstance(pem_root_certificates, bytes):
raise TypeError('expected certificate to be bytes, got %s' % (type(pem_root_certificates)))
self._pem_root_certificates = pem_root_certificates
self._private_key = private_key
self._certificate_chain = certificate_chain
-
+
cdef grpc_channel_credentials *c(self) except *:
cdef const char *c_pem_root_certificates
cdef grpc_ssl_pem_key_cert_pair c_pem_key_certificate_pair
@@ -157,14 +157,14 @@ cdef class SSLChannelCredentials(ChannelCredentials):
c_pem_key_certificate_pair.certificate_chain = NULL
return grpc_ssl_credentials_create(
c_pem_root_certificates, &c_pem_key_certificate_pair, NULL, NULL)
-
-
+
+
cdef class CompositeChannelCredentials(ChannelCredentials):
-
+
def __cinit__(self, call_credentialses, channel_credentials):
self._call_credentialses = call_credentialses
self._channel_credentials = channel_credentials
-
+
cdef grpc_channel_credentials *c(self) except *:
cdef grpc_channel_credentials *c_channel_credentials
c_channel_credentials = self._channel_credentials.c()
@@ -176,25 +176,25 @@ cdef class CompositeChannelCredentials(ChannelCredentials):
grpc_channel_credentials_release(c_channel_credentials)
grpc_call_credentials_release(c_call_credentials_composition)
return c_composition
-
-
+
+
cdef class ServerCertificateConfig:
-
+
def __cinit__(self):
fork_handlers_and_grpc_init()
self.c_cert_config = NULL
self.c_pem_root_certs = NULL
self.c_ssl_pem_key_cert_pairs = NULL
self.references = []
-
+
def __dealloc__(self):
grpc_ssl_server_certificate_config_destroy(self.c_cert_config)
gpr_free(self.c_ssl_pem_key_cert_pairs)
grpc_shutdown_blocking()
-
-
+
+
cdef class ServerCredentials:
-
+
def __cinit__(self):
fork_handlers_and_grpc_init()
self.c_credentials = NULL
@@ -202,12 +202,12 @@ cdef class ServerCredentials:
self.initial_cert_config = None
self.cert_config_fetcher = None
self.initial_cert_config_fetched = False
-
+
def __dealloc__(self):
if self.c_credentials != NULL:
grpc_server_credentials_release(self.c_credentials)
grpc_shutdown_blocking()
-
+
cdef const char* _get_c_pem_root_certs(pem_root_certs):
if pem_root_certs is None:
return NULL
@@ -222,7 +222,7 @@ cdef grpc_ssl_pem_key_cert_pair* _create_c_ssl_pem_key_cert_pairs(pem_key_cert_p
"SslPemKeyCertPair")
cdef size_t c_ssl_pem_key_cert_pairs_count = len(pem_key_cert_pairs)
cdef grpc_ssl_pem_key_cert_pair* c_ssl_pem_key_cert_pairs = NULL
- with nogil:
+ with nogil:
c_ssl_pem_key_cert_pairs = (
<grpc_ssl_pem_key_cert_pair *>gpr_malloc(
sizeof(grpc_ssl_pem_key_cert_pair) * c_ssl_pem_key_cert_pairs_count))
@@ -230,16 +230,16 @@ cdef grpc_ssl_pem_key_cert_pair* _create_c_ssl_pem_key_cert_pairs(pem_key_cert_p
c_ssl_pem_key_cert_pairs[i] = (
(<SslPemKeyCertPair>pem_key_cert_pairs[i]).c_pair)
return c_ssl_pem_key_cert_pairs
-
-def server_credentials_ssl(pem_root_certs, pem_key_cert_pairs,
- bint force_client_auth):
- pem_root_certs = str_to_bytes(pem_root_certs)
- pem_key_cert_pairs = list(pem_key_cert_pairs)
- cdef ServerCredentials credentials = ServerCredentials()
+
+def server_credentials_ssl(pem_root_certs, pem_key_cert_pairs,
+ bint force_client_auth):
+ pem_root_certs = str_to_bytes(pem_root_certs)
+ pem_key_cert_pairs = list(pem_key_cert_pairs)
+ cdef ServerCredentials credentials = ServerCredentials()
credentials.references.append(pem_root_certs)
- credentials.references.append(pem_key_cert_pairs)
+ credentials.references.append(pem_key_cert_pairs)
cdef const char * c_pem_root_certs = _get_c_pem_root_certs(pem_root_certs)
- credentials.c_ssl_pem_key_cert_pairs_count = len(pem_key_cert_pairs)
+ credentials.c_ssl_pem_key_cert_pairs_count = len(pem_key_cert_pairs)
credentials.c_ssl_pem_key_cert_pairs = _create_c_ssl_pem_key_cert_pairs(pem_key_cert_pairs)
cdef grpc_ssl_server_certificate_config *c_cert_config = NULL
c_cert_config = grpc_ssl_server_certificate_config_create(
@@ -254,8 +254,8 @@ def server_credentials_ssl(pem_root_certs, pem_key_cert_pairs,
c_cert_config)
# C-core assumes ownership of c_options
credentials.c_credentials = grpc_ssl_server_credentials_create_with_options(c_options)
- return credentials
-
+ return credentials
+
def server_certificate_config_ssl(pem_root_certs, pem_key_cert_pairs):
pem_root_certs = str_to_bytes(pem_root_certs)
pem_key_cert_pairs = list(pem_key_cert_pairs)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
index ed2aa95766..54eb7fdffc 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
@@ -1,19 +1,19 @@
# 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.
-
-cimport libc.time
-
+
+cimport libc.time
+
ctypedef ssize_t intptr_t
ctypedef size_t uintptr_t
ctypedef signed char int8_t
@@ -24,205 +24,205 @@ ctypedef unsigned char uint8_t
ctypedef unsigned short uint16_t
ctypedef unsigned int uint32_t
ctypedef unsigned long long uint64_t
-
-
-cdef extern from "grpc/support/alloc.h":
-
- void *gpr_malloc(size_t size) nogil
+
+
+cdef extern from "grpc/support/alloc.h":
+
+ void *gpr_malloc(size_t size) nogil
void *gpr_zalloc(size_t size) nogil
- void gpr_free(void *ptr) nogil
- void *gpr_realloc(void *p, size_t size) nogil
-
-
-cdef extern from "grpc/byte_buffer_reader.h":
-
- struct grpc_byte_buffer_reader:
- # We don't care about the internals
- pass
-
-
+ void gpr_free(void *ptr) nogil
+ void *gpr_realloc(void *p, size_t size) nogil
+
+
+cdef extern from "grpc/byte_buffer_reader.h":
+
+ struct grpc_byte_buffer_reader:
+ # We don't care about the internals
+ pass
+
+
cdef extern from "grpc/impl/codegen/grpc_types.h":
ctypedef struct grpc_experimental_completion_queue_functor:
void (*functor_run)(grpc_experimental_completion_queue_functor*, int);
-cdef extern from "grpc/grpc.h":
-
- ctypedef struct grpc_slice:
- # don't worry about writing out the members of grpc_slice; we never access
- # them directly.
- pass
-
- grpc_slice grpc_slice_ref(grpc_slice s) nogil
- void grpc_slice_unref(grpc_slice s) nogil
+cdef extern from "grpc/grpc.h":
+
+ ctypedef struct grpc_slice:
+ # don't worry about writing out the members of grpc_slice; we never access
+ # them directly.
+ pass
+
+ grpc_slice grpc_slice_ref(grpc_slice s) nogil
+ void grpc_slice_unref(grpc_slice s) nogil
grpc_slice grpc_empty_slice() nogil
- grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *)) nogil
- grpc_slice grpc_slice_new_with_len(
- void *p, size_t len, void (*destroy)(void *, size_t)) nogil
- grpc_slice grpc_slice_malloc(size_t length) nogil
- grpc_slice grpc_slice_from_copied_string(const char *source) nogil
- grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len) nogil
+ grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *)) nogil
+ grpc_slice grpc_slice_new_with_len(
+ void *p, size_t len, void (*destroy)(void *, size_t)) nogil
+ grpc_slice grpc_slice_malloc(size_t length) nogil
+ grpc_slice grpc_slice_from_copied_string(const char *source) nogil
+ grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len) nogil
grpc_slice grpc_slice_copy(grpc_slice s) nogil
-
- # Declare functions for function-like macros (because Cython)...
- void *grpc_slice_start_ptr "GRPC_SLICE_START_PTR" (grpc_slice s) nogil
- size_t grpc_slice_length "GRPC_SLICE_LENGTH" (grpc_slice s) nogil
-
+
+ # Declare functions for function-like macros (because Cython)...
+ void *grpc_slice_start_ptr "GRPC_SLICE_START_PTR" (grpc_slice s) nogil
+ size_t grpc_slice_length "GRPC_SLICE_LENGTH" (grpc_slice s) nogil
+
const int GPR_MS_PER_SEC
const int GPR_US_PER_SEC
const int GPR_NS_PER_SEC
- ctypedef enum gpr_clock_type:
- GPR_CLOCK_MONOTONIC
- GPR_CLOCK_REALTIME
- GPR_CLOCK_PRECISE
- GPR_TIMESPAN
-
- ctypedef struct gpr_timespec:
- int64_t seconds "tv_sec"
- int32_t nanoseconds "tv_nsec"
- gpr_clock_type clock_type
-
- gpr_timespec gpr_time_0(gpr_clock_type type) nogil
- gpr_timespec gpr_inf_future(gpr_clock_type type) nogil
- gpr_timespec gpr_inf_past(gpr_clock_type type) nogil
-
- gpr_timespec gpr_now(gpr_clock_type clock) nogil
-
- gpr_timespec gpr_convert_clock_type(gpr_timespec t,
- gpr_clock_type target_clock) nogil
-
- gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) nogil
+ ctypedef enum gpr_clock_type:
+ GPR_CLOCK_MONOTONIC
+ GPR_CLOCK_REALTIME
+ GPR_CLOCK_PRECISE
+ GPR_TIMESPAN
+
+ ctypedef struct gpr_timespec:
+ int64_t seconds "tv_sec"
+ int32_t nanoseconds "tv_nsec"
+ gpr_clock_type clock_type
+
+ gpr_timespec gpr_time_0(gpr_clock_type type) nogil
+ gpr_timespec gpr_inf_future(gpr_clock_type type) nogil
+ gpr_timespec gpr_inf_past(gpr_clock_type type) nogil
+
+ gpr_timespec gpr_now(gpr_clock_type clock) nogil
+
+ gpr_timespec gpr_convert_clock_type(gpr_timespec t,
+ gpr_clock_type target_clock) nogil
+
+ gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) nogil
gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) nogil
double gpr_timespec_to_micros(gpr_timespec t) nogil
-
- gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil
-
- int gpr_time_cmp(gpr_timespec a, gpr_timespec b) nogil
-
- ctypedef struct grpc_byte_buffer:
- # We don't care about the internals.
- pass
-
- grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
- size_t nslices) nogil
- size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) nogil
- void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer) nogil
-
- int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
- grpc_byte_buffer *buffer) nogil
- int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
- grpc_slice *slice) nogil
- void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) nogil
-
- ctypedef enum grpc_status_code:
- GRPC_STATUS_OK
- GRPC_STATUS_CANCELLED
- GRPC_STATUS_UNKNOWN
- GRPC_STATUS_INVALID_ARGUMENT
- GRPC_STATUS_DEADLINE_EXCEEDED
- GRPC_STATUS_NOT_FOUND
- GRPC_STATUS_ALREADY_EXISTS
- GRPC_STATUS_PERMISSION_DENIED
- GRPC_STATUS_UNAUTHENTICATED
- GRPC_STATUS_RESOURCE_EXHAUSTED
- GRPC_STATUS_FAILED_PRECONDITION
- GRPC_STATUS_ABORTED
- GRPC_STATUS_OUT_OF_RANGE
- GRPC_STATUS_UNIMPLEMENTED
- GRPC_STATUS_INTERNAL
- GRPC_STATUS_UNAVAILABLE
- GRPC_STATUS_DATA_LOSS
- GRPC_STATUS__DO_NOT_USE
-
- const char *GRPC_ARG_ENABLE_CENSUS
- const char *GRPC_ARG_MAX_CONCURRENT_STREAMS
- const char *GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
- const char *GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- const char *GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
- const char *GRPC_ARG_DEFAULT_AUTHORITY
- const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING
- const char *GRPC_ARG_SECONDARY_USER_AGENT_STRING
- const char *GRPC_SSL_TARGET_NAME_OVERRIDE_ARG
+
+ gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil
+
+ int gpr_time_cmp(gpr_timespec a, gpr_timespec b) nogil
+
+ ctypedef struct grpc_byte_buffer:
+ # We don't care about the internals.
+ pass
+
+ grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
+ size_t nslices) nogil
+ size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) nogil
+ void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer) nogil
+
+ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
+ grpc_byte_buffer *buffer) nogil
+ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
+ grpc_slice *slice) nogil
+ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) nogil
+
+ ctypedef enum grpc_status_code:
+ GRPC_STATUS_OK
+ GRPC_STATUS_CANCELLED
+ GRPC_STATUS_UNKNOWN
+ GRPC_STATUS_INVALID_ARGUMENT
+ GRPC_STATUS_DEADLINE_EXCEEDED
+ GRPC_STATUS_NOT_FOUND
+ GRPC_STATUS_ALREADY_EXISTS
+ GRPC_STATUS_PERMISSION_DENIED
+ GRPC_STATUS_UNAUTHENTICATED
+ GRPC_STATUS_RESOURCE_EXHAUSTED
+ GRPC_STATUS_FAILED_PRECONDITION
+ GRPC_STATUS_ABORTED
+ GRPC_STATUS_OUT_OF_RANGE
+ GRPC_STATUS_UNIMPLEMENTED
+ GRPC_STATUS_INTERNAL
+ GRPC_STATUS_UNAVAILABLE
+ GRPC_STATUS_DATA_LOSS
+ GRPC_STATUS__DO_NOT_USE
+
+ const char *GRPC_ARG_ENABLE_CENSUS
+ const char *GRPC_ARG_MAX_CONCURRENT_STREAMS
+ const char *GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
+ const char *GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
+ const char *GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
+ const char *GRPC_ARG_DEFAULT_AUTHORITY
+ const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING
+ const char *GRPC_ARG_SECONDARY_USER_AGENT_STRING
+ const char *GRPC_SSL_TARGET_NAME_OVERRIDE_ARG
const char *GRPC_SSL_SESSION_CACHE_ARG
const char *_GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM"
- const char *GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL
- const char *GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
-
- const int GRPC_WRITE_BUFFER_HINT
- const int GRPC_WRITE_NO_COMPRESS
- const int GRPC_WRITE_USED_MASK
-
+ const char *GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL
+ const char *GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
+
+ const int GRPC_WRITE_BUFFER_HINT
+ const int GRPC_WRITE_NO_COMPRESS
+ const int GRPC_WRITE_USED_MASK
+
const int GRPC_INITIAL_METADATA_WAIT_FOR_READY
const int GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
const int GRPC_INITIAL_METADATA_USED_MASK
- const int GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
-
- ctypedef struct grpc_completion_queue:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef struct grpc_channel:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef struct grpc_server:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef struct grpc_call:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef enum grpc_arg_type:
- GRPC_ARG_STRING
- GRPC_ARG_INTEGER
- GRPC_ARG_POINTER
-
- ctypedef struct grpc_arg_pointer_vtable:
- void *(*copy)(void *)
+ const int GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
+
+ ctypedef struct grpc_completion_queue:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef struct grpc_channel:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef struct grpc_server:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef struct grpc_call:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef enum grpc_arg_type:
+ GRPC_ARG_STRING
+ GRPC_ARG_INTEGER
+ GRPC_ARG_POINTER
+
+ ctypedef struct grpc_arg_pointer_vtable:
+ void *(*copy)(void *)
void (*destroy)(void *)
- int (*cmp)(void *, void *)
-
- ctypedef struct grpc_arg_value_pointer:
- void *address "p"
- grpc_arg_pointer_vtable *vtable
-
- union grpc_arg_value:
- char *string
- int integer
- grpc_arg_value_pointer pointer
-
- ctypedef struct grpc_arg:
- grpc_arg_type type
- char *key
- grpc_arg_value value
-
- ctypedef struct grpc_channel_args:
- size_t arguments_length "num_args"
- grpc_arg *arguments "args"
-
+ int (*cmp)(void *, void *)
+
+ ctypedef struct grpc_arg_value_pointer:
+ void *address "p"
+ grpc_arg_pointer_vtable *vtable
+
+ union grpc_arg_value:
+ char *string
+ int integer
+ grpc_arg_value_pointer pointer
+
+ ctypedef struct grpc_arg:
+ grpc_arg_type type
+ char *key
+ grpc_arg_value value
+
+ ctypedef struct grpc_channel_args:
+ size_t arguments_length "num_args"
+ grpc_arg *arguments "args"
+
ctypedef enum grpc_stream_compression_level:
GRPC_STREAM_COMPRESS_LEVEL_NONE
GRPC_STREAM_COMPRESS_LEVEL_LOW
GRPC_STREAM_COMPRESS_LEVEL_MED
GRPC_STREAM_COMPRESS_LEVEL_HIGH
- ctypedef enum grpc_call_error:
- GRPC_CALL_OK
- GRPC_CALL_ERROR
- GRPC_CALL_ERROR_NOT_ON_SERVER
- GRPC_CALL_ERROR_NOT_ON_CLIENT
- GRPC_CALL_ERROR_ALREADY_ACCEPTED
- GRPC_CALL_ERROR_ALREADY_INVOKED
- GRPC_CALL_ERROR_NOT_INVOKED
- GRPC_CALL_ERROR_ALREADY_FINISHED
- GRPC_CALL_ERROR_TOO_MANY_OPERATIONS
- GRPC_CALL_ERROR_INVALID_FLAGS
- GRPC_CALL_ERROR_INVALID_METADATA
-
+ ctypedef enum grpc_call_error:
+ GRPC_CALL_OK
+ GRPC_CALL_ERROR
+ GRPC_CALL_ERROR_NOT_ON_SERVER
+ GRPC_CALL_ERROR_NOT_ON_CLIENT
+ GRPC_CALL_ERROR_ALREADY_ACCEPTED
+ GRPC_CALL_ERROR_ALREADY_INVOKED
+ GRPC_CALL_ERROR_NOT_INVOKED
+ GRPC_CALL_ERROR_ALREADY_FINISHED
+ GRPC_CALL_ERROR_TOO_MANY_OPERATIONS
+ GRPC_CALL_ERROR_INVALID_FLAGS
+ GRPC_CALL_ERROR_INVALID_METADATA
+
ctypedef enum grpc_cq_completion_type:
GRPC_CQ_NEXT
GRPC_CQ_PLUCK
@@ -237,107 +237,107 @@ cdef extern from "grpc/grpc.h":
grpc_cq_completion_type cq_completion_type
grpc_cq_polling_type cq_polling_type
- ctypedef enum grpc_connectivity_state:
- GRPC_CHANNEL_IDLE
- GRPC_CHANNEL_CONNECTING
- GRPC_CHANNEL_READY
- GRPC_CHANNEL_TRANSIENT_FAILURE
- GRPC_CHANNEL_SHUTDOWN
-
- ctypedef struct grpc_metadata:
+ ctypedef enum grpc_connectivity_state:
+ GRPC_CHANNEL_IDLE
+ GRPC_CHANNEL_CONNECTING
+ GRPC_CHANNEL_READY
+ GRPC_CHANNEL_TRANSIENT_FAILURE
+ GRPC_CHANNEL_SHUTDOWN
+
+ ctypedef struct grpc_metadata:
grpc_slice key
grpc_slice value
- # ignore the 'internal_data.obfuscated' fields.
-
- ctypedef enum grpc_completion_type:
- GRPC_QUEUE_SHUTDOWN
- GRPC_QUEUE_TIMEOUT
- GRPC_OP_COMPLETE
-
- ctypedef struct grpc_event:
- grpc_completion_type type
- int success
- void *tag
-
- ctypedef struct grpc_metadata_array:
- size_t count
- size_t capacity
- grpc_metadata *metadata
-
- void grpc_metadata_array_init(grpc_metadata_array *array) nogil
- void grpc_metadata_array_destroy(grpc_metadata_array *array) nogil
-
- ctypedef struct grpc_call_details:
+ # ignore the 'internal_data.obfuscated' fields.
+
+ ctypedef enum grpc_completion_type:
+ GRPC_QUEUE_SHUTDOWN
+ GRPC_QUEUE_TIMEOUT
+ GRPC_OP_COMPLETE
+
+ ctypedef struct grpc_event:
+ grpc_completion_type type
+ int success
+ void *tag
+
+ ctypedef struct grpc_metadata_array:
+ size_t count
+ size_t capacity
+ grpc_metadata *metadata
+
+ void grpc_metadata_array_init(grpc_metadata_array *array) nogil
+ void grpc_metadata_array_destroy(grpc_metadata_array *array) nogil
+
+ ctypedef struct grpc_call_details:
grpc_slice method
grpc_slice host
- gpr_timespec deadline
-
- void grpc_call_details_init(grpc_call_details *details) nogil
- void grpc_call_details_destroy(grpc_call_details *details) nogil
-
- ctypedef enum grpc_op_type:
- GRPC_OP_SEND_INITIAL_METADATA
- GRPC_OP_SEND_MESSAGE
- GRPC_OP_SEND_CLOSE_FROM_CLIENT
- GRPC_OP_SEND_STATUS_FROM_SERVER
- GRPC_OP_RECV_INITIAL_METADATA
- GRPC_OP_RECV_MESSAGE
- GRPC_OP_RECV_STATUS_ON_CLIENT
- GRPC_OP_RECV_CLOSE_ON_SERVER
-
+ gpr_timespec deadline
+
+ void grpc_call_details_init(grpc_call_details *details) nogil
+ void grpc_call_details_destroy(grpc_call_details *details) nogil
+
+ ctypedef enum grpc_op_type:
+ GRPC_OP_SEND_INITIAL_METADATA
+ GRPC_OP_SEND_MESSAGE
+ GRPC_OP_SEND_CLOSE_FROM_CLIENT
+ GRPC_OP_SEND_STATUS_FROM_SERVER
+ GRPC_OP_RECV_INITIAL_METADATA
+ GRPC_OP_RECV_MESSAGE
+ GRPC_OP_RECV_STATUS_ON_CLIENT
+ GRPC_OP_RECV_CLOSE_ON_SERVER
+
ctypedef struct grpc_op_send_initial_metadata_maybe_compression_level:
uint8_t is_set
grpc_compression_level level
- ctypedef struct grpc_op_data_send_initial_metadata:
- size_t count
- grpc_metadata *metadata
+ ctypedef struct grpc_op_data_send_initial_metadata:
+ size_t count
+ grpc_metadata *metadata
grpc_op_send_initial_metadata_maybe_compression_level maybe_compression_level
-
- ctypedef struct grpc_op_data_send_status_from_server:
- size_t trailing_metadata_count
- grpc_metadata *trailing_metadata
- grpc_status_code status
+
+ ctypedef struct grpc_op_data_send_status_from_server:
+ size_t trailing_metadata_count
+ grpc_metadata *trailing_metadata
+ grpc_status_code status
grpc_slice *status_details
-
- ctypedef struct grpc_op_data_recv_status_on_client:
- grpc_metadata_array *trailing_metadata
- grpc_status_code *status
+
+ ctypedef struct grpc_op_data_recv_status_on_client:
+ grpc_metadata_array *trailing_metadata
+ grpc_status_code *status
grpc_slice *status_details
char** error_string
-
- ctypedef struct grpc_op_data_recv_close_on_server:
- int *cancelled
-
- ctypedef struct grpc_op_data_send_message:
- grpc_byte_buffer *send_message
-
- ctypedef struct grpc_op_data_receive_message:
- grpc_byte_buffer **receive_message "recv_message"
-
- ctypedef struct grpc_op_data_receive_initial_metadata:
- grpc_metadata_array *receive_initial_metadata "recv_initial_metadata"
-
- union grpc_op_data:
- grpc_op_data_send_initial_metadata send_initial_metadata
- grpc_op_data_send_message send_message
- grpc_op_data_send_status_from_server send_status_from_server
- grpc_op_data_receive_initial_metadata receive_initial_metadata "recv_initial_metadata"
- grpc_op_data_receive_message receive_message "recv_message"
- grpc_op_data_recv_status_on_client receive_status_on_client "recv_status_on_client"
- grpc_op_data_recv_close_on_server receive_close_on_server "recv_close_on_server"
-
- ctypedef struct grpc_op:
- grpc_op_type type "op"
- uint32_t flags
+
+ ctypedef struct grpc_op_data_recv_close_on_server:
+ int *cancelled
+
+ ctypedef struct grpc_op_data_send_message:
+ grpc_byte_buffer *send_message
+
+ ctypedef struct grpc_op_data_receive_message:
+ grpc_byte_buffer **receive_message "recv_message"
+
+ ctypedef struct grpc_op_data_receive_initial_metadata:
+ grpc_metadata_array *receive_initial_metadata "recv_initial_metadata"
+
+ union grpc_op_data:
+ grpc_op_data_send_initial_metadata send_initial_metadata
+ grpc_op_data_send_message send_message
+ grpc_op_data_send_status_from_server send_status_from_server
+ grpc_op_data_receive_initial_metadata receive_initial_metadata "recv_initial_metadata"
+ grpc_op_data_receive_message receive_message "recv_message"
+ grpc_op_data_recv_status_on_client receive_status_on_client "recv_status_on_client"
+ grpc_op_data_recv_close_on_server receive_close_on_server "recv_close_on_server"
+
+ ctypedef struct grpc_op:
+ grpc_op_type type "op"
+ uint32_t flags
void * reserved
- grpc_op_data data
-
+ grpc_op_data data
+
void grpc_dont_init_openssl() nogil
- void grpc_init() nogil
+ void grpc_init() nogil
void grpc_shutdown_blocking() nogil
int grpc_is_initialized() nogil
-
+
ctypedef struct grpc_completion_queue_factory:
pass
@@ -348,63 +348,63 @@ cdef extern from "grpc/grpc.h":
const grpc_completion_queue_attributes* attr, void* reserved) nogil
grpc_completion_queue *grpc_completion_queue_create_for_next(void *reserved) nogil
- grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
- gpr_timespec deadline,
- void *reserved) nogil
- grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
- gpr_timespec deadline,
- void *reserved) nogil
- void grpc_completion_queue_shutdown(grpc_completion_queue *cq) nogil
- void grpc_completion_queue_destroy(grpc_completion_queue *cq) nogil
-
+ grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
+ gpr_timespec deadline,
+ void *reserved) nogil
+ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
+ gpr_timespec deadline,
+ void *reserved) nogil
+ void grpc_completion_queue_shutdown(grpc_completion_queue *cq) nogil
+ void grpc_completion_queue_destroy(grpc_completion_queue *cq) nogil
+
grpc_completion_queue *grpc_completion_queue_create_for_callback(
grpc_experimental_completion_queue_functor* shutdown_callback,
void *reserved) nogil
- grpc_call_error grpc_call_start_batch(
- grpc_call *call, const grpc_op *ops, size_t nops, void *tag,
- void *reserved) nogil
- grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) nogil
- grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
- grpc_status_code status,
- const char *description,
- void *reserved) nogil
- char *grpc_call_get_peer(grpc_call *call) nogil
+ grpc_call_error grpc_call_start_batch(
+ grpc_call *call, const grpc_op *ops, size_t nops, void *tag,
+ void *reserved) nogil
+ grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) nogil
+ grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
+ grpc_status_code status,
+ const char *description,
+ void *reserved) nogil
+ char *grpc_call_get_peer(grpc_call *call) nogil
void grpc_call_unref(grpc_call *call) nogil
-
- grpc_channel *grpc_insecure_channel_create(const char *target,
- const grpc_channel_args *args,
- void *reserved) nogil
- grpc_call *grpc_channel_create_call(
+
+ grpc_channel *grpc_insecure_channel_create(const char *target,
+ const grpc_channel_args *args,
+ void *reserved) nogil
+ grpc_call *grpc_channel_create_call(
grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask,
grpc_completion_queue *completion_queue, grpc_slice method,
const grpc_slice *host, gpr_timespec deadline, void *reserved) nogil
- grpc_connectivity_state grpc_channel_check_connectivity_state(
- grpc_channel *channel, int try_to_connect) nogil
- void grpc_channel_watch_connectivity_state(
- grpc_channel *channel, grpc_connectivity_state last_observed_state,
- gpr_timespec deadline, grpc_completion_queue *cq, void *tag) nogil
- char *grpc_channel_get_target(grpc_channel *channel) nogil
- void grpc_channel_destroy(grpc_channel *channel) nogil
-
- grpc_server *grpc_server_create(
- const grpc_channel_args *args, void *reserved) nogil
- grpc_call_error grpc_server_request_call(
- grpc_server *server, grpc_call **call, grpc_call_details *details,
- grpc_metadata_array *request_metadata, grpc_completion_queue
- *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void
- *tag_new) nogil
- void grpc_server_register_completion_queue(grpc_server *server,
- grpc_completion_queue *cq,
- void *reserved) nogil
- int grpc_server_add_insecure_http2_port(
- grpc_server *server, const char *addr) nogil
- void grpc_server_start(grpc_server *server) nogil
- void grpc_server_shutdown_and_notify(
- grpc_server *server, grpc_completion_queue *cq, void *tag) nogil
- void grpc_server_cancel_all_calls(grpc_server *server) nogil
- void grpc_server_destroy(grpc_server *server) nogil
-
+ grpc_connectivity_state grpc_channel_check_connectivity_state(
+ grpc_channel *channel, int try_to_connect) nogil
+ void grpc_channel_watch_connectivity_state(
+ grpc_channel *channel, grpc_connectivity_state last_observed_state,
+ gpr_timespec deadline, grpc_completion_queue *cq, void *tag) nogil
+ char *grpc_channel_get_target(grpc_channel *channel) nogil
+ void grpc_channel_destroy(grpc_channel *channel) nogil
+
+ grpc_server *grpc_server_create(
+ const grpc_channel_args *args, void *reserved) nogil
+ grpc_call_error grpc_server_request_call(
+ grpc_server *server, grpc_call **call, grpc_call_details *details,
+ grpc_metadata_array *request_metadata, grpc_completion_queue
+ *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void
+ *tag_new) nogil
+ void grpc_server_register_completion_queue(grpc_server *server,
+ grpc_completion_queue *cq,
+ void *reserved) nogil
+ int grpc_server_add_insecure_http2_port(
+ grpc_server *server, const char *addr) nogil
+ void grpc_server_start(grpc_server *server) nogil
+ void grpc_server_shutdown_and_notify(
+ grpc_server *server, grpc_completion_queue *cq, void *tag) nogil
+ void grpc_server_cancel_all_calls(grpc_server *server) nogil
+ void grpc_server_destroy(grpc_server *server) nogil
+
char* grpc_channelz_get_top_channels(intptr_t start_channel_id)
char* grpc_channelz_get_servers(intptr_t start_server_id)
char* grpc_channelz_get_server(intptr_t server_id)
@@ -414,26 +414,26 @@ cdef extern from "grpc/grpc.h":
char* grpc_channelz_get_channel(intptr_t channel_id)
char* grpc_channelz_get_subchannel(intptr_t subchannel_id)
char* grpc_channelz_get_socket(intptr_t socket_id)
-
-cdef extern from "grpc/grpc_security.h":
-
+
+cdef extern from "grpc/grpc_security.h":
+
# Declare this as an enum, this is the only way to make it a const in
# cython
enum: GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX
- ctypedef enum grpc_ssl_roots_override_result:
- GRPC_SSL_ROOTS_OVERRIDE_OK
- GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY
- GRPC_SSL_ROOTS_OVERRIDE_FAILED
-
- ctypedef enum grpc_ssl_client_certificate_request_type:
- GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
- GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
- GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY
- GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
- GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
-
+ ctypedef enum grpc_ssl_roots_override_result:
+ GRPC_SSL_ROOTS_OVERRIDE_OK
+ GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY
+ GRPC_SSL_ROOTS_OVERRIDE_FAILED
+
+ ctypedef enum grpc_ssl_client_certificate_request_type:
+ GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
+ GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
+ GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY
+ GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
+ GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
+
ctypedef enum grpc_security_level:
GRPC_SECURITY_MIN
GRPC_SECURITY_NONE = GRPC_SECURITY_MIN
@@ -477,18 +477,18 @@ cdef extern from "grpc/grpc_security.h":
grpc_server_credentials *grpc_ssl_server_credentials_create_with_options(
grpc_ssl_server_credentials_options *options)
- ctypedef struct grpc_ssl_pem_key_cert_pair:
- const char *private_key
- const char *certificate_chain "cert_chain"
-
- ctypedef struct grpc_channel_credentials:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef struct grpc_call_credentials:
- # We don't care about the internals (and in fact don't know them)
- pass
-
+ ctypedef struct grpc_ssl_pem_key_cert_pair:
+ const char *private_key
+ const char *certificate_chain "cert_chain"
+
+ ctypedef struct grpc_channel_credentials:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef struct grpc_call_credentials:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
ctypedef struct grpc_ssl_session_cache:
# We don't care about the internals (and in fact don't know them)
pass
@@ -497,84 +497,84 @@ cdef extern from "grpc/grpc_security.h":
# We don't care about the internals (and in fact don't know them)
pass
- ctypedef void (*grpc_ssl_roots_override_callback)(char **pem_root_certs)
-
+ ctypedef void (*grpc_ssl_roots_override_callback)(char **pem_root_certs)
+
grpc_ssl_session_cache *grpc_ssl_session_cache_create_lru(size_t capacity)
void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache)
- void grpc_set_ssl_roots_override_callback(
- grpc_ssl_roots_override_callback cb) nogil
-
+ void grpc_set_ssl_roots_override_callback(
+ grpc_ssl_roots_override_callback cb) nogil
+
grpc_channel_credentials *grpc_google_default_credentials_create(grpc_call_credentials* call_credentials) nogil
- grpc_channel_credentials *grpc_ssl_credentials_create(
- const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
+ grpc_channel_credentials *grpc_ssl_credentials_create(
+ const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
verify_peer_options *verify_options, void *reserved) nogil
- grpc_channel_credentials *grpc_composite_channel_credentials_create(
- grpc_channel_credentials *creds1, grpc_call_credentials *creds2,
- void *reserved) nogil
- void grpc_channel_credentials_release(grpc_channel_credentials *creds) nogil
-
- grpc_call_credentials *grpc_composite_call_credentials_create(
- grpc_call_credentials *creds1, grpc_call_credentials *creds2,
- void *reserved) nogil
- grpc_call_credentials *grpc_google_compute_engine_credentials_create(
- void *reserved) nogil
- grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
- const char *json_key,
- gpr_timespec token_lifetime, void *reserved) nogil
- grpc_call_credentials *grpc_google_refresh_token_credentials_create(
- const char *json_refresh_token, void *reserved) nogil
- grpc_call_credentials *grpc_google_iam_credentials_create(
- const char *authorization_token, const char *authority_selector,
- void *reserved) nogil
- void grpc_call_credentials_release(grpc_call_credentials *creds) nogil
-
- grpc_channel *grpc_secure_channel_create(
- grpc_channel_credentials *creds, const char *target,
- const grpc_channel_args *args, void *reserved) nogil
-
- ctypedef struct grpc_server_credentials:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- void grpc_server_credentials_release(grpc_server_credentials *creds) nogil
-
- int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
- grpc_server_credentials *creds) nogil
-
- grpc_call_error grpc_call_set_credentials(grpc_call *call,
- grpc_call_credentials *creds) nogil
-
- ctypedef struct grpc_auth_context:
- # We don't care about the internals (and in fact don't know them)
- pass
-
- ctypedef struct grpc_auth_metadata_context:
- const char *service_url
- const char *method_name
- const grpc_auth_context *channel_auth_context
-
- ctypedef void (*grpc_credentials_plugin_metadata_cb)(
- void *user_data, const grpc_metadata *creds_md, size_t num_creds_md,
- grpc_status_code status, const char *error_details)
-
- ctypedef struct grpc_metadata_credentials_plugin:
+ grpc_channel_credentials *grpc_composite_channel_credentials_create(
+ grpc_channel_credentials *creds1, grpc_call_credentials *creds2,
+ void *reserved) nogil
+ void grpc_channel_credentials_release(grpc_channel_credentials *creds) nogil
+
+ grpc_call_credentials *grpc_composite_call_credentials_create(
+ grpc_call_credentials *creds1, grpc_call_credentials *creds2,
+ void *reserved) nogil
+ grpc_call_credentials *grpc_google_compute_engine_credentials_create(
+ void *reserved) nogil
+ grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
+ const char *json_key,
+ gpr_timespec token_lifetime, void *reserved) nogil
+ grpc_call_credentials *grpc_google_refresh_token_credentials_create(
+ const char *json_refresh_token, void *reserved) nogil
+ grpc_call_credentials *grpc_google_iam_credentials_create(
+ const char *authorization_token, const char *authority_selector,
+ void *reserved) nogil
+ void grpc_call_credentials_release(grpc_call_credentials *creds) nogil
+
+ grpc_channel *grpc_secure_channel_create(
+ grpc_channel_credentials *creds, const char *target,
+ const grpc_channel_args *args, void *reserved) nogil
+
+ ctypedef struct grpc_server_credentials:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ void grpc_server_credentials_release(grpc_server_credentials *creds) nogil
+
+ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
+ grpc_server_credentials *creds) nogil
+
+ grpc_call_error grpc_call_set_credentials(grpc_call *call,
+ grpc_call_credentials *creds) nogil
+
+ ctypedef struct grpc_auth_context:
+ # We don't care about the internals (and in fact don't know them)
+ pass
+
+ ctypedef struct grpc_auth_metadata_context:
+ const char *service_url
+ const char *method_name
+ const grpc_auth_context *channel_auth_context
+
+ ctypedef void (*grpc_credentials_plugin_metadata_cb)(
+ void *user_data, const grpc_metadata *creds_md, size_t num_creds_md,
+ grpc_status_code status, const char *error_details)
+
+ ctypedef struct grpc_metadata_credentials_plugin:
int (*get_metadata)(
- void *state, grpc_auth_metadata_context context,
+ void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb, void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status,
const char **error_details) except *
void (*destroy)(void *state) except *
- void *state
- const char *type
-
- grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
+ void *state
+ const char *type
+
+ grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin, grpc_security_level min_security_level, void *reserved) nogil
-
+
ctypedef struct grpc_auth_property_iterator:
pass
-
+
ctypedef struct grpc_auth_property:
char *name
char *value
@@ -623,41 +623,41 @@ cdef extern from "grpc/grpc_security.h":
-cdef extern from "grpc/compression.h":
-
- ctypedef enum grpc_compression_algorithm:
- GRPC_COMPRESS_NONE
- GRPC_COMPRESS_DEFLATE
- GRPC_COMPRESS_GZIP
+cdef extern from "grpc/compression.h":
+
+ ctypedef enum grpc_compression_algorithm:
+ GRPC_COMPRESS_NONE
+ GRPC_COMPRESS_DEFLATE
+ GRPC_COMPRESS_GZIP
GRPC_COMPRESS_STREAM_GZIP
- GRPC_COMPRESS_ALGORITHMS_COUNT
-
- ctypedef enum grpc_compression_level:
- GRPC_COMPRESS_LEVEL_NONE
- GRPC_COMPRESS_LEVEL_LOW
- GRPC_COMPRESS_LEVEL_MED
- GRPC_COMPRESS_LEVEL_HIGH
- GRPC_COMPRESS_LEVEL_COUNT
-
- ctypedef struct grpc_compression_options:
- uint32_t enabled_algorithms_bitset
-
- int grpc_compression_algorithm_parse(
+ GRPC_COMPRESS_ALGORITHMS_COUNT
+
+ ctypedef enum grpc_compression_level:
+ GRPC_COMPRESS_LEVEL_NONE
+ GRPC_COMPRESS_LEVEL_LOW
+ GRPC_COMPRESS_LEVEL_MED
+ GRPC_COMPRESS_LEVEL_HIGH
+ GRPC_COMPRESS_LEVEL_COUNT
+
+ ctypedef struct grpc_compression_options:
+ uint32_t enabled_algorithms_bitset
+
+ int grpc_compression_algorithm_parse(
grpc_slice value, grpc_compression_algorithm *algorithm) nogil
- int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
+ int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
const char **name) nogil
- grpc_compression_algorithm grpc_compression_algorithm_for_level(
- grpc_compression_level level, uint32_t accepted_encodings) nogil
- void grpc_compression_options_init(grpc_compression_options *opts) nogil
- void grpc_compression_options_enable_algorithm(
- grpc_compression_options *opts,
- grpc_compression_algorithm algorithm) nogil
- void grpc_compression_options_disable_algorithm(
- grpc_compression_options *opts,
- grpc_compression_algorithm algorithm) nogil
- int grpc_compression_options_is_algorithm_enabled(
- const grpc_compression_options *opts,
- grpc_compression_algorithm algorithm) nogil
+ grpc_compression_algorithm grpc_compression_algorithm_for_level(
+ grpc_compression_level level, uint32_t accepted_encodings) nogil
+ void grpc_compression_options_init(grpc_compression_options *opts) nogil
+ void grpc_compression_options_enable_algorithm(
+ grpc_compression_options *opts,
+ grpc_compression_algorithm algorithm) nogil
+ void grpc_compression_options_disable_algorithm(
+ grpc_compression_options *opts,
+ grpc_compression_algorithm algorithm) nogil
+ int grpc_compression_options_is_algorithm_enabled(
+ const grpc_compression_options *opts,
+ grpc_compression_algorithm algorithm) nogil
cdef extern from "grpc/impl/codegen/compression_types.h":
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
index a3b20f472c..5c1e0679a9 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi
@@ -1,27 +1,27 @@
# Copyright 2016 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.
-
-
+
+
# This function will ascii encode unicode string inputs if necessary.
-# In Python3, unicode strings are the default str type.
-cdef bytes str_to_bytes(object s):
- if s is None or isinstance(s, bytes):
- return s
- elif isinstance(s, unicode):
- return s.encode('ascii')
- else:
- raise TypeError('Expected bytes, str, or unicode, not {}'.format(type(s)))
+# In Python3, unicode strings are the default str type.
+cdef bytes str_to_bytes(object s):
+ if s is None or isinstance(s, bytes):
+ return s
+ elif isinstance(s, unicode):
+ return s.encode('ascii')
+ else:
+ raise TypeError('Expected bytes, str, or unicode, not {}'.format(type(s)))
# TODO(https://github.com/grpc/grpc/issues/13782): It would be nice for us if
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi
index 1660c9c2b8..35e1bdb0ae 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi
@@ -1,34 +1,34 @@
# 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.
-
-
+
+
cdef bytes _slice_bytes(grpc_slice slice)
cdef grpc_slice _copy_slice(grpc_slice slice) nogil
cdef grpc_slice _slice_from_bytes(bytes value) nogil
-
-
-cdef class CallDetails:
-
- cdef grpc_call_details c_details
-
-
-cdef class SslPemKeyCertPair:
-
- cdef grpc_ssl_pem_key_cert_pair c_pair
- cdef readonly object private_key, certificate_chain
-
-
-cdef class CompressionOptions:
-
- cdef grpc_compression_options c_options
+
+
+cdef class CallDetails:
+
+ cdef grpc_call_details c_details
+
+
+cdef class SslPemKeyCertPair:
+
+ cdef grpc_ssl_pem_key_cert_pair c_pair
+ cdef readonly object private_key, certificate_chain
+
+
+cdef class CompressionOptions:
+
+ cdef grpc_compression_options c_options
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index fc08110851..308d677695 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -1,18 +1,18 @@
# 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.
-
-
+
+
cdef bytes _slice_bytes(grpc_slice slice):
cdef void *start = grpc_slice_start_ptr(slice)
cdef size_t length = grpc_slice_length(slice)
@@ -32,166 +32,166 @@ cdef grpc_slice _slice_from_bytes(bytes value) nogil:
return grpc_slice_from_copied_buffer(value_ptr, length)
-class ConnectivityState:
- idle = GRPC_CHANNEL_IDLE
- connecting = GRPC_CHANNEL_CONNECTING
- ready = GRPC_CHANNEL_READY
- transient_failure = GRPC_CHANNEL_TRANSIENT_FAILURE
- shutdown = GRPC_CHANNEL_SHUTDOWN
-
-
-class ChannelArgKey:
- enable_census = GRPC_ARG_ENABLE_CENSUS
- max_concurrent_streams = GRPC_ARG_MAX_CONCURRENT_STREAMS
- max_receive_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
- max_send_message_length = GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
- http2_initial_sequence_number = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
- default_authority = GRPC_ARG_DEFAULT_AUTHORITY
- primary_user_agent_string = GRPC_ARG_PRIMARY_USER_AGENT_STRING
- secondary_user_agent_string = GRPC_ARG_SECONDARY_USER_AGENT_STRING
+class ConnectivityState:
+ idle = GRPC_CHANNEL_IDLE
+ connecting = GRPC_CHANNEL_CONNECTING
+ ready = GRPC_CHANNEL_READY
+ transient_failure = GRPC_CHANNEL_TRANSIENT_FAILURE
+ shutdown = GRPC_CHANNEL_SHUTDOWN
+
+
+class ChannelArgKey:
+ enable_census = GRPC_ARG_ENABLE_CENSUS
+ max_concurrent_streams = GRPC_ARG_MAX_CONCURRENT_STREAMS
+ max_receive_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
+ max_send_message_length = GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
+ http2_initial_sequence_number = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
+ default_authority = GRPC_ARG_DEFAULT_AUTHORITY
+ primary_user_agent_string = GRPC_ARG_PRIMARY_USER_AGENT_STRING
+ secondary_user_agent_string = GRPC_ARG_SECONDARY_USER_AGENT_STRING
ssl_session_cache = GRPC_SSL_SESSION_CACHE_ARG
- ssl_target_name_override = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG
-
-
-class WriteFlag:
- buffer_hint = GRPC_WRITE_BUFFER_HINT
- no_compress = GRPC_WRITE_NO_COMPRESS
-
-
-class StatusCode:
- ok = GRPC_STATUS_OK
- cancelled = GRPC_STATUS_CANCELLED
- unknown = GRPC_STATUS_UNKNOWN
- invalid_argument = GRPC_STATUS_INVALID_ARGUMENT
- deadline_exceeded = GRPC_STATUS_DEADLINE_EXCEEDED
- not_found = GRPC_STATUS_NOT_FOUND
- already_exists = GRPC_STATUS_ALREADY_EXISTS
- permission_denied = GRPC_STATUS_PERMISSION_DENIED
- unauthenticated = GRPC_STATUS_UNAUTHENTICATED
- resource_exhausted = GRPC_STATUS_RESOURCE_EXHAUSTED
- failed_precondition = GRPC_STATUS_FAILED_PRECONDITION
- aborted = GRPC_STATUS_ABORTED
- out_of_range = GRPC_STATUS_OUT_OF_RANGE
- unimplemented = GRPC_STATUS_UNIMPLEMENTED
- internal = GRPC_STATUS_INTERNAL
- unavailable = GRPC_STATUS_UNAVAILABLE
- data_loss = GRPC_STATUS_DATA_LOSS
-
-
-class CallError:
- ok = GRPC_CALL_OK
- error = GRPC_CALL_ERROR
- not_on_server = GRPC_CALL_ERROR_NOT_ON_SERVER
- not_on_client = GRPC_CALL_ERROR_NOT_ON_CLIENT
- already_accepted = GRPC_CALL_ERROR_ALREADY_ACCEPTED
- already_invoked = GRPC_CALL_ERROR_ALREADY_INVOKED
- not_invoked = GRPC_CALL_ERROR_NOT_INVOKED
- already_finished = GRPC_CALL_ERROR_ALREADY_FINISHED
- too_many_operations = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS
- invalid_flags = GRPC_CALL_ERROR_INVALID_FLAGS
- invalid_metadata = GRPC_CALL_ERROR_INVALID_METADATA
-
-
-class CompletionType:
- queue_shutdown = GRPC_QUEUE_SHUTDOWN
- queue_timeout = GRPC_QUEUE_TIMEOUT
- operation_complete = GRPC_OP_COMPLETE
-
-
-class OperationType:
- send_initial_metadata = GRPC_OP_SEND_INITIAL_METADATA
- send_message = GRPC_OP_SEND_MESSAGE
- send_close_from_client = GRPC_OP_SEND_CLOSE_FROM_CLIENT
- send_status_from_server = GRPC_OP_SEND_STATUS_FROM_SERVER
- receive_initial_metadata = GRPC_OP_RECV_INITIAL_METADATA
- receive_message = GRPC_OP_RECV_MESSAGE
- receive_status_on_client = GRPC_OP_RECV_STATUS_ON_CLIENT
- receive_close_on_server = GRPC_OP_RECV_CLOSE_ON_SERVER
-
+ ssl_target_name_override = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG
+
+
+class WriteFlag:
+ buffer_hint = GRPC_WRITE_BUFFER_HINT
+ no_compress = GRPC_WRITE_NO_COMPRESS
+
+
+class StatusCode:
+ ok = GRPC_STATUS_OK
+ cancelled = GRPC_STATUS_CANCELLED
+ unknown = GRPC_STATUS_UNKNOWN
+ invalid_argument = GRPC_STATUS_INVALID_ARGUMENT
+ deadline_exceeded = GRPC_STATUS_DEADLINE_EXCEEDED
+ not_found = GRPC_STATUS_NOT_FOUND
+ already_exists = GRPC_STATUS_ALREADY_EXISTS
+ permission_denied = GRPC_STATUS_PERMISSION_DENIED
+ unauthenticated = GRPC_STATUS_UNAUTHENTICATED
+ resource_exhausted = GRPC_STATUS_RESOURCE_EXHAUSTED
+ failed_precondition = GRPC_STATUS_FAILED_PRECONDITION
+ aborted = GRPC_STATUS_ABORTED
+ out_of_range = GRPC_STATUS_OUT_OF_RANGE
+ unimplemented = GRPC_STATUS_UNIMPLEMENTED
+ internal = GRPC_STATUS_INTERNAL
+ unavailable = GRPC_STATUS_UNAVAILABLE
+ data_loss = GRPC_STATUS_DATA_LOSS
+
+
+class CallError:
+ ok = GRPC_CALL_OK
+ error = GRPC_CALL_ERROR
+ not_on_server = GRPC_CALL_ERROR_NOT_ON_SERVER
+ not_on_client = GRPC_CALL_ERROR_NOT_ON_CLIENT
+ already_accepted = GRPC_CALL_ERROR_ALREADY_ACCEPTED
+ already_invoked = GRPC_CALL_ERROR_ALREADY_INVOKED
+ not_invoked = GRPC_CALL_ERROR_NOT_INVOKED
+ already_finished = GRPC_CALL_ERROR_ALREADY_FINISHED
+ too_many_operations = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS
+ invalid_flags = GRPC_CALL_ERROR_INVALID_FLAGS
+ invalid_metadata = GRPC_CALL_ERROR_INVALID_METADATA
+
+
+class CompletionType:
+ queue_shutdown = GRPC_QUEUE_SHUTDOWN
+ queue_timeout = GRPC_QUEUE_TIMEOUT
+ operation_complete = GRPC_OP_COMPLETE
+
+
+class OperationType:
+ send_initial_metadata = GRPC_OP_SEND_INITIAL_METADATA
+ send_message = GRPC_OP_SEND_MESSAGE
+ send_close_from_client = GRPC_OP_SEND_CLOSE_FROM_CLIENT
+ send_status_from_server = GRPC_OP_SEND_STATUS_FROM_SERVER
+ receive_initial_metadata = GRPC_OP_RECV_INITIAL_METADATA
+ receive_message = GRPC_OP_RECV_MESSAGE
+ receive_status_on_client = GRPC_OP_RECV_STATUS_ON_CLIENT
+ receive_close_on_server = GRPC_OP_RECV_CLOSE_ON_SERVER
+
GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM= (
_GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM)
-
+
GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY = (
_GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY)
-class CompressionAlgorithm:
- none = GRPC_COMPRESS_NONE
- deflate = GRPC_COMPRESS_DEFLATE
- gzip = GRPC_COMPRESS_GZIP
-
-
-class CompressionLevel:
- none = GRPC_COMPRESS_LEVEL_NONE
- low = GRPC_COMPRESS_LEVEL_LOW
- medium = GRPC_COMPRESS_LEVEL_MED
- high = GRPC_COMPRESS_LEVEL_HIGH
-
-
-cdef class CallDetails:
-
- def __cinit__(self):
+class CompressionAlgorithm:
+ none = GRPC_COMPRESS_NONE
+ deflate = GRPC_COMPRESS_DEFLATE
+ gzip = GRPC_COMPRESS_GZIP
+
+
+class CompressionLevel:
+ none = GRPC_COMPRESS_LEVEL_NONE
+ low = GRPC_COMPRESS_LEVEL_LOW
+ medium = GRPC_COMPRESS_LEVEL_MED
+ high = GRPC_COMPRESS_LEVEL_HIGH
+
+
+cdef class CallDetails:
+
+ def __cinit__(self):
fork_handlers_and_grpc_init()
- with nogil:
- grpc_call_details_init(&self.c_details)
-
- def __dealloc__(self):
- with nogil:
- grpc_call_details_destroy(&self.c_details)
+ with nogil:
+ grpc_call_details_init(&self.c_details)
+
+ def __dealloc__(self):
+ with nogil:
+ grpc_call_details_destroy(&self.c_details)
grpc_shutdown_blocking()
-
- @property
- def method(self):
+
+ @property
+ def method(self):
return _slice_bytes(self.c_details.method)
-
- @property
- def host(self):
+
+ @property
+ def host(self):
return _slice_bytes(self.c_details.host)
-
- @property
- def deadline(self):
+
+ @property
+ def deadline(self):
return _time_from_timespec(self.c_details.deadline)
-
-
-cdef class SslPemKeyCertPair:
-
- def __cinit__(self, bytes private_key, bytes certificate_chain):
- self.private_key = private_key
- self.certificate_chain = certificate_chain
- self.c_pair.private_key = self.private_key
- self.c_pair.certificate_chain = self.certificate_chain
-
-
-cdef class CompressionOptions:
-
- def __cinit__(self):
- with nogil:
- grpc_compression_options_init(&self.c_options)
-
- def enable_algorithm(self, grpc_compression_algorithm algorithm):
- with nogil:
- grpc_compression_options_enable_algorithm(&self.c_options, algorithm)
-
- def disable_algorithm(self, grpc_compression_algorithm algorithm):
- with nogil:
- grpc_compression_options_disable_algorithm(&self.c_options, algorithm)
-
- def is_algorithm_enabled(self, grpc_compression_algorithm algorithm):
- cdef int result
- with nogil:
- result = grpc_compression_options_is_algorithm_enabled(
- &self.c_options, algorithm)
- return result
-
- def to_channel_arg(self):
+
+
+cdef class SslPemKeyCertPair:
+
+ def __cinit__(self, bytes private_key, bytes certificate_chain):
+ self.private_key = private_key
+ self.certificate_chain = certificate_chain
+ self.c_pair.private_key = self.private_key
+ self.c_pair.certificate_chain = self.certificate_chain
+
+
+cdef class CompressionOptions:
+
+ def __cinit__(self):
+ with nogil:
+ grpc_compression_options_init(&self.c_options)
+
+ def enable_algorithm(self, grpc_compression_algorithm algorithm):
+ with nogil:
+ grpc_compression_options_enable_algorithm(&self.c_options, algorithm)
+
+ def disable_algorithm(self, grpc_compression_algorithm algorithm):
+ with nogil:
+ grpc_compression_options_disable_algorithm(&self.c_options, algorithm)
+
+ def is_algorithm_enabled(self, grpc_compression_algorithm algorithm):
+ cdef int result
+ with nogil:
+ result = grpc_compression_options_is_algorithm_enabled(
+ &self.c_options, algorithm)
+ return result
+
+ def to_channel_arg(self):
return (
GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
self.c_options.enabled_algorithms_bitset,
)
-
-
-def compression_algorithm_name(grpc_compression_algorithm algorithm):
+
+
+def compression_algorithm_name(grpc_compression_algorithm algorithm):
cdef const char* name
- with nogil:
- grpc_compression_algorithm_name(algorithm, &name)
- # Let Cython do the right thing with string casting
- return name
+ with nogil:
+ grpc_compression_algorithm_name(algorithm, &name)
+ # Let Cython do the right thing with string casting
+ return name
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi
index 6afe747833..e6e79536bb 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi
@@ -1,17 +1,17 @@
# Copyright 2016 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.
-
-
-cdef grpc_ssl_roots_override_result ssl_roots_override_callback(
+
+
+cdef grpc_ssl_roots_override_result ssl_roots_override_callback(
char **pem_root_certs) nogil
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi
index c11b9ab165..9cc3fd5a21 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi
@@ -1,20 +1,20 @@
# Copyright 2016 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.
-
-from libc.string cimport memcpy
-
-cdef grpc_ssl_roots_override_result ssl_roots_override_callback(
+
+from libc.string cimport memcpy
+
+cdef grpc_ssl_roots_override_result ssl_roots_override_callback(
char **pem_root_certs) nogil:
with gil:
temporary_pem_root_certs = ''
@@ -24,7 +24,7 @@ cdef grpc_ssl_roots_override_result ssl_roots_override_callback(
len(temporary_pem_root_certs))
pem_root_certs[0][len(temporary_pem_root_certs)] = '\0'
- return GRPC_SSL_ROOTS_OVERRIDE_OK
+ return GRPC_SSL_ROOTS_OVERRIDE_OK
def peer_identities(Call call):
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
index ccdc14bf2c..b89ed99d97 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
@@ -1,29 +1,29 @@
# 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.
-
-cdef class Server:
-
- cdef grpc_server *c_server
- cdef bint is_started # start has been called
- cdef bint is_shutting_down # shutdown has been called
- cdef bint is_shutdown # notification of complete shutdown received
- # used at dealloc when user forgets to shutdown
- cdef CompletionQueue backup_shutdown_queue
+cdef class Server:
+
+ cdef grpc_server *c_server
+
+ cdef bint is_started # start has been called
+ cdef bint is_shutting_down # shutdown has been called
+ cdef bint is_shutdown # notification of complete shutdown received
+ # used at dealloc when user forgets to shutdown
+ cdef CompletionQueue backup_shutdown_queue
# TODO(https://github.com/grpc/grpc/issues/15662): Elide this.
- cdef list references
- cdef list registered_completion_queues
-
- cdef _c_shutdown(self, CompletionQueue queue, tag)
- cdef notify_shutdown_complete(self)
+ cdef list references
+ cdef list registered_completion_queues
+
+ cdef _c_shutdown(self, CompletionQueue queue, tag)
+ cdef notify_shutdown_complete(self)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
index adfc6ac088..eff95c4f29 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi
@@ -1,39 +1,39 @@
# 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.
-
-
-cdef class Server:
-
+
+
+cdef class Server:
+
def __cinit__(self, object arguments):
fork_handlers_and_grpc_init()
- self.references = []
- self.registered_completion_queues = []
- self.is_started = False
- self.is_shutting_down = False
- self.is_shutdown = False
+ self.references = []
+ self.registered_completion_queues = []
+ self.is_started = False
+ self.is_shutting_down = False
+ self.is_shutdown = False
self.c_server = NULL
cdef _ChannelArgs channel_args = _ChannelArgs(arguments)
self.c_server = grpc_server_create(channel_args.c_args(), NULL)
self.references.append(arguments)
-
- def request_call(
- self, CompletionQueue call_queue not None,
- CompletionQueue server_queue not None, tag):
- if not self.is_started or self.is_shutting_down:
- raise ValueError("server must be started and not shutting down")
- if server_queue not in self.registered_completion_queues:
- raise ValueError("server_queue must be a registered completion queue")
+
+ def request_call(
+ self, CompletionQueue call_queue not None,
+ CompletionQueue server_queue not None, tag):
+ if not self.is_started or self.is_shutting_down:
+ raise ValueError("server must be started and not shutting down")
+ if server_queue not in self.registered_completion_queues:
+ raise ValueError("server_queue must be a registered completion queue")
cdef _RequestCallTag request_call_tag = _RequestCallTag(tag)
request_call_tag.prepare()
cpython.Py_INCREF(request_call_tag)
@@ -43,16 +43,16 @@ cdef class Server:
&request_call_tag.c_invocation_metadata,
call_queue.c_completion_queue, server_queue.c_completion_queue,
<cpython.PyObject *>request_call_tag)
-
- def register_completion_queue(
- self, CompletionQueue queue not None):
- if self.is_started:
- raise ValueError("cannot register completion queues after start")
- with nogil:
- grpc_server_register_completion_queue(
- self.c_server, queue.c_completion_queue, NULL)
- self.registered_completion_queues.append(queue)
-
+
+ def register_completion_queue(
+ self, CompletionQueue queue not None):
+ if self.is_started:
+ raise ValueError("cannot register completion queues after start")
+ with nogil:
+ grpc_server_register_completion_queue(
+ self.c_server, queue.c_completion_queue, NULL)
+ self.registered_completion_queues.append(queue)
+
def start(self, backup_queue=True):
"""Start the Cython gRPC Server.
@@ -61,80 +61,80 @@ cdef class Server:
queue. In the case that no CQ is bound to the server, and the shutdown
of server becomes un-observable.
"""
- if self.is_started:
- raise ValueError("the server has already started")
+ if self.is_started:
+ raise ValueError("the server has already started")
if backup_queue:
self.backup_shutdown_queue = CompletionQueue(shutdown_cq=True)
self.register_completion_queue(self.backup_shutdown_queue)
- self.is_started = True
- with nogil:
- grpc_server_start(self.c_server)
+ self.is_started = True
+ with nogil:
+ grpc_server_start(self.c_server)
if backup_queue:
# Ensure the core has gotten a chance to do the start-up work
self.backup_shutdown_queue.poll(deadline=time.time())
-
- def add_http2_port(self, bytes address,
- ServerCredentials server_credentials=None):
- address = str_to_bytes(address)
- self.references.append(address)
- cdef int result
- cdef char *address_c_string = address
- if server_credentials is not None:
- self.references.append(server_credentials)
- with nogil:
- result = grpc_server_add_secure_http2_port(
- self.c_server, address_c_string, server_credentials.c_credentials)
- else:
- with nogil:
- result = grpc_server_add_insecure_http2_port(self.c_server,
- address_c_string)
- return result
-
- cdef _c_shutdown(self, CompletionQueue queue, tag):
- self.is_shutting_down = True
+
+ def add_http2_port(self, bytes address,
+ ServerCredentials server_credentials=None):
+ address = str_to_bytes(address)
+ self.references.append(address)
+ cdef int result
+ cdef char *address_c_string = address
+ if server_credentials is not None:
+ self.references.append(server_credentials)
+ with nogil:
+ result = grpc_server_add_secure_http2_port(
+ self.c_server, address_c_string, server_credentials.c_credentials)
+ else:
+ with nogil:
+ result = grpc_server_add_insecure_http2_port(self.c_server,
+ address_c_string)
+ return result
+
+ cdef _c_shutdown(self, CompletionQueue queue, tag):
+ self.is_shutting_down = True
cdef _ServerShutdownTag server_shutdown_tag = _ServerShutdownTag(tag, self)
cpython.Py_INCREF(server_shutdown_tag)
- with nogil:
- grpc_server_shutdown_and_notify(
- self.c_server, queue.c_completion_queue,
+ with nogil:
+ grpc_server_shutdown_and_notify(
+ self.c_server, queue.c_completion_queue,
<cpython.PyObject *>server_shutdown_tag)
-
- def shutdown(self, CompletionQueue queue not None, tag):
- if queue.is_shutting_down:
- raise ValueError("queue must be live")
- elif not self.is_started:
- raise ValueError("the server hasn't started yet")
- elif self.is_shutting_down:
- return
- elif queue not in self.registered_completion_queues:
- raise ValueError("expected registered completion queue")
- else:
- self._c_shutdown(queue, tag)
-
- cdef notify_shutdown_complete(self):
+
+ def shutdown(self, CompletionQueue queue not None, tag):
+ if queue.is_shutting_down:
+ raise ValueError("queue must be live")
+ elif not self.is_started:
+ raise ValueError("the server hasn't started yet")
+ elif self.is_shutting_down:
+ return
+ elif queue not in self.registered_completion_queues:
+ raise ValueError("expected registered completion queue")
+ else:
+ self._c_shutdown(queue, tag)
+
+ cdef notify_shutdown_complete(self):
# called only after our server shutdown tag has emerged from a completion
# queue.
- self.is_shutdown = True
-
- def cancel_all_calls(self):
- if not self.is_shutting_down:
+ self.is_shutdown = True
+
+ def cancel_all_calls(self):
+ if not self.is_shutting_down:
raise UsageError("the server must be shutting down to cancel all calls")
- elif self.is_shutdown:
- return
- else:
- with nogil:
- grpc_server_cancel_all_calls(self.c_server)
-
+ elif self.is_shutdown:
+ return
+ else:
+ with nogil:
+ grpc_server_cancel_all_calls(self.c_server)
+
# TODO(https://github.com/grpc/grpc/issues/17515) Determine what, if any,
# portion of this is safe to call from __dealloc__, and potentially remove
# backup_shutdown_queue.
def destroy(self):
- if self.c_server != NULL:
- if not self.is_started:
- pass
- elif self.is_shutdown:
- pass
- elif not self.is_shutting_down:
+ if self.c_server != NULL:
+ if not self.is_started:
+ pass
+ elif self.is_shutdown:
+ pass
+ elif not self.is_shutting_down:
if self.backup_shutdown_queue is None:
raise InternalError('Server shutdown failed: no completion queue.')
else:
@@ -143,11 +143,11 @@ cdef class Server:
# and now we wait
while not self.is_shutdown:
self.backup_shutdown_queue.poll()
- else:
- # We're in the process of shutting down, but have not shutdown; can't do
- # much but repeatedly release the GIL and wait
- while not self.is_shutdown:
- time.sleep(0)
+ else:
+ # We're in the process of shutting down, but have not shutdown; can't do
+ # much but repeatedly release the GIL and wait
+ while not self.is_shutdown:
+ time.sleep(0)
with nogil:
grpc_server_destroy(self.c_server)
self.c_server = NULL
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pxd b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pxd
index 4aa3c32b80..166be37022 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pxd
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pxd
@@ -1,34 +1,34 @@
# 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.
# distutils: language=c++
-
+
cimport cpython
-include "_cygrpc/grpc.pxi"
-
+include "_cygrpc/grpc.pxi"
+
include "_cygrpc/arguments.pxd.pxi"
-include "_cygrpc/call.pxd.pxi"
-include "_cygrpc/channel.pxd.pxi"
-include "_cygrpc/credentials.pxd.pxi"
-include "_cygrpc/completion_queue.pxd.pxi"
+include "_cygrpc/call.pxd.pxi"
+include "_cygrpc/channel.pxd.pxi"
+include "_cygrpc/credentials.pxd.pxi"
+include "_cygrpc/completion_queue.pxd.pxi"
include "_cygrpc/event.pxd.pxi"
include "_cygrpc/metadata.pxd.pxi"
include "_cygrpc/operation.pxd.pxi"
include "_cygrpc/propagation_bits.pxd.pxi"
-include "_cygrpc/records.pxd.pxi"
-include "_cygrpc/security.pxd.pxi"
-include "_cygrpc/server.pxd.pxi"
+include "_cygrpc/records.pxd.pxi"
+include "_cygrpc/security.pxd.pxi"
+include "_cygrpc/server.pxd.pxi"
include "_cygrpc/tag.pxd.pxi"
include "_cygrpc/time.pxd.pxi"
include "_cygrpc/vtable.pxd.pxi"
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx
index ecbba24cbf..8d355c6fbb 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx
@@ -1,23 +1,23 @@
# 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.
# distutils: language=c++
-
-cimport cpython
-
+
+cimport cpython
+
import logging
import os
-import sys
+import sys
import threading
import time
@@ -30,31 +30,31 @@ except ImportError:
# distributed without breaking none compatible Python versions. For now, if
# Asyncio package is not available we just skip it.
pass
-
+
# The only copy of Python logger for the Cython extension
_LOGGER = logging.getLogger(__name__)
-# TODO(atash): figure out why the coverage tool gets confused about the Cython
-# coverage plugin when the following files don't have a '.pxi' suffix.
-include "_cygrpc/grpc_string.pyx.pxi"
+# TODO(atash): figure out why the coverage tool gets confused about the Cython
+# coverage plugin when the following files don't have a '.pxi' suffix.
+include "_cygrpc/grpc_string.pyx.pxi"
include "_cygrpc/arguments.pyx.pxi"
-include "_cygrpc/call.pyx.pxi"
-include "_cygrpc/channel.pyx.pxi"
+include "_cygrpc/call.pyx.pxi"
+include "_cygrpc/channel.pyx.pxi"
include "_cygrpc/channelz.pyx.pxi"
-include "_cygrpc/credentials.pyx.pxi"
-include "_cygrpc/completion_queue.pyx.pxi"
+include "_cygrpc/credentials.pyx.pxi"
+include "_cygrpc/completion_queue.pyx.pxi"
include "_cygrpc/event.pyx.pxi"
include "_cygrpc/metadata.pyx.pxi"
include "_cygrpc/operation.pyx.pxi"
include "_cygrpc/propagation_bits.pyx.pxi"
-include "_cygrpc/records.pyx.pxi"
-include "_cygrpc/security.pyx.pxi"
-include "_cygrpc/server.pyx.pxi"
+include "_cygrpc/records.pyx.pxi"
+include "_cygrpc/security.pyx.pxi"
+include "_cygrpc/server.pyx.pxi"
include "_cygrpc/tag.pyx.pxi"
include "_cygrpc/time.pyx.pxi"
include "_cygrpc/vtable.pyx.pxi"
include "_cygrpc/_hooks.pyx.pxi"
-
+
include "_cygrpc/iomgr.pyx.pxi"
include "_cygrpc/grpc_gevent.pyx.pxi"
@@ -81,13 +81,13 @@ include "_cygrpc/aio/channel.pyx.pxi"
include "_cygrpc/aio/server.pyx.pxi"
-#
-# initialize gRPC
-#
-cdef extern from "Python.h":
-
+#
+# initialize gRPC
+#
+cdef extern from "Python.h":
+
int PyEval_InitThreads()
-
+
cdef _initialize():
# We have Python callbacks called by c-core threads, this ensures the GIL
# is initialized.
@@ -95,5 +95,5 @@ cdef _initialize():
import ssl
grpc_dont_init_openssl()
# Load Arcadia certs in ComputePemRootCerts and do not override here.
-
-_initialize()
+
+_initialize()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_plugin_wrapping.py b/contrib/libs/grpc/src/python/grpcio/grpc/_plugin_wrapping.py
index 407ddf2c0c..e3bfa90916 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_plugin_wrapping.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_plugin_wrapping.py
@@ -1,51 +1,51 @@
# 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.
-
-import collections
+
+import collections
import logging
-import threading
-
-import grpc
-from grpc import _common
-from grpc._cython import cygrpc
-
+import threading
+
+import grpc
+from grpc import _common
+from grpc._cython import cygrpc
+
_LOGGER = logging.getLogger(__name__)
-
+
class _AuthMetadataContext(
- collections.namedtuple('AuthMetadataContext', (
+ collections.namedtuple('AuthMetadataContext', (
'service_url',
'method_name',
)), grpc.AuthMetadataContext):
- pass
-
-
+ pass
+
+
class _CallbackState(object):
-
+
def __init__(self):
self.lock = threading.Lock()
self.called = False
self.exception = None
-
-
+
+
class _AuthMetadataPluginCallback(grpc.AuthMetadataPluginCallback):
-
+
def __init__(self, state, callback):
self._state = state
self._callback = callback
-
- def __call__(self, metadata, error):
+
+ def __call__(self, metadata, error):
with self._state.lock:
if self._state.exception is None:
if self._state.called:
@@ -57,23 +57,23 @@ class _AuthMetadataPluginCallback(grpc.AuthMetadataPluginCallback):
raise RuntimeError(
'AuthMetadataPluginCallback raised exception "{}"!'.format(
self._state.exception))
- if error is None:
+ if error is None:
self._callback(metadata, cygrpc.StatusCode.ok, None)
- else:
+ else:
self._callback(None, cygrpc.StatusCode.internal,
_common.encode(str(error)))
-
-
+
+
class _Plugin(object):
-
+
def __init__(self, metadata_plugin):
self._metadata_plugin = metadata_plugin
-
+
def __call__(self, service_url, method_name, callback):
context = _AuthMetadataContext(_common.decode(service_url),
_common.decode(method_name))
callback_state = _CallbackState()
- try:
+ try:
self._metadata_plugin(
context, _AuthMetadataPluginCallback(callback_state, callback))
except Exception as exception: # pylint: disable=broad-except
@@ -86,8 +86,8 @@ class _Plugin(object):
return
callback(None, cygrpc.StatusCode.internal,
_common.encode(str(exception)))
-
-
+
+
def metadata_plugin_call_credentials(metadata_plugin, name):
if name is None:
try:
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_server.py b/contrib/libs/grpc/src/python/grpcio/grpc/_server.py
index 9e9a20650c..48ff743995 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_server.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_server.py
@@ -1,137 +1,137 @@
# Copyright 2016 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.
-"""Service-side implementation of gRPC Python."""
-
-import collections
-import enum
-import logging
-import threading
-import time
-
+"""Service-side implementation of gRPC Python."""
+
+import collections
+import enum
+import logging
+import threading
+import time
+
from concurrent import futures
import six
-import grpc
-from grpc import _common
+import grpc
+from grpc import _common
from grpc import _compression
from grpc import _interceptor
-from grpc._cython import cygrpc
-
+from grpc._cython import cygrpc
+
_LOGGER = logging.getLogger(__name__)
-_SHUTDOWN_TAG = 'shutdown'
-_REQUEST_CALL_TAG = 'request_call'
-
-_RECEIVE_CLOSE_ON_SERVER_TOKEN = 'receive_close_on_server'
-_SEND_INITIAL_METADATA_TOKEN = 'send_initial_metadata'
-_RECEIVE_MESSAGE_TOKEN = 'receive_message'
-_SEND_MESSAGE_TOKEN = 'send_message'
-_SEND_INITIAL_METADATA_AND_SEND_MESSAGE_TOKEN = (
- 'send_initial_metadata * send_message')
-_SEND_STATUS_FROM_SERVER_TOKEN = 'send_status_from_server'
-_SEND_INITIAL_METADATA_AND_SEND_STATUS_FROM_SERVER_TOKEN = (
- 'send_initial_metadata * send_status_from_server')
-
-_OPEN = 'open'
-_CLOSED = 'closed'
-_CANCELLED = 'cancelled'
-
-_EMPTY_FLAGS = 0
-
+_SHUTDOWN_TAG = 'shutdown'
+_REQUEST_CALL_TAG = 'request_call'
+
+_RECEIVE_CLOSE_ON_SERVER_TOKEN = 'receive_close_on_server'
+_SEND_INITIAL_METADATA_TOKEN = 'send_initial_metadata'
+_RECEIVE_MESSAGE_TOKEN = 'receive_message'
+_SEND_MESSAGE_TOKEN = 'send_message'
+_SEND_INITIAL_METADATA_AND_SEND_MESSAGE_TOKEN = (
+ 'send_initial_metadata * send_message')
+_SEND_STATUS_FROM_SERVER_TOKEN = 'send_status_from_server'
+_SEND_INITIAL_METADATA_AND_SEND_STATUS_FROM_SERVER_TOKEN = (
+ 'send_initial_metadata * send_status_from_server')
+
+_OPEN = 'open'
+_CLOSED = 'closed'
+_CANCELLED = 'cancelled'
+
+_EMPTY_FLAGS = 0
+
_DEALLOCATED_SERVER_CHECK_PERIOD_S = 1.0
_INF_TIMEOUT = 1e9
-
-
-def _serialized_request(request_event):
+
+
+def _serialized_request(request_event):
return request_event.batch_operations[0].message()
-
-
-def _application_code(code):
- cygrpc_code = _common.STATUS_CODE_TO_CYGRPC_STATUS_CODE.get(code)
- return cygrpc.StatusCode.unknown if cygrpc_code is None else cygrpc_code
-
-
-def _completion_code(state):
- if state.code is None:
- return cygrpc.StatusCode.ok
- else:
- return _application_code(state.code)
-
-
-def _abortion_code(state, code):
- if state.code is None:
- return code
- else:
- return _application_code(state.code)
-
-
-def _details(state):
- return b'' if state.details is None else state.details
-
-
-class _HandlerCallDetails(
- collections.namedtuple('_HandlerCallDetails', (
+
+
+def _application_code(code):
+ cygrpc_code = _common.STATUS_CODE_TO_CYGRPC_STATUS_CODE.get(code)
+ return cygrpc.StatusCode.unknown if cygrpc_code is None else cygrpc_code
+
+
+def _completion_code(state):
+ if state.code is None:
+ return cygrpc.StatusCode.ok
+ else:
+ return _application_code(state.code)
+
+
+def _abortion_code(state, code):
+ if state.code is None:
+ return code
+ else:
+ return _application_code(state.code)
+
+
+def _details(state):
+ return b'' if state.details is None else state.details
+
+
+class _HandlerCallDetails(
+ collections.namedtuple('_HandlerCallDetails', (
'method',
'invocation_metadata',
)), grpc.HandlerCallDetails):
- pass
-
-
-class _RPCState(object):
-
- def __init__(self):
- self.condition = threading.Condition()
- self.due = set()
- self.request = None
- self.client = _OPEN
- self.initial_metadata_allowed = True
+ pass
+
+
+class _RPCState(object):
+
+ def __init__(self):
+ self.condition = threading.Condition()
+ self.due = set()
+ self.request = None
+ self.client = _OPEN
+ self.initial_metadata_allowed = True
self.compression_algorithm = None
- self.disable_next_compression = False
- self.trailing_metadata = None
- self.code = None
- self.details = None
- self.statused = False
- self.rpc_errors = []
- self.callbacks = []
+ self.disable_next_compression = False
+ self.trailing_metadata = None
+ self.code = None
+ self.details = None
+ self.statused = False
+ self.rpc_errors = []
+ self.callbacks = []
self.aborted = False
-
-
-def _raise_rpc_error(state):
- rpc_error = grpc.RpcError()
- state.rpc_errors.append(rpc_error)
- raise rpc_error
-
-
-def _possibly_finish_call(state, token):
- state.due.remove(token)
+
+
+def _raise_rpc_error(state):
+ rpc_error = grpc.RpcError()
+ state.rpc_errors.append(rpc_error)
+ raise rpc_error
+
+
+def _possibly_finish_call(state, token):
+ state.due.remove(token)
if not _is_rpc_state_active(state) and not state.due:
- callbacks = state.callbacks
- state.callbacks = None
- return state, callbacks
- else:
- return None, ()
-
-
-def _send_status_from_server(state, token):
-
- def send_status_from_server(unused_send_status_from_server_event):
- with state.condition:
- return _possibly_finish_call(state, token)
-
- return send_status_from_server
-
-
+ callbacks = state.callbacks
+ state.callbacks = None
+ return state, callbacks
+ else:
+ return None, ()
+
+
+def _send_status_from_server(state, token):
+
+ def send_status_from_server(unused_send_status_from_server_event):
+ with state.condition:
+ return _possibly_finish_call(state, token)
+
+ return send_status_from_server
+
+
def _get_initial_metadata(state, metadata):
with state.condition:
if state.compression_algorithm:
@@ -152,11 +152,11 @@ def _get_initial_metadata_operation(state, metadata):
return operation
-def _abort(state, call, code, details):
- if state.client is not _CANCELLED:
- effective_code = _abortion_code(state, code)
- effective_details = details if state.details is None else state.details
- if state.initial_metadata_allowed:
+def _abort(state, call, code, details):
+ if state.client is not _CANCELLED:
+ effective_code = _abortion_code(state, code)
+ effective_details = details if state.details is None else state.details
+ if state.initial_metadata_allowed:
operations = (
_get_initial_metadata_operation(state, None),
cygrpc.SendStatusFromServerOperation(state.trailing_metadata,
@@ -164,111 +164,111 @@ def _abort(state, call, code, details):
effective_details,
_EMPTY_FLAGS),
)
- token = _SEND_INITIAL_METADATA_AND_SEND_STATUS_FROM_SERVER_TOKEN
- else:
+ token = _SEND_INITIAL_METADATA_AND_SEND_STATUS_FROM_SERVER_TOKEN
+ else:
operations = (cygrpc.SendStatusFromServerOperation(
state.trailing_metadata, effective_code, effective_details,
_EMPTY_FLAGS),)
- token = _SEND_STATUS_FROM_SERVER_TOKEN
+ token = _SEND_STATUS_FROM_SERVER_TOKEN
call.start_server_batch(operations,
_send_status_from_server(state, token))
- state.statused = True
- state.due.add(token)
-
-
-def _receive_close_on_server(state):
-
- def receive_close_on_server(receive_close_on_server_event):
- with state.condition:
+ state.statused = True
+ state.due.add(token)
+
+
+def _receive_close_on_server(state):
+
+ def receive_close_on_server(receive_close_on_server_event):
+ with state.condition:
if receive_close_on_server_event.batch_operations[0].cancelled():
- state.client = _CANCELLED
- elif state.client is _OPEN:
- state.client = _CLOSED
- state.condition.notify_all()
- return _possibly_finish_call(state, _RECEIVE_CLOSE_ON_SERVER_TOKEN)
-
- return receive_close_on_server
-
-
-def _receive_message(state, call, request_deserializer):
-
- def receive_message(receive_message_event):
- serialized_request = _serialized_request(receive_message_event)
- if serialized_request is None:
- with state.condition:
- if state.client is _OPEN:
- state.client = _CLOSED
- state.condition.notify_all()
- return _possibly_finish_call(state, _RECEIVE_MESSAGE_TOKEN)
- else:
- request = _common.deserialize(serialized_request,
- request_deserializer)
- with state.condition:
- if request is None:
- _abort(state, call, cygrpc.StatusCode.internal,
- b'Exception deserializing request!')
- else:
- state.request = request
- state.condition.notify_all()
- return _possibly_finish_call(state, _RECEIVE_MESSAGE_TOKEN)
-
- return receive_message
-
-
-def _send_initial_metadata(state):
-
- def send_initial_metadata(unused_send_initial_metadata_event):
- with state.condition:
- return _possibly_finish_call(state, _SEND_INITIAL_METADATA_TOKEN)
-
- return send_initial_metadata
-
-
-def _send_message(state, token):
-
- def send_message(unused_send_message_event):
- with state.condition:
- state.condition.notify_all()
- return _possibly_finish_call(state, token)
-
- return send_message
-
-
-class _Context(grpc.ServicerContext):
-
- def __init__(self, rpc_event, state, request_deserializer):
- self._rpc_event = rpc_event
- self._state = state
- self._request_deserializer = request_deserializer
-
- def is_active(self):
- with self._state.condition:
+ state.client = _CANCELLED
+ elif state.client is _OPEN:
+ state.client = _CLOSED
+ state.condition.notify_all()
+ return _possibly_finish_call(state, _RECEIVE_CLOSE_ON_SERVER_TOKEN)
+
+ return receive_close_on_server
+
+
+def _receive_message(state, call, request_deserializer):
+
+ def receive_message(receive_message_event):
+ serialized_request = _serialized_request(receive_message_event)
+ if serialized_request is None:
+ with state.condition:
+ if state.client is _OPEN:
+ state.client = _CLOSED
+ state.condition.notify_all()
+ return _possibly_finish_call(state, _RECEIVE_MESSAGE_TOKEN)
+ else:
+ request = _common.deserialize(serialized_request,
+ request_deserializer)
+ with state.condition:
+ if request is None:
+ _abort(state, call, cygrpc.StatusCode.internal,
+ b'Exception deserializing request!')
+ else:
+ state.request = request
+ state.condition.notify_all()
+ return _possibly_finish_call(state, _RECEIVE_MESSAGE_TOKEN)
+
+ return receive_message
+
+
+def _send_initial_metadata(state):
+
+ def send_initial_metadata(unused_send_initial_metadata_event):
+ with state.condition:
+ return _possibly_finish_call(state, _SEND_INITIAL_METADATA_TOKEN)
+
+ return send_initial_metadata
+
+
+def _send_message(state, token):
+
+ def send_message(unused_send_message_event):
+ with state.condition:
+ state.condition.notify_all()
+ return _possibly_finish_call(state, token)
+
+ return send_message
+
+
+class _Context(grpc.ServicerContext):
+
+ def __init__(self, rpc_event, state, request_deserializer):
+ self._rpc_event = rpc_event
+ self._state = state
+ self._request_deserializer = request_deserializer
+
+ def is_active(self):
+ with self._state.condition:
return _is_rpc_state_active(self._state)
-
- def time_remaining(self):
+
+ def time_remaining(self):
return max(self._rpc_event.call_details.deadline - time.time(), 0)
-
- def cancel(self):
+
+ def cancel(self):
self._rpc_event.call.cancel()
-
- def add_callback(self, callback):
- with self._state.condition:
- if self._state.callbacks is None:
- return False
- else:
- self._state.callbacks.append(callback)
- return True
-
- def disable_next_message_compression(self):
- with self._state.condition:
- self._state.disable_next_compression = True
-
- def invocation_metadata(self):
+
+ def add_callback(self, callback):
+ with self._state.condition:
+ if self._state.callbacks is None:
+ return False
+ else:
+ self._state.callbacks.append(callback)
+ return True
+
+ def disable_next_message_compression(self):
+ with self._state.condition:
+ self._state.disable_next_compression = True
+
+ def invocation_metadata(self):
return self._rpc_event.invocation_metadata
-
- def peer(self):
+
+ def peer(self):
return _common.decode(self._rpc_event.call.peer())
-
+
def peer_identities(self):
return cygrpc.peer_identities(self._rpc_event.call)
@@ -286,25 +286,25 @@ class _Context(grpc.ServicerContext):
with self._state.condition:
self._state.compression_algorithm = compression
- def send_initial_metadata(self, initial_metadata):
- with self._state.condition:
- if self._state.client is _CANCELLED:
- _raise_rpc_error(self._state)
- else:
- if self._state.initial_metadata_allowed:
+ def send_initial_metadata(self, initial_metadata):
+ with self._state.condition:
+ if self._state.client is _CANCELLED:
+ _raise_rpc_error(self._state)
+ else:
+ if self._state.initial_metadata_allowed:
operation = _get_initial_metadata_operation(
self._state, initial_metadata)
self._rpc_event.call.start_server_batch(
(operation,), _send_initial_metadata(self._state))
- self._state.initial_metadata_allowed = False
- self._state.due.add(_SEND_INITIAL_METADATA_TOKEN)
- else:
- raise ValueError('Initial metadata no longer allowed!')
-
- def set_trailing_metadata(self, trailing_metadata):
- with self._state.condition:
+ self._state.initial_metadata_allowed = False
+ self._state.due.add(_SEND_INITIAL_METADATA_TOKEN)
+ else:
+ raise ValueError('Initial metadata no longer allowed!')
+
+ def set_trailing_metadata(self, trailing_metadata):
+ with self._state.condition:
self._state.trailing_metadata = trailing_metadata
-
+
def abort(self, code, details):
# treat OK like other invalid arguments: fail the RPC
if code == grpc.StatusCode.OK:
@@ -322,101 +322,101 @@ class _Context(grpc.ServicerContext):
self._state.trailing_metadata = status.trailing_metadata
self.abort(status.code, status.details)
- def set_code(self, code):
- with self._state.condition:
- self._state.code = code
-
- def set_details(self, details):
- with self._state.condition:
- self._state.details = _common.encode(details)
-
+ def set_code(self, code):
+ with self._state.condition:
+ self._state.code = code
+
+ def set_details(self, details):
+ with self._state.condition:
+ self._state.details = _common.encode(details)
+
def _finalize_state(self):
pass
-
-
-class _RequestIterator(object):
-
- def __init__(self, state, call, request_deserializer):
- self._state = state
- self._call = call
- self._request_deserializer = request_deserializer
-
- def _raise_or_start_receive_message(self):
- if self._state.client is _CANCELLED:
- _raise_rpc_error(self._state)
+
+
+class _RequestIterator(object):
+
+ def __init__(self, state, call, request_deserializer):
+ self._state = state
+ self._call = call
+ self._request_deserializer = request_deserializer
+
+ def _raise_or_start_receive_message(self):
+ if self._state.client is _CANCELLED:
+ _raise_rpc_error(self._state)
elif not _is_rpc_state_active(self._state):
- raise StopIteration()
- else:
- self._call.start_server_batch(
+ raise StopIteration()
+ else:
+ self._call.start_server_batch(
(cygrpc.ReceiveMessageOperation(_EMPTY_FLAGS),),
- _receive_message(self._state, self._call,
- self._request_deserializer))
- self._state.due.add(_RECEIVE_MESSAGE_TOKEN)
-
- def _look_for_request(self):
- if self._state.client is _CANCELLED:
- _raise_rpc_error(self._state)
- elif (self._state.request is None and
- _RECEIVE_MESSAGE_TOKEN not in self._state.due):
- raise StopIteration()
- else:
- request = self._state.request
- self._state.request = None
- return request
-
+ _receive_message(self._state, self._call,
+ self._request_deserializer))
+ self._state.due.add(_RECEIVE_MESSAGE_TOKEN)
+
+ def _look_for_request(self):
+ if self._state.client is _CANCELLED:
+ _raise_rpc_error(self._state)
+ elif (self._state.request is None and
+ _RECEIVE_MESSAGE_TOKEN not in self._state.due):
+ raise StopIteration()
+ else:
+ request = self._state.request
+ self._state.request = None
+ return request
+
raise AssertionError() # should never run
- def _next(self):
- with self._state.condition:
- self._raise_or_start_receive_message()
- while True:
- self._state.condition.wait()
- request = self._look_for_request()
- if request is not None:
- return request
-
- def __iter__(self):
- return self
-
- def __next__(self):
- return self._next()
-
- def next(self):
- return self._next()
-
-
-def _unary_request(rpc_event, state, request_deserializer):
-
- def unary_request():
- with state.condition:
+ def _next(self):
+ with self._state.condition:
+ self._raise_or_start_receive_message()
+ while True:
+ self._state.condition.wait()
+ request = self._look_for_request()
+ if request is not None:
+ return request
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ return self._next()
+
+ def next(self):
+ return self._next()
+
+
+def _unary_request(rpc_event, state, request_deserializer):
+
+ def unary_request():
+ with state.condition:
if not _is_rpc_state_active(state):
- return None
- else:
+ return None
+ else:
rpc_event.call.start_server_batch(
(cygrpc.ReceiveMessageOperation(_EMPTY_FLAGS),),
_receive_message(state, rpc_event.call,
- request_deserializer))
- state.due.add(_RECEIVE_MESSAGE_TOKEN)
- while True:
- state.condition.wait()
- if state.request is None:
- if state.client is _CLOSED:
- details = '"{}" requires exactly one request message.'.format(
+ request_deserializer))
+ state.due.add(_RECEIVE_MESSAGE_TOKEN)
+ while True:
+ state.condition.wait()
+ if state.request is None:
+ if state.client is _CLOSED:
+ details = '"{}" requires exactly one request message.'.format(
rpc_event.call_details.method)
_abort(state, rpc_event.call,
- cygrpc.StatusCode.unimplemented,
- _common.encode(details))
- return None
- elif state.client is _CANCELLED:
- return None
- else:
- request = state.request
- state.request = None
- return request
-
- return unary_request
-
-
+ cygrpc.StatusCode.unimplemented,
+ _common.encode(details))
+ return None
+ elif state.client is _CANCELLED:
+ return None
+ else:
+ request = state.request
+ state.request = None
+ return request
+
+ return unary_request
+
+
def _call_behavior(rpc_event,
state,
behavior,
@@ -446,15 +446,15 @@ def _call_behavior(rpc_event,
_abort(state, rpc_event.call, cygrpc.StatusCode.unknown,
_common.encode(details))
return None, False
-
-
-def _take_response_from_response_iterator(rpc_event, state, response_iterator):
- try:
- return next(response_iterator), True
- except StopIteration:
- return None, True
+
+
+def _take_response_from_response_iterator(rpc_event, state, response_iterator):
+ try:
+ return next(response_iterator), True
+ except StopIteration:
+ return None, True
except Exception as exception: # pylint: disable=broad-except
- with state.condition:
+ with state.condition:
if state.aborted:
_abort(state, rpc_event.call, cygrpc.StatusCode.unknown,
b'RPC Aborted')
@@ -463,20 +463,20 @@ def _take_response_from_response_iterator(rpc_event, state, response_iterator):
_LOGGER.exception(details)
_abort(state, rpc_event.call, cygrpc.StatusCode.unknown,
_common.encode(details))
- return None, False
-
-
-def _serialize_response(rpc_event, state, response, response_serializer):
- serialized_response = _common.serialize(response, response_serializer)
- if serialized_response is None:
- with state.condition:
+ return None, False
+
+
+def _serialize_response(rpc_event, state, response, response_serializer):
+ serialized_response = _common.serialize(response, response_serializer)
+ if serialized_response is None:
+ with state.condition:
_abort(state, rpc_event.call, cygrpc.StatusCode.internal,
- b'Failed to serialize response!')
- return None
- else:
- return serialized_response
-
-
+ b'Failed to serialize response!')
+ return None
+ else:
+ return serialized_response
+
+
def _get_send_message_op_flags_from_state(state):
if state.disable_next_compression:
return cygrpc.WriteFlag.no_compress
@@ -489,62 +489,62 @@ def _reset_per_message_state(state):
state.disable_next_compression = False
-def _send_response(rpc_event, state, serialized_response):
- with state.condition:
+def _send_response(rpc_event, state, serialized_response):
+ with state.condition:
if not _is_rpc_state_active(state):
- return False
- else:
- if state.initial_metadata_allowed:
+ return False
+ else:
+ if state.initial_metadata_allowed:
operations = (
_get_initial_metadata_operation(state, None),
cygrpc.SendMessageOperation(
serialized_response,
_get_send_message_op_flags_from_state(state)),
)
- state.initial_metadata_allowed = False
- token = _SEND_INITIAL_METADATA_AND_SEND_MESSAGE_TOKEN
- else:
+ state.initial_metadata_allowed = False
+ token = _SEND_INITIAL_METADATA_AND_SEND_MESSAGE_TOKEN
+ else:
operations = (cygrpc.SendMessageOperation(
serialized_response,
_get_send_message_op_flags_from_state(state)),)
- token = _SEND_MESSAGE_TOKEN
+ token = _SEND_MESSAGE_TOKEN
rpc_event.call.start_server_batch(operations,
_send_message(state, token))
- state.due.add(token)
+ state.due.add(token)
_reset_per_message_state(state)
- while True:
- state.condition.wait()
- if token not in state.due:
+ while True:
+ state.condition.wait()
+ if token not in state.due:
return _is_rpc_state_active(state)
-
-
-def _status(rpc_event, state, serialized_response):
- with state.condition:
- if state.client is not _CANCELLED:
- code = _completion_code(state)
- details = _details(state)
- operations = [
+
+
+def _status(rpc_event, state, serialized_response):
+ with state.condition:
+ if state.client is not _CANCELLED:
+ code = _completion_code(state)
+ details = _details(state)
+ operations = [
cygrpc.SendStatusFromServerOperation(state.trailing_metadata,
code, details,
_EMPTY_FLAGS),
- ]
- if state.initial_metadata_allowed:
+ ]
+ if state.initial_metadata_allowed:
operations.append(_get_initial_metadata_operation(state, None))
- if serialized_response is not None:
- operations.append(
+ if serialized_response is not None:
+ operations.append(
cygrpc.SendMessageOperation(
serialized_response,
_get_send_message_op_flags_from_state(state)))
rpc_event.call.start_server_batch(
operations,
- _send_status_from_server(state, _SEND_STATUS_FROM_SERVER_TOKEN))
- state.statused = True
+ _send_status_from_server(state, _SEND_STATUS_FROM_SERVER_TOKEN))
+ state.statused = True
_reset_per_message_state(state)
- state.due.add(_SEND_STATUS_FROM_SERVER_TOKEN)
-
-
-def _unary_response_in_pool(rpc_event, state, behavior, argument_thunk,
- request_deserializer, response_serializer):
+ state.due.add(_SEND_STATUS_FROM_SERVER_TOKEN)
+
+
+def _unary_response_in_pool(rpc_event, state, behavior, argument_thunk,
+ request_deserializer, response_serializer):
cygrpc.install_context_from_request_call_event(rpc_event)
try:
argument = argument_thunk()
@@ -558,10 +558,10 @@ def _unary_response_in_pool(rpc_event, state, behavior, argument_thunk,
_status(rpc_event, state, serialized_response)
finally:
cygrpc.uninstall_context()
-
-
-def _stream_response_in_pool(rpc_event, state, behavior, argument_thunk,
- request_deserializer, response_serializer):
+
+
+def _stream_response_in_pool(rpc_event, state, behavior, argument_thunk,
+ request_deserializer, response_serializer):
cygrpc.install_context_from_request_call_event(rpc_event)
def send_response(response):
@@ -593,8 +593,8 @@ def _stream_response_in_pool(rpc_event, state, behavior, argument_thunk,
rpc_event, state, send_response, response_iterator)
finally:
cygrpc.uninstall_context()
-
-
+
+
def _is_rpc_state_active(state):
return state.client is not _CANCELLED and not state.statused
@@ -622,30 +622,30 @@ def _select_thread_pool_for_behavior(behavior, default_thread_pool):
def _handle_unary_unary(rpc_event, state, method_handler, default_thread_pool):
- unary_request = _unary_request(rpc_event, state,
- method_handler.request_deserializer)
+ unary_request = _unary_request(rpc_event, state,
+ method_handler.request_deserializer)
thread_pool = _select_thread_pool_for_behavior(method_handler.unary_unary,
default_thread_pool)
return thread_pool.submit(_unary_response_in_pool, rpc_event, state,
method_handler.unary_unary, unary_request,
method_handler.request_deserializer,
method_handler.response_serializer)
-
-
+
+
def _handle_unary_stream(rpc_event, state, method_handler, default_thread_pool):
- unary_request = _unary_request(rpc_event, state,
- method_handler.request_deserializer)
+ unary_request = _unary_request(rpc_event, state,
+ method_handler.request_deserializer)
thread_pool = _select_thread_pool_for_behavior(method_handler.unary_stream,
default_thread_pool)
return thread_pool.submit(_stream_response_in_pool, rpc_event, state,
method_handler.unary_stream, unary_request,
method_handler.request_deserializer,
method_handler.response_serializer)
-
-
+
+
def _handle_stream_unary(rpc_event, state, method_handler, default_thread_pool):
request_iterator = _RequestIterator(state, rpc_event.call,
- method_handler.request_deserializer)
+ method_handler.request_deserializer)
thread_pool = _select_thread_pool_for_behavior(method_handler.stream_unary,
default_thread_pool)
return thread_pool.submit(_unary_response_in_pool, rpc_event, state,
@@ -653,12 +653,12 @@ def _handle_stream_unary(rpc_event, state, method_handler, default_thread_pool):
lambda: request_iterator,
method_handler.request_deserializer,
method_handler.response_serializer)
-
-
+
+
def _handle_stream_stream(rpc_event, state, method_handler,
default_thread_pool):
request_iterator = _RequestIterator(state, rpc_event.call,
- method_handler.request_deserializer)
+ method_handler.request_deserializer)
thread_pool = _select_thread_pool_for_behavior(method_handler.stream_stream,
default_thread_pool)
return thread_pool.submit(_stream_response_in_pool, rpc_event, state,
@@ -666,8 +666,8 @@ def _handle_stream_stream(rpc_event, state, method_handler,
lambda: request_iterator,
method_handler.request_deserializer,
method_handler.response_serializer)
-
-
+
+
def _find_method_handler(rpc_event, generic_handlers, interceptor_pipeline):
def query_handlers(handler_call_details):
@@ -675,12 +675,12 @@ def _find_method_handler(rpc_event, generic_handlers, interceptor_pipeline):
method_handler = generic_handler.service(handler_call_details)
if method_handler is not None:
return method_handler
- return None
-
+ return None
+
handler_call_details = _HandlerCallDetails(
_common.decode(rpc_event.call_details.method),
rpc_event.invocation_metadata)
-
+
if interceptor_pipeline is not None:
return interceptor_pipeline.execute(query_handlers,
handler_call_details)
@@ -690,7 +690,7 @@ def _find_method_handler(rpc_event, generic_handlers, interceptor_pipeline):
def _reject_rpc(rpc_event, status, details):
rpc_state = _RPCState()
- operations = (
+ operations = (
_get_initial_metadata_operation(rpc_state, None),
cygrpc.ReceiveCloseOnServerOperation(_EMPTY_FLAGS),
cygrpc.SendStatusFromServerOperation(None, status, details,
@@ -700,32 +700,32 @@ def _reject_rpc(rpc_event, status, details):
rpc_state,
(),
))
- return rpc_state
-
-
-def _handle_with_method_handler(rpc_event, method_handler, thread_pool):
- state = _RPCState()
- with state.condition:
+ return rpc_state
+
+
+def _handle_with_method_handler(rpc_event, method_handler, thread_pool):
+ state = _RPCState()
+ with state.condition:
rpc_event.call.start_server_batch(
(cygrpc.ReceiveCloseOnServerOperation(_EMPTY_FLAGS),),
- _receive_close_on_server(state))
- state.due.add(_RECEIVE_CLOSE_ON_SERVER_TOKEN)
- if method_handler.request_streaming:
- if method_handler.response_streaming:
+ _receive_close_on_server(state))
+ state.due.add(_RECEIVE_CLOSE_ON_SERVER_TOKEN)
+ if method_handler.request_streaming:
+ if method_handler.response_streaming:
return state, _handle_stream_stream(rpc_event, state,
method_handler, thread_pool)
- else:
+ else:
return state, _handle_stream_unary(rpc_event, state,
method_handler, thread_pool)
- else:
- if method_handler.response_streaming:
+ else:
+ if method_handler.response_streaming:
return state, _handle_unary_stream(rpc_event, state,
method_handler, thread_pool)
- else:
+ else:
return state, _handle_unary_unary(rpc_event, state,
method_handler, thread_pool)
-
-
+
+
def _handle_call(rpc_event, generic_handlers, interceptor_pipeline, thread_pool,
concurrency_exceeded):
if not rpc_event.success:
@@ -739,85 +739,85 @@ def _handle_call(rpc_event, generic_handlers, interceptor_pipeline, thread_pool,
_LOGGER.exception(details)
return _reject_rpc(rpc_event, cygrpc.StatusCode.unknown,
b'Error in service handler!'), None
- if method_handler is None:
+ if method_handler is None:
return _reject_rpc(rpc_event, cygrpc.StatusCode.unimplemented,
b'Method not found!'), None
elif concurrency_exceeded:
return _reject_rpc(rpc_event, cygrpc.StatusCode.resource_exhausted,
b'Concurrent RPC limit exceeded!'), None
- else:
- return _handle_with_method_handler(rpc_event, method_handler,
- thread_pool)
- else:
+ else:
+ return _handle_with_method_handler(rpc_event, method_handler,
+ thread_pool)
+ else:
return None, None
-
-
-@enum.unique
-class _ServerStage(enum.Enum):
- STOPPED = 'stopped'
- STARTED = 'started'
- GRACE = 'grace'
-
-
-class _ServerState(object):
-
+
+
+@enum.unique
+class _ServerStage(enum.Enum):
+ STOPPED = 'stopped'
+ STARTED = 'started'
+ GRACE = 'grace'
+
+
+class _ServerState(object):
+
# pylint: disable=too-many-arguments
def __init__(self, completion_queue, server, generic_handlers,
interceptor_pipeline, thread_pool, maximum_concurrent_rpcs):
self.lock = threading.RLock()
- self.completion_queue = completion_queue
- self.server = server
- self.generic_handlers = list(generic_handlers)
+ self.completion_queue = completion_queue
+ self.server = server
+ self.generic_handlers = list(generic_handlers)
self.interceptor_pipeline = interceptor_pipeline
- self.thread_pool = thread_pool
- self.stage = _ServerStage.STOPPED
+ self.thread_pool = thread_pool
+ self.stage = _ServerStage.STOPPED
self.termination_event = threading.Event()
self.shutdown_events = [self.termination_event]
self.maximum_concurrent_rpcs = maximum_concurrent_rpcs
self.active_rpc_count = 0
-
- # TODO(https://github.com/grpc/grpc/issues/6597): eliminate these fields.
- self.rpc_states = set()
- self.due = set()
-
+
+ # TODO(https://github.com/grpc/grpc/issues/6597): eliminate these fields.
+ self.rpc_states = set()
+ self.due = set()
+
# A "volatile" flag to interrupt the daemon serving thread
self.server_deallocated = False
-
-
-def _add_generic_handlers(state, generic_handlers):
- with state.lock:
- state.generic_handlers.extend(generic_handlers)
-
-
-def _add_insecure_port(state, address):
- with state.lock:
- return state.server.add_http2_port(address)
-
-
-def _add_secure_port(state, address, server_credentials):
- with state.lock:
- return state.server.add_http2_port(address,
- server_credentials._credentials)
-
-
-def _request_call(state):
- state.server.request_call(state.completion_queue, state.completion_queue,
- _REQUEST_CALL_TAG)
- state.due.add(_REQUEST_CALL_TAG)
-
-
-# TODO(https://github.com/grpc/grpc/issues/6597): delete this function.
-def _stop_serving(state):
- if not state.rpc_states and not state.due:
+
+
+def _add_generic_handlers(state, generic_handlers):
+ with state.lock:
+ state.generic_handlers.extend(generic_handlers)
+
+
+def _add_insecure_port(state, address):
+ with state.lock:
+ return state.server.add_http2_port(address)
+
+
+def _add_secure_port(state, address, server_credentials):
+ with state.lock:
+ return state.server.add_http2_port(address,
+ server_credentials._credentials)
+
+
+def _request_call(state):
+ state.server.request_call(state.completion_queue, state.completion_queue,
+ _REQUEST_CALL_TAG)
+ state.due.add(_REQUEST_CALL_TAG)
+
+
+# TODO(https://github.com/grpc/grpc/issues/6597): delete this function.
+def _stop_serving(state):
+ if not state.rpc_states and not state.due:
state.server.destroy()
- for shutdown_event in state.shutdown_events:
- shutdown_event.set()
- state.stage = _ServerStage.STOPPED
- return True
- else:
- return False
-
-
+ for shutdown_event in state.shutdown_events:
+ shutdown_event.set()
+ state.stage = _ServerStage.STOPPED
+ return True
+ else:
+ return False
+
+
def _on_call_completed(state):
with state.lock:
state.active_rpc_count -= 1
@@ -865,8 +865,8 @@ def _process_event_and_continue(state, event):
return should_continue
-def _serve(state):
- while True:
+def _serve(state):
+ while True:
timeout = time.time() + _DEALLOCATED_SERVER_CHECK_PERIOD_S
event = state.completion_queue.poll(timeout)
if state.server_deallocated:
@@ -878,8 +878,8 @@ def _serve(state):
# ~before~ we poll again; if the event has a reference
# to a shutdown Call object, this can induce spinlock.
event = None
-
-
+
+
def _begin_shutdown_once(state):
with state.lock:
if state.stage is _ServerStage.STARTED:
@@ -888,45 +888,45 @@ def _begin_shutdown_once(state):
state.due.add(_SHUTDOWN_TAG)
-def _stop(state, grace):
- with state.lock:
- if state.stage is _ServerStage.STOPPED:
- shutdown_event = threading.Event()
- shutdown_event.set()
- return shutdown_event
- else:
+def _stop(state, grace):
+ with state.lock:
+ if state.stage is _ServerStage.STOPPED:
+ shutdown_event = threading.Event()
+ shutdown_event.set()
+ return shutdown_event
+ else:
_begin_shutdown_once(state)
- shutdown_event = threading.Event()
- state.shutdown_events.append(shutdown_event)
- if grace is None:
- state.server.cancel_all_calls()
- else:
-
- def cancel_all_calls_after_grace():
- shutdown_event.wait(timeout=grace)
- with state.lock:
- state.server.cancel_all_calls()
-
- thread = threading.Thread(target=cancel_all_calls_after_grace)
- thread.start()
- return shutdown_event
- shutdown_event.wait()
- return shutdown_event
-
-
-def _start(state):
- with state.lock:
- if state.stage is not _ServerStage.STOPPED:
- raise ValueError('Cannot start already-started server!')
- state.server.start()
- state.stage = _ServerStage.STARTED
- _request_call(state)
-
+ shutdown_event = threading.Event()
+ state.shutdown_events.append(shutdown_event)
+ if grace is None:
+ state.server.cancel_all_calls()
+ else:
+
+ def cancel_all_calls_after_grace():
+ shutdown_event.wait(timeout=grace)
+ with state.lock:
+ state.server.cancel_all_calls()
+
+ thread = threading.Thread(target=cancel_all_calls_after_grace)
+ thread.start()
+ return shutdown_event
+ shutdown_event.wait()
+ return shutdown_event
+
+
+def _start(state):
+ with state.lock:
+ if state.stage is not _ServerStage.STOPPED:
+ raise ValueError('Cannot start already-started server!')
+ state.server.start()
+ state.stage = _ServerStage.STARTED
+ _request_call(state)
+
thread = threading.Thread(target=_serve, args=(state,))
thread.daemon = True
- thread.start()
-
-
+ thread.start()
+
+
def _validate_generic_rpc_handlers(generic_rpc_handlers):
for generic_rpc_handler in generic_rpc_handlers:
service_attribute = getattr(generic_rpc_handler, 'service', None)
@@ -934,7 +934,7 @@ def _validate_generic_rpc_handlers(generic_rpc_handlers):
raise AttributeError(
'"{}" must conform to grpc.GenericRpcHandler type but does '
'not have "service" method!'.format(generic_rpc_handler))
-
+
def _augment_options(base_options, compression):
compression_option = _compression.create_channel_option(compression)
@@ -946,30 +946,30 @@ class _Server(grpc.Server):
# pylint: disable=too-many-arguments
def __init__(self, thread_pool, generic_handlers, interceptors, options,
maximum_concurrent_rpcs, compression):
- completion_queue = cygrpc.CompletionQueue()
+ completion_queue = cygrpc.CompletionQueue()
server = cygrpc.Server(_augment_options(options, compression))
- server.register_completion_queue(completion_queue)
- self._state = _ServerState(completion_queue, server, generic_handlers,
+ server.register_completion_queue(completion_queue)
+ self._state = _ServerState(completion_queue, server, generic_handlers,
_interceptor.service_pipeline(interceptors),
thread_pool, maximum_concurrent_rpcs)
-
- def add_generic_rpc_handlers(self, generic_rpc_handlers):
+
+ def add_generic_rpc_handlers(self, generic_rpc_handlers):
_validate_generic_rpc_handlers(generic_rpc_handlers)
- _add_generic_handlers(self._state, generic_rpc_handlers)
-
- def add_insecure_port(self, address):
+ _add_generic_handlers(self._state, generic_rpc_handlers)
+
+ def add_insecure_port(self, address):
return _common.validate_port_binding_result(
address, _add_insecure_port(self._state, _common.encode(address)))
-
- def add_secure_port(self, address, server_credentials):
+
+ def add_secure_port(self, address, server_credentials):
return _common.validate_port_binding_result(
address,
_add_secure_port(self._state, _common.encode(address),
server_credentials))
-
- def start(self):
- _start(self._state)
-
+
+ def start(self):
+ _start(self._state)
+
def wait_for_termination(self, timeout=None):
# NOTE(https://bugs.python.org/issue35935)
# Remove this workaround once threading.Event.wait() is working with
@@ -978,10 +978,10 @@ class _Server(grpc.Server):
self._state.termination_event.is_set,
timeout=timeout)
- def stop(self, grace):
- return _stop(self._state, grace)
-
- def __del__(self):
+ def stop(self, grace):
+ return _stop(self._state, grace)
+
+ def __del__(self):
if hasattr(self, '_state'):
# We can not grab a lock in __del__(), so set a flag to signal the
# serving daemon thread (if it exists) to initiate shutdown.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/_utilities.py b/contrib/libs/grpc/src/python/grpcio/grpc/_utilities.py
index 70ce2a3dd6..c48aaf60a2 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/_utilities.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/_utilities.py
@@ -1,36 +1,36 @@
# 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.
-"""Internal utilities for gRPC Python."""
-
-import collections
-import threading
-import time
+"""Internal utilities for gRPC Python."""
+
+import collections
+import threading
+import time
import logging
-
-import six
-
-import grpc
-from grpc import _common
-
+
+import six
+
+import grpc
+from grpc import _common
+
_LOGGER = logging.getLogger(__name__)
-_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE = (
- 'Exception calling connectivity future "done" callback!')
-
-
-class RpcMethodHandler(
- collections.namedtuple('_RpcMethodHandler', (
+_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE = (
+ 'Exception calling connectivity future "done" callback!')
+
+
+class RpcMethodHandler(
+ collections.namedtuple('_RpcMethodHandler', (
'request_streaming',
'response_streaming',
'request_deserializer',
@@ -40,130 +40,130 @@ class RpcMethodHandler(
'stream_unary',
'stream_stream',
)), grpc.RpcMethodHandler):
- pass
-
-
-class DictionaryGenericHandler(grpc.ServiceRpcHandler):
-
- def __init__(self, service, method_handlers):
- self._name = service
- self._method_handlers = {
- _common.fully_qualified_method(service, method): method_handler
- for method, method_handler in six.iteritems(method_handlers)
- }
-
- def service_name(self):
- return self._name
-
- def service(self, handler_call_details):
- return self._method_handlers.get(handler_call_details.method)
-
-
-class _ChannelReadyFuture(grpc.Future):
-
- def __init__(self, channel):
- self._condition = threading.Condition()
- self._channel = channel
-
- self._matured = False
- self._cancelled = False
- self._done_callbacks = []
-
- def _block(self, timeout):
- until = None if timeout is None else time.time() + timeout
- with self._condition:
- while True:
- if self._cancelled:
- raise grpc.FutureCancelledError()
- elif self._matured:
- return
- else:
- if until is None:
- self._condition.wait()
- else:
- remaining = until - time.time()
- if remaining < 0:
- raise grpc.FutureTimeoutError()
- else:
- self._condition.wait(timeout=remaining)
-
- def _update(self, connectivity):
- with self._condition:
- if (not self._cancelled and
- connectivity is grpc.ChannelConnectivity.READY):
- self._matured = True
- self._channel.unsubscribe(self._update)
- self._condition.notify_all()
- done_callbacks = tuple(self._done_callbacks)
- self._done_callbacks = None
- else:
- return
-
- for done_callback in done_callbacks:
+ pass
+
+
+class DictionaryGenericHandler(grpc.ServiceRpcHandler):
+
+ def __init__(self, service, method_handlers):
+ self._name = service
+ self._method_handlers = {
+ _common.fully_qualified_method(service, method): method_handler
+ for method, method_handler in six.iteritems(method_handlers)
+ }
+
+ def service_name(self):
+ return self._name
+
+ def service(self, handler_call_details):
+ return self._method_handlers.get(handler_call_details.method)
+
+
+class _ChannelReadyFuture(grpc.Future):
+
+ def __init__(self, channel):
+ self._condition = threading.Condition()
+ self._channel = channel
+
+ self._matured = False
+ self._cancelled = False
+ self._done_callbacks = []
+
+ def _block(self, timeout):
+ until = None if timeout is None else time.time() + timeout
+ with self._condition:
+ while True:
+ if self._cancelled:
+ raise grpc.FutureCancelledError()
+ elif self._matured:
+ return
+ else:
+ if until is None:
+ self._condition.wait()
+ else:
+ remaining = until - time.time()
+ if remaining < 0:
+ raise grpc.FutureTimeoutError()
+ else:
+ self._condition.wait(timeout=remaining)
+
+ def _update(self, connectivity):
+ with self._condition:
+ if (not self._cancelled and
+ connectivity is grpc.ChannelConnectivity.READY):
+ self._matured = True
+ self._channel.unsubscribe(self._update)
+ self._condition.notify_all()
+ done_callbacks = tuple(self._done_callbacks)
+ self._done_callbacks = None
+ else:
+ return
+
+ for done_callback in done_callbacks:
try:
done_callback(self)
except Exception: # pylint: disable=broad-except
_LOGGER.exception(_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE)
-
- def cancel(self):
- with self._condition:
- if not self._matured:
- self._cancelled = True
- self._channel.unsubscribe(self._update)
- self._condition.notify_all()
- done_callbacks = tuple(self._done_callbacks)
- self._done_callbacks = None
- else:
- return False
-
- for done_callback in done_callbacks:
+
+ def cancel(self):
+ with self._condition:
+ if not self._matured:
+ self._cancelled = True
+ self._channel.unsubscribe(self._update)
+ self._condition.notify_all()
+ done_callbacks = tuple(self._done_callbacks)
+ self._done_callbacks = None
+ else:
+ return False
+
+ for done_callback in done_callbacks:
try:
done_callback(self)
except Exception: # pylint: disable=broad-except
_LOGGER.exception(_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE)
-
+
return True
- def cancelled(self):
- with self._condition:
- return self._cancelled
-
- def running(self):
- with self._condition:
- return not self._cancelled and not self._matured
-
- def done(self):
- with self._condition:
- return self._cancelled or self._matured
-
- def result(self, timeout=None):
- self._block(timeout)
-
- def exception(self, timeout=None):
- self._block(timeout)
-
- def traceback(self, timeout=None):
- self._block(timeout)
-
- def add_done_callback(self, fn):
- with self._condition:
- if not self._cancelled and not self._matured:
- self._done_callbacks.append(fn)
- return
-
- fn(self)
-
- def start(self):
- with self._condition:
- self._channel.subscribe(self._update, try_to_connect=True)
-
- def __del__(self):
- with self._condition:
- if not self._cancelled and not self._matured:
- self._channel.unsubscribe(self._update)
-
-
-def channel_ready_future(channel):
- ready_future = _ChannelReadyFuture(channel)
- ready_future.start()
- return ready_future
+ def cancelled(self):
+ with self._condition:
+ return self._cancelled
+
+ def running(self):
+ with self._condition:
+ return not self._cancelled and not self._matured
+
+ def done(self):
+ with self._condition:
+ return self._cancelled or self._matured
+
+ def result(self, timeout=None):
+ self._block(timeout)
+
+ def exception(self, timeout=None):
+ self._block(timeout)
+
+ def traceback(self, timeout=None):
+ self._block(timeout)
+
+ def add_done_callback(self, fn):
+ with self._condition:
+ if not self._cancelled and not self._matured:
+ self._done_callbacks.append(fn)
+ return
+
+ fn(self)
+
+ def start(self):
+ with self._condition:
+ self._channel.subscribe(self._update, try_to_connect=True)
+
+ def __del__(self):
+ with self._condition:
+ if not self._cancelled and not self._matured:
+ self._channel.unsubscribe(self._update)
+
+
+def channel_ready_future(channel):
+ ready_future = _ChannelReadyFuture(channel)
+ ready_future.start()
+ return ready_future
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/_client_adaptations.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/_client_adaptations.py
index a0b7465a57..652ae0ea17 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/_client_adaptations.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/_client_adaptations.py
@@ -1,29 +1,29 @@
# Copyright 2016 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.
-"""Translates gRPC's client-side API into gRPC's client-side Beta API."""
-
-import grpc
-from grpc import _common
+"""Translates gRPC's client-side API into gRPC's client-side Beta API."""
+
+import grpc
+from grpc import _common
from grpc.beta import _metadata
-from grpc.beta import interfaces
-from grpc.framework.common import cardinality
-from grpc.framework.foundation import future
-from grpc.framework.interfaces.face import face
-
+from grpc.beta import interfaces
+from grpc.framework.common import cardinality
+from grpc.framework.foundation import future
+from grpc.framework.interfaces.face import face
+
# pylint: disable=too-many-arguments,too-many-locals,unused-argument
-_STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = {
+_STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = {
grpc.StatusCode.CANCELLED:
(face.Abortion.Kind.CANCELLED, face.CancellationError),
grpc.StatusCode.UNKNOWN:
@@ -32,418 +32,418 @@ _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = {
(face.Abortion.Kind.EXPIRED, face.ExpirationError),
grpc.StatusCode.UNIMPLEMENTED:
(face.Abortion.Kind.LOCAL_FAILURE, face.LocalError),
-}
-
-
-def _effective_metadata(metadata, metadata_transformer):
- non_none_metadata = () if metadata is None else metadata
- if metadata_transformer is None:
- return non_none_metadata
- else:
- return metadata_transformer(non_none_metadata)
-
-
-def _credentials(grpc_call_options):
- return None if grpc_call_options is None else grpc_call_options.credentials
-
-
-def _abortion(rpc_error_call):
- code = rpc_error_call.code()
- pair = _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS.get(code)
- error_kind = face.Abortion.Kind.LOCAL_FAILURE if pair is None else pair[0]
+}
+
+
+def _effective_metadata(metadata, metadata_transformer):
+ non_none_metadata = () if metadata is None else metadata
+ if metadata_transformer is None:
+ return non_none_metadata
+ else:
+ return metadata_transformer(non_none_metadata)
+
+
+def _credentials(grpc_call_options):
+ return None if grpc_call_options is None else grpc_call_options.credentials
+
+
+def _abortion(rpc_error_call):
+ code = rpc_error_call.code()
+ pair = _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS.get(code)
+ error_kind = face.Abortion.Kind.LOCAL_FAILURE if pair is None else pair[0]
return face.Abortion(error_kind, rpc_error_call.initial_metadata(),
- rpc_error_call.trailing_metadata(), code,
- rpc_error_call.details())
-
-
-def _abortion_error(rpc_error_call):
- code = rpc_error_call.code()
- pair = _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS.get(code)
- exception_class = face.AbortionError if pair is None else pair[1]
- return exception_class(rpc_error_call.initial_metadata(),
- rpc_error_call.trailing_metadata(), code,
- rpc_error_call.details())
-
-
-class _InvocationProtocolContext(interfaces.GRPCInvocationContext):
-
- def disable_next_request_compression(self):
- pass # TODO(https://github.com/grpc/grpc/issues/4078): design, implement.
-
-
-class _Rendezvous(future.Future, face.Call):
-
- def __init__(self, response_future, response_iterator, call):
- self._future = response_future
- self._iterator = response_iterator
- self._call = call
-
- def cancel(self):
- return self._call.cancel()
-
- def cancelled(self):
- return self._future.cancelled()
-
- def running(self):
- return self._future.running()
-
- def done(self):
- return self._future.done()
-
- def result(self, timeout=None):
- try:
- return self._future.result(timeout=timeout)
- except grpc.RpcError as rpc_error_call:
- raise _abortion_error(rpc_error_call)
- except grpc.FutureTimeoutError:
- raise future.TimeoutError()
- except grpc.FutureCancelledError:
- raise future.CancelledError()
-
- def exception(self, timeout=None):
- try:
- rpc_error_call = self._future.exception(timeout=timeout)
- if rpc_error_call is None:
- return None
- else:
- return _abortion_error(rpc_error_call)
- except grpc.FutureTimeoutError:
- raise future.TimeoutError()
- except grpc.FutureCancelledError:
- raise future.CancelledError()
-
- def traceback(self, timeout=None):
- try:
- return self._future.traceback(timeout=timeout)
- except grpc.FutureTimeoutError:
- raise future.TimeoutError()
- except grpc.FutureCancelledError:
- raise future.CancelledError()
-
- def add_done_callback(self, fn):
- self._future.add_done_callback(lambda ignored_callback: fn(self))
-
- def __iter__(self):
- return self
-
- def _next(self):
- try:
- return next(self._iterator)
- except grpc.RpcError as rpc_error_call:
- raise _abortion_error(rpc_error_call)
-
- def __next__(self):
- return self._next()
-
- def next(self):
- return self._next()
-
- def is_active(self):
- return self._call.is_active()
-
- def time_remaining(self):
- return self._call.time_remaining()
-
- def add_abortion_callback(self, abortion_callback):
-
- def done_callback():
- if self.code() is not grpc.StatusCode.OK:
- abortion_callback(_abortion(self._call))
-
- registered = self._call.add_callback(done_callback)
- return None if registered else done_callback()
-
- def protocol_context(self):
- return _InvocationProtocolContext()
-
- def initial_metadata(self):
+ rpc_error_call.trailing_metadata(), code,
+ rpc_error_call.details())
+
+
+def _abortion_error(rpc_error_call):
+ code = rpc_error_call.code()
+ pair = _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS.get(code)
+ exception_class = face.AbortionError if pair is None else pair[1]
+ return exception_class(rpc_error_call.initial_metadata(),
+ rpc_error_call.trailing_metadata(), code,
+ rpc_error_call.details())
+
+
+class _InvocationProtocolContext(interfaces.GRPCInvocationContext):
+
+ def disable_next_request_compression(self):
+ pass # TODO(https://github.com/grpc/grpc/issues/4078): design, implement.
+
+
+class _Rendezvous(future.Future, face.Call):
+
+ def __init__(self, response_future, response_iterator, call):
+ self._future = response_future
+ self._iterator = response_iterator
+ self._call = call
+
+ def cancel(self):
+ return self._call.cancel()
+
+ def cancelled(self):
+ return self._future.cancelled()
+
+ def running(self):
+ return self._future.running()
+
+ def done(self):
+ return self._future.done()
+
+ def result(self, timeout=None):
+ try:
+ return self._future.result(timeout=timeout)
+ except grpc.RpcError as rpc_error_call:
+ raise _abortion_error(rpc_error_call)
+ except grpc.FutureTimeoutError:
+ raise future.TimeoutError()
+ except grpc.FutureCancelledError:
+ raise future.CancelledError()
+
+ def exception(self, timeout=None):
+ try:
+ rpc_error_call = self._future.exception(timeout=timeout)
+ if rpc_error_call is None:
+ return None
+ else:
+ return _abortion_error(rpc_error_call)
+ except grpc.FutureTimeoutError:
+ raise future.TimeoutError()
+ except grpc.FutureCancelledError:
+ raise future.CancelledError()
+
+ def traceback(self, timeout=None):
+ try:
+ return self._future.traceback(timeout=timeout)
+ except grpc.FutureTimeoutError:
+ raise future.TimeoutError()
+ except grpc.FutureCancelledError:
+ raise future.CancelledError()
+
+ def add_done_callback(self, fn):
+ self._future.add_done_callback(lambda ignored_callback: fn(self))
+
+ def __iter__(self):
+ return self
+
+ def _next(self):
+ try:
+ return next(self._iterator)
+ except grpc.RpcError as rpc_error_call:
+ raise _abortion_error(rpc_error_call)
+
+ def __next__(self):
+ return self._next()
+
+ def next(self):
+ return self._next()
+
+ def is_active(self):
+ return self._call.is_active()
+
+ def time_remaining(self):
+ return self._call.time_remaining()
+
+ def add_abortion_callback(self, abortion_callback):
+
+ def done_callback():
+ if self.code() is not grpc.StatusCode.OK:
+ abortion_callback(_abortion(self._call))
+
+ registered = self._call.add_callback(done_callback)
+ return None if registered else done_callback()
+
+ def protocol_context(self):
+ return _InvocationProtocolContext()
+
+ def initial_metadata(self):
return _metadata.beta(self._call.initial_metadata())
-
- def terminal_metadata(self):
+
+ def terminal_metadata(self):
return _metadata.beta(self._call.terminal_metadata())
-
- def code(self):
- return self._call.code()
-
- def details(self):
- return self._call.details()
-
-
-def _blocking_unary_unary(channel, group, method, timeout, with_call,
- protocol_options, metadata, metadata_transformer,
- request, request_serializer, response_deserializer):
- try:
- multi_callable = channel.unary_unary(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- if with_call:
- response, call = multi_callable.with_call(
- request,
- timeout=timeout,
+
+ def code(self):
+ return self._call.code()
+
+ def details(self):
+ return self._call.details()
+
+
+def _blocking_unary_unary(channel, group, method, timeout, with_call,
+ protocol_options, metadata, metadata_transformer,
+ request, request_serializer, response_deserializer):
+ try:
+ multi_callable = channel.unary_unary(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ if with_call:
+ response, call = multi_callable.with_call(
+ request,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return response, _Rendezvous(None, None, call)
- else:
+ credentials=_credentials(protocol_options))
+ return response, _Rendezvous(None, None, call)
+ else:
return multi_callable(request,
timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
credentials=_credentials(protocol_options))
- except grpc.RpcError as rpc_error_call:
- raise _abortion_error(rpc_error_call)
-
-
-def _future_unary_unary(channel, group, method, timeout, protocol_options,
- metadata, metadata_transformer, request,
- request_serializer, response_deserializer):
- multi_callable = channel.unary_unary(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- response_future = multi_callable.future(
- request,
- timeout=timeout,
+ except grpc.RpcError as rpc_error_call:
+ raise _abortion_error(rpc_error_call)
+
+
+def _future_unary_unary(channel, group, method, timeout, protocol_options,
+ metadata, metadata_transformer, request,
+ request_serializer, response_deserializer):
+ multi_callable = channel.unary_unary(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ response_future = multi_callable.future(
+ request,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return _Rendezvous(response_future, None, response_future)
-
-
-def _unary_stream(channel, group, method, timeout, protocol_options, metadata,
- metadata_transformer, request, request_serializer,
- response_deserializer):
- multi_callable = channel.unary_stream(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- response_iterator = multi_callable(
- request,
- timeout=timeout,
+ credentials=_credentials(protocol_options))
+ return _Rendezvous(response_future, None, response_future)
+
+
+def _unary_stream(channel, group, method, timeout, protocol_options, metadata,
+ metadata_transformer, request, request_serializer,
+ response_deserializer):
+ multi_callable = channel.unary_stream(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ response_iterator = multi_callable(
+ request,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return _Rendezvous(None, response_iterator, response_iterator)
-
-
-def _blocking_stream_unary(channel, group, method, timeout, with_call,
- protocol_options, metadata, metadata_transformer,
- request_iterator, request_serializer,
- response_deserializer):
- try:
- multi_callable = channel.stream_unary(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- if with_call:
- response, call = multi_callable.with_call(
- request_iterator,
- timeout=timeout,
+ credentials=_credentials(protocol_options))
+ return _Rendezvous(None, response_iterator, response_iterator)
+
+
+def _blocking_stream_unary(channel, group, method, timeout, with_call,
+ protocol_options, metadata, metadata_transformer,
+ request_iterator, request_serializer,
+ response_deserializer):
+ try:
+ multi_callable = channel.stream_unary(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ if with_call:
+ response, call = multi_callable.with_call(
+ request_iterator,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return response, _Rendezvous(None, None, call)
- else:
+ credentials=_credentials(protocol_options))
+ return response, _Rendezvous(None, None, call)
+ else:
return multi_callable(request_iterator,
timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
credentials=_credentials(protocol_options))
- except grpc.RpcError as rpc_error_call:
- raise _abortion_error(rpc_error_call)
-
-
-def _future_stream_unary(channel, group, method, timeout, protocol_options,
- metadata, metadata_transformer, request_iterator,
- request_serializer, response_deserializer):
- multi_callable = channel.stream_unary(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- response_future = multi_callable.future(
- request_iterator,
- timeout=timeout,
+ except grpc.RpcError as rpc_error_call:
+ raise _abortion_error(rpc_error_call)
+
+
+def _future_stream_unary(channel, group, method, timeout, protocol_options,
+ metadata, metadata_transformer, request_iterator,
+ request_serializer, response_deserializer):
+ multi_callable = channel.stream_unary(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ response_future = multi_callable.future(
+ request_iterator,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return _Rendezvous(response_future, None, response_future)
-
-
-def _stream_stream(channel, group, method, timeout, protocol_options, metadata,
- metadata_transformer, request_iterator, request_serializer,
- response_deserializer):
- multi_callable = channel.stream_stream(
- _common.fully_qualified_method(group, method),
- request_serializer=request_serializer,
- response_deserializer=response_deserializer)
- effective_metadata = _effective_metadata(metadata, metadata_transformer)
- response_iterator = multi_callable(
- request_iterator,
- timeout=timeout,
+ credentials=_credentials(protocol_options))
+ return _Rendezvous(response_future, None, response_future)
+
+
+def _stream_stream(channel, group, method, timeout, protocol_options, metadata,
+ metadata_transformer, request_iterator, request_serializer,
+ response_deserializer):
+ multi_callable = channel.stream_stream(
+ _common.fully_qualified_method(group, method),
+ request_serializer=request_serializer,
+ response_deserializer=response_deserializer)
+ effective_metadata = _effective_metadata(metadata, metadata_transformer)
+ response_iterator = multi_callable(
+ request_iterator,
+ timeout=timeout,
metadata=_metadata.unbeta(effective_metadata),
- credentials=_credentials(protocol_options))
- return _Rendezvous(None, response_iterator, response_iterator)
-
-
-class _UnaryUnaryMultiCallable(face.UnaryUnaryMultiCallable):
-
- def __init__(self, channel, group, method, metadata_transformer,
- request_serializer, response_deserializer):
- self._channel = channel
- self._group = group
- self._method = method
- self._metadata_transformer = metadata_transformer
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
-
- def __call__(self,
- request,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
+ credentials=_credentials(protocol_options))
+ return _Rendezvous(None, response_iterator, response_iterator)
+
+
+class _UnaryUnaryMultiCallable(face.UnaryUnaryMultiCallable):
+
+ def __init__(self, channel, group, method, metadata_transformer,
+ request_serializer, response_deserializer):
+ self._channel = channel
+ self._group = group
+ self._method = method
+ self._metadata_transformer = metadata_transformer
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
+
+ def __call__(self,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
return _blocking_unary_unary(self._channel, self._group, self._method,
timeout, with_call, protocol_options,
metadata, self._metadata_transformer,
request, self._request_serializer,
self._response_deserializer)
-
- def future(self, request, timeout, metadata=None, protocol_options=None):
+
+ def future(self, request, timeout, metadata=None, protocol_options=None):
return _future_unary_unary(self._channel, self._group, self._method,
timeout, protocol_options, metadata,
self._metadata_transformer, request,
self._request_serializer,
self._response_deserializer)
-
- def event(self,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
-
-class _UnaryStreamMultiCallable(face.UnaryStreamMultiCallable):
-
- def __init__(self, channel, group, method, metadata_transformer,
- request_serializer, response_deserializer):
- self._channel = channel
- self._group = group
- self._method = method
- self._metadata_transformer = metadata_transformer
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
-
- def __call__(self, request, timeout, metadata=None, protocol_options=None):
+
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+
+class _UnaryStreamMultiCallable(face.UnaryStreamMultiCallable):
+
+ def __init__(self, channel, group, method, metadata_transformer,
+ request_serializer, response_deserializer):
+ self._channel = channel
+ self._group = group
+ self._method = method
+ self._metadata_transformer = metadata_transformer
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
+
+ def __call__(self, request, timeout, metadata=None, protocol_options=None):
return _unary_stream(self._channel, self._group, self._method, timeout,
protocol_options, metadata,
self._metadata_transformer, request,
self._request_serializer,
self._response_deserializer)
-
- def event(self,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
-
-class _StreamUnaryMultiCallable(face.StreamUnaryMultiCallable):
-
- def __init__(self, channel, group, method, metadata_transformer,
- request_serializer, response_deserializer):
- self._channel = channel
- self._group = group
- self._method = method
- self._metadata_transformer = metadata_transformer
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
-
- def __call__(self,
- request_iterator,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
+
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+
+class _StreamUnaryMultiCallable(face.StreamUnaryMultiCallable):
+
+ def __init__(self, channel, group, method, metadata_transformer,
+ request_serializer, response_deserializer):
+ self._channel = channel
+ self._group = group
+ self._method = method
+ self._metadata_transformer = metadata_transformer
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
+
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
return _blocking_stream_unary(self._channel, self._group, self._method,
timeout, with_call, protocol_options,
metadata, self._metadata_transformer,
request_iterator,
self._request_serializer,
self._response_deserializer)
-
- def future(self,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
+
+ def future(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
return _future_stream_unary(self._channel, self._group, self._method,
timeout, protocol_options, metadata,
self._metadata_transformer,
request_iterator, self._request_serializer,
self._response_deserializer)
-
- def event(self,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
-
-class _StreamStreamMultiCallable(face.StreamStreamMultiCallable):
-
- def __init__(self, channel, group, method, metadata_transformer,
- request_serializer, response_deserializer):
- self._channel = channel
- self._group = group
- self._method = method
- self._metadata_transformer = metadata_transformer
- self._request_serializer = request_serializer
- self._response_deserializer = response_deserializer
-
- def __call__(self,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
+
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+
+class _StreamStreamMultiCallable(face.StreamStreamMultiCallable):
+
+ def __init__(self, channel, group, method, metadata_transformer,
+ request_serializer, response_deserializer):
+ self._channel = channel
+ self._group = group
+ self._method = method
+ self._metadata_transformer = metadata_transformer
+ self._request_serializer = request_serializer
+ self._response_deserializer = response_deserializer
+
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
return _stream_stream(self._channel, self._group, self._method, timeout,
protocol_options, metadata,
self._metadata_transformer, request_iterator,
self._request_serializer,
self._response_deserializer)
-
- def event(self,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
-
-class _GenericStub(face.GenericStub):
-
- def __init__(self, channel, metadata_transformer, request_serializers,
- response_deserializers):
- self._channel = channel
- self._metadata_transformer = metadata_transformer
- self._request_serializers = request_serializers or {}
- self._response_deserializers = response_deserializers or {}
-
- def blocking_unary_unary(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- with_call=None,
- protocol_options=None):
+
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+
+class _GenericStub(face.GenericStub):
+
+ def __init__(self, channel, metadata_transformer, request_serializers,
+ response_deserializers):
+ self._channel = channel
+ self._metadata_transformer = metadata_transformer
+ self._request_serializers = request_serializers or {}
+ self._response_deserializers = response_deserializers or {}
+
+ def blocking_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ with_call=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -452,18 +452,18 @@ class _GenericStub(face.GenericStub):
group,
method,
))
- return _blocking_unary_unary(self._channel, group, method, timeout,
- with_call, protocol_options, metadata,
- self._metadata_transformer, request,
- request_serializer, response_deserializer)
-
- def future_unary_unary(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- protocol_options=None):
+ return _blocking_unary_unary(self._channel, group, method, timeout,
+ with_call, protocol_options, metadata,
+ self._metadata_transformer, request,
+ request_serializer, response_deserializer)
+
+ def future_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -472,18 +472,18 @@ class _GenericStub(face.GenericStub):
group,
method,
))
- return _future_unary_unary(self._channel, group, method, timeout,
- protocol_options, metadata,
- self._metadata_transformer, request,
- request_serializer, response_deserializer)
-
- def inline_unary_stream(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- protocol_options=None):
+ return _future_unary_unary(self._channel, group, method, timeout,
+ protocol_options, metadata,
+ self._metadata_transformer, request,
+ request_serializer, response_deserializer)
+
+ def inline_unary_stream(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -492,19 +492,19 @@ class _GenericStub(face.GenericStub):
group,
method,
))
- return _unary_stream(self._channel, group, method, timeout,
- protocol_options, metadata,
- self._metadata_transformer, request,
- request_serializer, response_deserializer)
-
- def blocking_stream_unary(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- with_call=None,
- protocol_options=None):
+ return _unary_stream(self._channel, group, method, timeout,
+ protocol_options, metadata,
+ self._metadata_transformer, request,
+ request_serializer, response_deserializer)
+
+ def blocking_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -518,14 +518,14 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_iterator, request_serializer,
response_deserializer)
-
- def future_stream_unary(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
+
+ def future_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -539,14 +539,14 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_iterator, request_serializer,
response_deserializer)
-
- def inline_stream_stream(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
+
+ def inline_stream_stream(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
request_serializer = self._request_serializers.get((
group,
method,
@@ -555,54 +555,54 @@ class _GenericStub(face.GenericStub):
group,
method,
))
- return _stream_stream(self._channel, group, method, timeout,
- protocol_options, metadata,
- self._metadata_transformer, request_iterator,
- request_serializer, response_deserializer)
-
- def event_unary_unary(self,
- group,
- method,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
- def event_unary_stream(self,
- group,
- method,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
- def event_stream_unary(self,
- group,
- method,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
- def event_stream_stream(self,
- group,
- method,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- raise NotImplementedError()
-
- def unary_unary(self, group, method):
+ return _stream_stream(self._channel, group, method, timeout,
+ protocol_options, metadata,
+ self._metadata_transformer, request_iterator,
+ request_serializer, response_deserializer)
+
+ def event_unary_unary(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+ def event_unary_stream(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+ def event_stream_unary(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+ def event_stream_stream(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ raise NotImplementedError()
+
+ def unary_unary(self, group, method):
request_serializer = self._request_serializers.get((
group,
method,
@@ -615,8 +615,8 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_serializer,
response_deserializer)
-
- def unary_stream(self, group, method):
+
+ def unary_stream(self, group, method):
request_serializer = self._request_serializers.get((
group,
method,
@@ -629,8 +629,8 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_serializer,
response_deserializer)
-
- def stream_unary(self, group, method):
+
+ def stream_unary(self, group, method):
request_serializer = self._request_serializers.get((
group,
method,
@@ -643,8 +643,8 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_serializer,
response_deserializer)
-
- def stream_stream(self, group, method):
+
+ def stream_stream(self, group, method):
request_serializer = self._request_serializers.get((
group,
method,
@@ -657,50 +657,50 @@ class _GenericStub(face.GenericStub):
self._metadata_transformer,
request_serializer,
response_deserializer)
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- return False
-
-
-class _DynamicStub(face.DynamicStub):
-
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ return False
+
+
+class _DynamicStub(face.DynamicStub):
+
def __init__(self, backing_generic_stub, group, cardinalities):
self._generic_stub = backing_generic_stub
- self._group = group
- self._cardinalities = cardinalities
-
- def __getattr__(self, attr):
- method_cardinality = self._cardinalities.get(attr)
- if method_cardinality is cardinality.Cardinality.UNARY_UNARY:
- return self._generic_stub.unary_unary(self._group, attr)
- elif method_cardinality is cardinality.Cardinality.UNARY_STREAM:
- return self._generic_stub.unary_stream(self._group, attr)
- elif method_cardinality is cardinality.Cardinality.STREAM_UNARY:
- return self._generic_stub.stream_unary(self._group, attr)
- elif method_cardinality is cardinality.Cardinality.STREAM_STREAM:
- return self._generic_stub.stream_stream(self._group, attr)
- else:
+ self._group = group
+ self._cardinalities = cardinalities
+
+ def __getattr__(self, attr):
+ method_cardinality = self._cardinalities.get(attr)
+ if method_cardinality is cardinality.Cardinality.UNARY_UNARY:
+ return self._generic_stub.unary_unary(self._group, attr)
+ elif method_cardinality is cardinality.Cardinality.UNARY_STREAM:
+ return self._generic_stub.unary_stream(self._group, attr)
+ elif method_cardinality is cardinality.Cardinality.STREAM_UNARY:
+ return self._generic_stub.stream_unary(self._group, attr)
+ elif method_cardinality is cardinality.Cardinality.STREAM_STREAM:
+ return self._generic_stub.stream_stream(self._group, attr)
+ else:
raise AttributeError('_DynamicStub object has no attribute "%s"!' %
attr)
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- return False
-
-
-def generic_stub(channel, host, metadata_transformer, request_serializers,
- response_deserializers):
- return _GenericStub(channel, metadata_transformer, request_serializers,
- response_deserializers)
-
-
-def dynamic_stub(channel, service, cardinalities, host, metadata_transformer,
- request_serializers, response_deserializers):
- return _DynamicStub(
- _GenericStub(channel, metadata_transformer, request_serializers,
- response_deserializers), service, cardinalities)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ return False
+
+
+def generic_stub(channel, host, metadata_transformer, request_serializers,
+ response_deserializers):
+ return _GenericStub(channel, metadata_transformer, request_serializers,
+ response_deserializers)
+
+
+def dynamic_stub(channel, service, cardinalities, host, metadata_transformer,
+ request_serializers, response_deserializers):
+ return _DynamicStub(
+ _GenericStub(channel, metadata_transformer, request_serializers,
+ response_deserializers), service, cardinalities)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/_server_adaptations.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/_server_adaptations.py
index 83f669a51f..8843a3c550 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/_server_adaptations.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/_server_adaptations.py
@@ -1,247 +1,247 @@
# Copyright 2016 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.
-"""Translates gRPC's server-side API into gRPC's server-side Beta API."""
-
-import collections
-import threading
-
-import grpc
-from grpc import _common
+"""Translates gRPC's server-side API into gRPC's server-side Beta API."""
+
+import collections
+import threading
+
+import grpc
+from grpc import _common
from grpc.beta import _metadata
-from grpc.beta import interfaces
-from grpc.framework.common import cardinality
-from grpc.framework.common import style
-from grpc.framework.foundation import abandonment
-from grpc.framework.foundation import logging_pool
-from grpc.framework.foundation import stream
-from grpc.framework.interfaces.face import face
-
+from grpc.beta import interfaces
+from grpc.framework.common import cardinality
+from grpc.framework.common import style
+from grpc.framework.foundation import abandonment
+from grpc.framework.foundation import logging_pool
+from grpc.framework.foundation import stream
+from grpc.framework.interfaces.face import face
+
# pylint: disable=too-many-return-statements
-_DEFAULT_POOL_SIZE = 8
-
-
-class _ServerProtocolContext(interfaces.GRPCServicerContext):
-
- def __init__(self, servicer_context):
- self._servicer_context = servicer_context
-
- def peer(self):
- return self._servicer_context.peer()
-
- def disable_next_response_compression(self):
- pass # TODO(https://github.com/grpc/grpc/issues/4078): design, implement.
-
-
-class _FaceServicerContext(face.ServicerContext):
-
- def __init__(self, servicer_context):
- self._servicer_context = servicer_context
-
- def is_active(self):
- return self._servicer_context.is_active()
-
- def time_remaining(self):
- return self._servicer_context.time_remaining()
-
- def add_abortion_callback(self, abortion_callback):
- raise NotImplementedError(
- 'add_abortion_callback no longer supported server-side!')
-
- def cancel(self):
- self._servicer_context.cancel()
-
- def protocol_context(self):
- return _ServerProtocolContext(self._servicer_context)
-
- def invocation_metadata(self):
+_DEFAULT_POOL_SIZE = 8
+
+
+class _ServerProtocolContext(interfaces.GRPCServicerContext):
+
+ def __init__(self, servicer_context):
+ self._servicer_context = servicer_context
+
+ def peer(self):
+ return self._servicer_context.peer()
+
+ def disable_next_response_compression(self):
+ pass # TODO(https://github.com/grpc/grpc/issues/4078): design, implement.
+
+
+class _FaceServicerContext(face.ServicerContext):
+
+ def __init__(self, servicer_context):
+ self._servicer_context = servicer_context
+
+ def is_active(self):
+ return self._servicer_context.is_active()
+
+ def time_remaining(self):
+ return self._servicer_context.time_remaining()
+
+ def add_abortion_callback(self, abortion_callback):
+ raise NotImplementedError(
+ 'add_abortion_callback no longer supported server-side!')
+
+ def cancel(self):
+ self._servicer_context.cancel()
+
+ def protocol_context(self):
+ return _ServerProtocolContext(self._servicer_context)
+
+ def invocation_metadata(self):
return _metadata.beta(self._servicer_context.invocation_metadata())
-
- def initial_metadata(self, initial_metadata):
+
+ def initial_metadata(self, initial_metadata):
self._servicer_context.send_initial_metadata(
_metadata.unbeta(initial_metadata))
-
- def terminal_metadata(self, terminal_metadata):
+
+ def terminal_metadata(self, terminal_metadata):
self._servicer_context.set_terminal_metadata(
_metadata.unbeta(terminal_metadata))
-
- def code(self, code):
- self._servicer_context.set_code(code)
-
- def details(self, details):
- self._servicer_context.set_details(details)
-
-
-def _adapt_unary_request_inline(unary_request_inline):
-
- def adaptation(request, servicer_context):
- return unary_request_inline(request,
- _FaceServicerContext(servicer_context))
-
- return adaptation
-
-
-def _adapt_stream_request_inline(stream_request_inline):
-
- def adaptation(request_iterator, servicer_context):
- return stream_request_inline(request_iterator,
- _FaceServicerContext(servicer_context))
-
- return adaptation
-
-
-class _Callback(stream.Consumer):
-
- def __init__(self):
- self._condition = threading.Condition()
- self._values = []
- self._terminated = False
- self._cancelled = False
-
- def consume(self, value):
- with self._condition:
- self._values.append(value)
- self._condition.notify_all()
-
- def terminate(self):
- with self._condition:
- self._terminated = True
- self._condition.notify_all()
-
- def consume_and_terminate(self, value):
- with self._condition:
- self._values.append(value)
- self._terminated = True
- self._condition.notify_all()
-
- def cancel(self):
- with self._condition:
- self._cancelled = True
- self._condition.notify_all()
-
- def draw_one_value(self):
- with self._condition:
- while True:
- if self._cancelled:
- raise abandonment.Abandoned()
- elif self._values:
- return self._values.pop(0)
- elif self._terminated:
- return None
- else:
- self._condition.wait()
-
- def draw_all_values(self):
- with self._condition:
- while True:
- if self._cancelled:
- raise abandonment.Abandoned()
- elif self._terminated:
- all_values = tuple(self._values)
- self._values = None
- return all_values
- else:
- self._condition.wait()
-
-
-def _run_request_pipe_thread(request_iterator, request_consumer,
- servicer_context):
- thread_joined = threading.Event()
-
- def pipe_requests():
- for request in request_iterator:
- if not servicer_context.is_active() or thread_joined.is_set():
- return
- request_consumer.consume(request)
- if not servicer_context.is_active() or thread_joined.is_set():
- return
- request_consumer.terminate()
-
+
+ def code(self, code):
+ self._servicer_context.set_code(code)
+
+ def details(self, details):
+ self._servicer_context.set_details(details)
+
+
+def _adapt_unary_request_inline(unary_request_inline):
+
+ def adaptation(request, servicer_context):
+ return unary_request_inline(request,
+ _FaceServicerContext(servicer_context))
+
+ return adaptation
+
+
+def _adapt_stream_request_inline(stream_request_inline):
+
+ def adaptation(request_iterator, servicer_context):
+ return stream_request_inline(request_iterator,
+ _FaceServicerContext(servicer_context))
+
+ return adaptation
+
+
+class _Callback(stream.Consumer):
+
+ def __init__(self):
+ self._condition = threading.Condition()
+ self._values = []
+ self._terminated = False
+ self._cancelled = False
+
+ def consume(self, value):
+ with self._condition:
+ self._values.append(value)
+ self._condition.notify_all()
+
+ def terminate(self):
+ with self._condition:
+ self._terminated = True
+ self._condition.notify_all()
+
+ def consume_and_terminate(self, value):
+ with self._condition:
+ self._values.append(value)
+ self._terminated = True
+ self._condition.notify_all()
+
+ def cancel(self):
+ with self._condition:
+ self._cancelled = True
+ self._condition.notify_all()
+
+ def draw_one_value(self):
+ with self._condition:
+ while True:
+ if self._cancelled:
+ raise abandonment.Abandoned()
+ elif self._values:
+ return self._values.pop(0)
+ elif self._terminated:
+ return None
+ else:
+ self._condition.wait()
+
+ def draw_all_values(self):
+ with self._condition:
+ while True:
+ if self._cancelled:
+ raise abandonment.Abandoned()
+ elif self._terminated:
+ all_values = tuple(self._values)
+ self._values = None
+ return all_values
+ else:
+ self._condition.wait()
+
+
+def _run_request_pipe_thread(request_iterator, request_consumer,
+ servicer_context):
+ thread_joined = threading.Event()
+
+ def pipe_requests():
+ for request in request_iterator:
+ if not servicer_context.is_active() or thread_joined.is_set():
+ return
+ request_consumer.consume(request)
+ if not servicer_context.is_active() or thread_joined.is_set():
+ return
+ request_consumer.terminate()
+
request_pipe_thread = threading.Thread(target=pipe_requests)
request_pipe_thread.daemon = True
- request_pipe_thread.start()
-
-
-def _adapt_unary_unary_event(unary_unary_event):
-
- def adaptation(request, servicer_context):
- callback = _Callback()
- if not servicer_context.add_callback(callback.cancel):
- raise abandonment.Abandoned()
- unary_unary_event(request, callback.consume_and_terminate,
- _FaceServicerContext(servicer_context))
- return callback.draw_all_values()[0]
-
- return adaptation
-
-
-def _adapt_unary_stream_event(unary_stream_event):
-
- def adaptation(request, servicer_context):
- callback = _Callback()
- if not servicer_context.add_callback(callback.cancel):
- raise abandonment.Abandoned()
- unary_stream_event(request, callback,
- _FaceServicerContext(servicer_context))
- while True:
- response = callback.draw_one_value()
- if response is None:
- return
- else:
- yield response
-
- return adaptation
-
-
-def _adapt_stream_unary_event(stream_unary_event):
-
- def adaptation(request_iterator, servicer_context):
- callback = _Callback()
- if not servicer_context.add_callback(callback.cancel):
- raise abandonment.Abandoned()
- request_consumer = stream_unary_event(
- callback.consume_and_terminate,
- _FaceServicerContext(servicer_context))
- _run_request_pipe_thread(request_iterator, request_consumer,
- servicer_context)
- return callback.draw_all_values()[0]
-
- return adaptation
-
-
-def _adapt_stream_stream_event(stream_stream_event):
-
- def adaptation(request_iterator, servicer_context):
- callback = _Callback()
- if not servicer_context.add_callback(callback.cancel):
- raise abandonment.Abandoned()
- request_consumer = stream_stream_event(
- callback, _FaceServicerContext(servicer_context))
- _run_request_pipe_thread(request_iterator, request_consumer,
- servicer_context)
- while True:
- response = callback.draw_one_value()
- if response is None:
- return
- else:
- yield response
-
- return adaptation
-
-
-class _SimpleMethodHandler(
- collections.namedtuple('_MethodHandler', (
+ request_pipe_thread.start()
+
+
+def _adapt_unary_unary_event(unary_unary_event):
+
+ def adaptation(request, servicer_context):
+ callback = _Callback()
+ if not servicer_context.add_callback(callback.cancel):
+ raise abandonment.Abandoned()
+ unary_unary_event(request, callback.consume_and_terminate,
+ _FaceServicerContext(servicer_context))
+ return callback.draw_all_values()[0]
+
+ return adaptation
+
+
+def _adapt_unary_stream_event(unary_stream_event):
+
+ def adaptation(request, servicer_context):
+ callback = _Callback()
+ if not servicer_context.add_callback(callback.cancel):
+ raise abandonment.Abandoned()
+ unary_stream_event(request, callback,
+ _FaceServicerContext(servicer_context))
+ while True:
+ response = callback.draw_one_value()
+ if response is None:
+ return
+ else:
+ yield response
+
+ return adaptation
+
+
+def _adapt_stream_unary_event(stream_unary_event):
+
+ def adaptation(request_iterator, servicer_context):
+ callback = _Callback()
+ if not servicer_context.add_callback(callback.cancel):
+ raise abandonment.Abandoned()
+ request_consumer = stream_unary_event(
+ callback.consume_and_terminate,
+ _FaceServicerContext(servicer_context))
+ _run_request_pipe_thread(request_iterator, request_consumer,
+ servicer_context)
+ return callback.draw_all_values()[0]
+
+ return adaptation
+
+
+def _adapt_stream_stream_event(stream_stream_event):
+
+ def adaptation(request_iterator, servicer_context):
+ callback = _Callback()
+ if not servicer_context.add_callback(callback.cancel):
+ raise abandonment.Abandoned()
+ request_consumer = stream_stream_event(
+ callback, _FaceServicerContext(servicer_context))
+ _run_request_pipe_thread(request_iterator, request_consumer,
+ servicer_context)
+ while True:
+ response = callback.draw_one_value()
+ if response is None:
+ return
+ else:
+ yield response
+
+ return adaptation
+
+
+class _SimpleMethodHandler(
+ collections.namedtuple('_MethodHandler', (
'request_streaming',
'response_streaming',
'request_deserializer',
@@ -251,135 +251,135 @@ class _SimpleMethodHandler(
'stream_unary',
'stream_stream',
)), grpc.RpcMethodHandler):
- pass
-
-
-def _simple_method_handler(implementation, request_deserializer,
- response_serializer):
- if implementation.style is style.Service.INLINE:
- if implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
+ pass
+
+
+def _simple_method_handler(implementation, request_deserializer,
+ response_serializer):
+ if implementation.style is style.Service.INLINE:
+ if implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
return _SimpleMethodHandler(
False, False, request_deserializer, response_serializer,
_adapt_unary_request_inline(implementation.unary_unary_inline),
None, None, None)
- elif implementation.cardinality is cardinality.Cardinality.UNARY_STREAM:
+ elif implementation.cardinality is cardinality.Cardinality.UNARY_STREAM:
return _SimpleMethodHandler(
False, True, request_deserializer, response_serializer, None,
_adapt_unary_request_inline(implementation.unary_stream_inline),
None, None)
- elif implementation.cardinality is cardinality.Cardinality.STREAM_UNARY:
+ elif implementation.cardinality is cardinality.Cardinality.STREAM_UNARY:
return _SimpleMethodHandler(
True, False, request_deserializer, response_serializer, None,
None,
_adapt_stream_request_inline(
implementation.stream_unary_inline), None)
- elif implementation.cardinality is cardinality.Cardinality.STREAM_STREAM:
- return _SimpleMethodHandler(
- True, True, request_deserializer, response_serializer, None,
- None, None,
- _adapt_stream_request_inline(
- implementation.stream_stream_inline))
- elif implementation.style is style.Service.EVENT:
- if implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
+ elif implementation.cardinality is cardinality.Cardinality.STREAM_STREAM:
+ return _SimpleMethodHandler(
+ True, True, request_deserializer, response_serializer, None,
+ None, None,
+ _adapt_stream_request_inline(
+ implementation.stream_stream_inline))
+ elif implementation.style is style.Service.EVENT:
+ if implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
return _SimpleMethodHandler(
False, False, request_deserializer, response_serializer,
_adapt_unary_unary_event(implementation.unary_unary_event),
None, None, None)
- elif implementation.cardinality is cardinality.Cardinality.UNARY_STREAM:
+ elif implementation.cardinality is cardinality.Cardinality.UNARY_STREAM:
return _SimpleMethodHandler(
False, True, request_deserializer, response_serializer, None,
_adapt_unary_stream_event(implementation.unary_stream_event),
None, None)
- elif implementation.cardinality is cardinality.Cardinality.STREAM_UNARY:
+ elif implementation.cardinality is cardinality.Cardinality.STREAM_UNARY:
return _SimpleMethodHandler(
True, False, request_deserializer, response_serializer, None,
None,
_adapt_stream_unary_event(implementation.stream_unary_event),
None)
- elif implementation.cardinality is cardinality.Cardinality.STREAM_STREAM:
+ elif implementation.cardinality is cardinality.Cardinality.STREAM_STREAM:
return _SimpleMethodHandler(
True, True, request_deserializer, response_serializer, None,
None, None,
_adapt_stream_stream_event(implementation.stream_stream_event))
raise ValueError()
-
-
-def _flatten_method_pair_map(method_pair_map):
- method_pair_map = method_pair_map or {}
- flat_map = {}
- for method_pair in method_pair_map:
- method = _common.fully_qualified_method(method_pair[0], method_pair[1])
- flat_map[method] = method_pair_map[method_pair]
- return flat_map
-
-
-class _GenericRpcHandler(grpc.GenericRpcHandler):
-
- def __init__(self, method_implementations, multi_method_implementation,
- request_deserializers, response_serializers):
- self._method_implementations = _flatten_method_pair_map(
- method_implementations)
- self._request_deserializers = _flatten_method_pair_map(
- request_deserializers)
- self._response_serializers = _flatten_method_pair_map(
- response_serializers)
- self._multi_method_implementation = multi_method_implementation
-
- def service(self, handler_call_details):
- method_implementation = self._method_implementations.get(
- handler_call_details.method)
- if method_implementation is not None:
+
+
+def _flatten_method_pair_map(method_pair_map):
+ method_pair_map = method_pair_map or {}
+ flat_map = {}
+ for method_pair in method_pair_map:
+ method = _common.fully_qualified_method(method_pair[0], method_pair[1])
+ flat_map[method] = method_pair_map[method_pair]
+ return flat_map
+
+
+class _GenericRpcHandler(grpc.GenericRpcHandler):
+
+ def __init__(self, method_implementations, multi_method_implementation,
+ request_deserializers, response_serializers):
+ self._method_implementations = _flatten_method_pair_map(
+ method_implementations)
+ self._request_deserializers = _flatten_method_pair_map(
+ request_deserializers)
+ self._response_serializers = _flatten_method_pair_map(
+ response_serializers)
+ self._multi_method_implementation = multi_method_implementation
+
+ def service(self, handler_call_details):
+ method_implementation = self._method_implementations.get(
+ handler_call_details.method)
+ if method_implementation is not None:
return _simple_method_handler(
method_implementation,
self._request_deserializers.get(handler_call_details.method),
self._response_serializers.get(handler_call_details.method))
- elif self._multi_method_implementation is None:
- return None
- else:
- try:
- return None #TODO(nathaniel): call the multimethod.
- except face.NoSuchMethodError:
- return None
-
-
-class _Server(interfaces.Server):
-
+ elif self._multi_method_implementation is None:
+ return None
+ else:
+ try:
+ return None #TODO(nathaniel): call the multimethod.
+ except face.NoSuchMethodError:
+ return None
+
+
+class _Server(interfaces.Server):
+
def __init__(self, grpc_server):
self._grpc_server = grpc_server
-
- def add_insecure_port(self, address):
+
+ def add_insecure_port(self, address):
return self._grpc_server.add_insecure_port(address)
-
- def add_secure_port(self, address, server_credentials):
+
+ def add_secure_port(self, address, server_credentials):
return self._grpc_server.add_secure_port(address, server_credentials)
-
- def start(self):
+
+ def start(self):
self._grpc_server.start()
-
- def stop(self, grace):
+
+ def stop(self, grace):
return self._grpc_server.stop(grace)
-
- def __enter__(self):
+
+ def __enter__(self):
self._grpc_server.start()
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
self._grpc_server.stop(None)
- return False
-
-
-def server(service_implementations, multi_method_implementation,
- request_deserializers, response_serializers, thread_pool,
- thread_pool_size):
+ return False
+
+
+def server(service_implementations, multi_method_implementation,
+ request_deserializers, response_serializers, thread_pool,
+ thread_pool_size):
generic_rpc_handler = _GenericRpcHandler(service_implementations,
multi_method_implementation,
request_deserializers,
response_serializers)
- if thread_pool is None:
+ if thread_pool is None:
effective_thread_pool = logging_pool.pool(
_DEFAULT_POOL_SIZE if thread_pool_size is None else thread_pool_size
)
- else:
- effective_thread_pool = thread_pool
- return _Server(
- grpc.server(effective_thread_pool, handlers=(generic_rpc_handler,)))
+ else:
+ effective_thread_pool = thread_pool
+ return _Server(
+ grpc.server(effective_thread_pool, handlers=(generic_rpc_handler,)))
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/implementations.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/implementations.py
index bf3c03bf64..c5507b543f 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/implementations.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/implementations.py
@@ -1,39 +1,39 @@
# Copyright 2015-2016 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.
-"""Entry points into the Beta API of gRPC Python."""
-
-# threading is referenced from specification in this module.
-import threading # pylint: disable=unused-import
-
+"""Entry points into the Beta API of gRPC Python."""
+
+# threading is referenced from specification in this module.
+import threading # pylint: disable=unused-import
+
# interfaces, cardinality, and face are referenced from specification in this
# module.
-import grpc
-from grpc import _auth
-from grpc.beta import _client_adaptations
+import grpc
+from grpc import _auth
+from grpc.beta import _client_adaptations
from grpc.beta import _metadata
-from grpc.beta import _server_adaptations
+from grpc.beta import _server_adaptations
from grpc.beta import interfaces # pylint: disable=unused-import
-from grpc.framework.common import cardinality # pylint: disable=unused-import
-from grpc.framework.interfaces.face import face # pylint: disable=unused-import
-
+from grpc.framework.common import cardinality # pylint: disable=unused-import
+from grpc.framework.interfaces.face import face # pylint: disable=unused-import
+
# pylint: disable=too-many-arguments
-ChannelCredentials = grpc.ChannelCredentials
-ssl_channel_credentials = grpc.ssl_channel_credentials
-CallCredentials = grpc.CallCredentials
-
-
+ChannelCredentials = grpc.ChannelCredentials
+ssl_channel_credentials = grpc.ssl_channel_credentials
+CallCredentials = grpc.CallCredentials
+
+
def metadata_call_credentials(metadata_plugin, name=None):
def plugin(context, callback):
@@ -46,265 +46,265 @@ def metadata_call_credentials(metadata_plugin, name=None):
return grpc.metadata_call_credentials(plugin, name=name)
-def google_call_credentials(credentials):
- """Construct CallCredentials from GoogleCredentials.
-
- Args:
- credentials: A GoogleCredentials object from the oauth2client library.
-
- Returns:
- A CallCredentials object for use in a GRPCCallOptions object.
- """
- return metadata_call_credentials(_auth.GoogleCallCredentials(credentials))
-
-
-access_token_call_credentials = grpc.access_token_call_credentials
-composite_call_credentials = grpc.composite_call_credentials
-composite_channel_credentials = grpc.composite_channel_credentials
-
-
-class Channel(object):
- """A channel to a remote host through which RPCs may be conducted.
-
- Only the "subscribe" and "unsubscribe" methods are supported for application
- use. This class' instance constructor and all other attributes are
- unsupported.
- """
-
- def __init__(self, channel):
- self._channel = channel
-
- def subscribe(self, callback, try_to_connect=None):
- """Subscribes to this Channel's connectivity.
-
- Args:
- callback: A callable to be invoked and passed an
- interfaces.ChannelConnectivity identifying this Channel's connectivity.
- The callable will be invoked immediately upon subscription and again for
- every change to this Channel's connectivity thereafter until it is
- unsubscribed.
- try_to_connect: A boolean indicating whether or not this Channel should
- attempt to connect if it is not already connected and ready to conduct
- RPCs.
- """
- self._channel.subscribe(callback, try_to_connect=try_to_connect)
-
- def unsubscribe(self, callback):
- """Unsubscribes a callback from this Channel's connectivity.
-
- Args:
- callback: A callable previously registered with this Channel from having
- been passed to its "subscribe" method.
- """
- self._channel.unsubscribe(callback)
-
-
-def insecure_channel(host, port):
- """Creates an insecure Channel to a remote host.
-
- Args:
- host: The name of the remote host to which to connect.
- port: The port of the remote host to which to connect.
- If None only the 'host' part will be used.
-
- Returns:
- A Channel to the remote host through which RPCs may be conducted.
- """
+def google_call_credentials(credentials):
+ """Construct CallCredentials from GoogleCredentials.
+
+ Args:
+ credentials: A GoogleCredentials object from the oauth2client library.
+
+ Returns:
+ A CallCredentials object for use in a GRPCCallOptions object.
+ """
+ return metadata_call_credentials(_auth.GoogleCallCredentials(credentials))
+
+
+access_token_call_credentials = grpc.access_token_call_credentials
+composite_call_credentials = grpc.composite_call_credentials
+composite_channel_credentials = grpc.composite_channel_credentials
+
+
+class Channel(object):
+ """A channel to a remote host through which RPCs may be conducted.
+
+ Only the "subscribe" and "unsubscribe" methods are supported for application
+ use. This class' instance constructor and all other attributes are
+ unsupported.
+ """
+
+ def __init__(self, channel):
+ self._channel = channel
+
+ def subscribe(self, callback, try_to_connect=None):
+ """Subscribes to this Channel's connectivity.
+
+ Args:
+ callback: A callable to be invoked and passed an
+ interfaces.ChannelConnectivity identifying this Channel's connectivity.
+ The callable will be invoked immediately upon subscription and again for
+ every change to this Channel's connectivity thereafter until it is
+ unsubscribed.
+ try_to_connect: A boolean indicating whether or not this Channel should
+ attempt to connect if it is not already connected and ready to conduct
+ RPCs.
+ """
+ self._channel.subscribe(callback, try_to_connect=try_to_connect)
+
+ def unsubscribe(self, callback):
+ """Unsubscribes a callback from this Channel's connectivity.
+
+ Args:
+ callback: A callable previously registered with this Channel from having
+ been passed to its "subscribe" method.
+ """
+ self._channel.unsubscribe(callback)
+
+
+def insecure_channel(host, port):
+ """Creates an insecure Channel to a remote host.
+
+ Args:
+ host: The name of the remote host to which to connect.
+ port: The port of the remote host to which to connect.
+ If None only the 'host' part will be used.
+
+ Returns:
+ A Channel to the remote host through which RPCs may be conducted.
+ """
channel = grpc.insecure_channel(host if port is None else '%s:%d' %
(host, port))
- return Channel(channel)
-
-
-def secure_channel(host, port, channel_credentials):
- """Creates a secure Channel to a remote host.
-
- Args:
- host: The name of the remote host to which to connect.
- port: The port of the remote host to which to connect.
- If None only the 'host' part will be used.
- channel_credentials: A ChannelCredentials.
-
- Returns:
- A secure Channel to the remote host through which RPCs may be conducted.
- """
+ return Channel(channel)
+
+
+def secure_channel(host, port, channel_credentials):
+ """Creates a secure Channel to a remote host.
+
+ Args:
+ host: The name of the remote host to which to connect.
+ port: The port of the remote host to which to connect.
+ If None only the 'host' part will be used.
+ channel_credentials: A ChannelCredentials.
+
+ Returns:
+ A secure Channel to the remote host through which RPCs may be conducted.
+ """
channel = grpc.secure_channel(
host if port is None else '%s:%d' % (host, port), channel_credentials)
- return Channel(channel)
-
-
-class StubOptions(object):
- """A value encapsulating the various options for creation of a Stub.
-
- This class and its instances have no supported interface - it exists to define
- the type of its instances and its instances exist to be passed to other
- functions.
- """
-
- def __init__(self, host, request_serializers, response_deserializers,
- metadata_transformer, thread_pool, thread_pool_size):
- self.host = host
- self.request_serializers = request_serializers
- self.response_deserializers = response_deserializers
- self.metadata_transformer = metadata_transformer
- self.thread_pool = thread_pool
- self.thread_pool_size = thread_pool_size
-
-
-_EMPTY_STUB_OPTIONS = StubOptions(None, None, None, None, None, None)
-
-
-def stub_options(host=None,
- request_serializers=None,
- response_deserializers=None,
- metadata_transformer=None,
- thread_pool=None,
- thread_pool_size=None):
- """Creates a StubOptions value to be passed at stub creation.
-
- All parameters are optional and should always be passed by keyword.
-
- Args:
- host: A host string to set on RPC calls.
- request_serializers: A dictionary from service name-method name pair to
- request serialization behavior.
- response_deserializers: A dictionary from service name-method name pair to
- response deserialization behavior.
- metadata_transformer: A callable that given a metadata object produces
- another metadata object to be used in the underlying communication on the
- wire.
- thread_pool: A thread pool to use in stubs.
- thread_pool_size: The size of thread pool to create for use in stubs;
- ignored if thread_pool has been passed.
-
- Returns:
- A StubOptions value created from the passed parameters.
- """
- return StubOptions(host, request_serializers, response_deserializers,
- metadata_transformer, thread_pool, thread_pool_size)
-
-
-def generic_stub(channel, options=None):
- """Creates a face.GenericStub on which RPCs can be made.
-
- Args:
- channel: A Channel for use by the created stub.
- options: A StubOptions customizing the created stub.
-
- Returns:
- A face.GenericStub on which RPCs can be made.
- """
- effective_options = _EMPTY_STUB_OPTIONS if options is None else options
- return _client_adaptations.generic_stub(
- channel._channel, # pylint: disable=protected-access
- effective_options.host,
- effective_options.metadata_transformer,
- effective_options.request_serializers,
- effective_options.response_deserializers)
-
-
-def dynamic_stub(channel, service, cardinalities, options=None):
- """Creates a face.DynamicStub with which RPCs can be invoked.
-
- Args:
- channel: A Channel for the returned face.DynamicStub to use.
- service: The package-qualified full name of the service.
- cardinalities: A dictionary from RPC method name to cardinality.Cardinality
- value identifying the cardinality of the RPC method.
- options: An optional StubOptions value further customizing the functionality
- of the returned face.DynamicStub.
-
- Returns:
- A face.DynamicStub with which RPCs can be invoked.
- """
+ return Channel(channel)
+
+
+class StubOptions(object):
+ """A value encapsulating the various options for creation of a Stub.
+
+ This class and its instances have no supported interface - it exists to define
+ the type of its instances and its instances exist to be passed to other
+ functions.
+ """
+
+ def __init__(self, host, request_serializers, response_deserializers,
+ metadata_transformer, thread_pool, thread_pool_size):
+ self.host = host
+ self.request_serializers = request_serializers
+ self.response_deserializers = response_deserializers
+ self.metadata_transformer = metadata_transformer
+ self.thread_pool = thread_pool
+ self.thread_pool_size = thread_pool_size
+
+
+_EMPTY_STUB_OPTIONS = StubOptions(None, None, None, None, None, None)
+
+
+def stub_options(host=None,
+ request_serializers=None,
+ response_deserializers=None,
+ metadata_transformer=None,
+ thread_pool=None,
+ thread_pool_size=None):
+ """Creates a StubOptions value to be passed at stub creation.
+
+ All parameters are optional and should always be passed by keyword.
+
+ Args:
+ host: A host string to set on RPC calls.
+ request_serializers: A dictionary from service name-method name pair to
+ request serialization behavior.
+ response_deserializers: A dictionary from service name-method name pair to
+ response deserialization behavior.
+ metadata_transformer: A callable that given a metadata object produces
+ another metadata object to be used in the underlying communication on the
+ wire.
+ thread_pool: A thread pool to use in stubs.
+ thread_pool_size: The size of thread pool to create for use in stubs;
+ ignored if thread_pool has been passed.
+
+ Returns:
+ A StubOptions value created from the passed parameters.
+ """
+ return StubOptions(host, request_serializers, response_deserializers,
+ metadata_transformer, thread_pool, thread_pool_size)
+
+
+def generic_stub(channel, options=None):
+ """Creates a face.GenericStub on which RPCs can be made.
+
+ Args:
+ channel: A Channel for use by the created stub.
+ options: A StubOptions customizing the created stub.
+
+ Returns:
+ A face.GenericStub on which RPCs can be made.
+ """
+ effective_options = _EMPTY_STUB_OPTIONS if options is None else options
+ return _client_adaptations.generic_stub(
+ channel._channel, # pylint: disable=protected-access
+ effective_options.host,
+ effective_options.metadata_transformer,
+ effective_options.request_serializers,
+ effective_options.response_deserializers)
+
+
+def dynamic_stub(channel, service, cardinalities, options=None):
+ """Creates a face.DynamicStub with which RPCs can be invoked.
+
+ Args:
+ channel: A Channel for the returned face.DynamicStub to use.
+ service: The package-qualified full name of the service.
+ cardinalities: A dictionary from RPC method name to cardinality.Cardinality
+ value identifying the cardinality of the RPC method.
+ options: An optional StubOptions value further customizing the functionality
+ of the returned face.DynamicStub.
+
+ Returns:
+ A face.DynamicStub with which RPCs can be invoked.
+ """
effective_options = _EMPTY_STUB_OPTIONS if options is None else options
- return _client_adaptations.dynamic_stub(
- channel._channel, # pylint: disable=protected-access
- service,
- cardinalities,
- effective_options.host,
- effective_options.metadata_transformer,
- effective_options.request_serializers,
- effective_options.response_deserializers)
-
-
-ServerCredentials = grpc.ServerCredentials
-ssl_server_credentials = grpc.ssl_server_credentials
-
-
-class ServerOptions(object):
- """A value encapsulating the various options for creation of a Server.
-
- This class and its instances have no supported interface - it exists to define
- the type of its instances and its instances exist to be passed to other
- functions.
- """
-
- def __init__(self, multi_method_implementation, request_deserializers,
- response_serializers, thread_pool, thread_pool_size,
- default_timeout, maximum_timeout):
- self.multi_method_implementation = multi_method_implementation
- self.request_deserializers = request_deserializers
- self.response_serializers = response_serializers
- self.thread_pool = thread_pool
- self.thread_pool_size = thread_pool_size
- self.default_timeout = default_timeout
- self.maximum_timeout = maximum_timeout
-
-
-_EMPTY_SERVER_OPTIONS = ServerOptions(None, None, None, None, None, None, None)
-
-
-def server_options(multi_method_implementation=None,
- request_deserializers=None,
- response_serializers=None,
- thread_pool=None,
- thread_pool_size=None,
- default_timeout=None,
- maximum_timeout=None):
- """Creates a ServerOptions value to be passed at server creation.
-
- All parameters are optional and should always be passed by keyword.
-
- Args:
- multi_method_implementation: A face.MultiMethodImplementation to be called
- to service an RPC if the server has no specific method implementation for
- the name of the RPC for which service was requested.
- request_deserializers: A dictionary from service name-method name pair to
- request deserialization behavior.
- response_serializers: A dictionary from service name-method name pair to
- response serialization behavior.
- thread_pool: A thread pool to use in stubs.
- thread_pool_size: The size of thread pool to create for use in stubs;
- ignored if thread_pool has been passed.
- default_timeout: A duration in seconds to allow for RPC service when
- servicing RPCs that did not include a timeout value when invoked.
- maximum_timeout: A duration in seconds to allow for RPC service when
- servicing RPCs no matter what timeout value was passed when the RPC was
- invoked.
-
- Returns:
- A StubOptions value created from the passed parameters.
- """
- return ServerOptions(multi_method_implementation, request_deserializers,
- response_serializers, thread_pool, thread_pool_size,
- default_timeout, maximum_timeout)
-
-
-def server(service_implementations, options=None):
- """Creates an interfaces.Server with which RPCs can be serviced.
-
- Args:
- service_implementations: A dictionary from service name-method name pair to
- face.MethodImplementation.
- options: An optional ServerOptions value further customizing the
- functionality of the returned Server.
-
- Returns:
- An interfaces.Server with which RPCs can be serviced.
- """
- effective_options = _EMPTY_SERVER_OPTIONS if options is None else options
- return _server_adaptations.server(
- service_implementations, effective_options.multi_method_implementation,
- effective_options.request_deserializers,
- effective_options.response_serializers, effective_options.thread_pool,
- effective_options.thread_pool_size)
+ return _client_adaptations.dynamic_stub(
+ channel._channel, # pylint: disable=protected-access
+ service,
+ cardinalities,
+ effective_options.host,
+ effective_options.metadata_transformer,
+ effective_options.request_serializers,
+ effective_options.response_deserializers)
+
+
+ServerCredentials = grpc.ServerCredentials
+ssl_server_credentials = grpc.ssl_server_credentials
+
+
+class ServerOptions(object):
+ """A value encapsulating the various options for creation of a Server.
+
+ This class and its instances have no supported interface - it exists to define
+ the type of its instances and its instances exist to be passed to other
+ functions.
+ """
+
+ def __init__(self, multi_method_implementation, request_deserializers,
+ response_serializers, thread_pool, thread_pool_size,
+ default_timeout, maximum_timeout):
+ self.multi_method_implementation = multi_method_implementation
+ self.request_deserializers = request_deserializers
+ self.response_serializers = response_serializers
+ self.thread_pool = thread_pool
+ self.thread_pool_size = thread_pool_size
+ self.default_timeout = default_timeout
+ self.maximum_timeout = maximum_timeout
+
+
+_EMPTY_SERVER_OPTIONS = ServerOptions(None, None, None, None, None, None, None)
+
+
+def server_options(multi_method_implementation=None,
+ request_deserializers=None,
+ response_serializers=None,
+ thread_pool=None,
+ thread_pool_size=None,
+ default_timeout=None,
+ maximum_timeout=None):
+ """Creates a ServerOptions value to be passed at server creation.
+
+ All parameters are optional and should always be passed by keyword.
+
+ Args:
+ multi_method_implementation: A face.MultiMethodImplementation to be called
+ to service an RPC if the server has no specific method implementation for
+ the name of the RPC for which service was requested.
+ request_deserializers: A dictionary from service name-method name pair to
+ request deserialization behavior.
+ response_serializers: A dictionary from service name-method name pair to
+ response serialization behavior.
+ thread_pool: A thread pool to use in stubs.
+ thread_pool_size: The size of thread pool to create for use in stubs;
+ ignored if thread_pool has been passed.
+ default_timeout: A duration in seconds to allow for RPC service when
+ servicing RPCs that did not include a timeout value when invoked.
+ maximum_timeout: A duration in seconds to allow for RPC service when
+ servicing RPCs no matter what timeout value was passed when the RPC was
+ invoked.
+
+ Returns:
+ A StubOptions value created from the passed parameters.
+ """
+ return ServerOptions(multi_method_implementation, request_deserializers,
+ response_serializers, thread_pool, thread_pool_size,
+ default_timeout, maximum_timeout)
+
+
+def server(service_implementations, options=None):
+ """Creates an interfaces.Server with which RPCs can be serviced.
+
+ Args:
+ service_implementations: A dictionary from service name-method name pair to
+ face.MethodImplementation.
+ options: An optional ServerOptions value further customizing the
+ functionality of the returned Server.
+
+ Returns:
+ An interfaces.Server with which RPCs can be serviced.
+ """
+ effective_options = _EMPTY_SERVER_OPTIONS if options is None else options
+ return _server_adaptations.server(
+ service_implementations, effective_options.multi_method_implementation,
+ effective_options.request_deserializers,
+ effective_options.response_serializers, effective_options.thread_pool,
+ effective_options.thread_pool_size)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/interfaces.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/interfaces.py
index e27403de08..fb8266c74b 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/interfaces.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/interfaces.py
@@ -1,165 +1,165 @@
# 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.
-"""Constants and interfaces of the Beta API of gRPC Python."""
-
-import abc
-
-import six
-
-import grpc
-
-ChannelConnectivity = grpc.ChannelConnectivity
-# FATAL_FAILURE was a Beta-API name for SHUTDOWN
-ChannelConnectivity.FATAL_FAILURE = ChannelConnectivity.SHUTDOWN
-
-StatusCode = grpc.StatusCode
-
-
-class GRPCCallOptions(object):
- """A value encapsulating gRPC-specific options passed on RPC invocation.
-
- This class and its instances have no supported interface - it exists to
- define the type of its instances and its instances exist to be passed to
- other functions.
- """
-
- def __init__(self, disable_compression, subcall_of, credentials):
- self.disable_compression = disable_compression
- self.subcall_of = subcall_of
- self.credentials = credentials
-
-
-def grpc_call_options(disable_compression=False, credentials=None):
- """Creates a GRPCCallOptions value to be passed at RPC invocation.
-
- All parameters are optional and should always be passed by keyword.
-
- Args:
- disable_compression: A boolean indicating whether or not compression should
- be disabled for the request object of the RPC. Only valid for
- request-unary RPCs.
- credentials: A CallCredentials object to use for the invoked RPC.
- """
- return GRPCCallOptions(disable_compression, None, credentials)
-
-
-GRPCAuthMetadataContext = grpc.AuthMetadataContext
-GRPCAuthMetadataPluginCallback = grpc.AuthMetadataPluginCallback
-GRPCAuthMetadataPlugin = grpc.AuthMetadataPlugin
-
-
-class GRPCServicerContext(six.with_metaclass(abc.ABCMeta)):
- """Exposes gRPC-specific options and behaviors to code servicing RPCs."""
-
- @abc.abstractmethod
- def peer(self):
- """Identifies the peer that invoked the RPC being serviced.
-
- Returns:
- A string identifying the peer that invoked the RPC being serviced.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def disable_next_response_compression(self):
- """Disables compression of the next response passed by the application."""
- raise NotImplementedError()
-
-
-class GRPCInvocationContext(six.with_metaclass(abc.ABCMeta)):
- """Exposes gRPC-specific options and behaviors to code invoking RPCs."""
-
- @abc.abstractmethod
- def disable_next_request_compression(self):
- """Disables compression of the next request passed by the application."""
- raise NotImplementedError()
-
-
-class Server(six.with_metaclass(abc.ABCMeta)):
- """Services RPCs."""
-
- @abc.abstractmethod
- def add_insecure_port(self, address):
- """Reserves a port for insecure RPC service once this Server becomes active.
-
- This method may only be called before calling this Server's start method is
- called.
-
- Args:
- address: The address for which to open a port.
-
- Returns:
- An integer port on which RPCs will be serviced after this link has been
- started. This is typically the same number as the port number contained
- in the passed address, but will likely be different if the port number
- contained in the passed address was zero.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_secure_port(self, address, server_credentials):
- """Reserves a port for secure RPC service after this Server becomes active.
-
- This method may only be called before calling this Server's start method is
- called.
-
- Args:
- address: The address for which to open a port.
- server_credentials: A ServerCredentials.
-
- Returns:
- An integer port on which RPCs will be serviced after this link has been
- started. This is typically the same number as the port number contained
- in the passed address, but will likely be different if the port number
- contained in the passed address was zero.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def start(self):
- """Starts this Server's service of RPCs.
-
- This method may only be called while the server is not serving RPCs (i.e. it
- is not idempotent).
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stop(self, grace):
- """Stops this Server's service of RPCs.
-
- All calls to this method immediately stop service of new RPCs. When existing
- RPCs are aborted is controlled by the grace period parameter passed to this
- method.
-
- This method may be called at any time and is idempotent. Passing a smaller
- grace value than has been passed in a previous call will have the effect of
- stopping the Server sooner. Passing a larger grace value than has been
- passed in a previous call will not have the effect of stopping the server
- later.
-
- Args:
- grace: A duration of time in seconds to allow existing RPCs to complete
- before being aborted by this Server's stopping. May be zero for
- immediate abortion of all in-progress RPCs.
-
- Returns:
- A threading.Event that will be set when this Server has completely
- stopped. The returned event may not be set until after the full grace
- period (if some ongoing RPC continues for the full length of the period)
- of it may be set much sooner (such as if this Server had no RPCs underway
- at the time it was stopped or if all RPCs that it had underway completed
- very early in the grace period).
- """
- raise NotImplementedError()
+"""Constants and interfaces of the Beta API of gRPC Python."""
+
+import abc
+
+import six
+
+import grpc
+
+ChannelConnectivity = grpc.ChannelConnectivity
+# FATAL_FAILURE was a Beta-API name for SHUTDOWN
+ChannelConnectivity.FATAL_FAILURE = ChannelConnectivity.SHUTDOWN
+
+StatusCode = grpc.StatusCode
+
+
+class GRPCCallOptions(object):
+ """A value encapsulating gRPC-specific options passed on RPC invocation.
+
+ This class and its instances have no supported interface - it exists to
+ define the type of its instances and its instances exist to be passed to
+ other functions.
+ """
+
+ def __init__(self, disable_compression, subcall_of, credentials):
+ self.disable_compression = disable_compression
+ self.subcall_of = subcall_of
+ self.credentials = credentials
+
+
+def grpc_call_options(disable_compression=False, credentials=None):
+ """Creates a GRPCCallOptions value to be passed at RPC invocation.
+
+ All parameters are optional and should always be passed by keyword.
+
+ Args:
+ disable_compression: A boolean indicating whether or not compression should
+ be disabled for the request object of the RPC. Only valid for
+ request-unary RPCs.
+ credentials: A CallCredentials object to use for the invoked RPC.
+ """
+ return GRPCCallOptions(disable_compression, None, credentials)
+
+
+GRPCAuthMetadataContext = grpc.AuthMetadataContext
+GRPCAuthMetadataPluginCallback = grpc.AuthMetadataPluginCallback
+GRPCAuthMetadataPlugin = grpc.AuthMetadataPlugin
+
+
+class GRPCServicerContext(six.with_metaclass(abc.ABCMeta)):
+ """Exposes gRPC-specific options and behaviors to code servicing RPCs."""
+
+ @abc.abstractmethod
+ def peer(self):
+ """Identifies the peer that invoked the RPC being serviced.
+
+ Returns:
+ A string identifying the peer that invoked the RPC being serviced.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def disable_next_response_compression(self):
+ """Disables compression of the next response passed by the application."""
+ raise NotImplementedError()
+
+
+class GRPCInvocationContext(six.with_metaclass(abc.ABCMeta)):
+ """Exposes gRPC-specific options and behaviors to code invoking RPCs."""
+
+ @abc.abstractmethod
+ def disable_next_request_compression(self):
+ """Disables compression of the next request passed by the application."""
+ raise NotImplementedError()
+
+
+class Server(six.with_metaclass(abc.ABCMeta)):
+ """Services RPCs."""
+
+ @abc.abstractmethod
+ def add_insecure_port(self, address):
+ """Reserves a port for insecure RPC service once this Server becomes active.
+
+ This method may only be called before calling this Server's start method is
+ called.
+
+ Args:
+ address: The address for which to open a port.
+
+ Returns:
+ An integer port on which RPCs will be serviced after this link has been
+ started. This is typically the same number as the port number contained
+ in the passed address, but will likely be different if the port number
+ contained in the passed address was zero.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_secure_port(self, address, server_credentials):
+ """Reserves a port for secure RPC service after this Server becomes active.
+
+ This method may only be called before calling this Server's start method is
+ called.
+
+ Args:
+ address: The address for which to open a port.
+ server_credentials: A ServerCredentials.
+
+ Returns:
+ An integer port on which RPCs will be serviced after this link has been
+ started. This is typically the same number as the port number contained
+ in the passed address, but will likely be different if the port number
+ contained in the passed address was zero.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def start(self):
+ """Starts this Server's service of RPCs.
+
+ This method may only be called while the server is not serving RPCs (i.e. it
+ is not idempotent).
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stop(self, grace):
+ """Stops this Server's service of RPCs.
+
+ All calls to this method immediately stop service of new RPCs. When existing
+ RPCs are aborted is controlled by the grace period parameter passed to this
+ method.
+
+ This method may be called at any time and is idempotent. Passing a smaller
+ grace value than has been passed in a previous call will have the effect of
+ stopping the Server sooner. Passing a larger grace value than has been
+ passed in a previous call will not have the effect of stopping the server
+ later.
+
+ Args:
+ grace: A duration of time in seconds to allow existing RPCs to complete
+ before being aborted by this Server's stopping. May be zero for
+ immediate abortion of all in-progress RPCs.
+
+ Returns:
+ A threading.Event that will be set when this Server has completely
+ stopped. The returned event may not be set until after the full grace
+ period (if some ongoing RPC continues for the full length of the period)
+ of it may be set much sooner (such as if this Server had no RPCs underway
+ at the time it was stopped or if all RPCs that it had underway completed
+ very early in the grace period).
+ """
+ raise NotImplementedError()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/beta/utilities.py b/contrib/libs/grpc/src/python/grpcio/grpc/beta/utilities.py
index 4a4bc0f9e7..fe3ce606c9 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/beta/utilities.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/beta/utilities.py
@@ -1,149 +1,149 @@
# 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.
-"""Utilities for the gRPC Python Beta API."""
-
-import threading
-import time
-
-# implementations is referenced from specification in this module.
-from grpc.beta import implementations # pylint: disable=unused-import
-from grpc.beta import interfaces
-from grpc.framework.foundation import callable_util
-from grpc.framework.foundation import future
-
-_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE = (
- 'Exception calling connectivity future "done" callback!')
-
-
-class _ChannelReadyFuture(future.Future):
-
- def __init__(self, channel):
- self._condition = threading.Condition()
- self._channel = channel
-
- self._matured = False
- self._cancelled = False
- self._done_callbacks = []
-
- def _block(self, timeout):
- until = None if timeout is None else time.time() + timeout
- with self._condition:
- while True:
- if self._cancelled:
- raise future.CancelledError()
- elif self._matured:
- return
- else:
- if until is None:
- self._condition.wait()
- else:
- remaining = until - time.time()
- if remaining < 0:
- raise future.TimeoutError()
- else:
- self._condition.wait(timeout=remaining)
-
- def _update(self, connectivity):
- with self._condition:
- if (not self._cancelled and
- connectivity is interfaces.ChannelConnectivity.READY):
- self._matured = True
- self._channel.unsubscribe(self._update)
- self._condition.notify_all()
- done_callbacks = tuple(self._done_callbacks)
- self._done_callbacks = None
- else:
- return
-
- for done_callback in done_callbacks:
- callable_util.call_logging_exceptions(
- done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self)
-
- def cancel(self):
- with self._condition:
- if not self._matured:
- self._cancelled = True
- self._channel.unsubscribe(self._update)
- self._condition.notify_all()
- done_callbacks = tuple(self._done_callbacks)
- self._done_callbacks = None
- else:
- return False
-
- for done_callback in done_callbacks:
- callable_util.call_logging_exceptions(
- done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self)
-
+"""Utilities for the gRPC Python Beta API."""
+
+import threading
+import time
+
+# implementations is referenced from specification in this module.
+from grpc.beta import implementations # pylint: disable=unused-import
+from grpc.beta import interfaces
+from grpc.framework.foundation import callable_util
+from grpc.framework.foundation import future
+
+_DONE_CALLBACK_EXCEPTION_LOG_MESSAGE = (
+ 'Exception calling connectivity future "done" callback!')
+
+
+class _ChannelReadyFuture(future.Future):
+
+ def __init__(self, channel):
+ self._condition = threading.Condition()
+ self._channel = channel
+
+ self._matured = False
+ self._cancelled = False
+ self._done_callbacks = []
+
+ def _block(self, timeout):
+ until = None if timeout is None else time.time() + timeout
+ with self._condition:
+ while True:
+ if self._cancelled:
+ raise future.CancelledError()
+ elif self._matured:
+ return
+ else:
+ if until is None:
+ self._condition.wait()
+ else:
+ remaining = until - time.time()
+ if remaining < 0:
+ raise future.TimeoutError()
+ else:
+ self._condition.wait(timeout=remaining)
+
+ def _update(self, connectivity):
+ with self._condition:
+ if (not self._cancelled and
+ connectivity is interfaces.ChannelConnectivity.READY):
+ self._matured = True
+ self._channel.unsubscribe(self._update)
+ self._condition.notify_all()
+ done_callbacks = tuple(self._done_callbacks)
+ self._done_callbacks = None
+ else:
+ return
+
+ for done_callback in done_callbacks:
+ callable_util.call_logging_exceptions(
+ done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self)
+
+ def cancel(self):
+ with self._condition:
+ if not self._matured:
+ self._cancelled = True
+ self._channel.unsubscribe(self._update)
+ self._condition.notify_all()
+ done_callbacks = tuple(self._done_callbacks)
+ self._done_callbacks = None
+ else:
+ return False
+
+ for done_callback in done_callbacks:
+ callable_util.call_logging_exceptions(
+ done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self)
+
return True
- def cancelled(self):
- with self._condition:
- return self._cancelled
-
- def running(self):
- with self._condition:
- return not self._cancelled and not self._matured
-
- def done(self):
- with self._condition:
- return self._cancelled or self._matured
-
- def result(self, timeout=None):
- self._block(timeout)
- return None
-
- def exception(self, timeout=None):
- self._block(timeout)
- return None
-
- def traceback(self, timeout=None):
- self._block(timeout)
- return None
-
- def add_done_callback(self, fn):
- with self._condition:
- if not self._cancelled and not self._matured:
- self._done_callbacks.append(fn)
- return
-
- fn(self)
-
- def start(self):
- with self._condition:
- self._channel.subscribe(self._update, try_to_connect=True)
-
- def __del__(self):
- with self._condition:
- if not self._cancelled and not self._matured:
- self._channel.unsubscribe(self._update)
-
-
-def channel_ready_future(channel):
- """Creates a future.Future tracking when an implementations.Channel is ready.
-
- Cancelling the returned future.Future does not tell the given
- implementations.Channel to abandon attempts it may have been making to
- connect; cancelling merely deactivates the return future.Future's
- subscription to the given implementations.Channel's connectivity.
-
- Args:
- channel: An implementations.Channel.
-
- Returns:
- A future.Future that matures when the given Channel has connectivity
- interfaces.ChannelConnectivity.READY.
- """
- ready_future = _ChannelReadyFuture(channel)
- ready_future.start()
- return ready_future
+ def cancelled(self):
+ with self._condition:
+ return self._cancelled
+
+ def running(self):
+ with self._condition:
+ return not self._cancelled and not self._matured
+
+ def done(self):
+ with self._condition:
+ return self._cancelled or self._matured
+
+ def result(self, timeout=None):
+ self._block(timeout)
+ return None
+
+ def exception(self, timeout=None):
+ self._block(timeout)
+ return None
+
+ def traceback(self, timeout=None):
+ self._block(timeout)
+ return None
+
+ def add_done_callback(self, fn):
+ with self._condition:
+ if not self._cancelled and not self._matured:
+ self._done_callbacks.append(fn)
+ return
+
+ fn(self)
+
+ def start(self):
+ with self._condition:
+ self._channel.subscribe(self._update, try_to_connect=True)
+
+ def __del__(self):
+ with self._condition:
+ if not self._cancelled and not self._matured:
+ self._channel.unsubscribe(self._update)
+
+
+def channel_ready_future(channel):
+ """Creates a future.Future tracking when an implementations.Channel is ready.
+
+ Cancelling the returned future.Future does not tell the given
+ implementations.Channel to abandon attempts it may have been making to
+ connect; cancelling merely deactivates the return future.Future's
+ subscription to the given implementations.Channel's connectivity.
+
+ Args:
+ channel: An implementations.Channel.
+
+ Returns:
+ A future.Future that matures when the given Channel has connectivity
+ interfaces.ChannelConnectivity.READY.
+ """
+ ready_future = _ChannelReadyFuture(channel)
+ ready_future.start()
+ return ready_future
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/cardinality.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/cardinality.py
index a7ffc1b576..c98735622d 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/cardinality.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/cardinality.py
@@ -1,26 +1,26 @@
# 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.
-"""Defines an enum for classifying RPC methods by streaming semantics."""
-
-import enum
-
-
-@enum.unique
-class Cardinality(enum.Enum):
- """Describes the streaming semantics of an RPC method."""
-
- UNARY_UNARY = 'request-unary/response-unary'
- UNARY_STREAM = 'request-unary/response-streaming'
- STREAM_UNARY = 'request-streaming/response-unary'
- STREAM_STREAM = 'request-streaming/response-streaming'
+"""Defines an enum for classifying RPC methods by streaming semantics."""
+
+import enum
+
+
+@enum.unique
+class Cardinality(enum.Enum):
+ """Describes the streaming semantics of an RPC method."""
+
+ UNARY_UNARY = 'request-unary/response-unary'
+ UNARY_STREAM = 'request-unary/response-streaming'
+ STREAM_UNARY = 'request-streaming/response-unary'
+ STREAM_STREAM = 'request-streaming/response-streaming'
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/style.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/style.py
index e6ea3c12a4..f6138d417f 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/style.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/common/style.py
@@ -1,24 +1,24 @@
# 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.
-"""Defines an enum for classifying RPC methods by control flow semantics."""
-
-import enum
-
-
-@enum.unique
-class Service(enum.Enum):
- """Describes the control flow style of RPC method implementation."""
-
- INLINE = 'inline'
- EVENT = 'event'
+"""Defines an enum for classifying RPC methods by control flow semantics."""
+
+import enum
+
+
+@enum.unique
+class Service(enum.Enum):
+ """Describes the control flow style of RPC method implementation."""
+
+ INLINE = 'inline'
+ EVENT = 'event'
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/abandonment.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/abandonment.py
index 54021597e5..660ce991c4 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/abandonment.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/abandonment.py
@@ -1,22 +1,22 @@
# 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.
-"""Utilities for indicating abandonment of computation."""
-
-
-class Abandoned(Exception):
- """Indicates that some computation is being abandoned.
-
- Abandoning a computation is different than returning a value or raising
- an exception indicating some operational or programming defect.
- """
+"""Utilities for indicating abandonment of computation."""
+
+
+class Abandoned(Exception):
+ """Indicates that some computation is being abandoned.
+
+ Abandoning a computation is different than returning a value or raising
+ an exception indicating some operational or programming defect.
+ """
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/callable_util.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/callable_util.py
index ed4f249344..24daf3406f 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/callable_util.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/callable_util.py
@@ -1,96 +1,96 @@
# 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.
-"""Utilities for working with callables."""
-
-import abc
-import collections
-import enum
-import functools
-import logging
-
-import six
-
+"""Utilities for working with callables."""
+
+import abc
+import collections
+import enum
+import functools
+import logging
+
+import six
+
_LOGGER = logging.getLogger(__name__)
-
-
-class Outcome(six.with_metaclass(abc.ABCMeta)):
- """A sum type describing the outcome of some call.
-
- Attributes:
- kind: One of Kind.RETURNED or Kind.RAISED respectively indicating that the
- call returned a value or raised an exception.
- return_value: The value returned by the call. Must be present if kind is
- Kind.RETURNED.
- exception: The exception raised by the call. Must be present if kind is
- Kind.RAISED.
- """
-
- @enum.unique
- class Kind(enum.Enum):
- """Identifies the general kind of the outcome of some call."""
-
- RETURNED = object()
- RAISED = object()
-
-
-class _EasyOutcome(
- collections.namedtuple('_EasyOutcome',
- ['kind', 'return_value', 'exception']), Outcome):
- """A trivial implementation of Outcome."""
-
-
-def _call_logging_exceptions(behavior, message, *args, **kwargs):
- try:
+
+
+class Outcome(six.with_metaclass(abc.ABCMeta)):
+ """A sum type describing the outcome of some call.
+
+ Attributes:
+ kind: One of Kind.RETURNED or Kind.RAISED respectively indicating that the
+ call returned a value or raised an exception.
+ return_value: The value returned by the call. Must be present if kind is
+ Kind.RETURNED.
+ exception: The exception raised by the call. Must be present if kind is
+ Kind.RAISED.
+ """
+
+ @enum.unique
+ class Kind(enum.Enum):
+ """Identifies the general kind of the outcome of some call."""
+
+ RETURNED = object()
+ RAISED = object()
+
+
+class _EasyOutcome(
+ collections.namedtuple('_EasyOutcome',
+ ['kind', 'return_value', 'exception']), Outcome):
+ """A trivial implementation of Outcome."""
+
+
+def _call_logging_exceptions(behavior, message, *args, **kwargs):
+ try:
return _EasyOutcome(Outcome.Kind.RETURNED, behavior(*args, **kwargs),
None)
- except Exception as e: # pylint: disable=broad-except
+ except Exception as e: # pylint: disable=broad-except
_LOGGER.exception(message)
- return _EasyOutcome(Outcome.Kind.RAISED, None, e)
-
-
-def with_exceptions_logged(behavior, message):
- """Wraps a callable in a try-except that logs any exceptions it raises.
-
- Args:
- behavior: Any callable.
- message: A string to log if the behavior raises an exception.
-
- Returns:
- A callable that when executed invokes the given behavior. The returned
- callable takes the same arguments as the given behavior but returns a
- future.Outcome describing whether the given behavior returned a value or
- raised an exception.
- """
-
- @functools.wraps(behavior)
- def wrapped_behavior(*args, **kwargs):
- return _call_logging_exceptions(behavior, message, *args, **kwargs)
-
- return wrapped_behavior
-
-
-def call_logging_exceptions(behavior, message, *args, **kwargs):
- """Calls a behavior in a try-except that logs any exceptions it raises.
-
- Args:
- behavior: Any callable.
- message: A string to log if the behavior raises an exception.
- *args: Positional arguments to pass to the given behavior.
- **kwargs: Keyword arguments to pass to the given behavior.
-
- Returns:
- An Outcome describing whether the given behavior returned a value or raised
- an exception.
- """
- return _call_logging_exceptions(behavior, message, *args, **kwargs)
+ return _EasyOutcome(Outcome.Kind.RAISED, None, e)
+
+
+def with_exceptions_logged(behavior, message):
+ """Wraps a callable in a try-except that logs any exceptions it raises.
+
+ Args:
+ behavior: Any callable.
+ message: A string to log if the behavior raises an exception.
+
+ Returns:
+ A callable that when executed invokes the given behavior. The returned
+ callable takes the same arguments as the given behavior but returns a
+ future.Outcome describing whether the given behavior returned a value or
+ raised an exception.
+ """
+
+ @functools.wraps(behavior)
+ def wrapped_behavior(*args, **kwargs):
+ return _call_logging_exceptions(behavior, message, *args, **kwargs)
+
+ return wrapped_behavior
+
+
+def call_logging_exceptions(behavior, message, *args, **kwargs):
+ """Calls a behavior in a try-except that logs any exceptions it raises.
+
+ Args:
+ behavior: Any callable.
+ message: A string to log if the behavior raises an exception.
+ *args: Positional arguments to pass to the given behavior.
+ **kwargs: Keyword arguments to pass to the given behavior.
+
+ Returns:
+ An Outcome describing whether the given behavior returned a value or raised
+ an exception.
+ """
+ return _call_logging_exceptions(behavior, message, *args, **kwargs)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/future.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/future.py
index e2206142e2..d11679cc3d 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/future.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/future.py
@@ -1,221 +1,221 @@
# 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.
-"""A Future interface.
-
-Python doesn't have a Future interface in its standard library. In the absence
-of such a standard, three separate, incompatible implementations
-(concurrent.futures.Future, ndb.Future, and asyncio.Future) have appeared. This
-interface attempts to be as compatible as possible with
-concurrent.futures.Future. From ndb.Future it adopts a traceback-object accessor
-method.
-
-Unlike the concrete and implemented Future classes listed above, the Future
-class defined in this module is an entirely abstract interface that anyone may
-implement and use.
-
-The one known incompatibility between this interface and the interface of
-concurrent.futures.Future is that this interface defines its own CancelledError
-and TimeoutError exceptions rather than raising the implementation-private
-concurrent.futures._base.CancelledError and the
-built-in-but-only-in-3.3-and-later TimeoutError.
-"""
-
-import abc
-
-import six
-
-
-class TimeoutError(Exception):
- """Indicates that a particular call timed out."""
-
-
-class CancelledError(Exception):
- """Indicates that the computation underlying a Future was cancelled."""
-
-
-class Future(six.with_metaclass(abc.ABCMeta)):
- """A representation of a computation in another control flow.
-
- Computations represented by a Future may be yet to be begun, may be ongoing,
- or may have already completed.
- """
-
- # NOTE(nathaniel): This isn't the return type that I would want to have if it
- # were up to me. Were this interface being written from scratch, the return
- # type of this method would probably be a sum type like:
- #
- # NOT_COMMENCED
- # COMMENCED_AND_NOT_COMPLETED
- # PARTIAL_RESULT<Partial_Result_Type>
- # COMPLETED<Result_Type>
- # UNCANCELLABLE
- # NOT_IMMEDIATELY_DETERMINABLE
- @abc.abstractmethod
- def cancel(self):
- """Attempts to cancel the computation.
-
- This method does not block.
-
- Returns:
- True if the computation has not yet begun, will not be allowed to take
- place, and determination of both was possible without blocking. False
- under all other circumstances including but not limited to the
- computation's already having begun, the computation's already having
- finished, and the computation's having been scheduled for execution on a
- remote system for which a determination of whether or not it commenced
- before being cancelled cannot be made without blocking.
- """
- raise NotImplementedError()
-
- # NOTE(nathaniel): Here too this isn't the return type that I'd want this
- # method to have if it were up to me. I think I'd go with another sum type
- # like:
- #
- # NOT_CANCELLED (this object's cancel method hasn't been called)
- # NOT_COMMENCED
- # COMMENCED_AND_NOT_COMPLETED
- # PARTIAL_RESULT<Partial_Result_Type>
- # COMPLETED<Result_Type>
- # UNCANCELLABLE
- # NOT_IMMEDIATELY_DETERMINABLE
- #
- # Notice how giving the cancel method the right semantics obviates most
- # reasons for this method to exist.
- @abc.abstractmethod
- def cancelled(self):
- """Describes whether the computation was cancelled.
-
- This method does not block.
-
- Returns:
- True if the computation was cancelled any time before its result became
- immediately available. False under all other circumstances including but
- not limited to this object's cancel method not having been called and
- the computation's result having become immediately available.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def running(self):
- """Describes whether the computation is taking place.
-
- This method does not block.
-
- Returns:
- True if the computation is scheduled to take place in the future or is
- taking place now, or False if the computation took place in the past or
- was cancelled.
- """
- raise NotImplementedError()
-
- # NOTE(nathaniel): These aren't quite the semantics I'd like here either. I
- # would rather this only returned True in cases in which the underlying
- # computation completed successfully. A computation's having been cancelled
- # conflicts with considering that computation "done".
- @abc.abstractmethod
- def done(self):
- """Describes whether the computation has taken place.
-
- This method does not block.
-
- Returns:
- True if the computation is known to have either completed or have been
- unscheduled or interrupted. False if the computation may possibly be
- executing or scheduled to execute later.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def result(self, timeout=None):
- """Accesses the outcome of the computation or raises its exception.
-
- This method may return immediately or may block.
-
- Args:
- timeout: The length of time in seconds to wait for the computation to
- finish or be cancelled, or None if this method should block until the
- computation has finished or is cancelled no matter how long that takes.
-
- Returns:
- The return value of the computation.
-
- Raises:
- TimeoutError: If a timeout value is passed and the computation does not
- terminate within the allotted time.
- CancelledError: If the computation was cancelled.
- Exception: If the computation raised an exception, this call will raise
- the same exception.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def exception(self, timeout=None):
- """Return the exception raised by the computation.
-
- This method may return immediately or may block.
-
- Args:
- timeout: The length of time in seconds to wait for the computation to
- terminate or be cancelled, or None if this method should block until
- the computation is terminated or is cancelled no matter how long that
- takes.
-
- Returns:
- The exception raised by the computation, or None if the computation did
- not raise an exception.
-
- Raises:
- TimeoutError: If a timeout value is passed and the computation does not
- terminate within the allotted time.
- CancelledError: If the computation was cancelled.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def traceback(self, timeout=None):
- """Access the traceback of the exception raised by the computation.
-
- This method may return immediately or may block.
-
- Args:
- timeout: The length of time in seconds to wait for the computation to
- terminate or be cancelled, or None if this method should block until
- the computation is terminated or is cancelled no matter how long that
- takes.
-
- Returns:
- The traceback of the exception raised by the computation, or None if the
- computation did not raise an exception.
-
- Raises:
- TimeoutError: If a timeout value is passed and the computation does not
- terminate within the allotted time.
- CancelledError: If the computation was cancelled.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_done_callback(self, fn):
- """Adds a function to be called at completion of the computation.
-
- The callback will be passed this Future object describing the outcome of
- the computation.
-
- If the computation has already completed, the callback will be called
- immediately.
-
- Args:
- fn: A callable taking this Future object as its single parameter.
- """
- raise NotImplementedError()
+"""A Future interface.
+
+Python doesn't have a Future interface in its standard library. In the absence
+of such a standard, three separate, incompatible implementations
+(concurrent.futures.Future, ndb.Future, and asyncio.Future) have appeared. This
+interface attempts to be as compatible as possible with
+concurrent.futures.Future. From ndb.Future it adopts a traceback-object accessor
+method.
+
+Unlike the concrete and implemented Future classes listed above, the Future
+class defined in this module is an entirely abstract interface that anyone may
+implement and use.
+
+The one known incompatibility between this interface and the interface of
+concurrent.futures.Future is that this interface defines its own CancelledError
+and TimeoutError exceptions rather than raising the implementation-private
+concurrent.futures._base.CancelledError and the
+built-in-but-only-in-3.3-and-later TimeoutError.
+"""
+
+import abc
+
+import six
+
+
+class TimeoutError(Exception):
+ """Indicates that a particular call timed out."""
+
+
+class CancelledError(Exception):
+ """Indicates that the computation underlying a Future was cancelled."""
+
+
+class Future(six.with_metaclass(abc.ABCMeta)):
+ """A representation of a computation in another control flow.
+
+ Computations represented by a Future may be yet to be begun, may be ongoing,
+ or may have already completed.
+ """
+
+ # NOTE(nathaniel): This isn't the return type that I would want to have if it
+ # were up to me. Were this interface being written from scratch, the return
+ # type of this method would probably be a sum type like:
+ #
+ # NOT_COMMENCED
+ # COMMENCED_AND_NOT_COMPLETED
+ # PARTIAL_RESULT<Partial_Result_Type>
+ # COMPLETED<Result_Type>
+ # UNCANCELLABLE
+ # NOT_IMMEDIATELY_DETERMINABLE
+ @abc.abstractmethod
+ def cancel(self):
+ """Attempts to cancel the computation.
+
+ This method does not block.
+
+ Returns:
+ True if the computation has not yet begun, will not be allowed to take
+ place, and determination of both was possible without blocking. False
+ under all other circumstances including but not limited to the
+ computation's already having begun, the computation's already having
+ finished, and the computation's having been scheduled for execution on a
+ remote system for which a determination of whether or not it commenced
+ before being cancelled cannot be made without blocking.
+ """
+ raise NotImplementedError()
+
+ # NOTE(nathaniel): Here too this isn't the return type that I'd want this
+ # method to have if it were up to me. I think I'd go with another sum type
+ # like:
+ #
+ # NOT_CANCELLED (this object's cancel method hasn't been called)
+ # NOT_COMMENCED
+ # COMMENCED_AND_NOT_COMPLETED
+ # PARTIAL_RESULT<Partial_Result_Type>
+ # COMPLETED<Result_Type>
+ # UNCANCELLABLE
+ # NOT_IMMEDIATELY_DETERMINABLE
+ #
+ # Notice how giving the cancel method the right semantics obviates most
+ # reasons for this method to exist.
+ @abc.abstractmethod
+ def cancelled(self):
+ """Describes whether the computation was cancelled.
+
+ This method does not block.
+
+ Returns:
+ True if the computation was cancelled any time before its result became
+ immediately available. False under all other circumstances including but
+ not limited to this object's cancel method not having been called and
+ the computation's result having become immediately available.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def running(self):
+ """Describes whether the computation is taking place.
+
+ This method does not block.
+
+ Returns:
+ True if the computation is scheduled to take place in the future or is
+ taking place now, or False if the computation took place in the past or
+ was cancelled.
+ """
+ raise NotImplementedError()
+
+ # NOTE(nathaniel): These aren't quite the semantics I'd like here either. I
+ # would rather this only returned True in cases in which the underlying
+ # computation completed successfully. A computation's having been cancelled
+ # conflicts with considering that computation "done".
+ @abc.abstractmethod
+ def done(self):
+ """Describes whether the computation has taken place.
+
+ This method does not block.
+
+ Returns:
+ True if the computation is known to have either completed or have been
+ unscheduled or interrupted. False if the computation may possibly be
+ executing or scheduled to execute later.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def result(self, timeout=None):
+ """Accesses the outcome of the computation or raises its exception.
+
+ This method may return immediately or may block.
+
+ Args:
+ timeout: The length of time in seconds to wait for the computation to
+ finish or be cancelled, or None if this method should block until the
+ computation has finished or is cancelled no matter how long that takes.
+
+ Returns:
+ The return value of the computation.
+
+ Raises:
+ TimeoutError: If a timeout value is passed and the computation does not
+ terminate within the allotted time.
+ CancelledError: If the computation was cancelled.
+ Exception: If the computation raised an exception, this call will raise
+ the same exception.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def exception(self, timeout=None):
+ """Return the exception raised by the computation.
+
+ This method may return immediately or may block.
+
+ Args:
+ timeout: The length of time in seconds to wait for the computation to
+ terminate or be cancelled, or None if this method should block until
+ the computation is terminated or is cancelled no matter how long that
+ takes.
+
+ Returns:
+ The exception raised by the computation, or None if the computation did
+ not raise an exception.
+
+ Raises:
+ TimeoutError: If a timeout value is passed and the computation does not
+ terminate within the allotted time.
+ CancelledError: If the computation was cancelled.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def traceback(self, timeout=None):
+ """Access the traceback of the exception raised by the computation.
+
+ This method may return immediately or may block.
+
+ Args:
+ timeout: The length of time in seconds to wait for the computation to
+ terminate or be cancelled, or None if this method should block until
+ the computation is terminated or is cancelled no matter how long that
+ takes.
+
+ Returns:
+ The traceback of the exception raised by the computation, or None if the
+ computation did not raise an exception.
+
+ Raises:
+ TimeoutError: If a timeout value is passed and the computation does not
+ terminate within the allotted time.
+ CancelledError: If the computation was cancelled.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_done_callback(self, fn):
+ """Adds a function to be called at completion of the computation.
+
+ The callback will be passed this Future object describing the outcome of
+ the computation.
+
+ If the computation has already completed, the callback will be called
+ immediately.
+
+ Args:
+ fn: A callable taking this Future object as its single parameter.
+ """
+ raise NotImplementedError()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/logging_pool.py
index e3e3f4f23a..421999fb1c 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/logging_pool.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/logging_pool.py
@@ -1,72 +1,72 @@
# 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.
-"""A thread pool that logs exceptions raised by tasks executed within it."""
-
-import logging
-
-from concurrent import futures
-
+"""A thread pool that logs exceptions raised by tasks executed within it."""
+
+import logging
+
+from concurrent import futures
+
_LOGGER = logging.getLogger(__name__)
-
-
-def _wrap(behavior):
- """Wraps an arbitrary callable behavior in exception-logging."""
-
- def _wrapping(*args, **kwargs):
- try:
- return behavior(*args, **kwargs)
+
+
+def _wrap(behavior):
+ """Wraps an arbitrary callable behavior in exception-logging."""
+
+ def _wrapping(*args, **kwargs):
+ try:
+ return behavior(*args, **kwargs)
except Exception:
_LOGGER.exception(
- 'Unexpected exception from %s executed in logging pool!',
- behavior)
- raise
-
- return _wrapping
-
-
-class _LoggingPool(object):
- """An exception-logging futures.ThreadPoolExecutor-compatible thread pool."""
-
- def __init__(self, backing_pool):
- self._backing_pool = backing_pool
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- self._backing_pool.shutdown(wait=True)
-
- def submit(self, fn, *args, **kwargs):
- return self._backing_pool.submit(_wrap(fn), *args, **kwargs)
-
- def map(self, func, *iterables, **kwargs):
+ 'Unexpected exception from %s executed in logging pool!',
+ behavior)
+ raise
+
+ return _wrapping
+
+
+class _LoggingPool(object):
+ """An exception-logging futures.ThreadPoolExecutor-compatible thread pool."""
+
+ def __init__(self, backing_pool):
+ self._backing_pool = backing_pool
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self._backing_pool.shutdown(wait=True)
+
+ def submit(self, fn, *args, **kwargs):
+ return self._backing_pool.submit(_wrap(fn), *args, **kwargs)
+
+ def map(self, func, *iterables, **kwargs):
return self._backing_pool.map(_wrap(func),
*iterables,
timeout=kwargs.get('timeout', None))
-
- def shutdown(self, wait=True):
- self._backing_pool.shutdown(wait=wait)
-
-
-def pool(max_workers):
- """Creates a thread pool that logs exceptions raised by the tasks within it.
-
- Args:
- max_workers: The maximum number of worker threads to allow the pool.
-
- Returns:
- A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions
- raised by the tasks executed within it.
- """
- return _LoggingPool(futures.ThreadPoolExecutor(max_workers))
+
+ def shutdown(self, wait=True):
+ self._backing_pool.shutdown(wait=wait)
+
+
+def pool(max_workers):
+ """Creates a thread pool that logs exceptions raised by the tasks within it.
+
+ Args:
+ max_workers: The maximum number of worker threads to allow the pool.
+
+ Returns:
+ A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions
+ raised by the tasks executed within it.
+ """
+ return _LoggingPool(futures.ThreadPoolExecutor(max_workers))
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream.py
index cb11129aea..fd47977b89 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream.py
@@ -1,45 +1,45 @@
# 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.
-"""Interfaces related to streams of values or objects."""
-
-import abc
-
-import six
-
-
-class Consumer(six.with_metaclass(abc.ABCMeta)):
- """Interface for consumers of finite streams of values or objects."""
-
- @abc.abstractmethod
- def consume(self, value):
- """Accepts a value.
-
- Args:
- value: Any value accepted by this Consumer.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def terminate(self):
- """Indicates to this Consumer that no more values will be supplied."""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def consume_and_terminate(self, value):
- """Supplies a value and signals that no more values will be supplied.
-
- Args:
- value: Any value accepted by this Consumer.
- """
- raise NotImplementedError()
+"""Interfaces related to streams of values or objects."""
+
+import abc
+
+import six
+
+
+class Consumer(six.with_metaclass(abc.ABCMeta)):
+ """Interface for consumers of finite streams of values or objects."""
+
+ @abc.abstractmethod
+ def consume(self, value):
+ """Accepts a value.
+
+ Args:
+ value: Any value accepted by this Consumer.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def terminate(self):
+ """Indicates to this Consumer that no more values will be supplied."""
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def consume_and_terminate(self, value):
+ """Supplies a value and signals that no more values will be supplied.
+
+ Args:
+ value: Any value accepted by this Consumer.
+ """
+ raise NotImplementedError()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream_util.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream_util.py
index 9b832ba804..1faaf29bd7 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream_util.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/foundation/stream_util.py
@@ -1,148 +1,148 @@
# 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.
-"""Helpful utilities related to the stream module."""
-
-import logging
-import threading
-
-from grpc.framework.foundation import stream
-
-_NO_VALUE = object()
+"""Helpful utilities related to the stream module."""
+
+import logging
+import threading
+
+from grpc.framework.foundation import stream
+
+_NO_VALUE = object()
_LOGGER = logging.getLogger(__name__)
-
-
-class TransformingConsumer(stream.Consumer):
- """A stream.Consumer that passes a transformation of its input to another."""
-
- def __init__(self, transformation, downstream):
- self._transformation = transformation
- self._downstream = downstream
-
- def consume(self, value):
- self._downstream.consume(self._transformation(value))
-
- def terminate(self):
- self._downstream.terminate()
-
- def consume_and_terminate(self, value):
- self._downstream.consume_and_terminate(self._transformation(value))
-
-
-class IterableConsumer(stream.Consumer):
- """A Consumer that when iterated over emits the values it has consumed."""
-
- def __init__(self):
- self._condition = threading.Condition()
- self._values = []
- self._active = True
-
+
+
+class TransformingConsumer(stream.Consumer):
+ """A stream.Consumer that passes a transformation of its input to another."""
+
+ def __init__(self, transformation, downstream):
+ self._transformation = transformation
+ self._downstream = downstream
+
def consume(self, value):
- with self._condition:
- if self._active:
+ self._downstream.consume(self._transformation(value))
+
+ def terminate(self):
+ self._downstream.terminate()
+
+ def consume_and_terminate(self, value):
+ self._downstream.consume_and_terminate(self._transformation(value))
+
+
+class IterableConsumer(stream.Consumer):
+ """A Consumer that when iterated over emits the values it has consumed."""
+
+ def __init__(self):
+ self._condition = threading.Condition()
+ self._values = []
+ self._active = True
+
+ def consume(self, value):
+ with self._condition:
+ if self._active:
self._values.append(value)
- self._condition.notify()
-
- def terminate(self):
- with self._condition:
- self._active = False
- self._condition.notify()
-
+ self._condition.notify()
+
+ def terminate(self):
+ with self._condition:
+ self._active = False
+ self._condition.notify()
+
def consume_and_terminate(self, value):
- with self._condition:
- if self._active:
+ with self._condition:
+ if self._active:
self._values.append(value)
- self._active = False
- self._condition.notify()
-
- def __iter__(self):
- return self
-
- def __next__(self):
- return self.next()
-
- def next(self):
- with self._condition:
- while self._active and not self._values:
- self._condition.wait()
- if self._values:
- return self._values.pop(0)
- else:
- raise StopIteration()
-
-
-class ThreadSwitchingConsumer(stream.Consumer):
- """A Consumer decorator that affords serialization and asynchrony."""
-
- def __init__(self, sink, pool):
- self._lock = threading.Lock()
- self._sink = sink
- self._pool = pool
- # True if self._spin has been submitted to the pool to be called once and
- # that call has not yet returned, False otherwise.
- self._spinning = False
- self._values = []
- self._active = True
-
- def _spin(self, sink, value, terminate):
- while True:
- try:
- if value is _NO_VALUE:
- sink.terminate()
- elif terminate:
- sink.consume_and_terminate(value)
- else:
- sink.consume(value)
- except Exception as e: # pylint:disable=broad-except
+ self._active = False
+ self._condition.notify()
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ return self.next()
+
+ def next(self):
+ with self._condition:
+ while self._active and not self._values:
+ self._condition.wait()
+ if self._values:
+ return self._values.pop(0)
+ else:
+ raise StopIteration()
+
+
+class ThreadSwitchingConsumer(stream.Consumer):
+ """A Consumer decorator that affords serialization and asynchrony."""
+
+ def __init__(self, sink, pool):
+ self._lock = threading.Lock()
+ self._sink = sink
+ self._pool = pool
+ # True if self._spin has been submitted to the pool to be called once and
+ # that call has not yet returned, False otherwise.
+ self._spinning = False
+ self._values = []
+ self._active = True
+
+ def _spin(self, sink, value, terminate):
+ while True:
+ try:
+ if value is _NO_VALUE:
+ sink.terminate()
+ elif terminate:
+ sink.consume_and_terminate(value)
+ else:
+ sink.consume(value)
+ except Exception as e: # pylint:disable=broad-except
_LOGGER.exception(e)
-
- with self._lock:
- if terminate:
- self._spinning = False
- return
- elif self._values:
- value = self._values.pop(0)
- terminate = not self._values and not self._active
- elif not self._active:
- value = _NO_VALUE
- terminate = True
- else:
- self._spinning = False
- return
-
- def consume(self, value):
- with self._lock:
- if self._active:
- if self._spinning:
- self._values.append(value)
- else:
- self._pool.submit(self._spin, self._sink, value, False)
- self._spinning = True
-
- def terminate(self):
- with self._lock:
- if self._active:
- self._active = False
- if not self._spinning:
- self._pool.submit(self._spin, self._sink, _NO_VALUE, True)
- self._spinning = True
-
- def consume_and_terminate(self, value):
- with self._lock:
- if self._active:
- self._active = False
- if self._spinning:
- self._values.append(value)
- else:
- self._pool.submit(self._spin, self._sink, value, True)
- self._spinning = True
+
+ with self._lock:
+ if terminate:
+ self._spinning = False
+ return
+ elif self._values:
+ value = self._values.pop(0)
+ terminate = not self._values and not self._active
+ elif not self._active:
+ value = _NO_VALUE
+ terminate = True
+ else:
+ self._spinning = False
+ return
+
+ def consume(self, value):
+ with self._lock:
+ if self._active:
+ if self._spinning:
+ self._values.append(value)
+ else:
+ self._pool.submit(self._spin, self._sink, value, False)
+ self._spinning = True
+
+ def terminate(self):
+ with self._lock:
+ if self._active:
+ self._active = False
+ if not self._spinning:
+ self._pool.submit(self._spin, self._sink, _NO_VALUE, True)
+ self._spinning = True
+
+ def consume_and_terminate(self, value):
+ with self._lock:
+ if self._active:
+ self._active = False
+ if self._spinning:
+ self._values.append(value)
+ else:
+ self._pool.submit(self._spin, self._sink, value, True)
+ self._spinning = True
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/base.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/base.py
index 45ce9484bc..82c44f9110 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/base.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/base.py
@@ -1,48 +1,48 @@
# 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.
-"""The base interface of RPC Framework.
-
-Implementations of this interface support the conduct of "operations":
-exchanges between two distinct ends of an arbitrary number of data payloads
-and metadata such as a name for the operation, initial and terminal metadata
-in each direction, and flow control. These operations may be used for transfers
-of data, remote procedure calls, status indication, or anything else
-applications choose.
-"""
-
-# threading is referenced from specification in this module.
-import abc
-import enum
-import threading # pylint: disable=unused-import
-
-import six
-
-# abandonment is referenced from specification in this module.
-from grpc.framework.foundation import abandonment # pylint: disable=unused-import
-
+"""The base interface of RPC Framework.
+
+Implementations of this interface support the conduct of "operations":
+exchanges between two distinct ends of an arbitrary number of data payloads
+and metadata such as a name for the operation, initial and terminal metadata
+in each direction, and flow control. These operations may be used for transfers
+of data, remote procedure calls, status indication, or anything else
+applications choose.
+"""
+
+# threading is referenced from specification in this module.
+import abc
+import enum
+import threading # pylint: disable=unused-import
+
+import six
+
+# abandonment is referenced from specification in this module.
+from grpc.framework.foundation import abandonment # pylint: disable=unused-import
+
# pylint: disable=too-many-arguments
-
-class NoSuchMethodError(Exception):
- """Indicates that an unrecognized operation has been called.
-
+
+class NoSuchMethodError(Exception):
+ """Indicates that an unrecognized operation has been called.
+
Attributes:
- code: A code value to communicate to the other side of the operation
- along with indication of operation termination. May be None.
- details: A details value to communicate to the other side of the
- operation along with indication of operation termination. May be None.
- """
+ code: A code value to communicate to the other side of the operation
+ along with indication of operation termination. May be None.
+ details: A details value to communicate to the other side of the
+ operation along with indication of operation termination. May be None.
+ """
def __init__(self, code, details):
"""Constructor.
@@ -54,277 +54,277 @@ class NoSuchMethodError(Exception):
operation along with indication of operation termination. May be None.
"""
super(NoSuchMethodError, self).__init__()
- self.code = code
- self.details = details
-
-
-class Outcome(object):
- """The outcome of an operation.
-
- Attributes:
- kind: A Kind value coarsely identifying how the operation terminated.
- code: An application-specific code value or None if no such value was
- provided.
- details: An application-specific details value or None if no such value was
- provided.
- """
-
- @enum.unique
- class Kind(enum.Enum):
- """Ways in which an operation can terminate."""
-
- COMPLETED = 'completed'
- CANCELLED = 'cancelled'
- EXPIRED = 'expired'
- LOCAL_SHUTDOWN = 'local shutdown'
- REMOTE_SHUTDOWN = 'remote shutdown'
- RECEPTION_FAILURE = 'reception failure'
- TRANSMISSION_FAILURE = 'transmission failure'
- LOCAL_FAILURE = 'local failure'
- REMOTE_FAILURE = 'remote failure'
-
-
-class Completion(six.with_metaclass(abc.ABCMeta)):
- """An aggregate of the values exchanged upon operation completion.
-
- Attributes:
- terminal_metadata: A terminal metadata value for the operaton.
- code: A code value for the operation.
- message: A message value for the operation.
- """
-
-
-class OperationContext(six.with_metaclass(abc.ABCMeta)):
- """Provides operation-related information and action."""
-
- @abc.abstractmethod
- def outcome(self):
- """Indicates the operation's outcome (or that the operation is ongoing).
-
- Returns:
- None if the operation is still active or the Outcome value for the
- operation if it has terminated.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_termination_callback(self, callback):
- """Adds a function to be called upon operation termination.
-
- Args:
- callback: A callable to be passed an Outcome value on operation
- termination.
-
- Returns:
- None if the operation has not yet terminated and the passed callback will
- later be called when it does terminate, or if the operation has already
- terminated an Outcome value describing the operation termination and the
- passed callback will not be called as a result of this method call.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the operation.
-
- Returns:
- A nonnegative float indicating the length of allowed time in seconds
- remaining for the operation to complete before it is considered to have
- timed out. Zero is returned if the operation has terminated.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def cancel(self):
- """Cancels the operation if the operation has not yet terminated."""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def fail(self, exception):
- """Indicates that the operation has failed.
-
- Args:
- exception: An exception germane to the operation failure. May be None.
- """
- raise NotImplementedError()
-
-
-class Operator(six.with_metaclass(abc.ABCMeta)):
- """An interface through which to participate in an operation."""
-
- @abc.abstractmethod
- def advance(self,
- initial_metadata=None,
- payload=None,
- completion=None,
- allowance=None):
- """Progresses the operation.
-
- Args:
- initial_metadata: An initial metadata value. Only one may ever be
- communicated in each direction for an operation, and they must be
- communicated no later than either the first payload or the completion.
- payload: A payload value.
- completion: A Completion value. May only ever be non-None once in either
- direction, and no payloads may be passed after it has been communicated.
- allowance: A positive integer communicating the number of additional
- payloads allowed to be passed by the remote side of the operation.
- """
- raise NotImplementedError()
-
-
-class ProtocolReceiver(six.with_metaclass(abc.ABCMeta)):
- """A means of receiving protocol values during an operation."""
-
- @abc.abstractmethod
- def context(self, protocol_context):
- """Accepts the protocol context object for the operation.
-
- Args:
- protocol_context: The protocol context object for the operation.
- """
- raise NotImplementedError()
-
-
-class Subscription(six.with_metaclass(abc.ABCMeta)):
- """Describes customer code's interest in values from the other side.
-
- Attributes:
- kind: A Kind value describing the overall kind of this value.
- termination_callback: A callable to be passed the Outcome associated with
- the operation after it has terminated. Must be non-None if kind is
- Kind.TERMINATION_ONLY. Must be None otherwise.
- allowance: A callable behavior that accepts positive integers representing
- the number of additional payloads allowed to be passed to the other side
- of the operation. Must be None if kind is Kind.FULL. Must not be None
- otherwise.
- operator: An Operator to be passed values from the other side of the
- operation. Must be non-None if kind is Kind.FULL. Must be None otherwise.
- protocol_receiver: A ProtocolReceiver to be passed protocol objects as they
- become available during the operation. Must be non-None if kind is
- Kind.FULL.
- """
-
- @enum.unique
- class Kind(enum.Enum):
-
- NONE = 'none'
- TERMINATION_ONLY = 'termination only'
- FULL = 'full'
-
-
-class Servicer(six.with_metaclass(abc.ABCMeta)):
- """Interface for service implementations."""
-
- @abc.abstractmethod
- def service(self, group, method, context, output_operator):
- """Services an operation.
-
- Args:
- group: The group identifier of the operation to be serviced.
- method: The method identifier of the operation to be serviced.
- context: An OperationContext object affording contextual information and
- actions.
- output_operator: An Operator that will accept output values of the
- operation.
-
- Returns:
- A Subscription via which this object may or may not accept more values of
- the operation.
-
- Raises:
- NoSuchMethodError: If this Servicer does not handle operations with the
- given group and method.
- abandonment.Abandoned: If the operation has been aborted and there no
- longer is any reason to service the operation.
- """
- raise NotImplementedError()
-
-
-class End(six.with_metaclass(abc.ABCMeta)):
- """Common type for entry-point objects on both sides of an operation."""
-
- @abc.abstractmethod
- def start(self):
- """Starts this object's service of operations."""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stop(self, grace):
- """Stops this object's service of operations.
-
- This object will refuse service of new operations as soon as this method is
- called but operations under way at the time of the call may be given a
- grace period during which they are allowed to finish.
-
- Args:
- grace: A duration of time in seconds to allow ongoing operations to
- terminate before being forcefully terminated by the stopping of this
- End. May be zero to terminate all ongoing operations and immediately
- stop.
-
- Returns:
- A threading.Event that will be set to indicate all operations having
- terminated and this End having completely stopped. The returned event
- may not be set until after the full grace period (if some ongoing
- operation continues for the full length of the period) or it may be set
- much sooner (if for example this End had no operations in progress at
- the time its stop method was called).
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def operate(self,
- group,
- method,
- subscription,
- timeout,
- initial_metadata=None,
- payload=None,
- completion=None,
- protocol_options=None):
- """Commences an operation.
-
- Args:
- group: The group identifier of the invoked operation.
- method: The method identifier of the invoked operation.
- subscription: A Subscription to which the results of the operation will be
- passed.
- timeout: A length of time in seconds to allow for the operation.
- initial_metadata: An initial metadata value to be sent to the other side
- of the operation. May be None if the initial metadata will be later
- passed via the returned operator or if there will be no initial metadata
- passed at all.
- payload: An initial payload for the operation.
- completion: A Completion value indicating the end of transmission to the
- other side of the operation.
- protocol_options: A value specified by the provider of a Base interface
- implementation affording custom state and behavior.
-
- Returns:
- A pair of objects affording information about the operation and action
- continuing the operation. The first element of the returned pair is an
- OperationContext for the operation and the second element of the
- returned pair is an Operator to which operation values not passed in
- this call should later be passed.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def operation_stats(self):
- """Reports the number of terminated operations broken down by outcome.
-
- Returns:
- A dictionary from Outcome.Kind value to an integer identifying the number
- of operations that terminated with that outcome kind.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_idle_action(self, action):
- """Adds an action to be called when this End has no ongoing operations.
-
- Args:
- action: A callable that accepts no arguments.
- """
- raise NotImplementedError()
+ self.code = code
+ self.details = details
+
+
+class Outcome(object):
+ """The outcome of an operation.
+
+ Attributes:
+ kind: A Kind value coarsely identifying how the operation terminated.
+ code: An application-specific code value or None if no such value was
+ provided.
+ details: An application-specific details value or None if no such value was
+ provided.
+ """
+
+ @enum.unique
+ class Kind(enum.Enum):
+ """Ways in which an operation can terminate."""
+
+ COMPLETED = 'completed'
+ CANCELLED = 'cancelled'
+ EXPIRED = 'expired'
+ LOCAL_SHUTDOWN = 'local shutdown'
+ REMOTE_SHUTDOWN = 'remote shutdown'
+ RECEPTION_FAILURE = 'reception failure'
+ TRANSMISSION_FAILURE = 'transmission failure'
+ LOCAL_FAILURE = 'local failure'
+ REMOTE_FAILURE = 'remote failure'
+
+
+class Completion(six.with_metaclass(abc.ABCMeta)):
+ """An aggregate of the values exchanged upon operation completion.
+
+ Attributes:
+ terminal_metadata: A terminal metadata value for the operaton.
+ code: A code value for the operation.
+ message: A message value for the operation.
+ """
+
+
+class OperationContext(six.with_metaclass(abc.ABCMeta)):
+ """Provides operation-related information and action."""
+
+ @abc.abstractmethod
+ def outcome(self):
+ """Indicates the operation's outcome (or that the operation is ongoing).
+
+ Returns:
+ None if the operation is still active or the Outcome value for the
+ operation if it has terminated.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_termination_callback(self, callback):
+ """Adds a function to be called upon operation termination.
+
+ Args:
+ callback: A callable to be passed an Outcome value on operation
+ termination.
+
+ Returns:
+ None if the operation has not yet terminated and the passed callback will
+ later be called when it does terminate, or if the operation has already
+ terminated an Outcome value describing the operation termination and the
+ passed callback will not be called as a result of this method call.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the operation.
+
+ Returns:
+ A nonnegative float indicating the length of allowed time in seconds
+ remaining for the operation to complete before it is considered to have
+ timed out. Zero is returned if the operation has terminated.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the operation if the operation has not yet terminated."""
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def fail(self, exception):
+ """Indicates that the operation has failed.
+
+ Args:
+ exception: An exception germane to the operation failure. May be None.
+ """
+ raise NotImplementedError()
+
+
+class Operator(six.with_metaclass(abc.ABCMeta)):
+ """An interface through which to participate in an operation."""
+
+ @abc.abstractmethod
+ def advance(self,
+ initial_metadata=None,
+ payload=None,
+ completion=None,
+ allowance=None):
+ """Progresses the operation.
+
+ Args:
+ initial_metadata: An initial metadata value. Only one may ever be
+ communicated in each direction for an operation, and they must be
+ communicated no later than either the first payload or the completion.
+ payload: A payload value.
+ completion: A Completion value. May only ever be non-None once in either
+ direction, and no payloads may be passed after it has been communicated.
+ allowance: A positive integer communicating the number of additional
+ payloads allowed to be passed by the remote side of the operation.
+ """
+ raise NotImplementedError()
+
+
+class ProtocolReceiver(six.with_metaclass(abc.ABCMeta)):
+ """A means of receiving protocol values during an operation."""
+
+ @abc.abstractmethod
+ def context(self, protocol_context):
+ """Accepts the protocol context object for the operation.
+
+ Args:
+ protocol_context: The protocol context object for the operation.
+ """
+ raise NotImplementedError()
+
+
+class Subscription(six.with_metaclass(abc.ABCMeta)):
+ """Describes customer code's interest in values from the other side.
+
+ Attributes:
+ kind: A Kind value describing the overall kind of this value.
+ termination_callback: A callable to be passed the Outcome associated with
+ the operation after it has terminated. Must be non-None if kind is
+ Kind.TERMINATION_ONLY. Must be None otherwise.
+ allowance: A callable behavior that accepts positive integers representing
+ the number of additional payloads allowed to be passed to the other side
+ of the operation. Must be None if kind is Kind.FULL. Must not be None
+ otherwise.
+ operator: An Operator to be passed values from the other side of the
+ operation. Must be non-None if kind is Kind.FULL. Must be None otherwise.
+ protocol_receiver: A ProtocolReceiver to be passed protocol objects as they
+ become available during the operation. Must be non-None if kind is
+ Kind.FULL.
+ """
+
+ @enum.unique
+ class Kind(enum.Enum):
+
+ NONE = 'none'
+ TERMINATION_ONLY = 'termination only'
+ FULL = 'full'
+
+
+class Servicer(six.with_metaclass(abc.ABCMeta)):
+ """Interface for service implementations."""
+
+ @abc.abstractmethod
+ def service(self, group, method, context, output_operator):
+ """Services an operation.
+
+ Args:
+ group: The group identifier of the operation to be serviced.
+ method: The method identifier of the operation to be serviced.
+ context: An OperationContext object affording contextual information and
+ actions.
+ output_operator: An Operator that will accept output values of the
+ operation.
+
+ Returns:
+ A Subscription via which this object may or may not accept more values of
+ the operation.
+
+ Raises:
+ NoSuchMethodError: If this Servicer does not handle operations with the
+ given group and method.
+ abandonment.Abandoned: If the operation has been aborted and there no
+ longer is any reason to service the operation.
+ """
+ raise NotImplementedError()
+
+
+class End(six.with_metaclass(abc.ABCMeta)):
+ """Common type for entry-point objects on both sides of an operation."""
+
+ @abc.abstractmethod
+ def start(self):
+ """Starts this object's service of operations."""
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stop(self, grace):
+ """Stops this object's service of operations.
+
+ This object will refuse service of new operations as soon as this method is
+ called but operations under way at the time of the call may be given a
+ grace period during which they are allowed to finish.
+
+ Args:
+ grace: A duration of time in seconds to allow ongoing operations to
+ terminate before being forcefully terminated by the stopping of this
+ End. May be zero to terminate all ongoing operations and immediately
+ stop.
+
+ Returns:
+ A threading.Event that will be set to indicate all operations having
+ terminated and this End having completely stopped. The returned event
+ may not be set until after the full grace period (if some ongoing
+ operation continues for the full length of the period) or it may be set
+ much sooner (if for example this End had no operations in progress at
+ the time its stop method was called).
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def operate(self,
+ group,
+ method,
+ subscription,
+ timeout,
+ initial_metadata=None,
+ payload=None,
+ completion=None,
+ protocol_options=None):
+ """Commences an operation.
+
+ Args:
+ group: The group identifier of the invoked operation.
+ method: The method identifier of the invoked operation.
+ subscription: A Subscription to which the results of the operation will be
+ passed.
+ timeout: A length of time in seconds to allow for the operation.
+ initial_metadata: An initial metadata value to be sent to the other side
+ of the operation. May be None if the initial metadata will be later
+ passed via the returned operator or if there will be no initial metadata
+ passed at all.
+ payload: An initial payload for the operation.
+ completion: A Completion value indicating the end of transmission to the
+ other side of the operation.
+ protocol_options: A value specified by the provider of a Base interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A pair of objects affording information about the operation and action
+ continuing the operation. The first element of the returned pair is an
+ OperationContext for the operation and the second element of the
+ returned pair is an Operator to which operation values not passed in
+ this call should later be passed.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def operation_stats(self):
+ """Reports the number of terminated operations broken down by outcome.
+
+ Returns:
+ A dictionary from Outcome.Kind value to an integer identifying the number
+ of operations that terminated with that outcome kind.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_idle_action(self, action):
+ """Adds an action to be called when this End has no ongoing operations.
+
+ Args:
+ action: A callable that accepts no arguments.
+ """
+ raise NotImplementedError()
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/utilities.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
index ad803164ff..281db62b5d 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
@@ -1,71 +1,71 @@
# 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.
-"""Utilities for use with the base interface of RPC Framework."""
-
-import collections
-
-from grpc.framework.interfaces.base import base
-
-
-class _Completion(base.Completion,
+"""Utilities for use with the base interface of RPC Framework."""
+
+import collections
+
+from grpc.framework.interfaces.base import base
+
+
+class _Completion(base.Completion,
collections.namedtuple('_Completion', (
'terminal_metadata',
'code',
'message',
))):
- """A trivial implementation of base.Completion."""
-
-
-class _Subscription(base.Subscription,
- collections.namedtuple('_Subscription', (
+ """A trivial implementation of base.Completion."""
+
+
+class _Subscription(base.Subscription,
+ collections.namedtuple('_Subscription', (
'kind',
'termination_callback',
'allowance',
'operator',
'protocol_receiver',
))):
- """A trivial implementation of base.Subscription."""
-
-
-_NONE_SUBSCRIPTION = _Subscription(base.Subscription.Kind.NONE, None, None,
- None, None)
-
-
-def completion(terminal_metadata, code, message):
- """Creates a base.Completion aggregating the given operation values.
-
- Args:
- terminal_metadata: A terminal metadata value for an operaton.
- code: A code value for an operation.
- message: A message value for an operation.
-
- Returns:
- A base.Completion aggregating the given operation values.
- """
- return _Completion(terminal_metadata, code, message)
-
-
-def full_subscription(operator, protocol_receiver):
- """Creates a "full" base.Subscription for the given base.Operator.
-
- Args:
- operator: A base.Operator to be used in an operation.
- protocol_receiver: A base.ProtocolReceiver to be used in an operation.
-
- Returns:
- A base.Subscription of kind base.Subscription.Kind.FULL wrapping the given
- base.Operator and base.ProtocolReceiver.
- """
- return _Subscription(base.Subscription.Kind.FULL, None, None, operator,
- protocol_receiver)
+ """A trivial implementation of base.Subscription."""
+
+
+_NONE_SUBSCRIPTION = _Subscription(base.Subscription.Kind.NONE, None, None,
+ None, None)
+
+
+def completion(terminal_metadata, code, message):
+ """Creates a base.Completion aggregating the given operation values.
+
+ Args:
+ terminal_metadata: A terminal metadata value for an operaton.
+ code: A code value for an operation.
+ message: A message value for an operation.
+
+ Returns:
+ A base.Completion aggregating the given operation values.
+ """
+ return _Completion(terminal_metadata, code, message)
+
+
+def full_subscription(operator, protocol_receiver):
+ """Creates a "full" base.Subscription for the given base.Operator.
+
+ Args:
+ operator: A base.Operator to be used in an operation.
+ protocol_receiver: A base.ProtocolReceiver to be used in an operation.
+
+ Returns:
+ A base.Subscription of kind base.Subscription.Kind.FULL wrapping the given
+ base.Operator and base.ProtocolReceiver.
+ """
+ return _Subscription(base.Subscription.Kind.FULL, None, None, operator,
+ protocol_receiver)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/__init__.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/face.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/face.py
index fdca20fc2c..5b47f11d0d 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/face.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/face.py
@@ -1,62 +1,62 @@
# 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.
-"""Interfaces defining the Face layer of RPC Framework."""
-
-import abc
-import collections
-import enum
-
-import six
-
-# cardinality, style, abandonment, future, and stream are
-# referenced from specification in this module.
-from grpc.framework.common import cardinality # pylint: disable=unused-import
-from grpc.framework.common import style # pylint: disable=unused-import
-from grpc.framework.foundation import abandonment # pylint: disable=unused-import
-from grpc.framework.foundation import future # pylint: disable=unused-import
-from grpc.framework.foundation import stream # pylint: disable=unused-import
-
+"""Interfaces defining the Face layer of RPC Framework."""
+
+import abc
+import collections
+import enum
+
+import six
+
+# cardinality, style, abandonment, future, and stream are
+# referenced from specification in this module.
+from grpc.framework.common import cardinality # pylint: disable=unused-import
+from grpc.framework.common import style # pylint: disable=unused-import
+from grpc.framework.foundation import abandonment # pylint: disable=unused-import
+from grpc.framework.foundation import future # pylint: disable=unused-import
+from grpc.framework.foundation import stream # pylint: disable=unused-import
+
# pylint: disable=too-many-arguments
-
-
-class NoSuchMethodError(Exception):
- """Raised by customer code to indicate an unrecognized method.
-
- Attributes:
- group: The group of the unrecognized method.
- name: The name of the unrecognized method.
- """
-
- def __init__(self, group, method):
- """Constructor.
-
- Args:
- group: The group identifier of the unrecognized RPC name.
- method: The method identifier of the unrecognized RPC name.
- """
- super(NoSuchMethodError, self).__init__()
- self.group = group
- self.method = method
-
- def __repr__(self):
+
+
+class NoSuchMethodError(Exception):
+ """Raised by customer code to indicate an unrecognized method.
+
+ Attributes:
+ group: The group of the unrecognized method.
+ name: The name of the unrecognized method.
+ """
+
+ def __init__(self, group, method):
+ """Constructor.
+
+ Args:
+ group: The group identifier of the unrecognized RPC name.
+ method: The method identifier of the unrecognized RPC name.
+ """
+ super(NoSuchMethodError, self).__init__()
+ self.group = group
+ self.method = method
+
+ def __repr__(self):
return 'face.NoSuchMethodError(%s, %s)' % (
self.group,
self.method,
)
-
-
-class Abortion(
+
+
+class Abortion(
collections.namedtuple('Abortion', (
'kind',
'initial_metadata',
@@ -64,989 +64,989 @@ class Abortion(
'code',
'details',
))):
- """A value describing RPC abortion.
-
- Attributes:
- kind: A Kind value identifying how the RPC failed.
- initial_metadata: The initial metadata from the other side of the RPC or
- None if no initial metadata value was received.
- terminal_metadata: The terminal metadata from the other side of the RPC or
- None if no terminal metadata value was received.
- code: The code value from the other side of the RPC or None if no code value
- was received.
- details: The details value from the other side of the RPC or None if no
- details value was received.
- """
-
- @enum.unique
- class Kind(enum.Enum):
- """Types of RPC abortion."""
-
- CANCELLED = 'cancelled'
- EXPIRED = 'expired'
- LOCAL_SHUTDOWN = 'local shutdown'
- REMOTE_SHUTDOWN = 'remote shutdown'
- NETWORK_FAILURE = 'network failure'
- LOCAL_FAILURE = 'local failure'
- REMOTE_FAILURE = 'remote failure'
-
-
-class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
- """Common super type for exceptions indicating RPC abortion.
-
- initial_metadata: The initial metadata from the other side of the RPC or
- None if no initial metadata value was received.
- terminal_metadata: The terminal metadata from the other side of the RPC or
- None if no terminal metadata value was received.
- code: The code value from the other side of the RPC or None if no code value
- was received.
- details: The details value from the other side of the RPC or None if no
- details value was received.
- """
-
- def __init__(self, initial_metadata, terminal_metadata, code, details):
- super(AbortionError, self).__init__()
- self.initial_metadata = initial_metadata
- self.terminal_metadata = terminal_metadata
- self.code = code
- self.details = details
-
- def __str__(self):
- return '%s(code=%s, details="%s")' % (self.__class__.__name__,
- self.code, self.details)
-
-
-class CancellationError(AbortionError):
- """Indicates that an RPC has been cancelled."""
-
-
-class ExpirationError(AbortionError):
- """Indicates that an RPC has expired ("timed out")."""
-
-
-class LocalShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to local shutdown of RPCs."""
-
-
-class RemoteShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
-
-
-class NetworkError(AbortionError):
- """Indicates that some error occurred on the network."""
-
-
-class LocalError(AbortionError):
- """Indicates that an RPC has terminated due to a local defect."""
-
-
-class RemoteError(AbortionError):
- """Indicates that an RPC has terminated due to a remote defect."""
-
-
-class RpcContext(six.with_metaclass(abc.ABCMeta)):
- """Provides RPC-related information and action."""
-
- @abc.abstractmethod
- def is_active(self):
- """Describes whether the RPC is active or has terminated."""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the RPC.
-
- Returns:
- A nonnegative float indicating the length of allowed time in seconds
- remaining for the RPC to complete before it is considered to have timed
- out.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def add_abortion_callback(self, abortion_callback):
- """Registers a callback to be called if the RPC is aborted.
-
- Args:
- abortion_callback: A callable to be called and passed an Abortion value
- in the event of RPC abortion.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def cancel(self):
- """Cancels the RPC.
-
- Idempotent and has no effect if the RPC has already terminated.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def protocol_context(self):
- """Accesses a custom object specified by an implementation provider.
-
- Returns:
- A value specified by the provider of a Face interface implementation
- affording custom state and behavior.
- """
- raise NotImplementedError()
-
-
-class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """Invocation-side utility object for an RPC."""
-
- @abc.abstractmethod
- def initial_metadata(self):
- """Accesses the initial metadata from the service-side of the RPC.
-
- This method blocks until the value is available or is known not to have been
- emitted from the service-side of the RPC.
-
- Returns:
- The initial metadata object emitted by the service-side of the RPC, or
- None if there was no such value.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def terminal_metadata(self):
- """Accesses the terminal metadata from the service-side of the RPC.
-
- This method blocks until the value is available or is known not to have been
- emitted from the service-side of the RPC.
-
- Returns:
- The terminal metadata object emitted by the service-side of the RPC, or
- None if there was no such value.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def code(self):
- """Accesses the code emitted by the service-side of the RPC.
-
- This method blocks until the value is available or is known not to have been
- emitted from the service-side of the RPC.
-
- Returns:
- The code object emitted by the service-side of the RPC, or None if there
- was no such value.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def details(self):
- """Accesses the details value emitted by the service-side of the RPC.
-
- This method blocks until the value is available or is known not to have been
- emitted from the service-side of the RPC.
-
- Returns:
- The details value emitted by the service-side of the RPC, or None if there
- was no such value.
- """
- raise NotImplementedError()
-
-
-class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """A context object passed to method implementations."""
-
- @abc.abstractmethod
- def invocation_metadata(self):
- """Accesses the metadata from the invocation-side of the RPC.
-
- This method blocks until the value is available or is known not to have been
- emitted from the invocation-side of the RPC.
-
- Returns:
- The metadata object emitted by the invocation-side of the RPC, or None if
- there was no such value.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Accepts the service-side initial metadata value of the RPC.
-
- This method need not be called by method implementations if they have no
- service-side initial metadata to transmit.
-
- Args:
- initial_metadata: The service-side initial metadata value of the RPC to
- be transmitted to the invocation side of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def terminal_metadata(self, terminal_metadata):
- """Accepts the service-side terminal metadata value of the RPC.
-
- This method need not be called by method implementations if they have no
- service-side terminal metadata to transmit.
-
- Args:
- terminal_metadata: The service-side terminal metadata value of the RPC to
- be transmitted to the invocation side of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def code(self, code):
- """Accepts the service-side code of the RPC.
-
- This method need not be called by method implementations if they have no
- code to transmit.
-
- Args:
- code: The code of the RPC to be transmitted to the invocation side of the
- RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def details(self, details):
- """Accepts the service-side details of the RPC.
-
- This method need not be called by method implementations if they have no
- service-side details to transmit.
-
- Args:
- details: The service-side details value of the RPC to be transmitted to
- the invocation side of the RPC.
- """
- raise NotImplementedError()
-
-
-class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
- """Invocation-side object used to accept the output of an RPC."""
-
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Receives the initial metadata from the service-side of the RPC.
-
- Args:
- initial_metadata: The initial metadata object emitted from the
- service-side of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def response(self, response):
- """Receives a response from the service-side of the RPC.
-
- Args:
- response: A response object emitted from the service-side of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def complete(self, terminal_metadata, code, details):
- """Receives the completion values emitted from the service-side of the RPC.
-
- Args:
- terminal_metadata: The terminal metadata object emitted from the
- service-side of the RPC.
- code: The code object emitted from the service-side of the RPC.
- details: The details object emitted from the service-side of the RPC.
- """
- raise NotImplementedError()
-
-
-class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-unary RPC in any call style."""
-
- @abc.abstractmethod
- def __call__(self,
- request,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
- """Synchronously invokes the underlying RPC.
-
- Args:
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- with_call: Whether or not to include return a Call for the RPC in addition
- to the response.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- The response value for the RPC, and a Call for the RPC if with_call was
- set to True at invocation.
-
- Raises:
- AbortionError: Indicating that the RPC was aborted.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future(self, request, timeout, metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and a future.Future. In the
- event of RPC completion, the return Future's result value will be the
- response value of the RPC. In the event of RPC abortion, the returned
- Future's exception value will be an AbortionError.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(self,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- request: The request value for the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A Call for the RPC.
- """
- raise NotImplementedError()
-
-
-class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-stream RPC in any call style."""
-
- @abc.abstractmethod
- def __call__(self, request, timeout, metadata=None, protocol_options=None):
- """Invokes the underlying RPC.
-
- Args:
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and an iterator of response
- values. Drawing response values from the returned iterator may raise
- AbortionError indicating abortion of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(self,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- request: The request value for the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A Call object for the RPC.
- """
- raise NotImplementedError()
-
-
-class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-unary RPC in any call style."""
-
- @abc.abstractmethod
- def __call__(self,
- request_iterator,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
- """Synchronously invokes the underlying RPC.
-
- Args:
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- with_call: Whether or not to include return a Call for the RPC in addition
- to the response.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- The response value for the RPC, and a Call for the RPC if with_call was
- set to True at invocation.
-
- Raises:
- AbortionError: Indicating that the RPC was aborted.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future(self,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and a future.Future. In the
- event of RPC completion, the return Future's result value will be the
- response value of the RPC. In the event of RPC abortion, the returned
- Future's exception value will be an AbortionError.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(self,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A single object that is both a Call object for the RPC and a
- stream.Consumer to which the request values of the RPC should be passed.
- """
- raise NotImplementedError()
-
-
-class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-stream RPC in any call style."""
-
- @abc.abstractmethod
- def __call__(self,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
- """Invokes the underlying RPC.
-
- Args:
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and an iterator of response
- values. Drawing response values from the returned iterator may raise
- AbortionError indicating abortion of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(self,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
-
- Args:
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of
- the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A single object that is both a Call object for the RPC and a
- stream.Consumer to which the request values of the RPC should be passed.
- """
- raise NotImplementedError()
-
-
-class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A sum type that describes a method implementation.
-
- Attributes:
- cardinality: A cardinality.Cardinality value.
- style: A style.Service value.
- unary_unary_inline: The implementation of the method as a callable value
- that takes a request value and a ServicerContext object and returns a
- response value. Only non-None if cardinality is
- cardinality.Cardinality.UNARY_UNARY and style is style.Service.INLINE.
- unary_stream_inline: The implementation of the method as a callable value
- that takes a request value and a ServicerContext object and returns an
- iterator of response values. Only non-None if cardinality is
- cardinality.Cardinality.UNARY_STREAM and style is style.Service.INLINE.
- stream_unary_inline: The implementation of the method as a callable value
- that takes an iterator of request values and a ServicerContext object and
- returns a response value. Only non-None if cardinality is
- cardinality.Cardinality.STREAM_UNARY and style is style.Service.INLINE.
- stream_stream_inline: The implementation of the method as a callable value
- that takes an iterator of request values and a ServicerContext object and
- returns an iterator of response values. Only non-None if cardinality is
- cardinality.Cardinality.STREAM_STREAM and style is style.Service.INLINE.
- unary_unary_event: The implementation of the method as a callable value that
- takes a request value, a response callback to which to pass the response
- value of the RPC, and a ServicerContext. Only non-None if cardinality is
- cardinality.Cardinality.UNARY_UNARY and style is style.Service.EVENT.
- unary_stream_event: The implementation of the method as a callable value
- that takes a request value, a stream.Consumer to which to pass the
- response values of the RPC, and a ServicerContext. Only non-None if
- cardinality is cardinality.Cardinality.UNARY_STREAM and style is
- style.Service.EVENT.
- stream_unary_event: The implementation of the method as a callable value
- that takes a response callback to which to pass the response value of the
- RPC and a ServicerContext and returns a stream.Consumer to which the
- request values of the RPC should be passed. Only non-None if cardinality
- is cardinality.Cardinality.STREAM_UNARY and style is style.Service.EVENT.
- stream_stream_event: The implementation of the method as a callable value
- that takes a stream.Consumer to which to pass the response values of the
- RPC and a ServicerContext and returns a stream.Consumer to which the
- request values of the RPC should be passed. Only non-None if cardinality
- is cardinality.Cardinality.STREAM_STREAM and style is
- style.Service.EVENT.
- """
-
-
-class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A general type able to service many methods."""
-
- @abc.abstractmethod
- def service(self, group, method, response_consumer, context):
- """Services an RPC.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- response_consumer: A stream.Consumer to be called to accept the response
- values of the RPC.
- context: a ServicerContext object.
-
- Returns:
- A stream.Consumer with which to accept the request values of the RPC. The
- consumer returned from this method may or may not be invoked to
- completion: in the case of RPC abortion, RPC Framework will simply stop
- passing values to this object. Implementations must not assume that this
- object will be called to completion of the request stream or even called
- at all.
-
- Raises:
- abandonment.Abandoned: May or may not be raised when the RPC has been
- aborted.
- NoSuchMethodError: If this MultiMethod does not recognize the given group
- and name for the RPC and is not able to service the RPC.
- """
- raise NotImplementedError()
-
-
-class GenericStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via generic methods."""
-
- @abc.abstractmethod
- def blocking_unary_unary(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
- """Invokes a unary-request-unary-response method.
-
- This method blocks until either returning the response value of the RPC
- (in the event of RPC completion) or raising an exception (in the event of
- RPC abortion).
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- with_call: Whether or not to include return a Call for the RPC in addition
- to the response.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- The response value for the RPC, and a Call for the RPC if with_call was
- set to True at invocation.
-
- Raises:
- AbortionError: Indicating that the RPC was aborted.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_unary_unary(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- protocol_options=None):
- """Invokes a unary-request-unary-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and a future.Future. In the
- event of RPC completion, the return Future's result value will be the
- response value of the RPC. In the event of RPC abortion, the returned
- Future's exception value will be an AbortionError.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_unary_stream(self,
- group,
- method,
- request,
- timeout,
- metadata=None,
- protocol_options=None):
- """Invokes a unary-request-stream-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request: The request value for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and an iterator of response
- values. Drawing response values from the returned iterator may raise
- AbortionError indicating abortion of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def blocking_stream_unary(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- with_call=False,
- protocol_options=None):
- """Invokes a stream-request-unary-response method.
-
- This method blocks until either returning the response value of the RPC
- (in the event of RPC completion) or raising an exception (in the event of
- RPC abortion).
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- with_call: Whether or not to include return a Call for the RPC in addition
- to the response.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- The response value for the RPC, and a Call for the RPC if with_call was
- set to True at invocation.
-
- Raises:
- AbortionError: Indicating that the RPC was aborted.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_stream_unary(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
- """Invokes a stream-request-unary-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and a future.Future. In the
- event of RPC completion, the return Future's result value will be the
- response value of the RPC. In the event of RPC abortion, the returned
- Future's exception value will be an AbortionError.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_stream_stream(self,
- group,
- method,
- request_iterator,
- timeout,
- metadata=None,
- protocol_options=None):
- """Invokes a stream-request-stream-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request_iterator: An iterator that yields request values for the RPC.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- An object that is both a Call for the RPC and an iterator of response
- values. Drawing response values from the returned iterator may raise
- AbortionError indicating abortion of the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_unary(self,
- group,
- method,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request: The request value for the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A Call for the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_stream(self,
- group,
- method,
- request,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- request: The request value for the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A Call for the RPC.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_unary(self,
- group,
- method,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A pair of a Call object for the RPC and a stream.Consumer to which the
- request values of the RPC should be passed.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_stream(self,
- group,
- method,
- receiver,
- abortion_callback,
- timeout,
- metadata=None,
- protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
- receiver: A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback: A callback to be called and passed an Abortion value
- in the event of RPC abortion.
- timeout: A duration of time in seconds to allow for the RPC.
- metadata: A metadata value to be passed to the service-side of the RPC.
- protocol_options: A value specified by the provider of a Face interface
- implementation affording custom state and behavior.
-
- Returns:
- A pair of a Call object for the RPC and a stream.Consumer to which the
- request values of the RPC should be passed.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def unary_unary(self, group, method):
- """Creates a UnaryUnaryMultiCallable for a unary-unary method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
-
- Returns:
- A UnaryUnaryMultiCallable value for the named unary-unary method.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def unary_stream(self, group, method):
- """Creates a UnaryStreamMultiCallable for a unary-stream method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
-
- Returns:
- A UnaryStreamMultiCallable value for the name unary-stream method.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stream_unary(self, group, method):
- """Creates a StreamUnaryMultiCallable for a stream-unary method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
-
- Returns:
- A StreamUnaryMultiCallable value for the named stream-unary method.
- """
- raise NotImplementedError()
-
- @abc.abstractmethod
- def stream_stream(self, group, method):
- """Creates a StreamStreamMultiCallable for a stream-stream method.
-
- Args:
- group: The group identifier of the RPC.
- method: The method identifier of the RPC.
-
- Returns:
- A StreamStreamMultiCallable value for the named stream-stream method.
- """
- raise NotImplementedError()
-
-
-class DynamicStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via attributes corresponding to afforded methods.
-
- Instances of this type may be scoped to a single group so that attribute
- access is unambiguous.
-
- Instances of this type respond to attribute access as follows: if the
- requested attribute is the name of a unary-unary method, the value of the
- attribute will be a UnaryUnaryMultiCallable with which to invoke an RPC; if
- the requested attribute is the name of a unary-stream method, the value of the
- attribute will be a UnaryStreamMultiCallable with which to invoke an RPC; if
- the requested attribute is the name of a stream-unary method, the value of the
- attribute will be a StreamUnaryMultiCallable with which to invoke an RPC; and
- if the requested attribute is the name of a stream-stream method, the value of
- the attribute will be a StreamStreamMultiCallable with which to invoke an RPC.
- """
+ """A value describing RPC abortion.
+
+ Attributes:
+ kind: A Kind value identifying how the RPC failed.
+ initial_metadata: The initial metadata from the other side of the RPC or
+ None if no initial metadata value was received.
+ terminal_metadata: The terminal metadata from the other side of the RPC or
+ None if no terminal metadata value was received.
+ code: The code value from the other side of the RPC or None if no code value
+ was received.
+ details: The details value from the other side of the RPC or None if no
+ details value was received.
+ """
+
+ @enum.unique
+ class Kind(enum.Enum):
+ """Types of RPC abortion."""
+
+ CANCELLED = 'cancelled'
+ EXPIRED = 'expired'
+ LOCAL_SHUTDOWN = 'local shutdown'
+ REMOTE_SHUTDOWN = 'remote shutdown'
+ NETWORK_FAILURE = 'network failure'
+ LOCAL_FAILURE = 'local failure'
+ REMOTE_FAILURE = 'remote failure'
+
+
+class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
+ """Common super type for exceptions indicating RPC abortion.
+
+ initial_metadata: The initial metadata from the other side of the RPC or
+ None if no initial metadata value was received.
+ terminal_metadata: The terminal metadata from the other side of the RPC or
+ None if no terminal metadata value was received.
+ code: The code value from the other side of the RPC or None if no code value
+ was received.
+ details: The details value from the other side of the RPC or None if no
+ details value was received.
+ """
+
+ def __init__(self, initial_metadata, terminal_metadata, code, details):
+ super(AbortionError, self).__init__()
+ self.initial_metadata = initial_metadata
+ self.terminal_metadata = terminal_metadata
+ self.code = code
+ self.details = details
+
+ def __str__(self):
+ return '%s(code=%s, details="%s")' % (self.__class__.__name__,
+ self.code, self.details)
+
+
+class CancellationError(AbortionError):
+ """Indicates that an RPC has been cancelled."""
+
+
+class ExpirationError(AbortionError):
+ """Indicates that an RPC has expired ("timed out")."""
+
+
+class LocalShutdownError(AbortionError):
+ """Indicates that an RPC has terminated due to local shutdown of RPCs."""
+
+
+class RemoteShutdownError(AbortionError):
+ """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
+
+
+class NetworkError(AbortionError):
+ """Indicates that some error occurred on the network."""
+
+
+class LocalError(AbortionError):
+ """Indicates that an RPC has terminated due to a local defect."""
+
+
+class RemoteError(AbortionError):
+ """Indicates that an RPC has terminated due to a remote defect."""
+
+
+class RpcContext(six.with_metaclass(abc.ABCMeta)):
+ """Provides RPC-related information and action."""
+
+ @abc.abstractmethod
+ def is_active(self):
+ """Describes whether the RPC is active or has terminated."""
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the RPC.
+
+ Returns:
+ A nonnegative float indicating the length of allowed time in seconds
+ remaining for the RPC to complete before it is considered to have timed
+ out.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def add_abortion_callback(self, abortion_callback):
+ """Registers a callback to be called if the RPC is aborted.
+
+ Args:
+ abortion_callback: A callable to be called and passed an Abortion value
+ in the event of RPC abortion.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the RPC.
+
+ Idempotent and has no effect if the RPC has already terminated.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def protocol_context(self):
+ """Accesses a custom object specified by an implementation provider.
+
+ Returns:
+ A value specified by the provider of a Face interface implementation
+ affording custom state and behavior.
+ """
+ raise NotImplementedError()
+
+
+class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
+ """Invocation-side utility object for an RPC."""
+
+ @abc.abstractmethod
+ def initial_metadata(self):
+ """Accesses the initial metadata from the service-side of the RPC.
+
+ This method blocks until the value is available or is known not to have been
+ emitted from the service-side of the RPC.
+
+ Returns:
+ The initial metadata object emitted by the service-side of the RPC, or
+ None if there was no such value.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def terminal_metadata(self):
+ """Accesses the terminal metadata from the service-side of the RPC.
+
+ This method blocks until the value is available or is known not to have been
+ emitted from the service-side of the RPC.
+
+ Returns:
+ The terminal metadata object emitted by the service-side of the RPC, or
+ None if there was no such value.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def code(self):
+ """Accesses the code emitted by the service-side of the RPC.
+
+ This method blocks until the value is available or is known not to have been
+ emitted from the service-side of the RPC.
+
+ Returns:
+ The code object emitted by the service-side of the RPC, or None if there
+ was no such value.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def details(self):
+ """Accesses the details value emitted by the service-side of the RPC.
+
+ This method blocks until the value is available or is known not to have been
+ emitted from the service-side of the RPC.
+
+ Returns:
+ The details value emitted by the service-side of the RPC, or None if there
+ was no such value.
+ """
+ raise NotImplementedError()
+
+
+class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
+ """A context object passed to method implementations."""
+
+ @abc.abstractmethod
+ def invocation_metadata(self):
+ """Accesses the metadata from the invocation-side of the RPC.
+
+ This method blocks until the value is available or is known not to have been
+ emitted from the invocation-side of the RPC.
+
+ Returns:
+ The metadata object emitted by the invocation-side of the RPC, or None if
+ there was no such value.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Accepts the service-side initial metadata value of the RPC.
+
+ This method need not be called by method implementations if they have no
+ service-side initial metadata to transmit.
+
+ Args:
+ initial_metadata: The service-side initial metadata value of the RPC to
+ be transmitted to the invocation side of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def terminal_metadata(self, terminal_metadata):
+ """Accepts the service-side terminal metadata value of the RPC.
+
+ This method need not be called by method implementations if they have no
+ service-side terminal metadata to transmit.
+
+ Args:
+ terminal_metadata: The service-side terminal metadata value of the RPC to
+ be transmitted to the invocation side of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def code(self, code):
+ """Accepts the service-side code of the RPC.
+
+ This method need not be called by method implementations if they have no
+ code to transmit.
+
+ Args:
+ code: The code of the RPC to be transmitted to the invocation side of the
+ RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def details(self, details):
+ """Accepts the service-side details of the RPC.
+
+ This method need not be called by method implementations if they have no
+ service-side details to transmit.
+
+ Args:
+ details: The service-side details value of the RPC to be transmitted to
+ the invocation side of the RPC.
+ """
+ raise NotImplementedError()
+
+
+class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
+ """Invocation-side object used to accept the output of an RPC."""
+
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Receives the initial metadata from the service-side of the RPC.
+
+ Args:
+ initial_metadata: The initial metadata object emitted from the
+ service-side of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def response(self, response):
+ """Receives a response from the service-side of the RPC.
+
+ Args:
+ response: A response object emitted from the service-side of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def complete(self, terminal_metadata, code, details):
+ """Receives the completion values emitted from the service-side of the RPC.
+
+ Args:
+ terminal_metadata: The terminal metadata object emitted from the
+ service-side of the RPC.
+ code: The code object emitted from the service-side of the RPC.
+ details: The details object emitted from the service-side of the RPC.
+ """
+ raise NotImplementedError()
+
+
+class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ """Affords invoking a unary-unary RPC in any call style."""
+
+ @abc.abstractmethod
+ def __call__(self,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
+
+ Args:
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ with_call: Whether or not to include return a Call for the RPC in addition
+ to the response.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ The response value for the RPC, and a Call for the RPC if with_call was
+ set to True at invocation.
+
+ Raises:
+ AbortionError: Indicating that the RPC was aborted.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future(self, request, timeout, metadata=None, protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and a future.Future. In the
+ event of RPC completion, the return Future's result value will be the
+ response value of the RPC. In the event of RPC abortion, the returned
+ Future's exception value will be an AbortionError.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ request: The request value for the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A Call for the RPC.
+ """
+ raise NotImplementedError()
+
+
+class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ """Affords invoking a unary-stream RPC in any call style."""
+
+ @abc.abstractmethod
+ def __call__(self, request, timeout, metadata=None, protocol_options=None):
+ """Invokes the underlying RPC.
+
+ Args:
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and an iterator of response
+ values. Drawing response values from the returned iterator may raise
+ AbortionError indicating abortion of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ request: The request value for the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A Call object for the RPC.
+ """
+ raise NotImplementedError()
+
+
+class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ """Affords invoking a stream-unary RPC in any call style."""
+
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
+
+ Args:
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ with_call: Whether or not to include return a Call for the RPC in addition
+ to the response.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ The response value for the RPC, and a Call for the RPC if with_call was
+ set to True at invocation.
+
+ Raises:
+ AbortionError: Indicating that the RPC was aborted.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and a future.Future. In the
+ event of RPC completion, the return Future's result value will be the
+ response value of the RPC. In the event of RPC abortion, the returned
+ Future's exception value will be an AbortionError.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A single object that is both a Call object for the RPC and a
+ stream.Consumer to which the request values of the RPC should be passed.
+ """
+ raise NotImplementedError()
+
+
+class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
+ """Affords invoking a stream-stream RPC in any call style."""
+
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes the underlying RPC.
+
+ Args:
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and an iterator of response
+ values. Drawing response values from the returned iterator may raise
+ AbortionError indicating abortion of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
+
+ Args:
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of
+ the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A single object that is both a Call object for the RPC and a
+ stream.Consumer to which the request values of the RPC should be passed.
+ """
+ raise NotImplementedError()
+
+
+class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
+ """A sum type that describes a method implementation.
+
+ Attributes:
+ cardinality: A cardinality.Cardinality value.
+ style: A style.Service value.
+ unary_unary_inline: The implementation of the method as a callable value
+ that takes a request value and a ServicerContext object and returns a
+ response value. Only non-None if cardinality is
+ cardinality.Cardinality.UNARY_UNARY and style is style.Service.INLINE.
+ unary_stream_inline: The implementation of the method as a callable value
+ that takes a request value and a ServicerContext object and returns an
+ iterator of response values. Only non-None if cardinality is
+ cardinality.Cardinality.UNARY_STREAM and style is style.Service.INLINE.
+ stream_unary_inline: The implementation of the method as a callable value
+ that takes an iterator of request values and a ServicerContext object and
+ returns a response value. Only non-None if cardinality is
+ cardinality.Cardinality.STREAM_UNARY and style is style.Service.INLINE.
+ stream_stream_inline: The implementation of the method as a callable value
+ that takes an iterator of request values and a ServicerContext object and
+ returns an iterator of response values. Only non-None if cardinality is
+ cardinality.Cardinality.STREAM_STREAM and style is style.Service.INLINE.
+ unary_unary_event: The implementation of the method as a callable value that
+ takes a request value, a response callback to which to pass the response
+ value of the RPC, and a ServicerContext. Only non-None if cardinality is
+ cardinality.Cardinality.UNARY_UNARY and style is style.Service.EVENT.
+ unary_stream_event: The implementation of the method as a callable value
+ that takes a request value, a stream.Consumer to which to pass the
+ response values of the RPC, and a ServicerContext. Only non-None if
+ cardinality is cardinality.Cardinality.UNARY_STREAM and style is
+ style.Service.EVENT.
+ stream_unary_event: The implementation of the method as a callable value
+ that takes a response callback to which to pass the response value of the
+ RPC and a ServicerContext and returns a stream.Consumer to which the
+ request values of the RPC should be passed. Only non-None if cardinality
+ is cardinality.Cardinality.STREAM_UNARY and style is style.Service.EVENT.
+ stream_stream_event: The implementation of the method as a callable value
+ that takes a stream.Consumer to which to pass the response values of the
+ RPC and a ServicerContext and returns a stream.Consumer to which the
+ request values of the RPC should be passed. Only non-None if cardinality
+ is cardinality.Cardinality.STREAM_STREAM and style is
+ style.Service.EVENT.
+ """
+
+
+class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
+ """A general type able to service many methods."""
+
+ @abc.abstractmethod
+ def service(self, group, method, response_consumer, context):
+ """Services an RPC.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ response_consumer: A stream.Consumer to be called to accept the response
+ values of the RPC.
+ context: a ServicerContext object.
+
+ Returns:
+ A stream.Consumer with which to accept the request values of the RPC. The
+ consumer returned from this method may or may not be invoked to
+ completion: in the case of RPC abortion, RPC Framework will simply stop
+ passing values to this object. Implementations must not assume that this
+ object will be called to completion of the request stream or even called
+ at all.
+
+ Raises:
+ abandonment.Abandoned: May or may not be raised when the RPC has been
+ aborted.
+ NoSuchMethodError: If this MultiMethod does not recognize the given group
+ and name for the RPC and is not able to service the RPC.
+ """
+ raise NotImplementedError()
+
+
+class GenericStub(six.with_metaclass(abc.ABCMeta)):
+ """Affords RPC invocation via generic methods."""
+
+ @abc.abstractmethod
+ def blocking_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
+
+ This method blocks until either returning the response value of the RPC
+ (in the event of RPC completion) or raising an exception (in the event of
+ RPC abortion).
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ with_call: Whether or not to include return a Call for the RPC in addition
+ to the response.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ The response value for the RPC, and a Call for the RPC if with_call was
+ set to True at invocation.
+
+ Raises:
+ AbortionError: Indicating that the RPC was aborted.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and a future.Future. In the
+ event of RPC completion, the return Future's result value will be the
+ response value of the RPC. In the event of RPC abortion, the returned
+ Future's exception value will be an AbortionError.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_unary_stream(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-stream-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request: The request value for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and an iterator of response
+ values. Drawing response values from the returned iterator may raise
+ AbortionError indicating abortion of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def blocking_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
+
+ This method blocks until either returning the response value of the RPC
+ (in the event of RPC completion) or raising an exception (in the event of
+ RPC abortion).
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ with_call: Whether or not to include return a Call for the RPC in addition
+ to the response.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ The response value for the RPC, and a Call for the RPC if with_call was
+ set to True at invocation.
+
+ Raises:
+ AbortionError: Indicating that the RPC was aborted.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and a future.Future. In the
+ event of RPC completion, the return Future's result value will be the
+ response value of the RPC. In the event of RPC abortion, the returned
+ Future's exception value will be an AbortionError.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_stream_stream(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-stream-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request_iterator: An iterator that yields request values for the RPC.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ An object that is both a Call for the RPC and an iterator of response
+ values. Drawing response values from the returned iterator may raise
+ AbortionError indicating abortion of the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_unary(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request: The request value for the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A Call for the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_stream(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ request: The request value for the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A Call for the RPC.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_unary(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A pair of a Call object for the RPC and a stream.Consumer to which the
+ request values of the RPC should be passed.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_stream(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+ receiver: A ResponseReceiver to be passed the response data of the RPC.
+ abortion_callback: A callback to be called and passed an Abortion value
+ in the event of RPC abortion.
+ timeout: A duration of time in seconds to allow for the RPC.
+ metadata: A metadata value to be passed to the service-side of the RPC.
+ protocol_options: A value specified by the provider of a Face interface
+ implementation affording custom state and behavior.
+
+ Returns:
+ A pair of a Call object for the RPC and a stream.Consumer to which the
+ request values of the RPC should be passed.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def unary_unary(self, group, method):
+ """Creates a UnaryUnaryMultiCallable for a unary-unary method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+
+ Returns:
+ A UnaryUnaryMultiCallable value for the named unary-unary method.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def unary_stream(self, group, method):
+ """Creates a UnaryStreamMultiCallable for a unary-stream method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+
+ Returns:
+ A UnaryStreamMultiCallable value for the name unary-stream method.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stream_unary(self, group, method):
+ """Creates a StreamUnaryMultiCallable for a stream-unary method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+
+ Returns:
+ A StreamUnaryMultiCallable value for the named stream-unary method.
+ """
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def stream_stream(self, group, method):
+ """Creates a StreamStreamMultiCallable for a stream-stream method.
+
+ Args:
+ group: The group identifier of the RPC.
+ method: The method identifier of the RPC.
+
+ Returns:
+ A StreamStreamMultiCallable value for the named stream-stream method.
+ """
+ raise NotImplementedError()
+
+
+class DynamicStub(six.with_metaclass(abc.ABCMeta)):
+ """Affords RPC invocation via attributes corresponding to afforded methods.
+
+ Instances of this type may be scoped to a single group so that attribute
+ access is unambiguous.
+
+ Instances of this type respond to attribute access as follows: if the
+ requested attribute is the name of a unary-unary method, the value of the
+ attribute will be a UnaryUnaryMultiCallable with which to invoke an RPC; if
+ the requested attribute is the name of a unary-stream method, the value of the
+ attribute will be a UnaryStreamMultiCallable with which to invoke an RPC; if
+ the requested attribute is the name of a stream-unary method, the value of the
+ attribute will be a StreamUnaryMultiCallable with which to invoke an RPC; and
+ if the requested attribute is the name of a stream-stream method, the value of
+ the attribute will be a StreamStreamMultiCallable with which to invoke an RPC.
+ """
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/utilities.py b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
index ca018850fe..f27bd67615 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
@@ -1,168 +1,168 @@
# 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.
-"""Utilities for RPC Framework's Face interface."""
-
-import collections
-
-# stream is referenced from specification in this module.
-from grpc.framework.common import cardinality
-from grpc.framework.common import style
-from grpc.framework.foundation import stream # pylint: disable=unused-import
-from grpc.framework.interfaces.face import face
-
-
-class _MethodImplementation(face.MethodImplementation,
- collections.namedtuple('_MethodImplementation', [
- 'cardinality',
- 'style',
- 'unary_unary_inline',
- 'unary_stream_inline',
- 'stream_unary_inline',
- 'stream_stream_inline',
- 'unary_unary_event',
- 'unary_stream_event',
- 'stream_unary_event',
- 'stream_stream_event',
- ])):
- pass
-
-
-def unary_unary_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a unary-unary RPC method as a callable value
- that takes a request value and an face.ServicerContext object and
- returns a response value.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
- style.Service.INLINE, behavior, None, None,
- None, None, None, None, None)
-
-
-def unary_stream_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a unary-stream RPC method as a callable
- value that takes a request value and an face.ServicerContext object and
- returns an iterator of response values.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
- style.Service.INLINE, None, behavior, None,
- None, None, None, None, None)
-
-
-def stream_unary_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a stream-unary RPC method as a callable
- value that takes an iterator of request values and an
- face.ServicerContext object and returns a response value.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
- style.Service.INLINE, None, None, behavior,
- None, None, None, None, None)
-
-
-def stream_stream_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a stream-stream RPC method as a callable
- value that takes an iterator of request values and an
- face.ServicerContext object and returns an iterator of response values.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
- style.Service.INLINE, None, None, None,
- behavior, None, None, None, None)
-
-
-def unary_unary_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a unary-unary RPC method as a callable
- value that takes a request value, a response callback to which to pass
- the response value of the RPC, and an face.ServicerContext.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
- style.Service.EVENT, None, None, None, None,
- behavior, None, None, None)
-
-
-def unary_stream_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a unary-stream RPC method as a callable
- value that takes a request value, a stream.Consumer to which to pass the
- the response values of the RPC, and an face.ServicerContext.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
- style.Service.EVENT, None, None, None, None,
- None, behavior, None, None)
-
-
-def stream_unary_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a stream-unary RPC method as a callable
- value that takes a response callback to which to pass the response value
- of the RPC and an face.ServicerContext and returns a stream.Consumer to
- which the request values of the RPC should be passed.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
- style.Service.EVENT, None, None, None, None,
- None, None, behavior, None)
-
-
-def stream_stream_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
-
- Args:
- behavior: The implementation of a stream-stream RPC method as a callable
- value that takes a stream.Consumer to which to pass the response values
- of the RPC and an face.ServicerContext and returns a stream.Consumer to
- which the request values of the RPC should be passed.
-
- Returns:
- An face.MethodImplementation derived from the given behavior.
- """
- return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
- style.Service.EVENT, None, None, None, None,
- None, None, None, behavior)
+"""Utilities for RPC Framework's Face interface."""
+
+import collections
+
+# stream is referenced from specification in this module.
+from grpc.framework.common import cardinality
+from grpc.framework.common import style
+from grpc.framework.foundation import stream # pylint: disable=unused-import
+from grpc.framework.interfaces.face import face
+
+
+class _MethodImplementation(face.MethodImplementation,
+ collections.namedtuple('_MethodImplementation', [
+ 'cardinality',
+ 'style',
+ 'unary_unary_inline',
+ 'unary_stream_inline',
+ 'stream_unary_inline',
+ 'stream_stream_inline',
+ 'unary_unary_event',
+ 'unary_stream_event',
+ 'stream_unary_event',
+ 'stream_stream_event',
+ ])):
+ pass
+
+
+def unary_unary_inline(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a unary-unary RPC method as a callable value
+ that takes a request value and an face.ServicerContext object and
+ returns a response value.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
+ style.Service.INLINE, behavior, None, None,
+ None, None, None, None, None)
+
+
+def unary_stream_inline(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a unary-stream RPC method as a callable
+ value that takes a request value and an face.ServicerContext object and
+ returns an iterator of response values.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
+ style.Service.INLINE, None, behavior, None,
+ None, None, None, None, None)
+
+
+def stream_unary_inline(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a stream-unary RPC method as a callable
+ value that takes an iterator of request values and an
+ face.ServicerContext object and returns a response value.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
+ style.Service.INLINE, None, None, behavior,
+ None, None, None, None, None)
+
+
+def stream_stream_inline(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a stream-stream RPC method as a callable
+ value that takes an iterator of request values and an
+ face.ServicerContext object and returns an iterator of response values.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
+ style.Service.INLINE, None, None, None,
+ behavior, None, None, None, None)
+
+
+def unary_unary_event(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a unary-unary RPC method as a callable
+ value that takes a request value, a response callback to which to pass
+ the response value of the RPC, and an face.ServicerContext.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
+ style.Service.EVENT, None, None, None, None,
+ behavior, None, None, None)
+
+
+def unary_stream_event(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a unary-stream RPC method as a callable
+ value that takes a request value, a stream.Consumer to which to pass the
+ the response values of the RPC, and an face.ServicerContext.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
+ style.Service.EVENT, None, None, None, None,
+ None, behavior, None, None)
+
+
+def stream_unary_event(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a stream-unary RPC method as a callable
+ value that takes a response callback to which to pass the response value
+ of the RPC and an face.ServicerContext and returns a stream.Consumer to
+ which the request values of the RPC should be passed.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
+ style.Service.EVENT, None, None, None, None,
+ None, None, behavior, None)
+
+
+def stream_stream_event(behavior):
+ """Creates an face.MethodImplementation for the given behavior.
+
+ Args:
+ behavior: The implementation of a stream-stream RPC method as a callable
+ value that takes a stream.Consumer to which to pass the response values
+ of the RPC and an face.ServicerContext and returns a stream.Consumer to
+ which the request values of the RPC should be passed.
+
+ Returns:
+ An face.MethodImplementation derived from the given behavior.
+ """
+ return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
+ style.Service.EVENT, None, None, None, None,
+ None, None, None, behavior)
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc_core_dependencies.py b/contrib/libs/grpc/src/python/grpcio/grpc_core_dependencies.py
index 27bbc873bb..67f985e1f4 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc_core_dependencies.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc_core_dependencies.py
@@ -1,20 +1,20 @@
# 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.
-
-# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_core_dependencies.py.template`!!!
-
-CORE_SOURCE_FILES = [
+
+# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_core_dependencies.py.template`!!!
+
+CORE_SOURCE_FILES = [
'src/core/ext/filters/census/grpc_context.cc',
'src/core/ext/filters/client_channel/backend_metric.cc',
'src/core/ext/filters/client_channel/backup_poller.cc',
@@ -931,7 +931,7 @@ CORE_SOURCE_FILES = [
'third_party/zlib/trees.c',
'third_party/zlib/uncompr.c',
'third_party/zlib/zutil.c',
-]
+]
ASM_SOURCE_FILES = {
'crypto_ios_aarch64': [
diff --git a/contrib/libs/grpc/src/python/grpcio/grpc_version.py b/contrib/libs/grpc/src/python/grpcio/grpc_version.py
index 86deb1034e..9237f14e2f 100644
--- a/contrib/libs/grpc/src/python/grpcio/grpc_version.py
+++ b/contrib/libs/grpc/src/python/grpcio/grpc_version.py
@@ -1,17 +1,17 @@
# 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.
-
-# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
-
+
+# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
+
VERSION = '1.33.2'
diff --git a/contrib/libs/grpc/src/python/grpcio/support.py b/contrib/libs/grpc/src/python/grpcio/support.py
index c6dc992db0..217f3cb9ed 100644
--- a/contrib/libs/grpc/src/python/grpcio/support.py
+++ b/contrib/libs/grpc/src/python/grpcio/support.py
@@ -1,118 +1,118 @@
# Copyright 2016 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.
-
-import os
-import os.path
-import shutil
-import sys
-import tempfile
-
-from distutils import errors
-
-import commands
-
-C_PYTHON_DEV = """
-#include <Python.h>
-int main(int argc, char **argv) { return 0; }
-"""
-C_PYTHON_DEV_ERROR_MESSAGE = """
-Could not find <Python.h>. This could mean the following:
+
+import os
+import os.path
+import shutil
+import sys
+import tempfile
+
+from distutils import errors
+
+import commands
+
+C_PYTHON_DEV = """
+#include <Python.h>
+int main(int argc, char **argv) { return 0; }
+"""
+C_PYTHON_DEV_ERROR_MESSAGE = """
+Could not find <Python.h>. This could mean the following:
* You're on Ubuntu and haven't run `apt-get install <PY_REPR>-dev`.
* You're on RHEL/Fedora and haven't run `yum install <PY_REPR>-devel` or
`dnf install <PY_REPR>-devel` (make sure you also have redhat-rpm-config
- installed)
- * You're on Mac OS X and the usual Python framework was somehow corrupted
- (check your environment variables or try re-installing?)
- * You're on Windows and your Python installation was somehow corrupted
- (check your environment variables or try re-installing?)
-"""
+ installed)
+ * You're on Mac OS X and the usual Python framework was somehow corrupted
+ (check your environment variables or try re-installing?)
+ * You're on Windows and your Python installation was somehow corrupted
+ (check your environment variables or try re-installing?)
+"""
if sys.version_info[0] == 2:
PYTHON_REPRESENTATION = 'python'
elif sys.version_info[0] == 3:
PYTHON_REPRESENTATION = 'python3'
else:
raise NotImplementedError('Unsupported Python version: %s' % sys.version)
-
-C_CHECKS = {
+
+C_CHECKS = {
C_PYTHON_DEV:
C_PYTHON_DEV_ERROR_MESSAGE.replace('<PY_REPR>', PYTHON_REPRESENTATION),
-}
-
-
-def _compile(compiler, source_string):
- tempdir = tempfile.mkdtemp()
- cpath = os.path.join(tempdir, 'a.c')
- with open(cpath, 'w') as cfile:
- cfile.write(source_string)
- try:
- compiler.compile([cpath])
- except errors.CompileError as error:
- return error
- finally:
- shutil.rmtree(tempdir)
-
-
-def _expect_compile(compiler, source_string, error_message):
- if _compile(compiler, source_string) is not None:
- sys.stderr.write(error_message)
- raise commands.CommandError(
+}
+
+
+def _compile(compiler, source_string):
+ tempdir = tempfile.mkdtemp()
+ cpath = os.path.join(tempdir, 'a.c')
+ with open(cpath, 'w') as cfile:
+ cfile.write(source_string)
+ try:
+ compiler.compile([cpath])
+ except errors.CompileError as error:
+ return error
+ finally:
+ shutil.rmtree(tempdir)
+
+
+def _expect_compile(compiler, source_string, error_message):
+ if _compile(compiler, source_string) is not None:
+ sys.stderr.write(error_message)
+ raise commands.CommandError(
"Diagnostics found a compilation environment issue:\n{}".format(
error_message))
-
-
-def diagnose_compile_error(build_ext, error):
- """Attempt to diagnose an error during compilation."""
- for c_check, message in C_CHECKS.items():
- _expect_compile(build_ext.compiler, c_check, message)
- python_sources = [
- source for source in build_ext.get_source_files()
- if source.startswith('./src/python') and source.endswith('c')
- ]
- for source in python_sources:
- if not os.path.isfile(source):
- raise commands.CommandError((
- "Diagnostics found a missing Python extension source file:\n{}\n\n"
- "This is usually because the Cython sources haven't been transpiled "
- "into C yet and you're building from source.\n"
- "Try setting the environment variable "
- "`GRPC_PYTHON_BUILD_WITH_CYTHON=1` when invoking `setup.py` or "
- "when using `pip`, e.g.:\n\n"
- "pip install -rrequirements.txt\n"
- "GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .").format(source))
-
-
-def diagnose_attribute_error(build_ext, error):
- if any('_needs_stub' in arg for arg in error.args):
- raise commands.CommandError(
- "We expect a missing `_needs_stub` attribute from older versions of "
- "setuptools. Consider upgrading setuptools.")
-
-
-_ERROR_DIAGNOSES = {
- errors.CompileError: diagnose_compile_error,
+
+
+def diagnose_compile_error(build_ext, error):
+ """Attempt to diagnose an error during compilation."""
+ for c_check, message in C_CHECKS.items():
+ _expect_compile(build_ext.compiler, c_check, message)
+ python_sources = [
+ source for source in build_ext.get_source_files()
+ if source.startswith('./src/python') and source.endswith('c')
+ ]
+ for source in python_sources:
+ if not os.path.isfile(source):
+ raise commands.CommandError((
+ "Diagnostics found a missing Python extension source file:\n{}\n\n"
+ "This is usually because the Cython sources haven't been transpiled "
+ "into C yet and you're building from source.\n"
+ "Try setting the environment variable "
+ "`GRPC_PYTHON_BUILD_WITH_CYTHON=1` when invoking `setup.py` or "
+ "when using `pip`, e.g.:\n\n"
+ "pip install -rrequirements.txt\n"
+ "GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .").format(source))
+
+
+def diagnose_attribute_error(build_ext, error):
+ if any('_needs_stub' in arg for arg in error.args):
+ raise commands.CommandError(
+ "We expect a missing `_needs_stub` attribute from older versions of "
+ "setuptools. Consider upgrading setuptools.")
+
+
+_ERROR_DIAGNOSES = {
+ errors.CompileError: diagnose_compile_error,
AttributeError: diagnose_attribute_error,
-}
-
-
-def diagnose_build_ext_error(build_ext, error, formatted):
- diagnostic = _ERROR_DIAGNOSES.get(type(error))
- if diagnostic is None:
- raise commands.CommandError(
+}
+
+
+def diagnose_build_ext_error(build_ext, error, formatted):
+ diagnostic = _ERROR_DIAGNOSES.get(type(error))
+ if diagnostic is None:
+ raise commands.CommandError(
"\n\nWe could not diagnose your build failure. If you are unable to "
"proceed, please file an issue at http://www.github.com/grpc/grpc "
"with `[Python install]` in the title; please attach the whole log "
"(including everything that may have appeared above the Python "
"backtrace).\n\n{}".format(formatted))
- else:
- diagnostic(build_ext, error)
+ else:
+ diagnostic(build_ext, error)
diff --git a/contrib/libs/grpc/src/python/grpcio/ya.make b/contrib/libs/grpc/src/python/grpcio/ya.make
index eec8e3dc3f..5cdb0230c4 100644
--- a/contrib/libs/grpc/src/python/grpcio/ya.make
+++ b/contrib/libs/grpc/src/python/grpcio/ya.make
@@ -1,5 +1,5 @@
PY23_LIBRARY()
-
+
LICENSE(Apache-2.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
@@ -9,12 +9,12 @@ OWNER(
g:contrib
g:cpp-contrib
)
-
-PEERDIR(
+
+PEERDIR(
contrib/libs/grpc/grpc
- contrib/python/six
-)
-
+ contrib/python/six
+)
+
IF (PYTHON2)
PEERDIR(
contrib/python/enum34
@@ -27,7 +27,7 @@ ADDINCL(
contrib/libs/grpc
contrib/libs/grpc/include
)
-
+
IF (SANITIZER_TYPE == undefined)
# https://github.com/grpc/grpc/blob/v1.15.1/tools/bazel.rc#L43
CXXFLAGS(-fno-sanitize=function)
@@ -36,16 +36,16 @@ ENDIF()
NO_LINT()
NO_COMPILER_WARNINGS()
-
-PY_SRCS(
- TOP_LEVEL
+
+PY_SRCS(
+ TOP_LEVEL
grpc/__init__.py
- grpc/_auth.py
- grpc/_channel.py
- grpc/_common.py
+ grpc/_auth.py
+ grpc/_channel.py
+ grpc/_common.py
grpc/_compression.py
grpc/_cython/__init__.py
- grpc/_cython/_cygrpc/__init__.py
+ grpc/_cython/_cygrpc/__init__.py
grpc/_cython/cygrpc.pyx
grpc/_grpcio_metadata.py
grpc/_interceptor.py
@@ -65,24 +65,24 @@ PY_SRCS(
grpc/experimental/session_cache.py
grpc/framework/__init__.py
grpc/framework/common/__init__.py
- grpc/framework/common/cardinality.py
- grpc/framework/common/style.py
+ grpc/framework/common/cardinality.py
+ grpc/framework/common/style.py
grpc/framework/foundation/__init__.py
- grpc/framework/foundation/abandonment.py
- grpc/framework/foundation/callable_util.py
- grpc/framework/foundation/future.py
- grpc/framework/foundation/logging_pool.py
- grpc/framework/foundation/stream.py
- grpc/framework/foundation/stream_util.py
+ grpc/framework/foundation/abandonment.py
+ grpc/framework/foundation/callable_util.py
+ grpc/framework/foundation/future.py
+ grpc/framework/foundation/logging_pool.py
+ grpc/framework/foundation/stream.py
+ grpc/framework/foundation/stream_util.py
grpc/framework/interfaces/__init__.py
grpc/framework/interfaces/base/__init__.py
- grpc/framework/interfaces/base/base.py
- grpc/framework/interfaces/base/utilities.py
+ grpc/framework/interfaces/base/base.py
+ grpc/framework/interfaces/base/utilities.py
grpc/framework/interfaces/face/__init__.py
- grpc/framework/interfaces/face/face.py
- grpc/framework/interfaces/face/utilities.py
-)
-
+ grpc/framework/interfaces/face/face.py
+ grpc/framework/interfaces/face/utilities.py
+)
+
IF (PYTHON3)
PY_SRCS(
TOP_LEVEL
@@ -102,4 +102,4 @@ IF (PYTHON3)
)
ENDIF()
-END()
+END()
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/README.rst b/contrib/libs/grpc/src/python/grpcio_health_checking/README.rst
index 7da751e4ad..044377a582 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/README.rst
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/README.rst
@@ -1,8 +1,8 @@
-gRPC Python Health Checking
-===========================
-
-Reference package for GRPC Python health checking.
-
+gRPC Python Health Checking
+===========================
+
+Reference package for GRPC Python health checking.
+
Supported Python Versions
-------------------------
Python >= 3.5
@@ -11,7 +11,7 @@ Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
-Dependencies
-------------
-
-Depends on the `grpcio` package, available from PyPI via `pip install grpcio`.
+Dependencies
+------------
+
+Depends on the `grpcio` package, available from PyPI via `pip install grpcio`.
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/__init__.py b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/__init__.py b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/__init__.py
index 1841020f80..5fb4f3c3cf 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/__init__.py
@@ -1,11 +1,11 @@
# 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.
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/health.py b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/health.py
index b1eacb03e7..f7ee639ec8 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/health.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_health/v1/health.py
@@ -1,26 +1,26 @@
# 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.
-"""Reference implementation for health checking in gRPC Python."""
-
+"""Reference implementation for health checking in gRPC Python."""
+
import collections
-import threading
+import threading
import sys
-import grpc
-
+import grpc
+
from grpc_health.v1 import health_pb2 as _health_pb2
from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc
-
+
if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
# Exposes AsyncHealthServicer as public API.
from . import _async as aio # pylint: disable=unused-import
@@ -29,7 +29,7 @@ if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name
# The entry of overall health for the entire server.
OVERALL_HEALTH = ''
-
+
class _Watcher():
@@ -79,8 +79,8 @@ def _watcher_to_send_response_callback_adapter(watcher):
class HealthServicer(_health_pb2_grpc.HealthServicer):
- """Servicer handling RPCs for service statuses."""
-
+ """Servicer handling RPCs for service statuses."""
+
def __init__(self,
experimental_non_blocking=True,
experimental_thread_pool=None):
@@ -90,7 +90,7 @@ class HealthServicer(_health_pb2_grpc.HealthServicer):
self.Watch.__func__.experimental_non_blocking = experimental_non_blocking
self.Watch.__func__.experimental_thread_pool = experimental_thread_pool
self._gracefully_shutting_down = False
-
+
def _on_close_callback(self, send_response_callback, service):
def callback():
@@ -101,15 +101,15 @@ class HealthServicer(_health_pb2_grpc.HealthServicer):
return callback
- def Check(self, request, context):
+ def Check(self, request, context):
with self._lock:
- status = self._server_status.get(request.service)
- if status is None:
- context.set_code(grpc.StatusCode.NOT_FOUND)
+ status = self._server_status.get(request.service)
+ if status is None:
+ context.set_code(grpc.StatusCode.NOT_FOUND)
return _health_pb2.HealthCheckResponse()
- else:
+ else:
return _health_pb2.HealthCheckResponse(status=status)
-
+
# pylint: disable=arguments-differ
def Watch(self, request, context, send_response_callback=None):
blocking_watcher = None
@@ -134,9 +134,9 @@ class HealthServicer(_health_pb2_grpc.HealthServicer):
self._on_close_callback(send_response_callback, service))
return blocking_watcher
- def set(self, service, status):
- """Sets the status of a service.
-
+ def set(self, service, status):
+ """Sets the status of a service.
+
Args:
service: string, the name of the service.
status: HealthCheckResponse.status enum value indicating the status of
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_version.py b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_version.py
index 2d43a84a03..f676be1068 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_version.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/grpc_version.py
@@ -1,17 +1,17 @@
# Copyright 2016 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.
-
-# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
-
+
+# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
+
VERSION = '1.33.2'
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/health_commands.py b/contrib/libs/grpc/src/python/grpcio_health_checking/health_commands.py
index a26b76dfa4..874dec7343 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/health_commands.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/health_commands.py
@@ -1,66 +1,66 @@
# 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.
-"""Provides distutils command classes for the GRPC Python setup process."""
-
-import os
-import shutil
-
-import setuptools
-
-ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
-HEALTH_PROTO = os.path.join(ROOT_DIR, '../../proto/grpc/health/v1/health.proto')
+"""Provides distutils command classes for the GRPC Python setup process."""
+
+import os
+import shutil
+
+import setuptools
+
+ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
+HEALTH_PROTO = os.path.join(ROOT_DIR, '../../proto/grpc/health/v1/health.proto')
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
-
-
+
+
class Preprocess(setuptools.Command):
"""Command to copy proto modules from grpc/src/proto and LICENSE from
the root directory"""
-
- description = ''
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- if os.path.isfile(HEALTH_PROTO):
+
+ description = ''
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ if os.path.isfile(HEALTH_PROTO):
shutil.copyfile(
HEALTH_PROTO,
os.path.join(ROOT_DIR, 'grpc_health/v1/health.proto'))
if os.path.isfile(LICENSE):
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
-
-
-class BuildPackageProtos(setuptools.Command):
- """Command to generate project *_pb2.py modules from proto files."""
-
- description = 'build grpc protobuf modules'
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- # due to limitations of the proto generator, we require that only *one*
- # directory is provided as an 'include' directory. We assume it's the '' key
- # to `self.distribution.package_dir` (and get a key error if it's not
- # there).
- from grpc_tools import command
- command.build_package_protos(self.distribution.package_dir[''])
+
+
+class BuildPackageProtos(setuptools.Command):
+ """Command to generate project *_pb2.py modules from proto files."""
+
+ description = 'build grpc protobuf modules'
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ # due to limitations of the proto generator, we require that only *one*
+ # directory is provided as an 'include' directory. We assume it's the '' key
+ # to `self.distribution.package_dir` (and get a key error if it's not
+ # there).
+ from grpc_tools import command
+ command.build_package_protos(self.distribution.package_dir[''])
diff --git a/contrib/libs/grpc/src/python/grpcio_health_checking/setup.py b/contrib/libs/grpc/src/python/grpcio_health_checking/setup.py
index c104a61db6..fa1fbbd55a 100644
--- a/contrib/libs/grpc/src/python/grpcio_health_checking/setup.py
+++ b/contrib/libs/grpc/src/python/grpcio_health_checking/setup.py
@@ -1,31 +1,31 @@
# 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.
-"""Setup module for the GRPC Python package's optional health checking."""
-
-import os
-
-import setuptools
-
+"""Setup module for the GRPC Python package's optional health checking."""
+
+import os
+
+import setuptools
+
_PACKAGE_PATH = os.path.realpath(os.path.dirname(__file__))
_README_PATH = os.path.join(_PACKAGE_PATH, 'README.rst')
-# Ensure we're in the proper directory whether or not we're being used by pip.
-os.chdir(os.path.dirname(os.path.abspath(__file__)))
-
+# Ensure we're in the proper directory whether or not we're being used by pip.
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
# Break import-style to ensure we can actually find our local modules.
-import grpc_version
-
+import grpc_version
+
class _NoOpCommand(setuptools.Command):
"""No-op command."""
@@ -58,15 +58,15 @@ CLASSIFIERS = [
'License :: OSI Approved :: Apache Software License',
]
-PACKAGE_DIRECTORIES = {
- '': '.',
-}
-
+PACKAGE_DIRECTORIES = {
+ '': '.',
+}
+
INSTALL_REQUIRES = (
'protobuf>=3.6.0',
'grpcio>={version}'.format(version=grpc_version.VERSION),
)
-
+
try:
import health_commands as _health_commands
# we are in the build environment, otherwise the above import fails
@@ -84,7 +84,7 @@ except ImportError:
'preprocess': _NoOpCommand,
'build_package_protos': _NoOpCommand,
}
-
+
setuptools.setup(name='grpcio-health-checking',
version=grpc_version.VERSION,
description='Standard Health Checking Service for gRPC',
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/__init__.py b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/__init__.py
index 232e21ff9e..5772620b60 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/__init__.py
@@ -1,11 +1,11 @@
# Copyright 2016 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.
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py
index 232e21ff9e..5772620b60 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py
@@ -1,11 +1,11 @@
# Copyright 2016 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.
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
index b1b16fdeab..b302cea241 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
@@ -1,54 +1,54 @@
# Copyright 2016 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.
-"""Reference implementation for reflection in gRPC Python."""
-
+"""Reference implementation for reflection in gRPC Python."""
+
import sys
-import grpc
-
+import grpc
+
from src.proto.grpc.reflection.v1alpha import reflection_pb2 as _reflection_pb2
from src.proto.grpc.reflection.v1alpha import reflection_pb2_grpc as _reflection_pb2_grpc
-
+
from grpc_reflection.v1alpha._base import BaseReflectionServicer
SERVICE_NAME = _reflection_pb2.DESCRIPTOR.services_by_name[
'ServerReflection'].full_name
-
-
+
+
class ReflectionServicer(BaseReflectionServicer):
- """Servicer handling RPCs for service statuses."""
-
- def ServerReflectionInfo(self, request_iterator, context):
+ """Servicer handling RPCs for service statuses."""
+
+ def ServerReflectionInfo(self, request_iterator, context):
# pylint: disable=unused-argument
- for request in request_iterator:
- if request.HasField('file_by_filename'):
- yield self._file_by_filename(request.file_by_filename)
- elif request.HasField('file_containing_symbol'):
- yield self._file_containing_symbol(
- request.file_containing_symbol)
- elif request.HasField('file_containing_extension'):
- yield self._file_containing_extension(
- request.file_containing_extension.containing_type,
- request.file_containing_extension.extension_number)
- elif request.HasField('all_extension_numbers_of_type'):
+ for request in request_iterator:
+ if request.HasField('file_by_filename'):
+ yield self._file_by_filename(request.file_by_filename)
+ elif request.HasField('file_containing_symbol'):
+ yield self._file_containing_symbol(
+ request.file_containing_symbol)
+ elif request.HasField('file_containing_extension'):
+ yield self._file_containing_extension(
+ request.file_containing_extension.containing_type,
+ request.file_containing_extension.extension_number)
+ elif request.HasField('all_extension_numbers_of_type'):
yield self._all_extension_numbers_of_type(
- request.all_extension_numbers_of_type)
- elif request.HasField('list_services'):
- yield self._list_services()
- else:
+ request.all_extension_numbers_of_type)
+ elif request.HasField('list_services'):
+ yield self._list_services()
+ else:
yield _reflection_pb2.ServerReflectionResponse(
error_response=_reflection_pb2.ErrorResponse(
- error_code=grpc.StatusCode.INVALID_ARGUMENT.value[0],
+ error_code=grpc.StatusCode.INVALID_ARGUMENT.value[0],
error_message=grpc.StatusCode.INVALID_ARGUMENT.value[1].
encode(),
))
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_version.py b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_version.py
index e65d110596..676511118a 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/grpc_version.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/grpc_version.py
@@ -1,17 +1,17 @@
# Copyright 2016 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.
-
-# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
-
+
+# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
+
VERSION = '1.33.2'
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/reflection_commands.py b/contrib/libs/grpc/src/python/grpcio_reflection/reflection_commands.py
index b8492c913f..311ca4c4db 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/reflection_commands.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/reflection_commands.py
@@ -1,68 +1,68 @@
# Copyright 2016 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.
-"""Provides distutils command classes for the GRPC Python setup process."""
-
-import os
-import shutil
-
-import setuptools
-
-ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
+"""Provides distutils command classes for the GRPC Python setup process."""
+
+import os
+import shutil
+
+import setuptools
+
+ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
REFLECTION_PROTO = os.path.join(
- ROOT_DIR, '../../proto/grpc/reflection/v1alpha/reflection.proto')
+ ROOT_DIR, '../../proto/grpc/reflection/v1alpha/reflection.proto')
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
-
-
+
+
class Preprocess(setuptools.Command):
"""Command to copy proto modules from grpc/src/proto and LICENSE from
the root directory"""
-
- description = ''
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
+
+ description = ''
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
if os.path.isfile(REFLECTION_PROTO):
- shutil.copyfile(
+ shutil.copyfile(
REFLECTION_PROTO,
- os.path.join(ROOT_DIR,
- 'grpc_reflection/v1alpha/reflection.proto'))
+ os.path.join(ROOT_DIR,
+ 'grpc_reflection/v1alpha/reflection.proto'))
if os.path.isfile(LICENSE):
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
-
-
-class BuildPackageProtos(setuptools.Command):
- """Command to generate project *_pb2.py modules from proto files."""
-
- description = 'build grpc protobuf modules'
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- # due to limitations of the proto generator, we require that only *one*
- # directory is provided as an 'include' directory. We assume it's the '' key
- # to `self.distribution.package_dir` (and get a key error if it's not
- # there).
- from grpc_tools import command
- command.build_package_protos(self.distribution.package_dir[''])
+
+
+class BuildPackageProtos(setuptools.Command):
+ """Command to generate project *_pb2.py modules from proto files."""
+
+ description = 'build grpc protobuf modules'
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ # due to limitations of the proto generator, we require that only *one*
+ # directory is provided as an 'include' directory. We assume it's the '' key
+ # to `self.distribution.package_dir` (and get a key error if it's not
+ # there).
+ from grpc_tools import command
+ command.build_package_protos(self.distribution.package_dir[''])
diff --git a/contrib/libs/grpc/src/python/grpcio_reflection/setup.py b/contrib/libs/grpc/src/python/grpcio_reflection/setup.py
index 9fe618d278..2d0a3fcdaa 100644
--- a/contrib/libs/grpc/src/python/grpcio_reflection/setup.py
+++ b/contrib/libs/grpc/src/python/grpcio_reflection/setup.py
@@ -1,32 +1,32 @@
# Copyright 2016 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.
-"""Setup module for the GRPC Python package's optional reflection."""
-
-import os
-import sys
-
-import setuptools
-
+"""Setup module for the GRPC Python package's optional reflection."""
+
+import os
+import sys
+
+import setuptools
+
_PACKAGE_PATH = os.path.realpath(os.path.dirname(__file__))
_README_PATH = os.path.join(_PACKAGE_PATH, 'README.rst')
-# Ensure we're in the proper directory whether or not we're being used by pip.
-os.chdir(os.path.dirname(os.path.abspath(__file__)))
-
+# Ensure we're in the proper directory whether or not we're being used by pip.
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
# Break import-style to ensure we can actually find our local modules.
-import grpc_version
-
+import grpc_version
+
class _NoOpCommand(setuptools.Command):
"""No-op command."""
@@ -59,15 +59,15 @@ CLASSIFIERS = [
'License :: OSI Approved :: Apache Software License',
]
-PACKAGE_DIRECTORIES = {
- '': '.',
-}
-
+PACKAGE_DIRECTORIES = {
+ '': '.',
+}
+
INSTALL_REQUIRES = (
'protobuf>=3.6.0',
'grpcio>={version}'.format(version=grpc_version.VERSION),
)
-
+
try:
import reflection_commands as _reflection_commands
# we are in the build environment, otherwise the above import fails
@@ -85,7 +85,7 @@ except ImportError:
'preprocess': _NoOpCommand,
'build_package_protos': _NoOpCommand,
}
-
+
setuptools.setup(name='grpcio-reflection',
version=grpc_version.VERSION,
license='Apache License 2.0',
diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc
index 3cc1568332..66b731e296 100644
--- a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/any.proto
-#include <google/protobuf/any.pb.h>
+#include <google/protobuf/any.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc
index 7b5bc2b7cb..b2e14d1836 100644
--- a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/api.proto
-#include <google/protobuf/api.pb.h>
+#include <google/protobuf/api.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.h b/contrib/libs/protobuf/src/google/protobuf/api.pb.h
index 6dd8aa33e3..09482c7fee 100644
--- a/contrib/libs/protobuf/src/google/protobuf/api.pb.h
+++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.h
@@ -31,8 +31,8 @@
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
-#include <google/protobuf/source_context.pb.h>
-#include <google/protobuf/type.pb.h>
+#include <google/protobuf/source_context.pb.h>
+#include <google/protobuf/type.pb.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fapi_2eproto PROTOBUF_EXPORT
diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc
index 4b68fff7c3..2e91b7c1ab 100644
--- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/descriptor.proto
-#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/descriptor.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.proto b/contrib/libs/protobuf/src/google/protobuf/descriptor.proto
index 879f3f84cf..156e410ae1 100644
--- a/contrib/libs/protobuf/src/google/protobuf/descriptor.proto
+++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.proto
@@ -502,7 +502,7 @@ message MessageOptions {
// maps field.
//
// For maps fields:
- // map<KeyType, ValueType> map_field = 1;
+ // map<KeyType, ValueType> map_field = 1;
// The parsed descriptor looks like:
// message MapFieldEntry {
// option map_entry = true;
diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc
index 8dd623f26c..2f02356645 100644
--- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/duration.proto
-#include <google/protobuf/duration.pb.h>
+#include <google/protobuf/duration.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc
index 24471fb9a5..96ee74a8e2 100644
--- a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/empty.proto
-#include <google/protobuf/empty.pb.h>
+#include <google/protobuf/empty.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc
index d05a7bc1be..d073936d83 100644
--- a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/field_mask.proto
-#include <google/protobuf/field_mask.pb.h>
+#include <google/protobuf/field_mask.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc
index aabddd706f..1181ba87a5 100644
--- a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/source_context.proto
-#include <google/protobuf/source_context.pb.h>
+#include <google/protobuf/source_context.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc
index 42926bced7..0baf5b842a 100644
--- a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
-#include <google/protobuf/struct.pb.h>
+#include <google/protobuf/struct.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.proto b/contrib/libs/protobuf/src/google/protobuf/struct.proto
index 350216893a..545215c252 100644
--- a/contrib/libs/protobuf/src/google/protobuf/struct.proto
+++ b/contrib/libs/protobuf/src/google/protobuf/struct.proto
@@ -50,7 +50,7 @@ option objc_class_prefix = "GPB";
// The JSON representation for `Struct` is JSON object.
message Struct {
// Unordered map of dynamically typed values.
- map<string, Value> fields = 1;
+ map<string, Value> fields = 1;
}
// `Value` represents a dynamically typed value which can be either
diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc
index 9b07a8cf48..c74a97372f 100644
--- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/timestamp.proto
-#include <google/protobuf/timestamp.pb.h>
+#include <google/protobuf/timestamp.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc
index d818b79580..1de2532e3b 100644
--- a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/type.proto
-#include <google/protobuf/type.pb.h>
+#include <google/protobuf/type.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.h b/contrib/libs/protobuf/src/google/protobuf/type.pb.h
index d9a73e092a..a99c06d180 100644
--- a/contrib/libs/protobuf/src/google/protobuf/type.pb.h
+++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.h
@@ -32,8 +32,8 @@
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
-#include <google/protobuf/any.pb.h>
-#include <google/protobuf/source_context.pb.h>
+#include <google/protobuf/any.pb.h>
+#include <google/protobuf/source_context.pb.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftype_2eproto PROTOBUF_EXPORT
diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc
index d1466528fa..128ddfc409 100644
--- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc
+++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc
@@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/wrappers.proto
-#include <google/protobuf/wrappers.pb.h>
+#include <google/protobuf/wrappers.pb.h>
#include <algorithm>
diff --git a/contrib/libs/protobuf/ya.make b/contrib/libs/protobuf/ya.make
index 53d1ee36e5..044e24badd 100644
--- a/contrib/libs/protobuf/ya.make
+++ b/contrib/libs/protobuf/ya.make
@@ -38,11 +38,11 @@ CFLAGS(
-DHAVE_PTHREAD=1
-DHAVE_ZLIB=1
)
-
+
IF (OS_ANDROID)
EXTRALIBS(log)
ENDIF()
-
+
SRCS(
GLOBAL src/google/protobuf/generated_message_util.cc
src/google/protobuf/any.cc
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h
index 5dcdd58d5e..6da6c31dad 100644
--- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h
+++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h
@@ -32,7 +32,7 @@
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
-#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/descriptor.pb.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fcompiler_2fplugin_2eproto PROTOC_EXPORT
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc
index 5976ed7906..471cc46ef6 100644
--- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc
+++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc
@@ -70,11 +70,11 @@ namespace python {
namespace {
TProtoStringType FixEv(const TProtoStringType& filename) {
- if (HasSuffixString(filename, ".ev")) {
- return StripSuffixString(filename, ".ev") + "_ev.proto";
- }
- return filename;
-}
+ if (HasSuffixString(filename, ".ev")) {
+ return StripSuffixString(filename, ".ev") + "_ev.proto";
+ }
+ return filename;
+}
// Returns the Python module name expected for a given .proto filename.
TProtoStringType ModuleName(const TProtoStringType& filename) {
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make
index 245e2424f3..9c4640fdcf 100644
--- a/contrib/libs/ya.make
+++ b/contrib/libs/ya.make
@@ -42,7 +42,7 @@ RECURSE(
courgette_bsdiff
cppkafka
crcutil
- crfsuite
+ crfsuite
croaring
ctemplate
curl
@@ -93,8 +93,8 @@ RECURSE(
googleapis-common-protos
gost-engine
gpsd
- grpc
- grpc/python
+ grpc
+ grpc/python
grpc/src/proto
gtfs_realtime
h3
@@ -116,7 +116,7 @@ RECURSE(
isa-l
isa-l/ut
jansson
- jdk
+ jdk
jemalloc
jemalloc/dynamic
jerasure
@@ -129,7 +129,7 @@ RECURSE(
kissfft
kyotocabinet
lang_detect
- lbfgs
+ lbfgs
lcms2
lepton
leveldb
@@ -182,7 +182,7 @@ RECURSE(
libsavi
libsodium
libspf2
- libsrtp
+ libsrtp
libssh2
libtapi
libtess2
@@ -201,7 +201,7 @@ RECURSE(
libxml/dynamic
libxslt
libyang
- libyuv
+ libyuv
linenoise
linux-headers
linuxvdso
@@ -266,7 +266,7 @@ RECURSE(
pcre
pcre2
pdqsort
- pffft
+ pffft
pfr
picohttpparser
#pire/ut
@@ -305,7 +305,7 @@ RECURSE(
sparrowhawk
sparsehash
spdk
- speex
+ speex
spirv_cross
spirv_headers
spirv_tools
@@ -343,14 +343,14 @@ RECURSE(
tralics
tree_sitter
uatraits
- usrsctp
+ usrsctp
utf8proc
util-linux
valgrind
vlfeat
vmaf
wapiti
- webrtc
+ webrtc
websocketpp
woff2
xdelta3
diff --git a/contrib/python/PyYAML/py2/yaml/scanner.py b/contrib/python/PyYAML/py2/yaml/scanner.py
index b5eec641a8..587b73d8b4 100644
--- a/contrib/python/PyYAML/py2/yaml/scanner.py
+++ b/contrib/python/PyYAML/py2/yaml/scanner.py
@@ -26,8 +26,8 @@
__all__ = ['Scanner', 'ScannerError']
-import sys
-
+import sys
+
from error import MarkedYAMLError
from tokens import *
@@ -1222,10 +1222,10 @@ class Scanner(object):
"expected escape sequence of %d hexdecimal numbers, but found %r" %
(length, self.peek(k).encode('utf-8')), self.get_mark())
code = int(self.prefix(length), 16)
- if code <= sys.maxunicode:
- chunks.append(unichr(code))
- else:
- chunks.append(('\\U%08x' % code).decode('unicode-escape'))
+ if code <= sys.maxunicode:
+ chunks.append(unichr(code))
+ else:
+ chunks.append(('\\U%08x' % code).decode('unicode-escape'))
self.forward(length)
elif ch in u'\r\n\x85\u2028\u2029':
self.scan_line_break()
diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
index 6663fe825b..8b41ca47dd 100644
--- a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
+++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc
@@ -822,7 +822,7 @@ PyObject* ToStringObject(const FieldDescriptor* descriptor,
}
return result;
#else
- return PyBytes_FromStringAndSize(value.c_str(), value.length());
+ return PyBytes_FromStringAndSize(value.c_str(), value.length());
#endif
}
diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
index 6663fe825b..8b41ca47dd 100644
--- a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
+++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc
@@ -822,7 +822,7 @@ PyObject* ToStringObject(const FieldDescriptor* descriptor,
}
return result;
#else
- return PyBytes_FromStringAndSize(value.c_str(), value.length());
+ return PyBytes_FromStringAndSize(value.c_str(), value.length());
#endif
}
diff --git a/contrib/python/ya.make b/contrib/python/ya.make
index ced6e24768..d01ced9f3a 100644
--- a/contrib/python/ya.make
+++ b/contrib/python/ya.make
@@ -334,7 +334,7 @@ RECURSE(
elasticsearch
elasticsearch-dsl
email-validator
- emoji
+ emoji
entrypoints
enum34
environ-config
@@ -362,7 +362,7 @@ RECURSE(
fastapi
fastapi-utils
fastdtw
- fasteners
+ fasteners
fastjsonschema
fastsnmp
faulthandler
@@ -471,7 +471,7 @@ RECURSE(
h11
h2
h3
- h5py
+ h5py
hammock
hexdump
hijri-converter
@@ -630,8 +630,8 @@ RECURSE(
MongoDBProxy
mongoengine
mongolock
- mongomock
- monotonic
+ mongomock
+ monotonic
more-itertools
moto
moto/standalone
@@ -814,7 +814,7 @@ RECURSE(
pyelftools/readelf
pyfakefs
pyflakes
- pyfst
+ pyfst
pygit2
PyGithub
Pygments
@@ -913,7 +913,7 @@ RECURSE(
python-rapidjson
python-saml
python-slugify
- python-telegram-bot
+ python-telegram-bot
python-utils
python3-saml
pytils
@@ -986,7 +986,7 @@ RECURSE(
semantic-version
semver
Send2Trash
- sentinels
+ sentinels
sentry-sdk
service-identity
setproctitle
diff --git a/contrib/restricted/ya.make b/contrib/restricted/ya.make
index 1e02ffaa9f..b52a206733 100644
--- a/contrib/restricted/ya.make
+++ b/contrib/restricted/ya.make
@@ -51,7 +51,7 @@ RECURSE(
protoc-c
protozero
range-v3
- rnnoise
+ rnnoise
rubberband
spdlog
thrift
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
index 43107caf1d..cd96aa0565 100644
--- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
+++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
@@ -50,14 +50,14 @@ namespace NPlugins {
return basename.append(".pb.cc");
}
- bool IsLiteRuntimeMessage(const Descriptor* desc) {
- return desc->file() != NULL && desc->file()->options().optimize_for() == google::protobuf::FileOptions::LITE_RUNTIME;
- }
-
- bool IsAutogeneratedNestedType(const Descriptor* desc) {
- return desc->options().map_entry();
- }
-
+ bool IsLiteRuntimeMessage(const Descriptor* desc) {
+ return desc->file() != NULL && desc->file()->options().optimize_for() == google::protobuf::FileOptions::LITE_RUNTIME;
+ }
+
+ bool IsAutogeneratedNestedType(const Descriptor* desc) {
+ return desc->options().map_entry();
+ }
+
class TFieldExtGenerator {
public:
TFieldExtGenerator(const FieldDescriptor* field)
@@ -121,82 +121,82 @@ namespace NPlugins {
}
};
- class TMapFieldExtGenerator: public TFieldExtGenerator {
- public:
- TMapFieldExtGenerator(const FieldDescriptor* field)
- : TFieldExtGenerator(field)
- , Key_(field->message_type()->FindFieldByName("key"))
- , Val_(field->message_type()->FindFieldByName("value"))
- {
- Variables_["key_cpp"] = PrimitiveTypeName(Key_->cpp_type());
-
- switch (Val_->cpp_type()) {
- case FieldDescriptor::CPPTYPE_MESSAGE:
+ class TMapFieldExtGenerator: public TFieldExtGenerator {
+ public:
+ TMapFieldExtGenerator(const FieldDescriptor* field)
+ : TFieldExtGenerator(field)
+ , Key_(field->message_type()->FindFieldByName("key"))
+ , Val_(field->message_type()->FindFieldByName("value"))
+ {
+ Variables_["key_cpp"] = PrimitiveTypeName(Key_->cpp_type());
+
+ switch (Val_->cpp_type()) {
+ case FieldDescriptor::CPPTYPE_MESSAGE:
Variables_["val_cpp"] = QualifiedClassName(Val_->message_type());
- break;
- case FieldDescriptor::CPPTYPE_ENUM:
- Variables_["val_cpp"] = ClassName(Val_->enum_type(), true);
- break;
- default:
- Variables_["val_cpp"] = PrimitiveTypeName(Val_->cpp_type());
- }
- }
-
- void GenerateAccessorDeclarations(io::Printer* printer) {
- printer->Print(Variables_,
+ break;
+ case FieldDescriptor::CPPTYPE_ENUM:
+ Variables_["val_cpp"] = ClassName(Val_->enum_type(), true);
+ break;
+ default:
+ Variables_["val_cpp"] = PrimitiveTypeName(Val_->cpp_type());
+ }
+ }
+
+ void GenerateAccessorDeclarations(io::Printer* printer) {
+ printer->Print(Variables_,
"inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$rname$() const { return $name$(); }\n"
"inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$rname$() { return mutable_$name$(); }\n");
- if (Variables_.end() != Variables_.find("RName"))
- printer->Print(Variables_,
+ if (Variables_.end() != Variables_.find("RName"))
+ printer->Print(Variables_,
"inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$RName$() const { return $name$(); }\n"
"inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$RName$() { return mutable_$name$(); }\n");
- }
-
- void GenerateKeyValuePrinting(io::Printer* printer, const char* scopeName, bool isKey) {
- const FieldDescriptor* desc = isKey ? Key_ : Val_;
-
- switch(desc->cpp_type()) {
- case FieldDescriptor::CPPTYPE_STRING:
+ }
+
+ void GenerateKeyValuePrinting(io::Printer* printer, const char* scopeName, bool isKey) {
+ const FieldDescriptor* desc = isKey ? Key_ : Val_;
+
+ switch(desc->cpp_type()) {
+ case FieldDescriptor::CPPTYPE_STRING:
printer->Print(TString::Join("::google::protobuf::io::PrintJSONString(out, ", scopeName , ");\n").data());
- break;
- case FieldDescriptor::CPPTYPE_ENUM:
+ break;
+ case FieldDescriptor::CPPTYPE_ENUM:
printer->Print(TString::Join("out << int(", scopeName, ");\n").data());
- break;
- case FieldDescriptor::CPPTYPE_MESSAGE:
+ break;
+ case FieldDescriptor::CPPTYPE_MESSAGE:
printer->Print(TString::Join(scopeName, ".PrintJSON(out);\n").data());
- break;
- default:
- if (isKey) {
+ break;
+ default:
+ if (isKey) {
printer->Print(TString::Join("out << '\"' << ", scopeName, " << '\"';\n").data());
- } else {
+ } else {
printer->Print(TString::Join("out << ", scopeName, ";\n").data());
- }
- }
- }
-
- void GenerateJSONPrinting(io::Printer* printer) {
- printer->Print(Variables_,
- "out << '{';\n"
- "const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& map = Get$rname$();\n"
- "for (auto it = map.begin(); it != map.end(); ++it) {\n"
- );
- printer->Indent();
- printer->Print("if (it != map.begin()) { out << ','; }\n");
-
- GenerateKeyValuePrinting(printer, "it->first", true);
- printer->Print("out << ':';\n");
- GenerateKeyValuePrinting(printer, "it->second", false);
-
- printer->Outdent();
- printer->Print("}\n");
- printer->Print("out << '}';\n");
- }
-
- private:
- const FieldDescriptor* Key_;
- const FieldDescriptor* Val_;
- };
-
+ }
+ }
+ }
+
+ void GenerateJSONPrinting(io::Printer* printer) {
+ printer->Print(Variables_,
+ "out << '{';\n"
+ "const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& map = Get$rname$();\n"
+ "for (auto it = map.begin(); it != map.end(); ++it) {\n"
+ );
+ printer->Indent();
+ printer->Print("if (it != map.begin()) { out << ','; }\n");
+
+ GenerateKeyValuePrinting(printer, "it->first", true);
+ printer->Print("out << ':';\n");
+ GenerateKeyValuePrinting(printer, "it->second", false);
+
+ printer->Outdent();
+ printer->Print("}\n");
+ printer->Print("out << '}';\n");
+ }
+
+ private:
+ const FieldDescriptor* Key_;
+ const FieldDescriptor* Val_;
+ };
+
class TRepeatedMessageFieldExtGenerator: public TFieldExtGenerator {
public:
TRepeatedMessageFieldExtGenerator(const FieldDescriptor* field)
@@ -584,37 +584,37 @@ namespace NPlugins {
TProtoStringType type_traits_;
};
- class TOneofGenerator {
- public:
- TOneofGenerator(const OneofDescriptor* Descriptor_)
- : Descriptor_(Descriptor_)
- {
- Variables_["camel_oneof_name"] = UnderscoresToCamelCase(Descriptor_->name(), true);
- Variables_["rname"] = Descriptor_->name();
- }
-
- void GenerateDeclarations(io::Printer* printer) const {
- printer->Print(Variables_, "$camel_oneof_name$Case Get$rname$Case() const { return $rname$_case(); }\n");
- printer->Print(Variables_, "void Clear$rname$() { clear_$rname$(); }\n");
+ class TOneofGenerator {
+ public:
+ TOneofGenerator(const OneofDescriptor* Descriptor_)
+ : Descriptor_(Descriptor_)
+ {
+ Variables_["camel_oneof_name"] = UnderscoresToCamelCase(Descriptor_->name(), true);
+ Variables_["rname"] = Descriptor_->name();
+ }
+
+ void GenerateDeclarations(io::Printer* printer) const {
+ printer->Print(Variables_, "$camel_oneof_name$Case Get$rname$Case() const { return $rname$_case(); }\n");
+ printer->Print(Variables_, "void Clear$rname$() { clear_$rname$(); }\n");
if (Descriptor_->name() != UnderscoresToCamelCase(Descriptor_->name(), true)) {
printer->Print(Variables_, "$camel_oneof_name$Case Get$camel_oneof_name$Case() const { return $rname$_case(); }\n");
printer->Print(Variables_, "void Clear$camel_oneof_name$() { clear_$rname$(); }\n");
}
- }
-
- private:
- const OneofDescriptor* Descriptor_;
- TVariables Variables_;
- };
-
+ }
+
+ private:
+ const OneofDescriptor* Descriptor_;
+ TVariables Variables_;
+ };
+
TFieldExtGenerator* MakeGenerator(const FieldDescriptor* field) {
if (field->is_repeated()) {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
- if (field->is_map()) {
- return new TMapFieldExtGenerator(field);
- }
+ if (field->is_map()) {
+ return new TMapFieldExtGenerator(field);
+ }
return new TRepeatedMessageFieldExtGenerator(field);
case FieldDescriptor::CPPTYPE_BOOL:
return new TRepeatedBoolFieldExtGenerator(field);
@@ -660,10 +660,10 @@ namespace NPlugins {
, Classname_(ClassName(descriptor, false))
, OutputDirectory_(outputDirectory)
{
- for (int i = 0, idx = 0; i < descriptor->nested_type_count(); i++) {
- if (!IsAutogeneratedNestedType(descriptor->nested_type(i))) {
+ for (int i = 0, idx = 0; i < descriptor->nested_type_count(); i++) {
+ if (!IsAutogeneratedNestedType(descriptor->nested_type(i))) {
NestedGenerators_.emplace_back(descriptor->nested_type(i), OutputDirectory_);
- }
+ }
}
FieldGenerators_.reserve(descriptor->field_count());
@@ -675,11 +675,11 @@ namespace NPlugins {
for (int i = 0; i < descriptor->extension_count(); i++) {
ExtensionGenerators_.emplace_back(descriptor->extension(i));
}
-
+
OneofGenerators_.reserve(descriptor->real_oneof_decl_count());
for (int i = 0; i < descriptor->real_oneof_decl_count(); i++) {
OneofGenerators_.emplace_back(descriptor->oneof_decl(i));
- }
+ }
}
void GenerateClassDefinitionExtension() {
@@ -774,11 +774,11 @@ namespace NPlugins {
}
for (auto& oneofGenerator: OneofGenerators_) {
oneofGenerator.GenerateDeclarations(&printer);
- }
+ }
TVariables vars;
vars["class"] = ClassName(Descriptor_, false);
- if (!IsLiteRuntimeMessage(Descriptor_)) {
- printer.Print("TProtoStringType ShortUtf8DebugString() const;\n");
+ if (!IsLiteRuntimeMessage(Descriptor_)) {
+ printer.Print("TProtoStringType ShortUtf8DebugString() const;\n");
printer.Print("void PrintJSON(IOutputStream&) const override;\n");
printer.Print(vars, "::google::protobuf::io::TAsJSON<$class$> AsJSON() const {\n");
@@ -821,13 +821,13 @@ namespace NPlugins {
TVariables vars;
vars["class"] = Classname_;
- if (!IsLiteRuntimeMessage(Descriptor_)) {
- printer.Print("// Yandex-specific extension\n");
- printer.Print(vars, "TProtoStringType $class$::ShortUtf8DebugString() const {\n");
- printer.Print(" return ::ShortUtf8DebugString(*this);\n");
- printer.Print("}\n");
- printer.Print("// End of Yandex-specific extension\n");
- }
+ if (!IsLiteRuntimeMessage(Descriptor_)) {
+ printer.Print("// Yandex-specific extension\n");
+ printer.Print(vars, "TProtoStringType $class$::ShortUtf8DebugString() const {\n");
+ printer.Print(" return ::ShortUtf8DebugString(*this);\n");
+ printer.Print("}\n");
+ printer.Print("// End of Yandex-specific extension\n");
+ }
}
void GenerateJSONImplementation() {
@@ -857,15 +857,15 @@ namespace NPlugins {
SetCommonFieldVariables(field, &vars);
if (field->is_repeated()) {
- // map or repeated field in both proto3 and proto2 syntax
+ // map or repeated field in both proto3 and proto2 syntax
printer.Print(vars, "if ($rname$Size() > 0) {\n");
} else if (field->has_presence()) {
- // any optional or required field in proto2 syntax
- // message-field or any oneof field in proto3 syntax
- printer.Print(vars, "if (Has$rname$()) {\n");
+ // any optional or required field in proto2 syntax
+ // message-field or any oneof field in proto3 syntax
+ printer.Print(vars, "if (Has$rname$()) {\n");
} else {
- // string, enum or primitive field in proto3 syntax
- printer.Print(vars, "if (Get$rname$()) {\n");
+ // string, enum or primitive field in proto3 syntax
+ printer.Print(vars, "if (Get$rname$()) {\n");
}
printer.Indent();
@@ -889,16 +889,16 @@ namespace NPlugins {
std::unique_ptr<io::ZeroCopyOutputStream> output(
OutputDirectory_->OpenForInsert(fileName, scope));
io::Printer printer(output.get(), '$');
- if (!IsLiteRuntimeMessage(Descriptor_)) {
- printer.Print("// Yandex debug output extension\n");
- TVariables vars;
- vars["class"] = ClassName(Descriptor_, true);
- printer.Print("template<>\n");
+ if (!IsLiteRuntimeMessage(Descriptor_)) {
+ printer.Print("// Yandex debug output extension\n");
+ TVariables vars;
+ vars["class"] = ClassName(Descriptor_, true);
+ printer.Print("template<>\n");
printer.Print(vars, "void Out< $class$>(IOutputStream& out, const $class$& msg) {\n");
- printer.Print(" out << \"{ \" << msg.ShortUtf8DebugString() << \" }\";\n");
- printer.Print("}\n");
- printer.Print("// End of Yandex debug output extension\n");
- }
+ printer.Print(" out << \"{ \" << msg.ShortUtf8DebugString() << \" }\";\n");
+ printer.Print("}\n");
+ printer.Print("// End of Yandex debug output extension\n");
+ }
}
void GenerateTypedefOutput(bool nested) {
diff --git a/contrib/tools/protoc/plugins/grpc_python/ya.make b/contrib/tools/protoc/plugins/grpc_python/ya.make
index 73d60e7846..1852d8b6fd 100644
--- a/contrib/tools/protoc/plugins/grpc_python/ya.make
+++ b/contrib/tools/protoc/plugins/grpc_python/ya.make
@@ -2,7 +2,7 @@
# Generated by devtools/yamaker.
OWNER(akastornov g:contrib g:cpp-contrib)
-
+
IF (USE_PREBUILT_TOOLS)
INCLUDE(${ARCADIA_ROOT}/build/prebuilt/contrib/tools/protoc/plugins/grpc_python/ya.make.prebuilt)
ENDIF()
@@ -10,7 +10,7 @@ ENDIF()
IF (NOT PREBUILT)
INCLUDE(${ARCADIA_ROOT}/contrib/tools/protoc/plugins/grpc_python/bin/ya.make)
ENDIF()
-
+
RECURSE(
bin
)
diff --git a/contrib/tools/ya.make b/contrib/tools/ya.make
index a209734c49..750911c587 100644
--- a/contrib/tools/ya.make
+++ b/contrib/tools/ya.make
@@ -51,7 +51,7 @@ RECURSE(
yasm
ycmd
zookeeper
- jdk
+ jdk
jdk/test
xmllint
)
diff --git a/library/cpp/messagebus/monitoring/ya.make b/library/cpp/messagebus/monitoring/ya.make
index 7834b786b8..25782492b1 100644
--- a/library/cpp/messagebus/monitoring/ya.make
+++ b/library/cpp/messagebus/monitoring/ya.make
@@ -1,4 +1,4 @@
-PROTO_LIBRARY()
+PROTO_LIBRARY()
OWNER(g:messagebus)
diff --git a/library/python/pytest/yatest_tools.py b/library/python/pytest/yatest_tools.py
index f9f54aab5a..6b8b896394 100644
--- a/library/python/pytest/yatest_tools.py
+++ b/library/python/pytest/yatest_tools.py
@@ -51,34 +51,34 @@ class Subtest(object):
class SubtestInfo(object):
- skipped_prefix = '[SKIPPED] '
-
+ skipped_prefix = '[SKIPPED] '
+
@classmethod
def from_str(cls, s):
- if s.startswith(SubtestInfo.skipped_prefix):
- s = s[len(SubtestInfo.skipped_prefix):]
- skipped = True
-
- else:
- skipped = False
-
- return SubtestInfo(*s.rsplit(TEST_SUBTEST_SEPARATOR, 1), skipped=skipped)
-
- def __init__(self, test, subtest="", skipped=False, **kwargs):
+ if s.startswith(SubtestInfo.skipped_prefix):
+ s = s[len(SubtestInfo.skipped_prefix):]
+ skipped = True
+
+ else:
+ skipped = False
+
+ return SubtestInfo(*s.rsplit(TEST_SUBTEST_SEPARATOR, 1), skipped=skipped)
+
+ def __init__(self, test, subtest="", skipped=False, **kwargs):
self.test = test
self.subtest = subtest
- self.skipped = skipped
+ self.skipped = skipped
for key, value in kwargs.iteritems():
setattr(self, key, value)
def __str__(self):
- s = ''
+ s = ''
+
+ if self.skipped:
+ s += SubtestInfo.skipped_prefix
+
+ return s + TEST_SUBTEST_SEPARATOR.join([self.test, self.subtest])
- if self.skipped:
- s += SubtestInfo.skipped_prefix
-
- return s + TEST_SUBTEST_SEPARATOR.join([self.test, self.subtest])
-
def __repr__(self):
return str(self)
@@ -229,7 +229,7 @@ def escape_for_fnmatch(s):
def get_python_cmd(opts=None, use_huge=True, suite=None):
- if opts and getattr(opts, 'flags', {}).get("USE_ARCADIA_PYTHON") == "no":
+ if opts and getattr(opts, 'flags', {}).get("USE_ARCADIA_PYTHON") == "no":
return ["python"]
if suite and not suite._use_arcadia_python:
return ["python"]
diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py
index 1eccd97cde..a8bcc21f51 100644
--- a/library/python/testing/yatest_common/yatest/common/process.py
+++ b/library/python/testing/yatest_common/yatest/common/process.py
@@ -29,8 +29,8 @@ MAX_MESSAGE_LEN = 1500
SANITIZER_ERROR_PATTERN = br": ([A-Z][\w]+Sanitizer)"
GLIBC_PATTERN = re.compile(r"\S+@GLIBC_([0-9.]+)")
yatest_logger = logging.getLogger("ya.test")
-
-
+
+
def truncate(s, size):
if s is None:
return None
@@ -625,7 +625,7 @@ def wait_for(check_function, timeout, fail_message="", sleep_time=1.0, on_check_
message += ": {}".format(fail_message)
raise TimeoutError(truncate(message, MAX_MESSAGE_LEN))
-
+
def _kill_process_tree(process_pid, target_pid_signal=None):
"""
Kills child processes, req. Note that psutil should be installed
diff --git a/library/python/testing/yatest_common/yatest/common/runtime.py b/library/python/testing/yatest_common/yatest/common/runtime.py
index 064923c9ce..e55e193446 100644
--- a/library/python/testing/yatest_common/yatest/common/runtime.py
+++ b/library/python/testing/yatest_common/yatest/common/runtime.py
@@ -77,15 +77,15 @@ def build_path(path=None):
return _join_path(_get_ya_plugin_instance().build_root, path)
-def java_path():
- """
+def java_path():
+ """
[DEPRECATED] Get path to java
- :return: absolute path to java
- """
+ :return: absolute path to java
+ """
from . import runtime_java
- return runtime_java.get_java_path(binary_path(os.path.join('contrib', 'tools', 'jdk')))
-
-
+ return runtime_java.get_java_path(binary_path(os.path.join('contrib', 'tools', 'jdk')))
+
+
def java_home():
"""
Get jdk directory path
diff --git a/library/python/testing/yatest_common/yatest/common/runtime_java.py b/library/python/testing/yatest_common/yatest/common/runtime_java.py
index 88d27b8b79..39bbb45570 100644
--- a/library/python/testing/yatest_common/yatest/common/runtime_java.py
+++ b/library/python/testing/yatest_common/yatest/common/runtime_java.py
@@ -1,30 +1,30 @@
-import os
-import tarfile
-import contextlib
-
+import os
+import tarfile
+import contextlib
+
from . import runtime
-
+
_JAVA_DIR = []
-def get_java_path(jdk_dir):
+def get_java_path(jdk_dir):
# deprecated - to be deleted
- java_paths = (os.path.join(jdk_dir, 'bin', 'java'), os.path.join(jdk_dir, 'bin', 'java.exe'))
-
- for p in java_paths:
- if os.path.exists(p):
- return p
-
- for f in os.listdir(jdk_dir):
- if f.endswith('.tar'):
- with contextlib.closing(tarfile.open(os.path.join(jdk_dir, f))) as tf:
- tf.extractall(jdk_dir)
-
- for p in java_paths:
- if os.path.exists(p):
- return p
-
- return ''
+ java_paths = (os.path.join(jdk_dir, 'bin', 'java'), os.path.join(jdk_dir, 'bin', 'java.exe'))
+
+ for p in java_paths:
+ if os.path.exists(p):
+ return p
+
+ for f in os.listdir(jdk_dir):
+ if f.endswith('.tar'):
+ with contextlib.closing(tarfile.open(os.path.join(jdk_dir, f))) as tf:
+ tf.extractall(jdk_dir)
+
+ for p in java_paths:
+ if os.path.exists(p):
+ return p
+
+ return ''
def get_build_java_dir(jdk_dir):
diff --git a/tools/ya.make b/tools/ya.make
index b57fc316af..51a6b8b426 100644
--- a/tools/ya.make
+++ b/tools/ya.make
@@ -1,5 +1,5 @@
RECURSE(
- acceleo
+ acceleo
arcdocidstrip
archiver
archiver/alignment_test
diff --git a/util/folder/dirent_win.c b/util/folder/dirent_win.c
index 9dd0360971..7e6db74ce5 100644
--- a/util/folder/dirent_win.c
+++ b/util/folder/dirent_win.c
@@ -81,7 +81,7 @@ int readdir_r(struct DIR* dir, struct dirent* entry, struct dirent** result) {
entry->d_fileno = dir->file_no++;
entry->d_reclen = sizeof(struct dirent);
if (dir->wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- (dir->wfd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || dir->wfd.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
+ (dir->wfd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || dir->wfd.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
{
entry->d_type = DT_LNK;
} else if (dir->wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c
index ce0261ac4f..cf94cec01a 100644
--- a/util/folder/lstat_win.c
+++ b/util/folder/lstat_win.c
@@ -22,7 +22,7 @@ int lstat(const char* fileName, stat_struct* fileStat) {
SetLastError(0);
findHandle = FindFirstFileW(buf, &findBuf);
if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
- (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
+ (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
{
fileStat->st_mode = fileStat->st_mode & ~_S_IFMT | _S_IFLNK;
}
diff --git a/ydb/library/aclib/protos/ya.make b/ydb/library/aclib/protos/ya.make
index 58ee77d774..59135589cc 100644
--- a/ydb/library/aclib/protos/ya.make
+++ b/ydb/library/aclib/protos/ya.make
@@ -1,4 +1,4 @@
-PROTO_LIBRARY()
+PROTO_LIBRARY()
OWNER(
xenoxeno
diff --git a/ydb/library/yql/parser/proto_ast/gen/ya.make b/ydb/library/yql/parser/proto_ast/gen/ya.make
index b4d2edcef2..72c7ac4da7 100644
--- a/ydb/library/yql/parser/proto_ast/gen/ya.make
+++ b/ydb/library/yql/parser/proto_ast/gen/ya.make
@@ -3,4 +3,4 @@ RECURSE(
v1
v1_proto
jsonpath
-)
+)
diff --git a/ydb/library/yql/parser/proto_ast/ya.make b/ydb/library/yql/parser/proto_ast/ya.make
index 284307e66d..536d1c27f8 100644
--- a/ydb/library/yql/parser/proto_ast/ya.make
+++ b/ydb/library/yql/parser/proto_ast/ya.make
@@ -7,7 +7,7 @@ OWNER(
PEERDIR(
contrib/libs/antlr3_cpp_runtime
- contrib/libs/protobuf
+ contrib/libs/protobuf
)
SRCS(
@@ -16,7 +16,7 @@ SRCS(
END()
-RECURSE(
- gen
+RECURSE(
+ gen
collect_issues
-)
+)
diff --git a/ydb/library/yql/providers/common/proto/ya.make b/ydb/library/yql/providers/common/proto/ya.make
index 6692645467..5b79b7dd12 100644
--- a/ydb/library/yql/providers/common/proto/ya.make
+++ b/ydb/library/yql/providers/common/proto/ya.make
@@ -1,6 +1,6 @@
OWNER(g:yql)
-PROTO_LIBRARY()
+PROTO_LIBRARY()
SRCS(
gateways_config.proto