Showing preview only (4,534K chars total). Download the full file or copy to clipboard to get everything.
Repository: cloudwego/kitex
Branch: main
Commit: 3c452e94c8d4
Files: 823
Total size: 4.2 MB
Directory structure:
gitextract_8ctnl3nt/
├── .codecov.yml
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/
│ ├── claude-review-fork.yml
│ ├── claude.yml
│ ├── pr-check.yml
│ └── tests.yml
├── .gitignore
├── .golangci.yaml
├── .licenserc.yaml
├── .typos.toml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── NOTICE
├── README.md
├── README_cn.md
├── ROADMAP.md
├── client/
│ ├── callopt/
│ │ ├── options.go
│ │ ├── options_test.go
│ │ └── streamcall/
│ │ ├── call_options.go
│ │ ├── call_options_test.go
│ │ ├── definition.go
│ │ └── grpc_options.go
│ ├── client.go
│ ├── client_test.go
│ ├── context.go
│ ├── context_middleware.go
│ ├── context_middleware_test.go
│ ├── context_test.go
│ ├── deprecated.go
│ ├── doc.go
│ ├── genericclient/
│ │ ├── client.go
│ │ └── deprecated.go
│ ├── middlewares.go
│ ├── middlewares_test.go
│ ├── mocks_test.go
│ ├── option.go
│ ├── option_advanced.go
│ ├── option_stream.go
│ ├── option_test.go
│ ├── option_ttstream.go
│ ├── option_unary.go
│ ├── rpctimeout.go
│ ├── rpctimeout_pool.go
│ ├── rpctimeout_pool_test.go
│ ├── rpctimeout_test.go
│ ├── service_inline.go
│ ├── service_inline_test.go
│ ├── stream.go
│ ├── stream_test.go
│ └── streamclient/
│ ├── client_option.go
│ ├── client_option_advanced.go
│ ├── definition.go
│ ├── grpc_option.go
│ └── option.go
├── go.mod
├── go.sum
├── internal/
│ ├── client/
│ │ ├── lock.go
│ │ ├── option.go
│ │ ├── option_ttstream.go
│ │ ├── remote_option.go
│ │ └── remote_option_windows.go
│ ├── configutil/
│ │ ├── config.go
│ │ ├── config_test.go
│ │ ├── once.go
│ │ └── once_test.go
│ ├── generic/
│ │ ├── context.go
│ │ ├── generic_service.go
│ │ ├── proto/
│ │ │ └── type.go
│ │ ├── utils.go
│ │ └── utils_test.go
│ ├── mocks/
│ │ ├── README.md
│ │ ├── bufiox/
│ │ │ └── bufreader.go
│ │ ├── conn.go
│ │ ├── diagnosis/
│ │ │ └── service.go
│ │ ├── discovery/
│ │ │ └── discovery.go
│ │ ├── doc.go
│ │ ├── generic/
│ │ │ ├── generic_service.go
│ │ │ └── thrift.go
│ │ ├── klog/
│ │ │ └── log.go
│ │ ├── limiter/
│ │ │ └── limiter.go
│ │ ├── loadbalance/
│ │ │ └── loadbalancer.go
│ │ ├── message/
│ │ │ └── message.go
│ │ ├── net/
│ │ │ └── net.go
│ │ ├── netpoll/
│ │ │ ├── connection.go
│ │ │ └── nocopy.go
│ │ ├── proto/
│ │ │ ├── kitex_gen/
│ │ │ │ └── pbapi/
│ │ │ │ └── mock/
│ │ │ │ ├── client.go
│ │ │ │ ├── invoker.go
│ │ │ │ ├── mock.go
│ │ │ │ ├── pbapi.pb.go
│ │ │ │ └── server.go
│ │ │ └── pbapi.proto
│ │ ├── proxy/
│ │ │ └── proxy.go
│ │ ├── remote/
│ │ │ ├── bytebuf.go
│ │ │ ├── codec.go
│ │ │ ├── conn_wrapper.go
│ │ │ ├── connpool.go
│ │ │ ├── dialer.go
│ │ │ ├── payload_codec.go
│ │ │ ├── servicesearcher.go
│ │ │ ├── trans_handler.go
│ │ │ ├── trans_meta.go
│ │ │ └── trans_pipeline.go
│ │ ├── rpc_info/
│ │ │ └── timeout_provider.go
│ │ ├── serviceinfo.go
│ │ ├── stats/
│ │ │ └── tracer.go
│ │ ├── thrift/
│ │ │ ├── gen.sh
│ │ │ ├── k-consts.go
│ │ │ ├── k-stream.go
│ │ │ ├── k-test.go
│ │ │ ├── stream.go
│ │ │ ├── stream.thrift
│ │ │ ├── test.go
│ │ │ └── test.thrift
│ │ ├── transhandlerclient.go
│ │ ├── transhandlerserver.go
│ │ ├── update.sh
│ │ └── utils/
│ │ └── sharedticker.go
│ ├── reusable.go
│ ├── server/
│ │ ├── config.go
│ │ ├── option.go
│ │ ├── register_option.go
│ │ ├── remote_option.go
│ │ └── remote_option_windows.go
│ ├── stream/
│ │ ├── cancel.go
│ │ ├── stream_option.go
│ │ └── stream_option_test.go
│ ├── test/
│ │ ├── assert.go
│ │ ├── assert_test.go
│ │ └── port.go
│ └── utils/
│ └── safemcache/
│ ├── safemcache.go
│ └── safemcache_test.go
├── licenses/
│ ├── LICENSE-gjson
│ ├── LICENSE-go-genproto-main
│ ├── LICENSE-grpc.txt
│ ├── LICENSE-httprouter
│ ├── LICENSE-json-iterator.txt
│ ├── LICENSE-pid
│ ├── LICENSE-protobuf.txt
│ ├── LICENSE-thrift
│ ├── LICENSE-xxhash.txt
│ └── LICENSE-yaml.v3
├── pkg/
│ ├── acl/
│ │ ├── acl.go
│ │ └── acl_test.go
│ ├── circuitbreak/
│ │ ├── cbsuite.go
│ │ ├── cbsuite_option.go
│ │ ├── cbsuite_option_test.go
│ │ ├── cbsuite_test.go
│ │ ├── circuitbreak.go
│ │ ├── circuitbreak_test.go
│ │ ├── default.go
│ │ ├── default_test.go
│ │ ├── doc.go
│ │ └── item_circuit_breaker.go
│ ├── connpool/
│ │ ├── config.go
│ │ └── config_test.go
│ ├── consts/
│ │ └── ctx.go
│ ├── diagnosis/
│ │ ├── interface.go
│ │ └── interface_test.go
│ ├── discovery/
│ │ ├── constants.go
│ │ ├── discovery.go
│ │ └── discovery_test.go
│ ├── endpoint/
│ │ ├── cep/
│ │ │ └── endpoint.go
│ │ ├── deprecated.go
│ │ ├── endpoint.go
│ │ ├── endpoint_test.go
│ │ ├── sep/
│ │ │ └── endpoint.go
│ │ └── unary_endpoint.go
│ ├── event/
│ │ ├── bus.go
│ │ ├── bus_test.go
│ │ ├── event.go
│ │ ├── queue.go
│ │ └── queue_test.go
│ ├── exception/
│ │ ├── deprecated.go
│ │ └── deprecated_test.go
│ ├── fallback/
│ │ ├── fallback.go
│ │ └── fallback_test.go
│ ├── generic/
│ │ ├── binary_test/
│ │ │ ├── generic_init.go
│ │ │ └── generic_test.go
│ │ ├── binarypb_codec.go
│ │ ├── binarypb_codec_test.go
│ │ ├── binarythrift_codec.go
│ │ ├── binarythrift_codec_test.go
│ │ ├── binarythrift_codec_v2.go
│ │ ├── closer.go
│ │ ├── descriptor/
│ │ │ ├── annotation.go
│ │ │ ├── descriptor.go
│ │ │ ├── field_mapping.go
│ │ │ ├── field_mapping_test.go
│ │ │ ├── http.go
│ │ │ ├── http_mapping.go
│ │ │ ├── http_test.go
│ │ │ ├── render.go
│ │ │ ├── route.go
│ │ │ ├── router.go
│ │ │ ├── tree.go
│ │ │ ├── tree_test.go
│ │ │ ├── type.go
│ │ │ ├── type_test.go
│ │ │ ├── util.go
│ │ │ ├── value_mapping.go
│ │ │ └── value_mapping_test.go
│ │ ├── descriptor_provider.go
│ │ ├── generic.go
│ │ ├── generic_service.go
│ │ ├── generic_service_test.go
│ │ ├── generic_test.go
│ │ ├── grpcjson_test/
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ └── api.thrift
│ │ ├── grpcjsonpb_test/
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── pbapi.proto
│ │ │ └── pbapi_multi_service.proto
│ │ ├── http_test/
│ │ │ ├── conf/
│ │ │ │ └── kitex.yml
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── baseline.thrift
│ │ │ ├── binary_echo.thrift
│ │ │ ├── dynamicgo_go_tag_error.thrift
│ │ │ ├── http_annotation.thrift
│ │ │ └── mock.thrift
│ │ ├── httppb_test/
│ │ │ ├── conf/
│ │ │ │ └── kitex.yml
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── echo.pb.go
│ │ │ ├── echo.proto
│ │ │ └── echo.thrift
│ │ ├── httppbthrift_codec.go
│ │ ├── httppbthrift_codec_test.go
│ │ ├── httpthrift_codec.go
│ │ ├── httpthrift_codec_test.go
│ │ ├── json_test/
│ │ │ ├── conf/
│ │ │ │ └── kitex.yml
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── base.thrift
│ │ │ ├── baseline.thrift
│ │ │ ├── binary_echo.thrift
│ │ │ ├── example.thrift
│ │ │ ├── example_multi_service.thrift
│ │ │ ├── extend.thrift
│ │ │ ├── mock.thrift
│ │ │ ├── mock_unknown_method.thrift
│ │ │ └── self_ref.thrift
│ │ ├── jsonpb_codec.go
│ │ ├── jsonpb_codec_test.go
│ │ ├── jsonpb_test/
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── echo.proto
│ │ │ ├── echo_import.proto
│ │ │ ├── example.proto
│ │ │ └── example2.proto
│ │ ├── jsonthrift_codec.go
│ │ ├── jsonthrift_codec_test.go
│ │ ├── map_test/
│ │ │ ├── conf/
│ │ │ │ └── kitex.yml
│ │ │ ├── generic_init.go
│ │ │ ├── generic_test.go
│ │ │ └── idl/
│ │ │ ├── base.thrift
│ │ │ ├── example.thrift
│ │ │ ├── mock.thrift
│ │ │ └── self_ref.thrift
│ │ ├── mapthrift_codec.go
│ │ ├── mapthrift_codec_test.go
│ │ ├── option.go
│ │ ├── option_test.go
│ │ ├── pb_descriptor_provider.go
│ │ ├── pbidl_provider.go
│ │ ├── pbidl_provider_test.go
│ │ ├── proto/
│ │ │ ├── json.go
│ │ │ ├── json_test.go
│ │ │ ├── protobuf.go
│ │ │ ├── raw.go
│ │ │ ├── raw_test.go
│ │ │ └── type.go
│ │ ├── reflect_test/
│ │ │ ├── idl/
│ │ │ │ ├── base.thrift
│ │ │ │ ├── example.thrift
│ │ │ │ └── self_ref.thrift
│ │ │ ├── map_test.go
│ │ │ └── reflect_test.go
│ │ ├── streaming.go
│ │ ├── thrift/
│ │ │ ├── base.go
│ │ │ ├── base_test.go
│ │ │ ├── binary.go
│ │ │ ├── http.go
│ │ │ ├── http_pb.go
│ │ │ ├── json.go
│ │ │ ├── parse.go
│ │ │ ├── parse_option.go
│ │ │ ├── parse_test.go
│ │ │ ├── raw.go
│ │ │ ├── raw_test.go
│ │ │ ├── read.go
│ │ │ ├── read_test.go
│ │ │ ├── struct.go
│ │ │ ├── thrift.go
│ │ │ ├── util.go
│ │ │ ├── util_test.go
│ │ │ ├── write.go
│ │ │ └── write_test.go
│ │ ├── thriftidl_provider.go
│ │ ├── thriftidl_provider_option.go
│ │ └── thriftidl_provider_test.go
│ ├── gofunc/
│ │ ├── go.go
│ │ └── go_test.go
│ ├── http/
│ │ ├── resolver.go
│ │ └── resolver_test.go
│ ├── kerrors/
│ │ ├── bizerrors.go
│ │ ├── bizerrors_test.go
│ │ ├── kerrors.go
│ │ ├── kerrors_test.go
│ │ └── streaming_errors.go
│ ├── klog/
│ │ ├── default.go
│ │ ├── default_test.go
│ │ └── log.go
│ ├── limit/
│ │ ├── limit.go
│ │ └── limit_test.go
│ ├── limiter/
│ │ ├── connection_limiter.go
│ │ ├── connection_limiter_test.go
│ │ ├── dummy.go
│ │ ├── item_limiter.go
│ │ ├── limiter.go
│ │ ├── limiter_test.go
│ │ ├── qps_limiter.go
│ │ └── qps_limiter_test.go
│ ├── loadbalance/
│ │ ├── consist.go
│ │ ├── consist_test.go
│ │ ├── dummy_picker.go
│ │ ├── interleaved_weighted_round_robin.go
│ │ ├── iterator.go
│ │ ├── lbcache/
│ │ │ ├── cache.go
│ │ │ ├── cache_test.go
│ │ │ ├── hookable.go
│ │ │ ├── hookable_test.go
│ │ │ └── shared_ticker.go
│ │ ├── loadbalancer.go
│ │ ├── weighted_balancer.go
│ │ ├── weighted_balancer_test.go
│ │ ├── weighted_random.go
│ │ ├── weighted_random_with_alias_method.go
│ │ ├── weighted_round_robin.go
│ │ └── weighted_round_robin_test.go
│ ├── logid/
│ │ ├── logid.go
│ │ ├── streaming.go
│ │ └── streaming_test.go
│ ├── mem/
│ │ ├── span.go
│ │ └── span_test.go
│ ├── profiler/
│ │ ├── profiler.go
│ │ └── profiler_test.go
│ ├── protocol/
│ │ └── bthrift/
│ │ ├── README.md
│ │ ├── apache/
│ │ │ ├── apache.go
│ │ │ ├── apache_test.go
│ │ │ ├── binary_protocol.go
│ │ │ ├── binary_protocol_test.go
│ │ │ └── thrift.go
│ │ ├── binary.go
│ │ ├── binary_test.go
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── interface.go
│ │ ├── internal/
│ │ │ └── test/
│ │ │ ├── README.md
│ │ │ ├── assert.go
│ │ │ └── assert_test.go
│ │ ├── unknown.go
│ │ └── unknown_test.go
│ ├── proxy/
│ │ └── proxy.go
│ ├── registry/
│ │ └── registry.go
│ ├── remote/
│ │ ├── bound/
│ │ │ ├── limiter_inbound.go
│ │ │ ├── limiter_inbound_test.go
│ │ │ ├── transmeta_bound.go
│ │ │ └── transmeta_bound_test.go
│ │ ├── bufiox2buffer.go
│ │ ├── bytebuf.go
│ │ ├── codec/
│ │ │ ├── bytebuf_util.go
│ │ │ ├── default_codec.go
│ │ │ ├── default_codec_test.go
│ │ │ ├── grpc/
│ │ │ │ ├── grpc.go
│ │ │ │ ├── grpc_compress.go
│ │ │ │ └── grpc_test.go
│ │ │ ├── header_codec.go
│ │ │ ├── header_codec_test.go
│ │ │ ├── perrors/
│ │ │ │ ├── protocol_error.go
│ │ │ │ └── protocol_error_test.go
│ │ │ ├── protobuf/
│ │ │ │ ├── encoding/
│ │ │ │ │ ├── encoding.go
│ │ │ │ │ └── gzip/
│ │ │ │ │ └── gzip.go
│ │ │ │ ├── error.pb.go
│ │ │ │ ├── error.proto
│ │ │ │ ├── pberror.go
│ │ │ │ ├── protobuf.go
│ │ │ │ ├── protobuf_test.go
│ │ │ │ ├── test.pb.go
│ │ │ │ └── test.proto
│ │ │ ├── thrift/
│ │ │ │ ├── codec.go
│ │ │ │ ├── codec_apache.go
│ │ │ │ ├── codec_apache_test.go
│ │ │ │ ├── codec_fast.go
│ │ │ │ ├── codec_frugal.go
│ │ │ │ ├── codec_frugal_test.go
│ │ │ │ ├── thrift.go
│ │ │ │ ├── thrift_data.go
│ │ │ │ ├── thrift_data_test.go
│ │ │ │ └── thrift_test.go
│ │ │ ├── util.go
│ │ │ ├── util_test.go
│ │ │ ├── validate.go
│ │ │ └── validate_test.go
│ │ ├── codec.go
│ │ ├── compression.go
│ │ ├── connpool/
│ │ │ ├── dummy.go
│ │ │ ├── long_pool.go
│ │ │ ├── long_pool_test.go
│ │ │ ├── reporter.go
│ │ │ ├── short_pool.go
│ │ │ ├── short_pool_test.go
│ │ │ └── utils.go
│ │ ├── connpool.go
│ │ ├── custom_meta_handler.go
│ │ ├── custom_meta_handler_test.go
│ │ ├── default_bytebuf.go
│ │ ├── default_bytebuf_test.go
│ │ ├── dialer.go
│ │ ├── doc.go
│ │ ├── message.go
│ │ ├── option.go
│ │ ├── payload_codec.go
│ │ ├── profiler_meta.go
│ │ ├── remotecli/
│ │ │ ├── client.go
│ │ │ ├── client_test.go
│ │ │ ├── conn_wrapper.go
│ │ │ ├── conn_wrapper_test.go
│ │ │ ├── stream.go
│ │ │ └── stream_test.go
│ │ ├── remotesvr/
│ │ │ ├── server.go
│ │ │ └── server_test.go
│ │ ├── role.go
│ │ ├── trans/
│ │ │ ├── common.go
│ │ │ ├── default_client_handler.go
│ │ │ ├── default_client_handler_test.go
│ │ │ ├── default_server_handler.go
│ │ │ ├── default_server_handler_test.go
│ │ │ ├── detection/
│ │ │ │ ├── noop.go
│ │ │ │ ├── server_handler.go
│ │ │ │ └── server_handler_test.go
│ │ │ ├── gonet/
│ │ │ │ ├── bytebuffer.go
│ │ │ │ ├── bytebuffer_test.go
│ │ │ │ ├── client_handler.go
│ │ │ │ ├── conn.go
│ │ │ │ ├── conn_extension.go
│ │ │ │ ├── conn_extension_test.go
│ │ │ │ ├── conn_test.go
│ │ │ │ ├── dialer.go
│ │ │ │ ├── mocks_test.go
│ │ │ │ ├── server_handler.go
│ │ │ │ ├── server_handler_test.go
│ │ │ │ ├── trans_server.go
│ │ │ │ └── trans_server_test.go
│ │ │ ├── invoke/
│ │ │ │ ├── conn_extension.go
│ │ │ │ ├── conn_extension_test.go
│ │ │ │ ├── invoke.go
│ │ │ │ ├── invoke_handler.go
│ │ │ │ ├── invoke_handler_test.go
│ │ │ │ ├── message.go
│ │ │ │ └── message_test.go
│ │ │ ├── listen_config.go
│ │ │ ├── listen_config_windows.go
│ │ │ ├── mocks_test.go
│ │ │ ├── netpoll/
│ │ │ │ ├── bytebuf.go
│ │ │ │ ├── bytebuf_test.go
│ │ │ │ ├── client_handler.go
│ │ │ │ ├── conn_extension.go
│ │ │ │ ├── dialer.go
│ │ │ │ ├── http_client.go
│ │ │ │ ├── http_client_handler.go
│ │ │ │ ├── http_client_handler_test.go
│ │ │ │ ├── mocks_test.go
│ │ │ │ ├── server_handler.go
│ │ │ │ ├── server_handler_test.go
│ │ │ │ ├── trans_server.go
│ │ │ │ └── trans_server_test.go
│ │ │ ├── netpollmux/
│ │ │ │ ├── client_handler.go
│ │ │ │ ├── client_handler_test.go
│ │ │ │ ├── control_frame.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── mocks_test.go
│ │ │ │ ├── mux_conn.go
│ │ │ │ ├── mux_conn_test.go
│ │ │ │ ├── mux_pool.go
│ │ │ │ ├── mux_pool_test.go
│ │ │ │ ├── mux_transport.go
│ │ │ │ ├── mux_transport_test.go
│ │ │ │ ├── server_handler.go
│ │ │ │ ├── server_handler_test.go
│ │ │ │ ├── shard_map.go
│ │ │ │ └── shard_map_test.go
│ │ │ ├── nphttp2/
│ │ │ │ ├── buffer.go
│ │ │ │ ├── buffer_test.go
│ │ │ │ ├── client_conn.go
│ │ │ │ ├── client_conn_test.go
│ │ │ │ ├── client_handler.go
│ │ │ │ ├── client_handler_test.go
│ │ │ │ ├── codes/
│ │ │ │ │ ├── code_string.go
│ │ │ │ │ ├── codes.go
│ │ │ │ │ └── codes_test.go
│ │ │ │ ├── codes.go
│ │ │ │ ├── codes_test.go
│ │ │ │ ├── conn_pool.go
│ │ │ │ ├── conn_pool_test.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── grpc/
│ │ │ │ │ ├── bdp_estimator.go
│ │ │ │ │ ├── bdp_estimator_test.go
│ │ │ │ │ ├── context.go
│ │ │ │ │ ├── context_test.go
│ │ │ │ │ ├── controlbuf.go
│ │ │ │ │ ├── controlbuf_test.go
│ │ │ │ │ ├── defaults.go
│ │ │ │ │ ├── doc.go
│ │ │ │ │ ├── flowcontrol.go
│ │ │ │ │ ├── flowcontrol_test.go
│ │ │ │ │ ├── framer.go
│ │ │ │ │ ├── graceful_shutdown_test.go
│ │ │ │ │ ├── grpcframe/
│ │ │ │ │ │ ├── errors.go
│ │ │ │ │ │ ├── errors_test.go
│ │ │ │ │ │ ├── frame_parser.go
│ │ │ │ │ │ ├── frame_reader.go
│ │ │ │ │ │ ├── frame_reader_test.go
│ │ │ │ │ │ └── frame_writer.go
│ │ │ │ │ ├── http2_client.go
│ │ │ │ │ ├── http2_server.go
│ │ │ │ │ ├── http_util.go
│ │ │ │ │ ├── http_util_test.go
│ │ │ │ │ ├── keepalive.go
│ │ │ │ │ ├── keepalive_test.go
│ │ │ │ │ ├── mocks_test.go
│ │ │ │ │ ├── syscall/
│ │ │ │ │ │ ├── syscall_linux.go
│ │ │ │ │ │ └── syscall_nonlinux.go
│ │ │ │ │ ├── testutils/
│ │ │ │ │ │ ├── channel.go
│ │ │ │ │ │ ├── leakcheck/
│ │ │ │ │ │ │ ├── leakcheck.go
│ │ │ │ │ │ │ └── leakcheck_test.go
│ │ │ │ │ │ ├── status_equal.go
│ │ │ │ │ │ └── status_equal_test.go
│ │ │ │ │ ├── trace.go
│ │ │ │ │ ├── trace_test.go
│ │ │ │ │ ├── transport.go
│ │ │ │ │ └── transport_test.go
│ │ │ │ ├── meta_api.go
│ │ │ │ ├── meta_api_test.go
│ │ │ │ ├── metadata/
│ │ │ │ │ ├── metadata.go
│ │ │ │ │ └── metadata_test.go
│ │ │ │ ├── mocks_test.go
│ │ │ │ ├── peer/
│ │ │ │ │ ├── peer.go
│ │ │ │ │ └── peer_test.go
│ │ │ │ ├── server_conn.go
│ │ │ │ ├── server_conn_test.go
│ │ │ │ ├── server_handler.go
│ │ │ │ ├── server_handler_test.go
│ │ │ │ ├── status/
│ │ │ │ │ ├── mock_test.go
│ │ │ │ │ ├── status.go
│ │ │ │ │ └── status_test.go
│ │ │ │ ├── stream.go
│ │ │ │ └── stream_test.go
│ │ │ └── ttstream/
│ │ │ ├── client_handler.go
│ │ │ ├── client_handler_option.go
│ │ │ ├── client_stream_cleanup.go
│ │ │ ├── client_trans_pool.go
│ │ │ ├── client_trans_pool_longconn.go
│ │ │ ├── client_trans_pool_muxconn.go
│ │ │ ├── client_trans_pool_shortconn.go
│ │ │ ├── container/
│ │ │ │ ├── linklist.go
│ │ │ │ ├── object_pool.go
│ │ │ │ ├── object_pool_test.go
│ │ │ │ ├── pipe.go
│ │ │ │ ├── pipe_test.go
│ │ │ │ ├── queue.go
│ │ │ │ ├── queue_test.go
│ │ │ │ ├── stack.go
│ │ │ │ └── stack_test.go
│ │ │ ├── context.go
│ │ │ ├── exception.go
│ │ │ ├── exception_test.go
│ │ │ ├── frame.go
│ │ │ ├── frame_handler.go
│ │ │ ├── frame_test.go
│ │ │ ├── metadata.go
│ │ │ ├── mock_test.go
│ │ │ ├── server_handler.go
│ │ │ ├── server_handler_option.go
│ │ │ ├── server_handler_test.go
│ │ │ ├── stream.go
│ │ │ ├── stream_client.go
│ │ │ ├── stream_client_test.go
│ │ │ ├── stream_reader.go
│ │ │ ├── stream_reader_test.go
│ │ │ ├── stream_server.go
│ │ │ ├── stream_server_test.go
│ │ │ ├── stream_test.go
│ │ │ ├── stream_writer.go
│ │ │ ├── test_utils.go
│ │ │ ├── trace_test.go
│ │ │ ├── transport.go
│ │ │ ├── transport_buffer.go
│ │ │ ├── transport_buffer_test.go
│ │ │ ├── transport_client.go
│ │ │ ├── transport_server.go
│ │ │ └── transport_test.go
│ │ ├── trans_errors.go
│ │ ├── trans_errors_test.go
│ │ ├── trans_handler.go
│ │ ├── trans_meta.go
│ │ ├── trans_pipeline.go
│ │ ├── trans_server.go
│ │ └── transmeta/
│ │ ├── http_metakey.go
│ │ └── metakey.go
│ ├── retry/
│ │ ├── backup.go
│ │ ├── backup_retryer.go
│ │ ├── backup_test.go
│ │ ├── failure.go
│ │ ├── failure_retryer.go
│ │ ├── failure_test.go
│ │ ├── item_retry.go
│ │ ├── mixed.go
│ │ ├── mixed_retryer.go
│ │ ├── mixed_test.go
│ │ ├── percentage_limit.go
│ │ ├── policy.go
│ │ ├── policy_test.go
│ │ ├── retryer.go
│ │ ├── retryer_test.go
│ │ ├── util.go
│ │ └── util_test.go
│ ├── rpcinfo/
│ │ ├── basicinfo.go
│ │ ├── convert.go
│ │ ├── convert_test.go
│ │ ├── copy.go
│ │ ├── copy_test.go
│ │ ├── ctx.go
│ │ ├── ctx_test.go
│ │ ├── endpointInfo.go
│ │ ├── endpointInfo_test.go
│ │ ├── interface.go
│ │ ├── invocation.go
│ │ ├── invocation_test.go
│ │ ├── mocks_test.go
│ │ ├── mutable.go
│ │ ├── remoteinfo/
│ │ │ ├── remoteInfo.go
│ │ │ └── remoteInfo_test.go
│ │ ├── rpcconfig.go
│ │ ├── rpcconfig_test.go
│ │ ├── rpcinfo.go
│ │ ├── rpcinfo_test.go
│ │ ├── rpcstats.go
│ │ ├── rpcstats_test.go
│ │ ├── stats_util.go
│ │ ├── stats_util_test.go
│ │ ├── stream_tracer.go
│ │ ├── stream_tracer_test.go
│ │ ├── tracer.go
│ │ └── tracer_test.go
│ ├── rpctimeout/
│ │ ├── item_rpc_timeout.go
│ │ └── rpctimeout.go
│ ├── serviceinfo/
│ │ ├── serviceinfo.go
│ │ └── serviceinfo_test.go
│ ├── stats/
│ │ ├── event.go
│ │ ├── event_test.go
│ │ ├── status.go
│ │ └── tracer.go
│ ├── streaming/
│ │ ├── context.go
│ │ ├── streaming.go
│ │ ├── streamx.go
│ │ ├── timeout.go
│ │ ├── timeout_test.go
│ │ ├── util.go
│ │ └── util_test.go
│ ├── transmeta/
│ │ ├── http2.go
│ │ ├── http2_test.go
│ │ ├── metainfo.go
│ │ ├── metainfo_test.go
│ │ ├── ttheader.go
│ │ └── ttheader_test.go
│ ├── utils/
│ │ ├── byte2str.go
│ │ ├── byte2str_test.go
│ │ ├── config.go
│ │ ├── config_test.go
│ │ ├── contextmap/
│ │ │ ├── contextmap.go
│ │ │ └── contextmap_test.go
│ │ ├── counter.go
│ │ ├── counter_test.go
│ │ ├── err_chain.go
│ │ ├── err_chain_test.go
│ │ ├── fastthrift/
│ │ │ ├── fastthrift.go
│ │ │ └── fastthrift_test.go
│ │ ├── func.go
│ │ ├── func_test.go
│ │ ├── int_len.go
│ │ ├── int_len_test.go
│ │ ├── interface.go
│ │ ├── json.go
│ │ ├── json_fuzz_test.go
│ │ ├── json_sonic.go
│ │ ├── json_test.go
│ │ ├── kitexutil/
│ │ │ ├── kitexutil.go
│ │ │ └── kitexutil_test.go
│ │ ├── max_counter.go
│ │ ├── max_counter_test.go
│ │ ├── netaddr.go
│ │ ├── netaddr_test.go
│ │ ├── ring.go
│ │ ├── ring_single.go
│ │ ├── ring_test.go
│ │ ├── rpcstats.go
│ │ ├── rpcstats_test.go
│ │ ├── runtimex.go
│ │ ├── runtimex_test.go
│ │ ├── sharedticker.go
│ │ ├── sharedticker_test.go
│ │ ├── slice.go
│ │ ├── slice_test.go
│ │ ├── strbuf.go
│ │ ├── strbuf_test.go
│ │ ├── strings.go
│ │ ├── strings_test.go
│ │ ├── thrift.go
│ │ ├── thrift_test.go
│ │ ├── yaml.go
│ │ └── yaml_test.go
│ ├── warmup/
│ │ ├── pool_helper.go
│ │ ├── pool_helper_test.go
│ │ └── warmup.go
│ └── xds/
│ └── xds.go
├── scripts/
│ ├── .utils/
│ │ ├── check_go_mod.sh
│ │ ├── check_version.sh
│ │ └── funcs.sh
│ ├── release-hotfix.sh
│ └── release.sh
├── server/
│ ├── deprecated.go
│ ├── genericserver/
│ │ ├── server.go
│ │ ├── server_test.go
│ │ └── unknownservice.go
│ ├── hooks.go
│ ├── invoke/
│ │ ├── message.go
│ │ └── message_test.go
│ ├── invoke.go
│ ├── invoke_test.go
│ ├── middlewares.go
│ ├── middlewares_test.go
│ ├── mocks_test.go
│ ├── option.go
│ ├── option_advanced.go
│ ├── option_advanced_test.go
│ ├── option_stream.go
│ ├── option_stream_test.go
│ ├── option_test.go
│ ├── option_ttstream.go
│ ├── option_unary.go
│ ├── register_option.go
│ ├── register_option_test.go
│ ├── server.go
│ ├── server_test.go
│ ├── service.go
│ ├── service_inline.go
│ ├── service_inline_test.go
│ ├── service_test.go
│ ├── stream.go
│ └── stream_test.go
├── tool/
│ ├── cmd/
│ │ └── kitex/
│ │ ├── args/
│ │ │ ├── args.go
│ │ │ ├── args_test.go
│ │ │ ├── deprecated.go
│ │ │ └── deprecated_test.go
│ │ ├── main.go
│ │ ├── sdk/
│ │ │ └── kitex_sdk.go
│ │ ├── utils/
│ │ │ └── utils.go
│ │ └── versions/
│ │ ├── dependencies.go
│ │ ├── dependencies_test.go
│ │ ├── version.go
│ │ └── version_test.go
│ └── internal_pkg/
│ ├── doc.go
│ ├── generator/
│ │ ├── completer.go
│ │ ├── custom_template.go
│ │ ├── feature.go
│ │ ├── generator.go
│ │ ├── generator_test.go
│ │ ├── template.go
│ │ ├── template_test.go
│ │ ├── type.go
│ │ └── type_test.go
│ ├── log/
│ │ └── log.go
│ ├── pluginmode/
│ │ ├── protoc/
│ │ │ ├── plugin.go
│ │ │ ├── protoc.go
│ │ │ └── util.go
│ │ └── thriftgo/
│ │ ├── ast.go
│ │ ├── convertor.go
│ │ ├── file_tpl.go
│ │ ├── hessian2.go
│ │ ├── hessian2_test.go
│ │ ├── patcher.go
│ │ ├── plugin.go
│ │ ├── register_tpl.go
│ │ └── struct_tpl.go
│ ├── prutal/
│ │ ├── prutal.go
│ │ └── prutal_test.go
│ ├── tpl/
│ │ ├── bootstrap.sh.go
│ │ ├── build.sh.go
│ │ ├── client.go
│ │ ├── client_v2.go
│ │ ├── handler.go
│ │ ├── handler.method.go
│ │ ├── invoker.go
│ │ ├── main.go
│ │ ├── pbtpl/
│ │ │ ├── pbtpl.go
│ │ │ └── pbtpl_test.go
│ │ ├── server.go
│ │ ├── service.go
│ │ ├── service_v2.go
│ │ ├── templates_test.go
│ │ └── tool_version.go
│ └── util/
│ ├── dump.go
│ ├── env/
│ │ ├── env.go
│ │ └── env_test.go
│ ├── util.go
│ └── util_test.go
├── transport/
│ └── keys.go
└── version.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .codecov.yml
================================================
github_checks:
annotations: false
ignore:
- "tool/**/*.go"
coverage:
status:
project:
default:
# pass if coverage drops by no more than 0.05%
# this is possibly caused by unstable coverage.
threshold: 0.05%
================================================
FILE: .github/CODEOWNERS
================================================
# For more information, please refer to https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @cloudwego/Kitex-reviewers @cloudwego/Kitex-approvers @cloudwego/Kitex-maintainers
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Kitex version:**
Please provide the version of Kitex you are using.
**Environment:**
The output of `go env`.
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
#### What type of PR is this?
<!--
Add one of the following kinds:
build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
optimize: A new optimization
fix: A bug fix
perf: A code change that improves performance
refactor: A code change that neither fixes a bug nor adds a feature
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc)
test: Adding missing tests or correcting existing tests
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
-->
#### Check the PR title.
<!--
The description of the title will be attached in Release Notes,
so please describe it from user-oriented, what this PR does / why we need it.
Please check your PR title with the below requirements:
-->
- [ ] This PR title match the format: \<type\>(optional scope): \<description\>
- [ ] The description of this PR title is user-oriented and clear enough for others to understand.
- [ ] Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)
#### (Optional) Translate the PR title into Chinese.
#### (Optional) More detailed description for this PR(en: English/zh: Chinese).
<!--
Provide more detailed info for review(e.g., it's recommended to provide perf data if this is a perf type PR).
-->
en:
zh(optional):
#### (Optional) Which issue(s) this PR fixes:
<!--
Automatically closes linked issue when PR is merged.
Eg: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
#### (optional) The PR that updates user documentation:
<!--
If the current PR requires user awareness at the usage level, please submit a PR to update user docs. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)
-->
================================================
FILE: .github/workflows/claude-review-fork.yml
================================================
name: Claude Review Fork PR
# Manual workflow to review PRs from forks
# Usage: Go to Actions tab > Claude Review Fork PR > Run workflow
# Enter the PR number to review
on:
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to review'
required: true
type: string
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
jobs:
review-fork-pr:
runs-on: ubuntu-latest
steps:
- name: Get PR Information
id: pr-info
run: |
PR_DATA=$(gh pr view ${{ github.event.inputs.pr_number }} --repo ${{ github.repository }} --json headRefName,headRepository,headRepositoryOwner,number,title)
echo "PR Data: $PR_DATA"
echo "pr_head_ref=$(echo $PR_DATA | jq -r '.headRefName')" >> $GITHUB_OUTPUT
echo "pr_head_repo=$(echo $PR_DATA | jq -r '.headRepository.name')" >> $GITHUB_OUTPUT
echo "pr_head_owner=$(echo $PR_DATA | jq -r '.headRepositoryOwner.login')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout PR
uses: actions/checkout@v4
with:
repository: ${{ steps.pr-info.outputs.pr_head_owner }}/${{ steps.pr-info.outputs.pr_head_repo }}
ref: ${{ steps.pr-info.outputs.pr_head_ref }}
fetch-depth: 1
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.inputs.pr_number }}
Please review pull request #${{ github.event.inputs.pr_number }} and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr comment ${{ github.event.inputs.pr_number }}` with your Bash tool to leave your review as a comment on the PR.
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
================================================
FILE: .github/workflows/claude.yml
================================================
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'
================================================
FILE: .github/workflows/pr-check.yml
================================================
name: Pull Request Check
on: [ pull_request ]
jobs:
compliant:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check License Header
uses: apache/skywalking-eyes/header@v0.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Spell
uses: crate-ci/typos@master
golangci-lint:
runs-on: [ Linux, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# for self-hosted, the cache path is shared across projects
# and it works well without the cache of github actions
# Enable it if we're going to use Github only
cache: false
- name: Golangci Lint
# https://golangci-lint.run/
uses: golangci/golangci-lint-action@v8
with:
version: latest
only-new-issues: true
================================================
FILE: .github/workflows/tests.yml
================================================
name: Tests
on: [ pull_request ]
jobs:
unit-scenario-test:
strategy:
matrix:
go: [ "1.21", "1.26" ]
runs-on: [ Linux, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: Scenario Tests
run: |
cd ..
rm -rf kitex-tests
git clone --depth=1 https://github.com/cloudwego/kitex-tests.git
cd kitex-tests
KITEX_TOOL_USE_PROTOC=0 ./run.sh ${{github.workspace}}
cd ${{github.workspace}}
- name: Upload coverage to Codecov # coverage generated by run.sh
uses: codecov/codecov-action@v5
with:
flags: integration
benchmark-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Benchmark
# we only use this CI to verify bench code works
# setting benchtime=100ms is saving our time...
run: go test -bench=. -benchmem -run=none ./... -benchtime=100ms
unit-test-x64:
strategy:
matrix:
go: ["1.21", "1.22", "1.23", "1.24", "1.25", "1.26" ]
runs-on: [ Linux, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false # don't use cache for self-hosted runners
- name: Unit Test
run: go test -race ./...
unit-test-arm:
strategy:
matrix:
go: ["1.21", "1.22", "1.23", "1.24", "1.25", "1.26" ]
runs-on: [ ARM64 ] # It's OK under Linux or macOS
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false # don't use cache for self-hosted runners
- name: Unit Test
run: go test -race ./...
codegen-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Prepare
run: |
go install github.com/cloudwego/thriftgo@main
go install ./tool/cmd/kitex
LOCAL_REPO=$(pwd)
cd ..
git clone https://github.com/cloudwego/kitex-tests.git
cd kitex-tests/codegen
go mod init codegen-test
go mod edit -replace=github.com/apache/thrift=github.com/apache/thrift@v0.13.0
go mod edit -replace github.com/cloudwego/kitex=${LOCAL_REPO}
go mod edit -replace github.com/cloudwego/kitex/pkg/protocol/bthrift=${LOCAL_REPO}/pkg/protocol/bthrift
go mod tidy
bash -version
bash ./codegen_install_check.sh
- name: CodeGen
run: |
cd ../kitex-tests/codegen
tree
bash ./codegen_run.sh
windows-test:
runs-on: [ Windows ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false # don't use cache for self-hosted runners
- name: Windows compatibility test
run: go test -run=^$ ./...
codecov:
needs: [ unit-scenario-test, unit-test-x64, unit-test-arm ]
runs-on: [ Linux, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false # don't use cache for self-hosted runners
- name: Run coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
flags: unit
================================================
FILE: .gitignore
================================================
# Files generated by IDEs
.idea/
*.iml
# Vim swap files
*.swp
# Vscode files
.vscode
# Emacs save files
*~
\#*\#
.\#*
# User cluster configs
.kubeconfig
# Downloaded Kubernetes binary release
/kubernetes/
# Downloaded kubernetes binary release tar ball
kubernetes.tar.gz
# direnv .envrc files
.envrc
# make-related metadata
/.make/
# the result of the go build
output*
output/*
# log
*.log
*.log.*
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Go test binaries
*.test
testdata/
# kitex binary
tool/cmd/kitex/kitex
# remote dump file
*.json
base1.go
dump.txt
base2.go
# Go workspace file
go.work
go.work.sum
================================================
FILE: .golangci.yaml
================================================
version: "2"
linters:
default: none
enable:
- govet
- ineffassign
- staticcheck
- unconvert
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- kitex_gen
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofumpt
- goimports
settings:
gofumpt:
extra-rules: true
goimports:
local-prefixes:
- github.com/cloudwego/kitex
exclusions:
generated: lax
paths:
- kitex_gen
- third_party$
- builtin$
- examples$
================================================
FILE: .licenserc.yaml
================================================
header:
license:
spdx-id: Apache-2.0
copyright-owner: CloudWeGo Authors
paths:
- "**/*.go"
- "**/*.s"
paths-ignore:
- internal/mocks/thrift/test.go
- pkg/remote/codec/thrift/thrift_frugal.go
- pkg/remote/codec/thrift/thrift_frugal_test.go
- pkg/remote/codec/thrift/thrift_others.go
- pkg/remote/trans/nphttp2/codes/codes.go
- pkg/remote/trans/nphttp2/grpc/grpcframe/
- pkg/remote/trans/nphttp2/grpc/bdp_estimator.go
- pkg/remote/trans/nphttp2/grpc/controlbuf.go
- pkg/remote/trans/nphttp2/grpc/defaults.go
- pkg/remote/trans/nphttp2/grpc/framer.go
- pkg/remote/trans/nphttp2/grpc/flowcontrol.go
- pkg/remote/trans/nphttp2/grpc/http2_client.go
- pkg/remote/trans/nphttp2/grpc/http2_server.go
- pkg/remote/trans/nphttp2/grpc/http_util.go
- pkg/remote/trans/nphttp2/grpc/keepalive.go
- pkg/remote/trans/nphttp2/grpc/keepalive_test.go
- pkg/remote/trans/nphttp2/grpc/transport.go
- pkg/remote/trans/nphttp2/grpc/transport_test.go
- pkg/remote/trans/nphttp2/metadata/metadata.go
- pkg/remote/trans/nphttp2/status/status.go
- pkg/remote/codec/protobuf/error.pb.go
- pkg/remote/codec/protobuf/test.pb.go
- pkg/generic/descriptor/tree.go
- pkg/generic/descriptor/tree_test.go
- pkg/generic/httppb_test/idl/echo.pb.go
- pkg/utils/json.go
- pkg/protocol/bthrift/test/kitex_gen/**
comment: on-failure
================================================
FILE: .typos.toml
================================================
# Typo check: https://github.com/crate-ci/typos
[files]
extend-exclude = ["go.mod", "go.sum"]
[default.extend-words]
typ = "typ" # type
Descritor = "Descritor" # reflect pkg typo, exported func, let it go
consts = "consts" # conventional abbreviation for constants
[default.extend-identifiers]
GoAways = "GoAways" # GoAway frame plural noun
henc = "henc" # hpack encoder
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
conduct@cloudwego.io.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
================================================
FILE: CONTRIBUTING.md
================================================
# How to Contribute
## Your First Pull Request
We use github for our codebase. You can start by reading [How To Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).
## Branch Organization
We use [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) as our branch organization, as known as [FDD](https://en.wikipedia.org/wiki/Feature-driven_development)
## Bugs
### 1. How to Find Known Issues
We are using [Github Issues](https://github.com/cloudwego/kitex/issues) for our public bugs. We keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist.
### 2. Reporting New Issues
Providing a reduced test code is a recommended way for reporting issues. Then can placed in:
- Just in issues
- [Golang Playground](https://play.golang.org/)
### 3. Security Bugs
Please do not report the safe disclosure of bugs to public issues. Contact us by [Support Email](mailto:conduct@cloudwego.io)
## How to Get in Touch
- [Email](mailto:conduct@cloudwego.io)
## Submit a Pull Request
Before you submit your Pull Request (PR) consider the following guidelines:
1. Search [GitHub](https://github.com/cloudwego/kitex/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate existing efforts.
2. Please submit an issue instead of PR if you have a better suggestion for format tools. We won't accept a lot of file changes directly without issue statement and assignment.
3. Be sure that the issue describes the problem you're fixing, or documents the design for the feature you'd like to add. Before we accepting your work, we need to conduct some checks and evaluations. So, It will be better if you can discuss the design with us.
4. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the cloudwego/kitex repo.
5. In your forked repository, make your changes in a new git branch:
```
git checkout -b my-fix-branch main
```
6. Create your patch, including appropriate test cases. Please refer to [Go-UT](https://pkg.go.dev/testing#pkg-overview) for writing guides. [Go-Mock](https://github.com/golang/mock) is recommended to mock interface, please refer to internal/mocks/readme.md for more details, and [Mockey](https://github.com/bytedance/mockey) is recommended to mock functions, please refer to its readme doc for specific usage.
7. Follow our [Style Guides](#code-style-guides).
8. Commit your changes using a descriptive commit message that follows [AngularJS Git Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit).
Adherence to these conventions is necessary because release notes are automatically generated from these messages.
9. Push your branch to GitHub:
```
git push origin my-fix-branch
```
10. In GitHub, send a pull request to `kitex:main` with a clear and unambiguous title.
## Contribution Prerequisites
- Our development environment keeps up with [Go Official](https://golang.org/project/).
- You need fully checking with lint tools before submit your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) and [golangci-lint](https://github.com/golangci/golangci-lint)
- You are familiar with [Github](https://github.com)
- Maybe you need familiar with [Actions](https://github.com/features/actions)(our default workflow tool).
## Code Style Guides
See [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments).
Good resources:
- [Effective Go](https://golang.org/doc/effective_go)
- [Pingcap General advice](https://pingcap.github.io/style-guide/general.html)
- [Uber Go Style Guide](https://github.com/uber-go/guide/blob/master/style.md)
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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: NOTICE
================================================
CloudWeGo
Copyright 2021 CloudWeGo Authors.
Apache Thrift
Copyright (C) 2006 - 2019, The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
================================================
FILE: README.md
================================================
# CloudWeGo-Kitex
English | [中文](README_cn.md)
[](https://github.com/cloudwego/kitex/releases)
[](https://www.cloudwego.io/)
[](https://github.com/cloudwego/kitex/blob/main/LICENSE)
[](https://goreportcard.com/report/github.com/cloudwego/kitex)
[](https://github.com/cloudwego/kitex/issues)
[](https://github.com/cloudwego/kitex/issues?q=is%3Aissue+is%3Aclosed)


Kitex [kaɪt'eks] is a **high-performance** and **strong-extensibility** Go RPC framework that helps developers build microservices. If the performance and extensibility are the main concerns when you develop microservices, Kitex can be a good choice.
## Basic Features
- **High Performance**
Kitex integrates [Netpoll](https://github.com/cloudwego/netpoll), a high-performance network library, which offers a significant performance advantage over [go net](https://pkg.go.dev/net).
- **Extensibility**
Kitex provides many interfaces with default implementations for users to customize. You can extend or inject them into Kitex to fulfill your needs (please refer to the framework extension section below).
- **Multi-message Protocol**
Kitex is designed to be extensible to support multiple RPC messaging protocols. The initial release contains support for **Thrift**, **Kitex Protobuf** and **gRPC**, in which Kitex Protobuf is a Kitex custom Protobuf messaging protocol with a protocol format similar to Thrift. Kitex also supports developers extending their own messaging protocols.
- **Multi-transport Protocol**
For service governance, Kitex supports **TTHeader** and **HTTP2**. TTHeader can be used in conjunction with Thrift and Kitex Protobuf.
- **Multi-message Type**
Kitex supports **PingPong**, **One-way**, and **Bidirectional Streaming**. Among them, One-way currently only supports Thrift protocol.
- **Service Governance**
Kitex integrates service governance modules such as service registry, service discovery, load balancing, circuit breaker, rate limiting, retry, monitoring, tracing, logging, diagnosis, etc. Most of these have been provided with default extensions, giving users the option to integrate them as desired.
- **Code Generation**
Kitex has built-in code generation tools that support generating **Thrift**, **Protobuf**, and scaffold code.
## Documentation
- [**Getting Started**](https://www.cloudwego.io/docs/kitex/getting-started/)
- **User Guide**
- **Basic Features**
Including Message Type, Supported Protocols, Directly Invoke, Connection Pool, Timeout Control, Request Retry, LoadBalancer, Circuit Breaker, Rate Limiting, Instrumentation Control, Logging and HttpResolver.[[more]](https://www.cloudwego.io/docs/kitex/tutorials/basic-feature/)
- **Governance Features**
Supporting Service Discovery, Monitoring, Tracing and Customized Access Control.[[more]](https://www.cloudwego.io/docs/kitex/tutorials/service-governance/)
- **Advanced Features**
Supporting Generic Call and Server SDK Mode.[[more]](https://www.cloudwego.io/docs/kitex/tutorials/advanced-feature/)
- **Code Generation**
Including Code Generation Tool and Combined Service.[[more]](https://www.cloudwego.io/docs/kitex/tutorials/code-gen/)
- **Framework Extension**
Providing Middleware Extensions, Suite Extensions, Service Registry, Service Discovery, Customize LoadBalancer, Monitoring, Logging, Codec, Transport Module, Transport Pipeline, Metadata Transparent Transmission, Diagnosis Module.[[more]](https://www.cloudwego.io/docs/kitex/tutorials/framework-exten/)
- **Reference**
- For Transport Protocol, Exception Instruction and Version Specification, please refer to [doc](https://www.cloudwego.io/docs/kitex/reference/).
- **Best Practice**
- Kitex best practices in production, such as graceful shutdown, error handling, and integration testing. [More](https://www.cloudwego.io/docs/kitex/best-practice/)
- **FAQ**
- Please refer to [FAQ](https://www.cloudwego.io/docs/kitex/faq/).
## Performance
Performance benchmark can only provide a limited reference. In production, there are many factors that can affect actual performance.
We provide the [kitex-benchmark](https://github.com/cloudwego/kitex-benchmark) project to track and compare the performance of Kitex and other frameworks under different conditions for reference.
## Related Projects
- [Netpoll](https://github.com/cloudwego/netpoll): A high-performance network library.
- [kitex-contrib](https://github.com/kitex-contrib): A partial extension library of Kitex, which users can integrate into Kitex through options according to their needs.
- [kitex-examples](https://github.com/cloudwego/kitex-examples): Examples of Kitex showcasing various features.
- [biz-demo](https://github.com/cloudwego/biz-demo): Business demos using Kitex.
## Blogs
- [Enhancing Performance in Microservice Architecture with Kitex](https://www.cloudwego.io/blog/2024/01/29/enhancing-performance-in-microservice-architecture-with-kitex/)
- [CloudWeGo: A leading practice for building enterprise cloud native middleware!](https://www.cloudwego.io/blog/2023/06/15/cloudwego-a-leading-practice-for-building-enterprise-cloud-native-middleware/)
- [Kitex: Unifying Open Source Practice for a High-Performance RPC Framework](https://www.cloudwego.io/blog/2022/09/30/kitex-unifying-open-source-practice-for-a-high-performance-rpc-framework/)
- [Performance Optimization on Kitex](https://www.cloudwego.io/blog/2021/09/23/performance-optimization-on-kitex/)
- [ByteDance Practice on Go Network Library](https://www.cloudwego.io/blog/2020/05/24/bytedance-practices-on-go-network-library/)
- [Getting Started With Kitex's Practice: Performance Testing Guide](https://www.cloudwego.io/blog/2021/11/24/getting-started-with-kitexs-practice-performance-testing-guide/)
## Contributing
Contributor guide: [Contributing](https://github.com/cloudwego/kitex/blob/develop/CONTRIBUTING.md).
## License
Kitex is distributed under the [Apache License, version 2.0](https://github.com/cloudwego/kitex/blob/develop/LICENSE). The licenses of third party dependencies of Kitex are explained [here](https://github.com/cloudwego/kitex/blob/develop/licenses).
## Community
- Email: [conduct@cloudwego.io](conduct@cloudwego.io)
- How to become a member: [COMMUNITY MEMBERSHIP](https://github.com/cloudwego/community/blob/main/COMMUNITY_MEMBERSHIP.md)
- Issues: [Issues](https://github.com/cloudwego/kitex/issues)
- Discord: Join the community with [Discord Channel](https://discord.gg/jceZSE7DsW).
- Lark: Scan the QR code below with [Lark](https://www.larksuite.com/zh_cn/download) to join our CloudWeGo/kitex user group.

## Landscapes
<p align="center">
<img src="https://landscape.cncf.io/images/cncf-landscape-horizontal-color.svg" width="150"/> <img src="https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg" width="200"/>
<br/><br/>
CloudWeGo enriches the <a href="https://landscape.cncf.io/">CNCF CLOUD NATIVE Landscape</a>.
</p>
================================================
FILE: README_cn.md
================================================
# CloudWeGo-Kitex
[English](README.md) | 中文
[](https://github.com/cloudwego/kitex/releases)
[](https://www.cloudwego.io/)
[](https://github.com/cloudwego/kitex/blob/main/LICENSE)
[](https://goreportcard.com/report/github.com/cloudwego/kitex)
[](https://github.com/cloudwego/kitex/issues)
[](https://github.com/cloudwego/kitex/issues?q=is%3Aissue+is%3Aclosed)


Kitex[kaɪt'eks] 字节跳动内部的 Go 微服务 RPC 框架,具有**高性能**、**强可扩展**的特点,在字节内部已广泛使用。如今越来越多的微服务选择使用 Go,如果对微服务性能有要求,又希望定制扩展融入自己的治理体系,Kitex 会是一个不错的选择。
## 框架特点
- **高性能**
使用自研的高性能网络库 [Netpoll](https://github.com/cloudwego/netpoll),性能相较 go net 具有显著优势。
- **扩展性**
提供了较多的扩展接口以及默认扩展实现,使用者也可以根据需要自行定制扩展,具体见下面的框架扩展。
- **多消息协议**
RPC 消息协议默认支持 **Thrift**、**Kitex Protobuf**、**gRPC**。Thrift 支持 Buffered 和 Framed 二进制协议;Kitex Protobuf 是 Kitex 自定义的 Protobuf 消息协议,协议格式类似 Thrift;gRPC 是对 gRPC 消息协议的支持,可以与 gRPC 互通。除此之外,使用者也可以扩展自己的消息协议。
- **多传输协议**
传输协议封装消息协议进行 RPC 互通,传输协议可以额外透传元信息,用于服务治理,Kitex 支持的传输协议有 **TTHeader**、**HTTP2**。TTHeader 可以和 Thrift、Kitex Protobuf 结合使用。
- **多种消息类型**
支持 **PingPong**、**Oneway**、**双向 Streaming**。其中 Oneway 目前只对 Thrift 协议支持。
- **服务治理**
支持服务注册/发现、负载均衡、熔断、限流、重试、监控、链路跟踪、日志、诊断等服务治理模块,大部分均已提供默认扩展,使用者可选择集成。
- **代码生成**
Kitex 内置代码生成工具,可支持生成 **Thrift**、**Protobuf** 以及脚手架代码。
## 详细文档
- [**快速开始**](https://www.cloudwego.io/zh/docs/kitex/getting-started/)
- **用户指南**
- **基本特性**
包含消息类型、编解码协议、直连访问、连接池、超时控制、请求重试、负载均衡、熔断、埋点粒度控制、日志以及 HttpResolver,详见[文档](https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-feature/)。
- **治理特性**
支持服务发现、监控、链路跟踪、自定义访问控制等治理特性,详见[文档](https://www.cloudwego.io/zh/docs/kitex/tutorials/service-governance/)。
- **高级特性**
支持泛化调用、Server SDK 化等高级特性,详见[文档](https://www.cloudwego.io/zh/docs/kitex/tutorials/advanced-feature/)。
- **代码生成**
提供代码生成工具与 Combine Service 说明,详见[文档](https://www.cloudwego.io/zh/docs/kitex/tutorials/code-gen/)。
- **框架扩展**
提供基本扩展 - 自定义 Middleware、Suite 扩展(封装自定义治理模块)、服务注册扩展、服务发现扩展、负载均衡扩展、监控扩展、日志扩展、编解码(协议)扩展、传输模块扩展、Transport Pipeline-Bound 扩展、元信息传递扩展、诊断模块扩展等支持,详见[文档](https://www.cloudwego.io/zh/docs/kitex/tutorials/framework-exten/)。
- **参考**
- 关于应用层传输协议 TTHeader、异常说明与版本管理,请参考[文档](https://www.cloudwego.io/zh/docs/kitex/reference/)。
- **最佳实践**
- Kitex 在生产环境下的最佳实践,如优雅停机、错误处理、集成测试,详见:[文档](https://www.cloudwego.io/zh/docs/kitex/best-practice/)
- **FAQ**
- 请参考 [FAQ](https://www.cloudwego.io/zh/docs/kitex/faq/)。
## 框架性能
性能测试只能提供相对参考,工业场景下,有诸多因素可以影响实际的性能表现。
我们提供了 [kitex-benchmark](https://github.com/cloudwego/kitex-benchmark) 项目用来长期追踪和比较 Kitex 与其他框架在不同情况下的性能数据以供参考。
## 相关项目
- [Netpoll](https://github.com/cloudwego/netpoll):自研的高性能网络库,Kitex 默认集成的。
- [kitex-contrib](https://github.com/kitex-contrib):Kitex 的部分扩展库,使用者可以根据需求通过 Option 集成进 Kitex 中。
- [kitex-examples](https://github.com/cloudwego/kitex-examples): Kitex 功能示例代码集。
- [biz-demo](https://github.com/cloudwego/biz-demo): Kitex 业务示例。
## 相关文章
- [Kitex 两周年回顾 — 能力升级、社区合作与未来展望](https://www.cloudwego.io/zh/blog/2023/11/30/kitex-%E4%B8%A4%E5%91%A8%E5%B9%B4%E5%9B%9E%E9%A1%BE-%E8%83%BD%E5%8A%9B%E5%8D%87%E7%BA%A7%E7%A4%BE%E5%8C%BA%E5%90%88%E4%BD%9C%E4%B8%8E%E6%9C%AA%E6%9D%A5%E5%B1%95%E6%9C%9B/)
- [高性能 RPC 框架 CloudWeGo-Kitex 内外统一的开源实践](https://www.cloudwego.io/zh/blog/2022/09/20/%E9%AB%98%E6%80%A7%E8%83%BD-rpc-%E6%A1%86%E6%9E%B6-cloudwego-kitex-%E5%86%85%E5%A4%96%E7%BB%9F%E4%B8%80%E7%9A%84%E5%BC%80%E6%BA%90%E5%AE%9E%E8%B7%B5/)
- [字节跳动 Go RPC 框架 Kitex 性能优化实践](https://www.cloudwego.io/zh/blog/2021/09/23/%E5%AD%97%E8%8A%82%E8%B7%B3%E5%8A%A8-go-rpc-%E6%A1%86%E6%9E%B6-kitex-%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E5%AE%9E%E8%B7%B5/)
- [字节跳动在 Go 网络库上的实践](https://www.cloudwego.io/zh/blog/2020/05/24/%E5%AD%97%E8%8A%82%E8%B7%B3%E5%8A%A8%E5%9C%A8-go-%E7%BD%91%E7%BB%9C%E5%BA%93%E4%B8%8A%E7%9A%84%E5%AE%9E%E8%B7%B5/)
- [RPC 框架 Kitex 实践入门:性能测试指南](https://www.cloudwego.io/zh/blog/2021/11/24/rpc-%E6%A1%86%E6%9E%B6-kitex-%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95%E6%8C%87%E5%8D%97/)
## 贡献代码
贡献者指南:[Contributing](CONTRIBUTING.md)。
## 开源许可
Kitex 基于[Apache License 2.0](LICENSE) 许可证,其依赖的三方组件的开源许可见 [Licenses](licenses)。
## 联系我们
- Email: conduct@cloudwego.io
- 如何成为 member: [COMMUNITY MEMBERSHIP](https://github.com/cloudwego/community/blob/main/COMMUNITY_MEMBERSHIP.md)
- Issues: [Issues](https://github.com/cloudwego/kitex/issues)
- Discord: 加入我们的 [Discord 频道](https://discord.gg/jceZSE7DsW)
- 飞书用户群([注册飞书](https://www.feishu.cn/)后扫码进群)

## Landscapes
<p align="center">
<img src="https://landscape.cncf.io/images/cncf-landscape-horizontal-color.svg" width="150"/> <img src="https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg" width="200"/>
<br/><br/>
CloudWeGo 丰富了 <a href="https://landscape.cncf.io/">CNCF 云原生生态</a>。
</p>
================================================
FILE: ROADMAP.md
================================================
# Kitex RoadMap
This document shows key roadmap of Kitex development from the year of 2021 to 2022. It may help users know more about the future features. But the actual work is driven by real-world needs, we may adjust our goals sometimes.
## New Features:
- IO Communication
- Netpoll provides more features and do further performance optimization, references https://github.com/cloudwego/netpoll.
- Support ShmIPC to optimize IPC.
- Support data packet compression.
- Service Governance
- Support more extension for users. All developers are welcome to contribute your extension to https://github.com/kitex-contrib.
- Support dynamic config, expose API in Kitex.
- Support Proxyless mode to integrate with Istio.
- Codec
- Support no serialization which references [Cap'n](https://capnproto.org/index.html) but is compatible with Thrift.
- Support runtime serialization&deserialization without generating code (JIT) for Thrift.
- Tool
- Support generating Protobuf code to optimize performance.
## Performance Optimization
- Improve the throughput of client side.
- Optimize Protobuf Streaming performance.
- Kitex-Protobuf supports codec with NoCopy API to reduce memory copies.
## User Experience Optimization
- Provide good development practices for users to develop with Kitex more easily.
- Improve Kitex Tool to provide more conveniences.
================================================
FILE: client/callopt/options.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Package callopt contains options that control the behavior of client on request level.
package callopt
import (
"fmt"
"net"
"strings"
"sync"
"time"
"github.com/cloudwego/kitex/internal/client"
"github.com/cloudwego/kitex/pkg/discovery"
"github.com/cloudwego/kitex/pkg/fallback"
"github.com/cloudwego/kitex/pkg/http"
"github.com/cloudwego/kitex/pkg/retry"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
)
var callOptionsPool = sync.Pool{
New: newOptions,
}
type CallOptions struct {
configs rpcinfo.MutableRPCConfig
svr remoteinfo.RemoteInfo
locks *client.ConfigLocks
httpResolver http.Resolver
// export field for using in client
RetryPolicy retry.Policy
Fallback *fallback.Policy
CompressorName string
StreamOptions client.StreamOptions
BinaryGenericIDLService string
}
func newOptions() interface{} {
return &CallOptions{
locks: &client.ConfigLocks{
Tags: make(map[string]struct{}),
},
}
}
// Recycle zeros the call option and put it to the pool.
func (co *CallOptions) Recycle() {
if co == nil {
return
}
co.configs = nil
co.svr = nil
co.RetryPolicy = retry.Policy{}
co.Fallback = nil
co.locks.Zero()
callOptionsPool.Put(co)
}
// Option is a series of options used at the beginning of a RPC call.
type Option struct {
f func(o *CallOptions, di *strings.Builder)
}
// F returns the function of the option.
// It's useful for creating streamcall.Option from existing callopt.Option
// Note: not all callopt.Option(s) are available for stream clients.
func (o Option) F() func(o *CallOptions, di *strings.Builder) {
return o.f
}
// NewOption returns a new Option with the given function.
// It's useful for converting streamcall.Option back to a callopt.Option
func NewOption(f func(o *CallOptions, di *strings.Builder)) Option {
return Option{f: f}
}
// WithHostPort specifies the target address for a RPC call.
// The given address will overwrite the result from Resolver.
func WithHostPort(hostport string) Option {
return Option{func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithHostPort(")
di.WriteString(hostport)
di.WriteString("),")
if err := setInstance(o.svr, hostport); err != nil {
panic(fmt.Errorf("WithHostPort: %w", err))
}
}}
}
func setInstance(svr remoteinfo.RemoteInfo, hostport string) error {
if _, err := net.ResolveTCPAddr("tcp", hostport); err == nil {
svr.SetInstance(discovery.NewInstance("tcp", hostport, discovery.DefaultWeight, nil))
} else if _, err := net.ResolveUnixAddr("unix", hostport); err == nil {
svr.SetInstance(discovery.NewInstance("unix", hostport, discovery.DefaultWeight, nil))
} else {
return fmt.Errorf("invalid '%s'", hostport)
}
return nil
}
// WithURL specifies the target for a RPC call with url.
// The given url will be resolved to hostport and overwrites the result from Resolver.
func WithURL(url string) Option {
return Option{func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithURL(")
di.WriteString(url)
di.WriteString("),")
o.svr.SetTag(rpcinfo.HTTPURL, url)
hostport, err := o.httpResolver.Resolve(url)
if err != nil {
panic(fmt.Errorf("http resolve failed: %w", err))
}
if err := setInstance(o.svr, hostport); err != nil {
panic(fmt.Errorf("WithURL: %w", err))
}
}}
}
// WithHTTPHost specifies host in http header(work when RPC over http).
func WithHTTPHost(host string) Option {
return Option{func(o *CallOptions, di *strings.Builder) {
o.svr.SetTag(rpcinfo.HTTPHost, host)
}}
}
// WithRPCTimeout specifies the RPC timeout for a RPC call.
// FIXME: callopt.WithRPCTimeout works only when client.WithRPCTimeout or
// client.WithTimeoutProvider is specified.
func WithRPCTimeout(d time.Duration) Option {
return Option{func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithRPCTimeout()")
o.configs.SetRPCTimeout(d)
o.locks.Bits |= rpcinfo.BitRPCTimeout
// TODO SetReadWriteTimeout 是否考虑删除
o.configs.SetReadWriteTimeout(d)
o.locks.Bits |= rpcinfo.BitReadWriteTimeout
}}
}
// WithConnectTimeout specifies the connection timeout for a RPC call.
func WithConnectTimeout(d time.Duration) Option {
return Option{func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithConnectTimeout()")
o.configs.SetConnectTimeout(d)
o.locks.Bits |= rpcinfo.BitConnectTimeout
}}
}
// WithTag sets the tags for service discovery for a RPC call.
func WithTag(key, val string) Option {
return Option{f: func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithTag")
di.WriteByte('(')
di.WriteString(key)
di.WriteByte('=')
di.WriteString(val)
di.WriteByte(')')
o.svr.SetTag(key, val)
o.locks.Tags[key] = struct{}{}
}}
}
// WithRetryPolicy sets the retry policy for a RPC call.
// Build retry.Policy with retry.BuildFailurePolicy or retry.BuildBackupRequest or retry.BuildMixedPolicy
// instead of building retry.Policy directly.
//
// Demos are provided below:
//
// demo1. call with failure retry policy, default retry error is Timeout
// `resp, err := cli.Mock(ctx, req, callopt.WithRetryPolicy(retry.BuildFailurePolicy(retry.NewFailurePolicy())))`
// demo2. call with backup request policy
// `bp := retry.NewBackupPolicy(10)
// `bp.WithMaxRetryTimes(1)`
// `resp, err := cli.Mock(ctx, req, callopt.WithRetryPolicy(retry.BuildBackupRequest(bp)))`
// demo2. call with miexed request policy
// `bp := retry.BuildMixedPolicy(10)
// `resp, err := cli.Mock(ctx, req, callopt.WithRetryPolicy(retry.BuildMixedPolicy(retry.NewMixedPolicy(10))))`
func WithRetryPolicy(p retry.Policy) Option {
return Option{f: func(o *CallOptions, di *strings.Builder) {
if !p.Enable {
return
}
if p.Type == retry.MixedType {
di.WriteString("WithMixedRetry")
} else if p.Type == retry.BackupType {
di.WriteString("WithBackupRequest")
} else {
di.WriteString("WithFailureRetry")
}
o.RetryPolicy = p
}}
}
// WithFallback is used to set the fallback policy for a RPC call.
// Demos are provided below:
//
// demo1. call with fallback for error
// `resp, err := cli.Mock(ctx, req, callopt.WithFallback(fallback.ErrorFallback(yourFBFunc))`
// demo2. call with fallback for error and enable reportAsFallback, which sets reportAsFallback to be true and will do report(metric) as Fallback result
// `resp, err := cli.Mock(ctx, req, callopt.WithFallback(fallback.ErrorFallback(yourFBFunc).EnableReportAsFallback())`
func WithFallback(fb *fallback.Policy) Option {
return Option{f: func(o *CallOptions, di *strings.Builder) {
if !fallback.IsPolicyValid(fb) {
return
}
di.WriteString("WithFallback")
o.Fallback = fb
}}
}
// WithGRPCCompressor specifies the compressor for the GRPC frame payload.
// Supported compressor names: identity, gzip
// Custom compressors can be registered via `encoding.RegisterCompressor`
func WithGRPCCompressor(compressorName string) Option {
return Option{f: func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithGRPCCompressor")
di.WriteByte('(')
di.WriteString(compressorName)
di.WriteByte(')')
o.CompressorName = compressorName
}}
}
// WithBinaryGenericIDLService specifies the target IDL Service Name that
// binary generic call would visit.
// Empty svcName would not take effect.
//
// Example:
//
// resp, err := cli.GenericCall(ctx, method, req,
// callopt.WithBinaryGenericIDLService("TestService"))
//
// Note: Only effective for BinaryThriftGenericV2 and BinaryPbGeneric.
// For other generic types, this option will be ignored.
func WithBinaryGenericIDLService(svcName string) Option {
return Option{f: func(o *CallOptions, di *strings.Builder) {
di.WriteString("WithBinaryGenericIDLService")
di.WriteByte('(')
di.WriteString(svcName)
di.WriteByte(')')
o.BinaryGenericIDLService = svcName
}}
}
// Apply applies call options to the rpcinfo.RPCConfig and internal.RemoteInfo of kitex client.
// The return value records the name and arguments of each option.
// This function is for internal purpose only.
func Apply(cos []Option, cfg rpcinfo.MutableRPCConfig, svr remoteinfo.RemoteInfo, locks *client.ConfigLocks, httpResolver http.Resolver) (string, *CallOptions) {
var buf strings.Builder
buf.Grow(64)
co := callOptionsPool.Get().(*CallOptions)
co.configs = cfg
co.svr = svr
co.locks.Merge(locks)
co.httpResolver = httpResolver
buf.WriteByte('[')
for i := range cos {
if i > 0 {
buf.WriteByte(',')
}
cos[i].f(co, &buf)
}
buf.WriteByte(']')
co.locks.ApplyLocks(cfg, svr)
return buf.String(), co
}
================================================
FILE: client/callopt/options_test.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package callopt
import (
"context"
"fmt"
"strings"
"testing"
"time"
"github.com/cloudwego/kitex/internal/client"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/fallback"
"github.com/cloudwego/kitex/pkg/http"
"github.com/cloudwego/kitex/pkg/retry"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
)
// Mock value
var (
option Option
applyRes string
rpcConfig = rpcinfo.AsMutableRPCConfig(rpcinfo.NewRPCConfig())
remoteInfo = remoteinfo.NewRemoteInfo(&rpcinfo.EndpointBasicInfo{
ServiceName: "service",
Method: "method0",
}, "method1")
)
const (
mockHostPort = "127.0.0.1:8888"
mockURL = "www.cloudwego.com"
mockHTTPHost = "www.cloudwego.com"
mockRPCTimeout = 1000 * time.Millisecond
mockRPCTimeoutStr = "1000ms"
mockConnectTimeout = 500 * time.Millisecond
mockConnectTimeoutStr = "500ms"
mockKey = "mock_key"
mockVal = "mock_val"
)
// TestApply apply different option
func TestApply(t *testing.T) {
// WithHostPort
option = WithHostPort(mockHostPort)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, applyRes == fmt.Sprintf("[WithHostPort(%s),]", mockHostPort))
// WithURL
option = WithURL(mockURL)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, applyRes == fmt.Sprintf("[WithURL(%s),]", mockURL))
// WithHTTPHost
option = WithHTTPHost(mockHTTPHost)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
httpHost, exist := remoteInfo.Tag(rpcinfo.HTTPHost)
test.Assert(t, httpHost == mockHTTPHost, applyRes)
test.Assert(t, exist)
// WithRPCTimeout
option = WithRPCTimeout(mockRPCTimeout)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, applyRes == "[WithRPCTimeout()]", applyRes)
test.Assert(t, rpcConfig.ImmutableView().RPCTimeout() == mockRPCTimeout, rpcConfig.ImmutableView().RPCTimeout())
test.Assert(t, rpcConfig.ImmutableView().ReadWriteTimeout() == mockRPCTimeout, rpcConfig.ImmutableView().ReadWriteTimeout())
// WithConnectTimeout
option = WithConnectTimeout(mockConnectTimeout)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, applyRes == "[WithConnectTimeout()]", applyRes)
test.Assert(t, rpcConfig.ImmutableView().ConnectTimeout() == mockConnectTimeout, rpcConfig.ImmutableView().ConnectTimeout())
// WithTag
option = WithTag(mockKey, mockVal)
applyRes, _ = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
v, exist := remoteInfo.Tag(mockKey)
test.Assert(t, exist)
test.Assert(t, v == mockVal, v)
// WithRetryPolicy
option = WithRetryPolicy(retry.BuildFailurePolicy(retry.NewFailurePolicy()))
_, co := Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.RetryPolicy.Enable)
test.Assert(t, co.RetryPolicy.FailurePolicy != nil)
// WithRetryPolicy
option = WithRetryPolicy(retry.BuildMixedPolicy(retry.NewMixedPolicy(10)))
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.RetryPolicy.Enable)
test.Assert(t, co.RetryPolicy.MixedPolicy != nil)
// WithRetryPolicy
option = WithRetryPolicy(retry.BuildBackupRequest(retry.NewBackupPolicy(10)))
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.RetryPolicy.Enable)
test.Assert(t, co.RetryPolicy.BackupPolicy != nil)
// WithRetryPolicy pass empty struct
option = WithRetryPolicy(retry.Policy{})
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, !co.RetryPolicy.Enable)
// WithFallback
option = WithFallback(fallback.ErrorFallback(fallback.UnwrapHelper(func(ctx context.Context, req, resp interface{}, err error) (fbResp interface{}, fbErr error) {
return
})).EnableReportAsFallback())
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.Fallback != nil)
// WithFallback pass nil
option = WithFallback(nil)
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.Fallback == nil)
// WithBinaryGenericIDLService
option = WithBinaryGenericIDLService("test_idl")
_, co = Apply([]Option{option}, rpcConfig, remoteInfo, client.NewConfigLocks(), http.NewDefaultResolver())
test.Assert(t, co.BinaryGenericIDLService == "test_idl")
}
func BenchmarkStringsBuilder(b *testing.B) {
var cos []Option
cos = append(cos, WithRPCTimeout(time.Second))
cos = append(cos, WithTag("cluster", "mock"))
cos = append(cos, WithTag("idc", "mock"))
b.ReportAllocs()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
co := callOptionsPool.Get().(*CallOptions)
co.configs = rpcinfo.NewRPCConfig().(rpcinfo.MutableRPCConfig)
co.svr = remoteinfo.NewRemoteInfo(&rpcinfo.EndpointBasicInfo{}, "method")
var buf strings.Builder
buf.Grow(64)
buf.WriteByte('[')
for i := range cos {
if i > 0 {
buf.WriteByte(',')
}
cos[i].f(co, &buf)
}
buf.WriteByte(']')
_ = buf.String()
}
})
}
================================================
FILE: client/callopt/streamcall/call_options.go
================================================
/*
* Copyright 2023 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package streamcall
import (
"fmt"
"strings"
"time"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/pkg/streaming"
)
// These options are directly translated from callopt.Option(s). If you can't find the option with the
// same name in callopt.Option(s), most probably it means it's not for streaming clients.
// WithHostPort specifies the target address for an RPC call.
func WithHostPort(hostPort string) Option {
return ConvertOptionFrom(callopt.WithHostPort(hostPort))
}
// WithURL specifies the target for a RPC call with url.
// The given url will be resolved to hostport and overwrites the result from Resolver.
func WithURL(url string) Option {
return ConvertOptionFrom(callopt.WithURL(url))
}
// WithConnectTimeout specifies the connection timeout for a RPC call.
func WithConnectTimeout(d time.Duration) Option {
return ConvertOptionFrom(callopt.WithConnectTimeout(d))
}
// WithTag sets the tags for service discovery for an RPC call.
func WithTag(key, val string) Option {
return ConvertOptionFrom(callopt.WithTag(key, val))
}
// WithRecvTimeout add recv timeout for stream.Recv function.
// NOTICE: ONLY effective for ttheader streaming protocol for now.
//
// Deprecated: using WithRecvTimeoutConfig
// When WithRecvTimeout and WithRecvTimeoutConfig are both configured for ttstream,
// WithRecvTimeoutConfig has higher priority.
func WithRecvTimeout(d time.Duration) Option {
return Option{f: func(o *callopt.CallOptions, di *strings.Builder) {
di.WriteString("WithRecvTimeout(")
di.WriteString(d.String())
di.WriteString(")")
o.StreamOptions.RecvTimeout = d
}}
}
// WithRecvTimeoutConfig add recv timeout for stream.Recv function.
// By default, it will cancel the remote peer when timeout.
//
// However, in certain scenarios (e.g., resume-enabled transfers: A → B → C), A may not wish to cancel B and C upon detecting a timeout.
// It expects B and C to complete one round of streaming communication and cache the results.
// This allows A to resume the request from the disconnected point on the next attempt, completing the resume-from-breakpoint process.
// Config like this:
//
// WithRecvTimeoutConfig(streaming.TimeoutConfig{
// Timeout: tm,
// DisableCancelRemote: true,
// })
//
// The remote peer must promptly exit the handler; otherwise, there is a risk of stream leakage!
func WithRecvTimeoutConfig(cfg streaming.TimeoutConfig) Option {
return Option{f: func(o *callopt.CallOptions, di *strings.Builder) {
fmt.Fprintf(di, "WithRecvTimeoutConfig(+%v)", cfg)
o.StreamOptions.RecvTimeoutConfig = cfg
}}
}
// WithBinaryGenericIDLService specifies the target IDL Service Name that
// binary generic streaming call would visit.
// Empty svcName would not take effect.
//
// Example:
//
// stream, err := cli.ServerStreaming(ctx, method, req,
// streamcall.WithBinaryGenericIDLService("TestService"))
//
// Note: Only effective for BinaryThriftGenericV2 and BinaryPbGeneric.
// For other generic types, this option will be ignored.
func WithBinaryGenericIDLService(svcName string) Option {
return Option{f: func(o *callopt.CallOptions, di *strings.Builder) {
di.WriteString("WithBinaryGenericIDLService")
di.WriteByte('(')
di.WriteString(svcName)
di.WriteByte(')')
o.BinaryGenericIDLService = svcName
}}
}
================================================
FILE: client/callopt/streamcall/call_options_test.go
================================================
/*
* Copyright 2025 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package streamcall
import (
"strings"
"testing"
"time"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/streaming"
)
func TestWithRecvTimeout(t *testing.T) {
var sb strings.Builder
callOpts := callopt.CallOptions{}
testTimeout := 1 * time.Second
WithRecvTimeout(testTimeout).f(&callOpts, &sb)
test.Assert(t, callOpts.StreamOptions.RecvTimeout == testTimeout)
test.Assert(t, sb.String() == "WithRecvTimeout(1s)")
}
func TestWithRecvTimeoutConfig(t *testing.T) {
// config timeout
sb := strings.Builder{}
callOpts := callopt.CallOptions{}
WithRecvTimeoutConfig(streaming.TimeoutConfig{Timeout: 1 * time.Second}).f(&callOpts, &sb)
test.Assert(t, callOpts.StreamOptions.RecvTimeoutConfig.Timeout == 1*time.Second, callOpts)
test.Assert(t, !callOpts.StreamOptions.RecvTimeoutConfig.DisableCancelRemote, callOpts)
// config DisableCancelRemote
sb = strings.Builder{}
callOpts = callopt.CallOptions{}
WithRecvTimeoutConfig(streaming.TimeoutConfig{DisableCancelRemote: true}).f(&callOpts, &sb)
test.Assert(t, callOpts.StreamOptions.RecvTimeoutConfig.Timeout == 0, callOpts)
test.Assert(t, callOpts.StreamOptions.RecvTimeoutConfig.DisableCancelRemote, callOpts)
// config timeout and DisableCancelRemote
sb = strings.Builder{}
callOpts = callopt.CallOptions{}
WithRecvTimeoutConfig(streaming.TimeoutConfig{Timeout: 1 * time.Second, DisableCancelRemote: true}).f(&callOpts, &sb)
test.Assert(t, callOpts.StreamOptions.RecvTimeoutConfig.Timeout == 1*time.Second, callOpts)
test.Assert(t, callOpts.StreamOptions.RecvTimeoutConfig.DisableCancelRemote, callOpts)
}
func TestWithBinaryGenericIDLService(t *testing.T) {
// config empty IDL Service
sb := strings.Builder{}
callOpts := callopt.CallOptions{}
WithBinaryGenericIDLService("").f(&callOpts, &sb)
test.Assert(t, callOpts.BinaryGenericIDLService == "", callOpts.BinaryGenericIDLService)
// config IDL Service
sb = strings.Builder{}
callOpts = callopt.CallOptions{}
WithBinaryGenericIDLService("test_idl").f(&callOpts, &sb)
test.Assert(t, callOpts.BinaryGenericIDLService == "test_idl", callOpts.BinaryGenericIDLService)
}
================================================
FILE: client/callopt/streamcall/definition.go
================================================
/*
* Copyright 2023 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package streamcall
import (
"strings"
"github.com/cloudwego/kitex/client/callopt"
)
// Option is the option type used in StreamClient's Call method
type Option struct {
f func(o *callopt.CallOptions, di *strings.Builder)
}
// Deprecated: it's not supposed to be called by users directly and may be removed in future versions.
// GetCallOption returns a callopt.Option
func (o Option) GetCallOption() callopt.Option {
return callopt.NewOption(o.f)
}
// Deprecated: it's not supposed to be called by users directly; may be removed in future versions.
// ConvertOptionFrom converts a callopt.Option to StreamOption
// It's convenient for creating StreamOption from existing callopt.Option
// Note: NOT all callopt.Option(s) converted will work for stream clients;
// Even if it works for now, it's NOT guaranteed that it will always work for future versions.
func ConvertOptionFrom(option callopt.Option) Option {
return Option{f: option.F()}
}
// GetCallOptions converts given streamcall.Option(s) to callopt.Option
func GetCallOptions(ops []Option) []callopt.Option {
options := make([]callopt.Option, 0, len(ops))
for _, opt := range ops {
options = append(options, opt.GetCallOption())
}
return options
}
================================================
FILE: client/callopt/streamcall/grpc_options.go
================================================
/*
* Copyright 2023 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package streamcall
import "github.com/cloudwego/kitex/client/callopt"
// WithGRPCCompressor specifies the compressor for the GRPC frame payload.
func WithGRPCCompressor(compressorName string) Option {
return ConvertOptionFrom(callopt.WithGRPCCompressor(compressorName))
}
================================================
FILE: client/client.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"errors"
"fmt"
"runtime"
"runtime/debug"
"strconv"
"sync/atomic"
"github.com/bytedance/gopkg/cloud/metainfo"
"github.com/cloudwego/localsession/backup"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/internal/client"
igeneric "github.com/cloudwego/kitex/internal/generic"
"github.com/cloudwego/kitex/pkg/acl"
"github.com/cloudwego/kitex/pkg/consts"
"github.com/cloudwego/kitex/pkg/diagnosis"
"github.com/cloudwego/kitex/pkg/discovery"
"github.com/cloudwego/kitex/pkg/endpoint"
"github.com/cloudwego/kitex/pkg/endpoint/cep"
"github.com/cloudwego/kitex/pkg/event"
"github.com/cloudwego/kitex/pkg/fallback"
"github.com/cloudwego/kitex/pkg/kerrors"
"github.com/cloudwego/kitex/pkg/klog"
"github.com/cloudwego/kitex/pkg/loadbalance"
"github.com/cloudwego/kitex/pkg/loadbalance/lbcache"
"github.com/cloudwego/kitex/pkg/proxy"
"github.com/cloudwego/kitex/pkg/remote"
"github.com/cloudwego/kitex/pkg/remote/bound"
"github.com/cloudwego/kitex/pkg/remote/remotecli"
"github.com/cloudwego/kitex/pkg/retry"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
"github.com/cloudwego/kitex/pkg/rpctimeout"
"github.com/cloudwego/kitex/pkg/serviceinfo"
"github.com/cloudwego/kitex/pkg/streaming"
"github.com/cloudwego/kitex/pkg/utils"
"github.com/cloudwego/kitex/pkg/warmup"
"github.com/cloudwego/kitex/transport"
)
// Client is the core interface abstraction of kitex client.
// It is designed for generated codes and should not be used directly.
// Parameter method specifies the method of a RPC call.
// Request is a packing of request parameters in the actual method defined in IDL, consist of zero, one
// or multiple arguments. So is response to the actual result type.
// Response may be nil to address oneway calls.
type Client interface {
Call(ctx context.Context, method string, request, response interface{}) error
}
type kClient struct {
svcInfo *serviceinfo.ServiceInfo
eps endpoint.UnaryEndpoint
sEps cep.StreamEndpoint
opt *client.Options
lbf *lbcache.BalancerFactory
inited bool
closed bool
}
// Set finalizer on kClient does not take effect, because kClient has a circular reference problem
// when construct the endpoint.Endpoint in the invokeHandleEndpoint,
// so wrapping kClient as kcFinalizerClient, and set finalizer on kcFinalizerClient, it can solve this problem.
type kcFinalizerClient struct {
*kClient
}
func (kf *kcFinalizerClient) Call(ctx context.Context, method string, request, response interface{}) error {
defer runtime.KeepAlive(kf)
return kf.kClient.Call(ctx, method, request, response)
}
// NewClient creates a kitex.Client with the given ServiceInfo, it is from generated code.
func NewClient(svcInfo *serviceinfo.ServiceInfo, opts ...Option) (Client, error) {
if svcInfo == nil {
return nil, errors.New("NewClient: no service info")
}
kc := &kcFinalizerClient{kClient: &kClient{}}
kc.svcInfo = svcInfo
kc.opt = client.NewOptions(opts)
if err := kc.init(); err != nil {
_ = kc.Close()
return nil, err
}
// like os.File, if kc is garbage-collected, but Close is not called, call Close.
runtime.SetFinalizer(kc, func(c *kcFinalizerClient) {
_ = c.Close()
})
return kc, nil
}
func (kc *kClient) init() (err error) {
initTransportProtocol(kc.svcInfo, kc.opt.Configs)
if err = kc.checkOptions(); err != nil {
return err
}
if err = kc.initCircuitBreaker(); err != nil {
return err
}
if err = kc.initRetryer(); err != nil {
return err
}
if err = kc.initProxy(); err != nil {
return err
}
if err = kc.initConnPool(); err != nil {
return err
}
if err = kc.initLBCache(); err != nil {
return err
}
ctx := kc.initContext()
mw := kc.initMiddlewares(ctx)
kc.initDebugService()
kc.richRemoteOption()
if err = kc.buildInvokeChain(mw); err != nil {
return err
}
if err = kc.warmingUp(); err != nil {
return err
}
kc.inited = true
return nil
}
func (kc *kClient) checkOptions() (err error) {
if kc.opt.Svr.ServiceName == "" {
return errors.New("service name is required")
}
return nil
}
func (kc *kClient) initCircuitBreaker() error {
if kc.opt.CBSuite != nil {
kc.opt.CBSuite.SetEventBusAndQueue(kc.opt.Bus, kc.opt.Events)
}
return nil
}
func (kc *kClient) initRetryer() error {
if kc.opt.UnaryOptions.RetryContainer == nil {
if kc.opt.UnaryOptions.RetryMethodPolicies == nil {
return nil
}
kc.opt.InitRetryContainer()
}
return kc.opt.UnaryOptions.RetryContainer.Init(kc.opt.UnaryOptions.RetryMethodPolicies, kc.opt.UnaryOptions.RetryWithResult)
}
func (kc *kClient) initContext() context.Context {
ctx := context.Background()
ctx = context.WithValue(ctx, endpoint.CtxEventBusKey, kc.opt.Bus)
ctx = context.WithValue(ctx, endpoint.CtxEventQueueKey, kc.opt.Events)
ctx = context.WithValue(ctx, rpctimeout.TimeoutAdjustKey, &kc.opt.ExtraTimeout)
if chr, ok := kc.opt.Proxy.(proxy.ContextHandler); ok {
ctx = chr.HandleContext(ctx)
}
return ctx
}
func (kc *kClient) initProxy() error {
if kc.opt.Proxy != nil {
cfg := proxy.Config{
ServerInfo: kc.opt.Svr,
Resolver: kc.opt.Resolver,
Balancer: kc.opt.Balancer,
Pool: kc.opt.RemoteOpt.ConnPool,
FixedTargets: kc.opt.Targets,
RPCConfig: kc.opt.Configs,
}
if err := kc.opt.Proxy.Configure(&cfg); err != nil {
return err
}
// update fields in the client option for further use.
kc.opt.Resolver = cfg.Resolver
kc.opt.Balancer = cfg.Balancer
// close predefined pool when proxy init new pool.
if cfg.Pool != kc.opt.RemoteOpt.ConnPool && kc.opt.RemoteOpt.ConnPool != nil {
kc.opt.RemoteOpt.ConnPool.Close()
}
kc.opt.RemoteOpt.ConnPool = cfg.Pool
kc.opt.Targets = cfg.FixedTargets
}
return nil
}
func (kc *kClient) initConnPool() error {
pool := kc.opt.RemoteOpt.ConnPool
kc.opt.CloseCallbacks = append(kc.opt.CloseCallbacks, pool.Close)
if df, ok := pool.(interface{ Dump() interface{} }); ok {
kc.opt.DebugService.RegisterProbeFunc(diagnosis.ConnPoolKey, df.Dump)
}
if r, ok := pool.(remote.ConnPoolReporter); ok && kc.opt.RemoteOpt.EnableConnPoolReporter {
r.EnableReporter()
}
if long, ok := pool.(remote.LongConnPool); ok {
kc.opt.Bus.Watch(discovery.ChangeEventName, func(ev *event.Event) {
ch, ok := ev.Extra.(*discovery.Change)
if !ok {
return
}
for _, inst := range ch.Removed {
if addr := inst.Address(); addr != nil {
long.Clean(addr.Network(), addr.String())
}
}
})
}
return nil
}
func (kc *kClient) initLBCache() error {
if kc.opt.Proxy != nil && kc.opt.Resolver == nil {
return nil
}
onChange := discoveryEventHandler(discovery.ChangeEventName, kc.opt.Bus, kc.opt.Events)
onDelete := discoveryEventHandler(discovery.DeleteEventName, kc.opt.Bus, kc.opt.Events)
resolver := kc.opt.Resolver
if resolver == nil {
// fake a resolver instead of returning an error directly because users may use
// callopt.WithHostPort to specify target addresses after NewClient.
resolver = &discovery.SynthesizedResolver{
ResolveFunc: func(ctx context.Context, target string) (discovery.Result, error) {
return discovery.Result{}, kerrors.ErrNoResolver
},
NameFunc: func() string { return "no_resolver" },
}
}
// because we cannot ensure that user's custom loadbalancer is cacheable, we need to disable it here
cacheOpts := lbcache.Options{DiagnosisService: kc.opt.DebugService, Cacheable: false}
balancer := kc.opt.Balancer
if balancer == nil {
// default internal lb balancer is cacheable
cacheOpts.Cacheable = true
balancer = loadbalance.NewWeightedBalancer()
}
if kc.opt.BalancerCacheOpt != nil {
cacheOpts = *kc.opt.BalancerCacheOpt
}
kc.lbf = lbcache.NewBalancerFactory(resolver, balancer, cacheOpts)
rbIdx := kc.lbf.RegisterRebalanceHook(onChange)
kc.opt.CloseCallbacks = append(kc.opt.CloseCallbacks, func() error {
kc.lbf.DeregisterRebalanceHook(rbIdx)
return nil
})
dIdx := kc.lbf.RegisterDeleteHook(onDelete)
kc.opt.CloseCallbacks = append(kc.opt.CloseCallbacks, func() error {
kc.lbf.DeregisterDeleteHook(dIdx)
return nil
})
return nil
}
type middleware struct {
// unary middleware
mws []endpoint.Middleware // wrap the mws at `context mw -> customized mws -> other mws`
uMws []endpoint.UnaryMiddleware // wrap the mws at `service cb mw -> xds router -> rpctimeout mw -> customized unary mws`
// streaming middleware
smws []endpoint.Middleware // wrap the mws at `xds router -> context mw -> customized mws -> other mws`
sMws []cep.StreamMiddleware // wrap the mws at `service cb mw -> customized stream mws`
}
// For unary:
// service cb mw -> xds router -> rpctimeout mw -> customized unary mws -> context mw -> customized mws -> other mws
// For streaming:
// service cb mw -> customized stream mws -> xds router -> context mw -> customized mws -> other mws
// The reason why the xds router must be placed before the timeout middleware is that the timeout configuration is
// obtained from the rds config, and the timeout middleware only takes effect in the unary scenario.
// Therefore, in the streaming scenario, the xds router can be placed after the stream middleware.
func (kc *kClient) initMiddlewares(ctx context.Context) (mw middleware) {
// 1. universal middlewares
builderMWs := richMWsWithBuilder(ctx, kc.opt.MWBs)
mw.mws = append(mw.mws, contextMW)
mw.mws = append(mw.mws, builderMWs...)
mw.mws = append(mw.mws, acl.NewACLMiddleware(kc.opt.ACLRules))
if kc.opt.Proxy == nil {
mw.mws = append(mw.mws, newResolveMWBuilder(kc.lbf)(ctx))
mw.mws = append(mw.mws, kc.opt.CBSuite.InstanceCBMW())
mw.mws = append(mw.mws, richMWsWithBuilder(ctx, kc.opt.IMWBs)...)
} else {
if kc.opt.Resolver != nil { // customized service discovery
mw.mws = append(mw.mws, newResolveMWBuilder(kc.lbf)(ctx))
}
mw.mws = append(mw.mws, newProxyMW(kc.opt.Proxy))
}
mw.mws = append(mw.mws, newIOErrorHandleMW(kc.opt.ErrHandle))
// 2. unary middlewares
mw.uMws = append(mw.uMws, kc.opt.CBSuite.ServiceCBMW().ToUnaryMiddleware())
if kc.opt.XDSEnabled && kc.opt.XDSRouterMiddleware != nil && kc.opt.Proxy == nil {
// integrate xds if enabled
mw.uMws = append(mw.uMws, kc.opt.XDSRouterMiddleware.ToUnaryMiddleware())
}
mw.uMws = append(mw.uMws, rpcTimeoutMW(ctx))
kc.opt.UnaryOptions.InitMiddlewares(ctx)
mw.uMws = append(mw.uMws, kc.opt.UnaryOptions.UnaryMiddlewares...)
// 3. stream middlewares
kc.opt.Streaming.InitMiddlewares(ctx)
mw.smws = mw.mws
if kc.opt.XDSEnabled && kc.opt.XDSRouterMiddleware != nil && kc.opt.Proxy == nil {
// integrate xds if enabled
mw.smws = append([]endpoint.Middleware{kc.opt.XDSRouterMiddleware}, mw.smws...)
}
kc.opt.StreamOptions.InitMiddlewares(ctx)
mw.sMws = append([]cep.StreamMiddleware{kc.opt.CBSuite.StreamingServiceCBMW()}, kc.opt.StreamOptions.StreamMiddlewares...)
return
}
func richMWsWithBuilder(ctx context.Context, mwBs []endpoint.MiddlewareBuilder) (mws []endpoint.Middleware) {
for i := range mwBs {
if mw := mwBs[i](ctx); mw != nil {
mws = append(mws, mw)
}
}
return
}
// initRPCInfo initializes the RPCInfo structure and attaches it to context.
func (kc *kClient) initRPCInfo(ctx context.Context, method string, retryTimes int,
firstRI rpcinfo.RPCInfo, streamCall bool,
) (context.Context, rpcinfo.RPCInfo, *callopt.CallOptions) {
return initRPCInfo(ctx, method, kc.opt, kc.svcInfo, retryTimes, firstRI, streamCall)
}
func applyCallOptions(ctx context.Context, cfg rpcinfo.MutableRPCConfig, svr remoteinfo.RemoteInfo, opt *client.Options) (context.Context, *callopt.CallOptions) {
cos := CallOptionsFromCtx(ctx)
if len(cos) > 0 {
info, callOpts := callopt.Apply(cos, cfg, svr, opt.Locks, opt.HTTPResolver)
ctx = context.WithValue(ctx, ctxCallOptionInfoKey, info)
return ctx, callOpts
}
opt.Locks.ApplyLocks(cfg, svr)
return ctx, nil
}
// Call implements the Client interface .
func (kc *kClient) Call(ctx context.Context, method string, request, response interface{}) (err error) {
// merge backup context if no metainfo found in ctx
ctx = backup.RecoverCtxOnDemands(ctx, kc.opt.CtxBackupHandler)
validateForCall(ctx, kc.inited, kc.closed)
var ri rpcinfo.RPCInfo
var callOpts *callopt.CallOptions
ctx, ri, callOpts = kc.initRPCInfo(ctx, method, 0, nil, false)
ctx = kc.opt.TracerCtl.DoStart(ctx, ri)
var reportErr error
var recycleRI bool
defer func() {
if panicInfo := recover(); panicInfo != nil {
err = rpcinfo.ClientPanicToErr(ctx, panicInfo, ri, false)
reportErr = err
}
kc.opt.TracerCtl.DoFinish(ctx, ri, reportErr)
if recycleRI {
// why need check recycleRI to decide if recycle RPCInfo?
// 1. no retry, rpc timeout happen will cause panic when response return
// 2. retry success, will cause panic when first call return
// 3. backup request may cause panic, cannot recycle first RPCInfo
// RPCInfo will be recycled after rpc is finished,
// holding RPCInfo in a new goroutine is forbidden.
rpcinfo.PutRPCInfo(ri)
}
callOpts.Recycle()
}()
callOptRetry := getCalloptRetryPolicy(callOpts)
if kc.opt.UnaryOptions.RetryContainer == nil && callOptRetry != nil && callOptRetry.Enable {
// setup retry in callopt
kc.opt.InitRetryContainer()
}
// Add necessary keys to context for isolation between kitex client method calls
ctx = retry.PrepareRetryContext(ctx)
if mi := ri.Invocation().MethodInfo(); mi == nil {
err = kerrors.ErrNonExistentMethod(kc.svcInfo.ServiceName, method)
} else if mi.StreamingMode() != serviceinfo.StreamingNone && mi.StreamingMode() != serviceinfo.StreamingUnary {
err = kerrors.ErrNotUnaryMethod(kc.svcInfo.ServiceName, method)
} else if kc.opt.UnaryOptions.RetryContainer == nil {
// call without retry policy
err = kc.eps(ctx, request, response)
if err == nil {
recycleRI = true
}
} else {
var lastRI rpcinfo.RPCInfo
lastRI, recycleRI, err = kc.opt.UnaryOptions.RetryContainer.WithRetryIfNeeded(ctx, callOptRetry, kc.rpcCallWithRetry(ri, method), ri, request, response)
if ri != lastRI {
// reset ri of ctx to lastRI
ctx = rpcinfo.NewCtxWithRPCInfo(ctx, lastRI)
}
ri = lastRI
}
// do fallback if with setup
err, reportErr = doFallbackIfNeeded(ctx, ri, request, response, err, kc.opt.UnaryOptions.Fallback, callOpts)
return err
}
func (kc *kClient) rpcCallWithRetry(ri rpcinfo.RPCInfo, method string) retry.RPCCallFunc {
// call with retry policy
var callTimes int32
// prevRI represents a value of rpcinfo.RPCInfo type.
var prevRI atomic.Value
return func(ctx context.Context, r retry.Retryer, request, response interface{}) (rpcinfo.RPCInfo, error) {
currCallTimes := int(atomic.AddInt32(&callTimes, 1))
cRI := ri
if currCallTimes > 1 {
ctx, cRI, _ = kc.initRPCInfo(ctx, method, currCallTimes-1, ri, false)
ctx = metainfo.WithPersistentValue(ctx, retry.TransitKey, strconv.Itoa(currCallTimes-1))
if prevRI.Load() == nil {
prevRI.Store(ri)
}
r.Prepare(ctx, prevRI.Load().(rpcinfo.RPCInfo), cRI)
prevRI.Store(cRI)
}
callErr := kc.eps(ctx, request, response)
return cRI, callErr
}
}
func (kc *kClient) initDebugService() {
if ds := kc.opt.DebugService; ds != nil {
ds.RegisterProbeFunc(diagnosis.DestServiceKey, diagnosis.WrapAsProbeFunc(kc.opt.Svr.ServiceName))
ds.RegisterProbeFunc(diagnosis.OptionsKey, diagnosis.WrapAsProbeFunc(kc.opt.DebugInfo))
ds.RegisterProbeFunc(diagnosis.ChangeEventsKey, kc.opt.Events.Dump)
ds.RegisterProbeFunc(diagnosis.ServiceInfosKey, diagnosis.WrapAsProbeFunc(map[string]*serviceinfo.ServiceInfo{kc.svcInfo.ServiceName: kc.svcInfo}))
}
}
func (kc *kClient) richRemoteOption() {
kc.opt.RemoteOpt.SvcInfo = kc.svcInfo
// for client trans info handler
if len(kc.opt.MetaHandlers) > 0 {
// TODO in stream situations, meta is only assembled when the stream creates
// metaHandler needs to be called separately.
// (newClientStreamer: call WriteMeta before remotecli.NewClient)
transInfoHdlr := bound.NewTransMetaHandler(kc.opt.MetaHandlers)
kc.opt.RemoteOpt.PrependBoundHandler(transInfoHdlr)
// add meta handlers into streaming meta handlers
for _, h := range kc.opt.MetaHandlers {
if shdlr, ok := h.(remote.StreamingMetaHandler); ok {
kc.opt.RemoteOpt.StreamingMetaHandlers = append(kc.opt.RemoteOpt.StreamingMetaHandlers, shdlr)
}
}
}
}
func (kc *kClient) buildInvokeChain(mw middleware) error {
innerHandlerEp, err := kc.invokeHandleEndpoint()
if err != nil {
return err
}
eps := endpoint.Chain(mw.mws...)(innerHandlerEp)
kc.eps = endpoint.UnaryChain(mw.uMws...)(func(ctx context.Context, req, resp interface{}) (err error) {
return eps(ctx, req, resp)
})
innerStreamingEp, err := kc.invokeStreamingEndpoint()
if err != nil {
return err
}
sEps := endpoint.Chain(mw.smws...)(innerStreamingEp)
kc.sEps = cep.StreamChain(mw.sMws...)(func(ctx context.Context) (st streaming.ClientStream, err error) {
resp := &streaming.Result{}
err = sEps(ctx, nil, resp)
if err != nil {
return nil, err
}
return resp.ClientStream, nil
})
return nil
}
func (kc *kClient) invokeHandleEndpoint() (endpoint.Endpoint, error) {
transPipl, err := newCliTransHandler(kc.opt.RemoteOpt)
if err != nil {
return nil, err
}
return func(ctx context.Context, req, resp interface{}) (err error) {
var sendMsg remote.Message
var recvMsg remote.Message
defer func() {
remote.RecycleMessage(sendMsg)
// Notice, recycle and decode may race if decode exec in another goroutine.
// No race now, it is ok to recycle. Or recvMsg recycle depend on recv err
remote.RecycleMessage(recvMsg)
}()
ri := rpcinfo.GetRPCInfo(ctx)
cli, err := remotecli.NewClient(ctx, ri, transPipl, kc.opt.RemoteOpt)
if err != nil {
return
}
defer cli.Recycle()
m := ri.Invocation().MethodInfo()
if m.OneWay() {
sendMsg = remote.NewMessage(req, ri, remote.Oneway, remote.Client)
} else {
sendMsg = remote.NewMessage(req, ri, remote.Call, remote.Client)
}
if err = cli.Send(ctx, ri, sendMsg); err != nil {
return
}
if m.OneWay() {
cli.Recv(ctx, ri, nil)
return nil
}
recvMsg = remote.NewMessage(resp, ri, remote.Reply, remote.Client)
err = cli.Recv(ctx, ri, recvMsg)
return err
}, nil
}
// Close is not concurrency safe.
func (kc *kClient) Close() error {
defer func() {
if err := recover(); err != nil {
klog.Warnf("KITEX: panic when close client, error=%s, stack=%s", err, string(debug.Stack()))
}
}()
if kc.closed {
return nil
}
kc.closed = true
var errs utils.ErrChain
for _, cb := range kc.opt.CloseCallbacks {
if err := cb(); err != nil {
errs.Append(err)
}
}
if kc.opt.CBSuite != nil {
if err := kc.opt.CBSuite.Close(); err != nil {
errs.Append(err)
}
}
if errs.HasError() {
return errs
}
return nil
}
func newCliTransHandler(opt *remote.ClientOption) (remote.ClientTransHandler, error) {
handler, err := opt.CliHandlerFactory.NewTransHandler(opt)
if err != nil {
return nil, err
}
transPl := remote.NewTransPipeline(handler)
for _, ib := range opt.Inbounds {
transPl.AddInboundHandler(ib)
}
for _, ob := range opt.Outbounds {
transPl.AddOutboundHandler(ob)
}
return transPl, nil
}
func initTransportProtocol(svcInfo *serviceinfo.ServiceInfo, cfg rpcinfo.RPCConfig) {
mutableRPCConfig := rpcinfo.AsMutableRPCConfig(cfg)
mutableRPCConfig.SetPayloadCodec(svcInfo.PayloadCodec)
if svcInfo.PayloadCodec == serviceinfo.Protobuf && cfg.TransportProtocol()&transport.GRPC != transport.GRPC {
// pb use ttheader framed by default
mutableRPCConfig.SetTransportProtocol(transport.TTHeaderFramed)
}
}
func (kc *kClient) warmingUp() error {
if kc.opt.WarmUpOption == nil {
return nil
}
wuo := kc.opt.WarmUpOption
doWarmupPool := wuo.PoolOption != nil && kc.opt.Proxy == nil
// service discovery
if kc.opt.Resolver == nil {
return nil
}
nas := make(map[string][]string)
ctx := context.Background()
var dests []rpcinfo.EndpointInfo
if ro := kc.opt.WarmUpOption.ResolverOption; ro != nil {
for _, d := range ro.Dests {
dests = append(dests, rpcinfo.FromBasicInfo(d))
}
}
if len(dests) == 0 && doWarmupPool && len(wuo.PoolOption.Targets) == 0 {
// build a default destination for the resolver
cfg := rpcinfo.AsMutableRPCConfig(kc.opt.Configs).Clone()
rmt := remoteinfo.NewRemoteInfo(kc.opt.Svr, "*")
ctx, _ = applyCallOptions(ctx, cfg, rmt, kc.opt)
dests = append(dests, rmt.ImmutableView())
}
for _, dest := range dests {
lb, err := kc.lbf.Get(ctx, dest)
if err != nil {
switch kc.opt.WarmUpOption.ErrorHandling {
case warmup.IgnoreError:
case warmup.WarningLog:
klog.Warnf("KITEX: failed to warm up service discovery: %s", err.Error())
case warmup.ErrorLog:
klog.Errorf("KITEX: failed to warm up service discovery: %s", err.Error())
case warmup.FailFast:
return fmt.Errorf("service discovery warm-up: %w", err)
}
continue
}
if res, ok := lb.GetResult(); ok {
for _, i := range res.Instances {
if addr := i.Address(); addr != nil {
n, a := addr.Network(), addr.String()
nas[n] = append(nas[n], a)
}
}
}
}
// connection pool
if !doWarmupPool {
return nil
}
if len(wuo.PoolOption.Targets) == 0 {
wuo.PoolOption.Targets = nas
}
pool := kc.opt.RemoteOpt.ConnPool
if wp, ok := pool.(warmup.Pool); ok {
co := remote.ConnOption{
Dialer: kc.opt.RemoteOpt.Dialer,
ConnectTimeout: kc.opt.Configs.ConnectTimeout(),
}
err := wp.WarmUp(kc.opt.WarmUpOption.ErrorHandling, wuo.PoolOption, co)
if err != nil {
switch kc.opt.WarmUpOption.ErrorHandling {
case warmup.IgnoreError:
case warmup.WarningLog:
klog.Warnf("KITEX: failed to warm up connection pool: %s", err.Error())
case warmup.ErrorLog:
klog.Errorf("KITEX: failed to warm up connection pool: %s", err.Error())
case warmup.FailFast:
return fmt.Errorf("connection pool warm-up: %w", err)
}
}
} else {
klog.Warnf("KITEX: connection pool<%T> does not support warm-up operation", pool)
}
return nil
}
func validateForCall(ctx context.Context, inited, closed bool) {
if !inited {
panic("client not initialized")
}
if closed {
panic("client is already closed")
}
if ctx == nil {
panic("ctx is nil")
}
}
func getCalloptRetryPolicy(callOpts *callopt.CallOptions) (callOptRetry *retry.Policy) {
if callOpts != nil {
if callOpts.RetryPolicy.Enable {
callOptRetry = &callOpts.RetryPolicy
}
}
return
}
func doFallbackIfNeeded(ctx context.Context, ri rpcinfo.RPCInfo, request, response interface{}, oriErr error, cliFallback *fallback.Policy, callOpts *callopt.CallOptions) (err, reportErr error) {
fallback, hasFallback := getFallbackPolicy(cliFallback, callOpts)
err = oriErr
reportErr = oriErr
var fbErr error
if hasFallback {
reportAsFB := false
// Notice: If rpc err is nil, rpcStatAsFB will always be false, even if it's set to true by user.
fbErr, reportAsFB = fallback.DoIfNeeded(ctx, ri, request, response, oriErr)
if reportAsFB {
reportErr = fbErr
}
err = fbErr
}
if err == nil && !hasFallback {
err = ri.Invocation().BizStatusErr()
}
return
}
// return fallback policy from call option and client option.
func getFallbackPolicy(cliOptFB *fallback.Policy, callOpts *callopt.CallOptions) (fb *fallback.Policy, hasFallback bool) {
var callOptFB *fallback.Policy
if callOpts != nil {
callOptFB = callOpts.Fallback
}
if callOptFB != nil {
return callOptFB, true
}
if cliOptFB != nil {
return cliOptFB, true
}
return nil, false
}
// purifyProtocol purifies the transport protocol for one rpc request according to whether it's stream call or not.
// It simplifies the latter judgement logic to avoid processing multiple mixed protocols.
func purifyProtocol(cfg rpcinfo.MutableRPCConfig, tp transport.Protocol, streamCall bool) {
cfg.SetTransportProtocol(transport.PurePayload) // reset transport protocol to pure payload
if streamCall {
if tp&(transport.GRPC|transport.GRPCStreaming) != 0 {
// reset to grpc transport protocol for better forward compatibility
tp = transport.GRPC
} else if tp&transport.TTHeaderStreaming != 0 {
// also add TTHeaderFramed to be compatible with protocol judgement logic,
// cuz to some extent, TTHeaderStreaming is also part of the ttheader protocol.
tp = transport.TTHeaderStreaming | transport.TTHeaderFramed
}
} else {
if tp&transport.GRPC != 0 {
tp = transport.GRPC
} else if tp&(transport.TTHeaderStreaming|transport.GRPCStreaming) != 0 {
tp = tp &^ (transport.TTHeaderStreaming | transport.GRPCStreaming) // remove streaming protocol
}
}
cfg.SetTransportProtocol(tp)
}
func initRPCInfo(ctx context.Context, method string, opt *client.Options, svcInfo *serviceinfo.ServiceInfo,
retryTimes int, firstRI rpcinfo.RPCInfo, streamCall bool,
) (context.Context, rpcinfo.RPCInfo, *callopt.CallOptions) {
cfg := rpcinfo.AsMutableRPCConfig(opt.Configs).Clone()
rmt := remoteinfo.NewRemoteInfo(opt.Svr, method)
var callOpts *callopt.CallOptions
ctx, callOpts = applyCallOptions(ctx, cfg, rmt, opt)
var rpcStats rpcinfo.MutableRPCStats
if firstRI != nil {
rpcStats = rpcinfo.AsMutableRPCStats(firstRI.Stats().CopyForRetry())
} else {
rpcStats = rpcinfo.AsMutableRPCStats(rpcinfo.NewRPCStats())
}
if opt.StatsLevel != nil {
rpcStats.SetLevel(*opt.StatsLevel)
}
mi := svcInfo.MethodInfo(ctx, method)
if mi != nil && mi.OneWay() {
cfg.SetInteractionMode(rpcinfo.Oneway)
}
if retryTimes > 0 {
// it is used to distinguish the request is a local retry request.
rmt.SetTag(rpcinfo.RetryTag, strconv.Itoa(retryTimes))
}
// Export read-only views to external users.
ri := rpcinfo.NewRPCInfo(
rpcinfo.FromBasicInfo(opt.Cli),
rmt.ImmutableView(),
rpcinfo.NewInvocation(svcInfo.ServiceName, method, svcInfo.GetPackageName()),
cfg.ImmutableView(),
rpcStats.ImmutableView(),
)
inkSetter := ri.Invocation().(rpcinfo.InvocationSetter)
// set ServiceInfo to judge whether it's combine service in ttheader codec.
inkSetter.SetExtra(rpcinfo.InvocationServiceInfoKey, svcInfo)
if mi != nil {
inkSetter.SetStreamingMode(mi.StreamingMode())
inkSetter.SetMethodInfo(mi)
}
if streamCall {
cfg.SetInteractionMode(rpcinfo.Streaming)
}
purifyProtocol(cfg, ri.Config().TransportProtocol(), streamCall)
if fromMethod := ctx.Value(consts.CtxKeyMethod); fromMethod != nil {
rpcinfo.AsMutableEndpointInfo(ri.From()).SetMethod(fromMethod.(string))
}
if p := opt.Timeouts; p != nil {
if c := p.Timeouts(ri); c != nil {
_ = cfg.SetRPCTimeout(c.RPCTimeout())
_ = cfg.SetConnectTimeout(c.ConnectTimeout())
_ = cfg.SetReadWriteTimeout(c.ReadWriteTimeout())
}
}
sopt := opt.StreamOptions
if sopt.RecvTimeout > 0 {
cfg.SetStreamRecvTimeout(sopt.RecvTimeout)
}
if sopt.RecvTimeoutConfig.Timeout > 0 {
cfg.SetStreamRecvTimeoutConfig(sopt.RecvTimeoutConfig)
}
ctx = rpcinfo.NewCtxWithRPCInfo(ctx, ri)
if callOpts != nil {
if callOpts.CompressorName != "" {
// set send grpc compressor at client to tell how to server decode
remote.SetSendCompressor(ri, callOpts.CompressorName)
}
if callOpts.StreamOptions.RecvTimeout != 0 {
cfg.SetStreamRecvTimeout(callOpts.StreamOptions.RecvTimeout)
}
if callOpts.StreamOptions.RecvTimeoutConfig.Timeout > 0 {
cfg.SetStreamRecvTimeoutConfig(callOpts.StreamOptions.RecvTimeoutConfig)
}
// WithBinaryGenericIDLService only take effect for BinaryThriftGenericV2 and BinaryPbGeneric
if callOpts.BinaryGenericIDLService != "" && igeneric.BinaryGenericSupportsMultiService(svcInfo) {
inkSetter.SetServiceName(callOpts.BinaryGenericIDLService)
}
}
return ctx, ri, callOpts
}
================================================
FILE: client/client_test.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"errors"
"net"
"runtime"
"runtime/debug"
"strings"
"sync/atomic"
"testing"
"time"
"github.com/bytedance/gopkg/cloud/metainfo"
"github.com/cloudwego/localsession"
"github.com/cloudwego/localsession/backup"
"github.com/cloudwego/netpoll"
"github.com/golang/mock/gomock"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/client/callopt/streamcall"
"github.com/cloudwego/kitex/internal/client"
"github.com/cloudwego/kitex/internal/mocks"
mocksnetpoll "github.com/cloudwego/kitex/internal/mocks/netpoll"
mocksremote "github.com/cloudwego/kitex/internal/mocks/remote"
"github.com/cloudwego/kitex/internal/mocks/rpc_info"
mocksstats "github.com/cloudwego/kitex/internal/mocks/stats"
mockthrift "github.com/cloudwego/kitex/internal/mocks/thrift"
internal_stream "github.com/cloudwego/kitex/internal/stream"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/endpoint"
"github.com/cloudwego/kitex/pkg/fallback"
"github.com/cloudwego/kitex/pkg/kerrors"
"github.com/cloudwego/kitex/pkg/remote"
"github.com/cloudwego/kitex/pkg/retry"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
"github.com/cloudwego/kitex/pkg/rpctimeout"
"github.com/cloudwego/kitex/pkg/serviceinfo"
"github.com/cloudwego/kitex/pkg/stats"
"github.com/cloudwego/kitex/pkg/streaming"
"github.com/cloudwego/kitex/pkg/utils"
"github.com/cloudwego/kitex/pkg/warmup"
"github.com/cloudwego/kitex/transport"
)
var (
// method="mock" typeID=thrift.REPLY seqID=1
bs = []byte{128, 1, 0, 2, 0, 0, 0, 4, 109, 111, 99, 107, 0, 0, 0, 1}
mockWarmupOption = &warmup.ClientOption{
ErrorHandling: warmup.ErrorLog,
ResolverOption: &warmup.ResolverOption{
Dests: []*rpcinfo.EndpointBasicInfo{
{
ServiceName: "mock_service",
Method: "mock_method",
},
},
},
PoolOption: &warmup.PoolOption{
ConnNum: 128,
Parallel: 128,
},
}
)
func newMockConn(ctrl *gomock.Controller) netpoll.Connection {
conn := mocksnetpoll.NewMockConnection(ctrl)
conn.EXPECT().Read(gomock.Any()).DoAndReturn(func(b []byte) (int, error) {
return copy(b, bs), nil
}).AnyTimes()
conn.EXPECT().Write(gomock.Any()).DoAndReturn(func(b []byte) (n int, err error) {
return len(b), nil
}).AnyTimes()
conn.EXPECT().RemoteAddr().Return(utils.NewNetAddr("tcp", "mock")).AnyTimes()
conn.EXPECT().IsActive().Return(true).AnyTimes()
conn.EXPECT().Close().Return(nil).AnyTimes()
return conn
}
func newDialer(ctrl *gomock.Controller) remote.Dialer {
conn := newMockConn(ctrl)
dialer := mocksremote.NewMockDialer(ctrl)
dialer.EXPECT().DialTimeout(gomock.Any(), gomock.Any(), gomock.Any()).Return(conn, nil).AnyTimes()
return dialer
}
func newMockCliTransHandlerFactory(ctrl *gomock.Controller) remote.ClientTransHandlerFactory {
handler := mocksremote.NewMockClientTransHandler(ctrl)
handler.EXPECT().OnMessage(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, args, result remote.Message) (context.Context, error) {
return ctx, nil
}).AnyTimes()
handler.EXPECT().Read(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, conn net.Conn, msg remote.Message) (context.Context, error) {
return ctx, nil
}).AnyTimes()
handler.EXPECT().Write(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, conn net.Conn, msg remote.Message) (context.Context, error) {
return ctx, nil
}).AnyTimes()
handler.EXPECT().SetPipeline(gomock.Any()).AnyTimes()
handler.EXPECT().OnError(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
handler.EXPECT().OnInactive(gomock.Any(), gomock.Any()).AnyTimes()
factory := mocksremote.NewMockClientTransHandlerFactory(ctrl)
factory.EXPECT().NewTransHandler(gomock.Any()).DoAndReturn(func(opt *remote.ClientOption) (remote.ClientTransHandler, error) {
return handler, nil
}).AnyTimes()
return factory
}
func newMockClient(tb testing.TB, ctrl *gomock.Controller, extra ...Option) Client {
opts := []Option{
WithTransHandlerFactory(newMockCliTransHandlerFactory(ctrl)),
WithResolver(resolver404(ctrl)),
WithDialer(newDialer(ctrl)),
WithDestService("destService"),
}
opts = append(opts, extra...)
svcInfo := mocks.ServiceInfo()
cli, err := NewClient(svcInfo, opts...)
test.Assert(tb, err == nil)
return cli
}
func TestCall(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
cli := newMockClient(t, ctrl)
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil, err)
}
func TestCallWithContextBackup(t *testing.T) {
localsession.InitDefaultManager(localsession.DefaultManagerOptions())
d, dd := "d", "dd"
ctx := context.WithValue(context.Background(), "a", "a")
ctx = context.WithValue(ctx, d, dd)
ctx = metainfo.WithPersistentValues(ctx, "b", "b", "c", "c")
ctx = metainfo.WithValues(ctx, "e", "e")
backup.BackupCtx(ctx)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
cli := newMockClient(t, ctrl, WithContextBackup(func(prev, cur context.Context) (ctx context.Context, backup bool) {
if v := prev.Value(d); v != nil {
cur = context.WithValue(cur, d, v)
}
return cur, true
}), WithMiddleware(func(e endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
test.Assert(t, ctx.Value("a") == "aa")
b, _ := metainfo.GetPersistentValue(ctx, "b")
test.Assert(t, b == "bb")
c, _ := metainfo.GetPersistentValue(ctx, "c")
test.Assert(t, c == "c")
test.Assert(t, ctx.Value(d) == dd)
_, ok := metainfo.GetPersistentValue(ctx, "e")
test.Assert(t, !ok)
f, _ := metainfo.GetValue(ctx, "f")
test.Assert(t, f == "f")
return nil
}
}))
req := new(MockTStruct)
res := new(MockTStruct)
ctx2 := context.WithValue(context.Background(), "a", "aa")
ctx2 = metainfo.WithPersistentValue(ctx2, "b", "bb")
ctx2 = metainfo.WithValue(ctx2, "f", "f")
err := cli.Call(ctx2, mtd, req, res)
test.Assert(t, err == nil, err)
}
func TestWithRetryOption(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockRetryContainer := retry.NewRetryContainer()
cli := newMockClient(t, ctrl, WithRetryContainer(mockRetryContainer))
test.Assert(t, cli.(*kcFinalizerClient).opt.UnaryOptions.RetryContainer == mockRetryContainer)
}
func BenchmarkCall(b *testing.B) {
ctrl := gomock.NewController(b)
defer ctrl.Finish()
mtd := mocks.MockExceptionMethod
cli := newMockClient(b, ctrl)
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
b.ResetTimer()
for i := 0; i < b.N; i++ {
cli.Call(ctx, mtd, req, res)
}
}
func BenchmarkCallParallel(b *testing.B) {
ctrl := gomock.NewController(b)
defer ctrl.Finish()
mtd := mocks.MockOnewayMethod
cli := newMockClient(b, ctrl)
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
cli.Call(ctx, mtd, req, res)
}
})
}
func TestTagOptions(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
tgs := map[string]string{}
cls := func(m map[string]string) {
for k := range m {
delete(m, k)
}
}
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
ri := rpcinfo.GetRPCInfo(ctx)
test.Assert(t, ri != nil)
to := ri.To()
test.Assert(t, to != nil)
re := remoteinfo.AsRemoteInfo(to)
test.Assert(t, re != nil)
for k, v := range tgs {
val, ok := re.Tag(k)
test.Assertf(t, ok, "expected tag not found: %s", k)
test.Assertf(t, v == val, "values of tag '%s' not equal: '%s' != '%s'", k, v, val)
}
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
cls(tgs)
tgs["cluster"] = "client cluster"
tgs["idc"] = "client idc"
cli = newMockClient(t, ctrl, WithTag("cluster", "client cluster"), WithTag("idc", "client idc"))
err = cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
cls(tgs)
tgs["cluster"] = "call cluster"
tgs["idc"] = "call idc"
ctx = NewCtxWithCallOptions(ctx, []callopt.Option{
callopt.WithTag("cluster", "cluster"),
callopt.WithTag("idc", "idc"),
})
err = cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestTagOptionLocks0(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
re := remoteinfo.AsRemoteInfo(rpcinfo.GetRPCInfo(ctx).To())
var err error
err = re.SetTag("cluster", "clusterx")
test.Assert(t, err == nil)
test.Assert(t, re.DefaultTag("cluster", "") == "clusterx")
err = re.SetTag("idc", "idcx")
test.Assert(t, err == nil)
test.Assert(t, re.DefaultTag("idc", "") == "idcx")
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestTagOptionLocks1(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
re := remoteinfo.AsRemoteInfo(rpcinfo.GetRPCInfo(ctx).To())
var err error
err = re.SetTag("cluster", "whatever")
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
err = re.SetTag("idc", "whatever")
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
options = append(options, WithTag("cluster", "client cluster"))
options = append(options, WithTag("idc", "client idc"))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestTagOptionLocks2(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockOnewayMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
re := remoteinfo.AsRemoteInfo(rpcinfo.GetRPCInfo(ctx).To())
var err error
err = re.SetTag("cluster", "whatever")
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
err = re.SetTag("idc", "whatever")
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
ctx = NewCtxWithCallOptions(ctx, []callopt.Option{
callopt.WithTag("cluster", "cluster"),
callopt.WithTag("idc", "idc"),
})
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestWarmingUpOption(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
var options []client.Option
options = append(options, WithWarmingUp(mockWarmupOption))
cli := newMockClient(t, ctrl, options...)
test.Assert(t, cli.(*kcFinalizerClient).opt.WarmUpOption == mockWarmupOption)
}
func TestTimeoutOptions(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
ri := rpcinfo.GetRPCInfo(ctx)
test.Assert(t, ri != nil)
cfgs := ri.Config()
test.Assert(t, cfgs != nil)
mcfg := rpcinfo.AsMutableRPCConfig(cfgs)
test.Assert(t, mcfg != nil)
var err error
err = mcfg.SetRPCTimeout(time.Hour)
test.Assert(t, err == nil)
test.Assert(t, cfgs.RPCTimeout() == time.Hour)
err = mcfg.SetConnectTimeout(time.Hour * 2)
test.Assert(t, err == nil)
test.Assert(t, cfgs.ConnectTimeout() == time.Hour*2)
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestTimeoutCtxCall(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
var accessed int32
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
time.Sleep(time.Millisecond * 100)
atomic.StoreInt32(&accessed, 1)
return next(ctx, req, resp)
}
}
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*10)
req, res := new(MockTStruct), new(MockTStruct)
cli := newMockClient(t, ctrl, WithMiddleware(md))
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, errors.Is(err, kerrors.ErrRPCTimeout))
test.Assert(t, atomic.LoadInt32(&accessed) == 0)
cancel()
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil)
test.Assert(t, atomic.LoadInt32(&accessed) == 1)
}
func TestTimeoutOptionsLock0(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
tos := []time.Duration{time.Hour / 2, time.Hour / 3}
mtd := mocks.MockMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, res interface{}) error {
ri := rpcinfo.GetRPCInfo(ctx)
test.Assert(t, ri != nil)
cfgs := ri.Config()
test.Assert(t, cfgs != nil)
mcfg := rpcinfo.AsMutableRPCConfig(cfgs)
test.Assert(t, mcfg != nil)
var err error
err = mcfg.SetRPCTimeout(time.Hour)
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
test.Assert(t, cfgs.RPCTimeout() == tos[0])
err = mcfg.SetConnectTimeout(time.Hour * 2)
test.Assert(t, errors.Is(err, kerrors.ErrNotSupported))
test.Assert(t, cfgs.ConnectTimeout() == tos[1])
return nil
}
}
var options []client.Option
options = append(options, WithMiddleware(md))
options = append(options, WithRPCTimeout(tos[0]))
options = append(options, WithConnectTimeout(tos[1]))
ctx := context.Background()
req := new(MockTStruct)
res := new(MockTStruct)
cli := newMockClient(t, ctrl, options...)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
tos[0], tos[1] = time.Minute, time.Minute*2
ctx = NewCtxWithCallOptions(ctx, []callopt.Option{
callopt.WithRPCTimeout(tos[0]),
callopt.WithConnectTimeout(tos[1]),
})
err = cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
}
func TestAdjustTimeout(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
adjustTimeoutMWB := func(moreTimeout time.Duration) endpoint.MiddlewareBuilder {
return func(mwCtx context.Context) endpoint.Middleware {
if p, ok := mwCtx.Value(rpctimeout.TimeoutAdjustKey).(*time.Duration); ok {
*p = moreTimeout
}
return endpoint.DummyMiddleware
}
}
mtd := mocks.MockMethod
md := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
time.Sleep(time.Second)
return nil
}
}
req, res := new(MockTStruct), new(MockTStruct)
// should timeout
cli := newMockClient(t, ctrl,
WithMiddlewareBuilder(adjustTimeoutMWB(0)),
WithMiddleware(md),
WithRPCTimeout(time.Millisecond*500))
err := cli.Call(context.Background(), mtd, req, res)
test.Assert(t, errors.Is(err, kerrors.ErrRPCTimeout))
// shouldn't timeout
cli = newMockClient(t, ctrl,
WithMiddlewareBuilder(adjustTimeoutMWB(time.Second)),
WithMiddleware(md),
WithRPCTimeout(time.Millisecond*500))
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil, err)
}
func TestRetry(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
var count int32
tp := rpc_info.NewMockTimeoutProvider(ctrl)
tp.EXPECT().Timeouts(gomock.Any()).DoAndReturn(func(ri rpcinfo.RPCInfo) rpcinfo.Timeouts {
retryTimeStr, ok := ri.To().Tag(rpcinfo.RetryTag)
if atomic.AddInt32(&count, 1) == 1 {
// first request
test.Assert(t, !ok)
} else {
// retry request
test.Assert(t, retryTimeStr == "1", retryTimeStr)
}
return ri.Config()
}).AnyTimes()
mockTimeoutMW := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
ri := rpcinfo.GetRPCInfo(ctx)
if atomic.LoadInt32(&count) == 1 {
return kerrors.ErrRPCTimeout
} else {
retryTimeStr := ri.To().DefaultTag(rpcinfo.RetryTag, "0")
test.Assert(t, retryTimeStr == "1", retryTimeStr)
r, _ := metainfo.GetPersistentValue(ctx, retry.TransitKey)
test.Assert(t, r == "1", r)
}
return nil
}
}
// case1: return timeout
cli := newMockClient(t, ctrl,
WithTimeoutProvider(tp),
WithMiddleware(mockTimeoutMW))
mtd := mocks.MockMethod
req, res := mocks.NewMockArgs(), mocks.NewMockResult()
err := cli.Call(context.Background(), mtd, req, res)
test.Assert(t, errors.Is(err, kerrors.ErrRPCTimeout))
test.Assert(t, count == 1, count)
// case 2: have timeout retry, return success
count = 0
cli = newMockClient(t, ctrl,
WithTimeoutProvider(tp),
WithMiddleware(mockTimeoutMW),
WithFailureRetry(&retry.FailurePolicy{
StopPolicy: retry.StopPolicy{
MaxRetryTimes: 3,
CBPolicy: retry.CBPolicy{
ErrorRate: 0.1,
},
},
RetrySameNode: true,
}))
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil, err)
test.Assert(t, count == 2, count)
}
func TestRetryWithDifferentTimeout(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
var count int32
tp := rpc_info.NewMockTimeoutProvider(ctrl)
tp.EXPECT().Timeouts(gomock.Any()).DoAndReturn(func(ri rpcinfo.RPCInfo) rpcinfo.Timeouts {
cfg := rpcinfo.AsMutableRPCConfig(ri.Config()).Clone()
retryTimeStr, ok := ri.To().Tag(rpcinfo.RetryTag)
if atomic.AddInt32(&count, 1) == 1 {
// first request
test.Assert(t, !ok)
cfg.SetRPCTimeout(100 * time.Millisecond)
} else {
// retry request
test.Assert(t, retryTimeStr == "1", retryTimeStr)
// reset rpc timeout for retry request
cfg.SetRPCTimeout(500 * time.Millisecond)
}
return cfg.ImmutableView()
}).AnyTimes()
mockTimeoutMW := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
ri := rpcinfo.GetRPCInfo(ctx)
if atomic.LoadInt32(&count) == 1 {
test.Assert(t, ri.Config().RPCTimeout().Milliseconds() == 100, ri.Config().RPCTimeout().Milliseconds())
} else {
retryTimeStr := ri.To().DefaultTag(rpcinfo.RetryTag, "0")
test.Assert(t, retryTimeStr == "1", retryTimeStr)
r, _ := metainfo.GetPersistentValue(ctx, retry.TransitKey)
test.Assert(t, r == "1", r)
test.Assert(t, ri.Config().RPCTimeout().Milliseconds() == 500, ri.Config().RPCTimeout().Milliseconds())
}
time.Sleep(200 * time.Millisecond)
return nil
}
}
// case: sleep 200ms
// first request timeout is 100 then the timeout happens
// retry request timeout is 500 then success
cli := newMockClient(t, ctrl,
WithTimeoutProvider(tp),
WithMiddleware(mockTimeoutMW),
WithFailureRetry(&retry.FailurePolicy{
StopPolicy: retry.StopPolicy{
MaxRetryTimes: 3,
CBPolicy: retry.CBPolicy{
ErrorRate: 0.1,
},
},
RetrySameNode: true,
}))
mtd := mocks.MockMethod
req, res := mocks.NewMockArgs(), mocks.NewMockResult()
err := cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil, err)
test.Assert(t, count == 2, count)
}
func TestRetryWithResultRetry(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockErr := errors.New("mock")
retryWithMockErr := false
errMW := func(next endpoint.Endpoint) endpoint.Endpoint {
var count int32
return func(ctx context.Context, req, resp interface{}) (err error) {
if atomic.CompareAndSwapInt32(&count, 0, 1) {
return mockErr
}
return nil
}
}
mockTimeoutMW := func(next endpoint.Endpoint) endpoint.Endpoint {
var count int32
return func(ctx context.Context, req, resp interface{}) (err error) {
if atomic.CompareAndSwapInt32(&count, 0, 1) {
time.Sleep(300 * time.Millisecond)
}
return nil
}
}
errRetryFunc := func(err error, ri rpcinfo.RPCInfo) bool {
if errors.Is(err, mockErr) {
retryWithMockErr = true
return true
}
return false
}
// case 1: retry for mockErr
cli := newMockClient(t, ctrl,
WithMiddleware(errMW),
WithRPCTimeout(100*time.Millisecond),
WithFailureRetry(&retry.FailurePolicy{
StopPolicy: retry.StopPolicy{
MaxRetryTimes: 3,
CBPolicy: retry.CBPolicy{
ErrorRate: 0.1,
},
},
RetrySameNode: true,
ShouldResultRetry: &retry.ShouldResultRetry{ErrorRetry: errRetryFunc},
}))
mtd := mocks.MockMethod
req, res := mocks.NewMockArgs(), mocks.NewMockResult()
err := cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil, err)
test.Assert(t, retryWithMockErr)
// case 1: retry for timeout
cli = newMockClient(t, ctrl,
WithMiddleware(mockTimeoutMW),
WithRPCTimeout(100*time.Millisecond),
WithFailureRetry(&retry.FailurePolicy{
StopPolicy: retry.StopPolicy{
MaxRetryTimes: 3,
CBPolicy: retry.CBPolicy{
ErrorRate: 0.1,
},
},
RetrySameNode: true,
ShouldResultRetry: &retry.ShouldResultRetry{ErrorRetry: errRetryFunc},
}))
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err == nil, err)
// case 2: set NotRetryForTimeout as true, won't do retry for timeout
cli = newMockClient(t, ctrl,
WithMiddleware(mockTimeoutMW),
WithRPCTimeout(100*time.Millisecond),
WithFailureRetry(&retry.FailurePolicy{
StopPolicy: retry.StopPolicy{
MaxRetryTimes: 3,
CBPolicy: retry.CBPolicy{
ErrorRate: 0.1,
},
},
RetrySameNode: true,
ShouldResultRetry: &retry.ShouldResultRetry{ErrorRetry: errRetryFunc, NotRetryForTimeout: true},
}))
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, errors.Is(err, kerrors.ErrRPCTimeout))
}
func TestFallbackForError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
isTimeout := false
isMockErr := false
isBizErr := false
errForReportIsNil := false
var rpcResult interface{}
// prepare mock data
retStr := "success"
sleepMW := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
time.Sleep(300 * time.Millisecond)
return nil
}
}
mockErr := errors.New("mock")
mockErrMW := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
return mockErr
}
}
bizErrMW := func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
if setter, ok := rpcinfo.GetRPCInfo(ctx).Invocation().(rpcinfo.InvocationSetter); ok {
setter.SetBizStatusErr(kerrors.NewBizStatusError(100, mockErr.Error()))
}
return nil
}
}
mockTracer := mocksstats.NewMockTracer(ctrl)
mockTracer.EXPECT().Start(gomock.Any()).DoAndReturn(func(ctx context.Context) context.Context {
return ctx
}).AnyTimes()
mockTracer.EXPECT().Finish(gomock.Any()).DoAndReturn(func(ctx context.Context) {
if rpcinfo.GetRPCInfo(ctx).Stats().Error() == nil {
errForReportIsNil = true
} else {
errForReportIsNil = false
}
}).AnyTimes()
newFallback := func(realReqResp bool, testCase string) *fallback.Policy {
var fallbackFunc fallback.Func
checkErr := func(err error) {
isTimeout, isMockErr, isBizErr = false, false, false
if errors.Is(err, kerrors.ErrRPCTimeout) {
isTimeout = true
}
if errors.Is(err, mockErr) {
isMockErr = true
}
if _, ok := kerrors.FromBizStatusError(err); ok {
isBizErr = true
}
}
if realReqResp {
fallbackFunc = fallback.UnwrapHelper(func(ctx context.Context, req, resp interface{}, err error) (fbResp interface{}, fbErr error) {
checkErr(err)
_, ok := req.(*mockthrift.MockReq)
test.Assert(t, ok, testCase)
return &retStr, nil
})
} else {
fallbackFunc = func(ctx context.Context, args utils.KitexArgs, result utils.KitexResult, err error) (fbErr error) {
checkErr(err)
_, ok := args.(*mockthrift.MockTestArgs)
test.Assert(t, ok, testCase)
result.SetSuccess(&retStr)
return nil
}
}
return fallback.NewFallbackPolicy(fallbackFunc)
}
// case 1: fallback for timeout, return nil err, but report original err
cli := newMockClient(t, ctrl,
WithMiddleware(sleepMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(newFallback(false, "case 1")),
WithTracer(mockTracer),
)
mtd := mocks.MockMethod
rpcResult = mockthrift.NewMockTestResult()
err := cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == nil, err)
test.Assert(t, *rpcResult.(utils.KitexResult).GetResult().(*string) == retStr)
test.Assert(t, isTimeout, err)
test.Assert(t, !errForReportIsNil)
// case 2: fallback for mock error, but report original err
cli = newMockClient(t, ctrl,
WithMiddleware(mockErrMW),
WithFallback(newFallback(false, "case 2")))
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == nil, err)
test.Assert(t, *rpcResult.(utils.KitexResult).GetResult().(*string) == retStr)
test.Assert(t, isMockErr, err)
test.Assert(t, !errForReportIsNil)
// case 3: fallback for timeout, return nil err, and report nil err as enable reportAsFallback
cli = newMockClient(t, ctrl,
WithMiddleware(sleepMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(newFallback(true, "case 3").EnableReportAsFallback()),
WithTracer(mockTracer),
)
// reset
isTimeout = false
errForReportIsNil = false
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == nil, err)
test.Assert(t, *rpcResult.(utils.KitexResult).GetResult().(*string) == retStr)
test.Assert(t, isTimeout, err)
test.Assert(t, errForReportIsNil)
// case 4: no fallback, return biz err, but report nil err
cli = newMockClient(t, ctrl,
WithMiddleware(bizErrMW),
WithRPCTimeout(100*time.Millisecond),
WithTracer(mockTracer),
)
// reset
errForReportIsNil = false
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
_, ok := kerrors.FromBizStatusError(err)
test.Assert(t, ok, err)
test.Assert(t, errForReportIsNil)
// case 5: fallback for biz error, return nil err,
// and report nil err even if don't enable reportAsFallback as biz error won't report failure by design
cli = newMockClient(t, ctrl,
WithMiddleware(bizErrMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(newFallback(true, "case 5")),
WithTracer(mockTracer),
)
// reset
isBizErr = false
errForReportIsNil = false
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == nil, err)
test.Assert(t, *rpcResult.(utils.KitexResult).GetResult().(*string) == retStr)
test.Assert(t, isBizErr, err)
test.Assert(t, errForReportIsNil)
// case 6: fallback for timeout error, return nil err
cli = newMockClient(t, ctrl,
WithMiddleware(sleepMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(fallback.TimeoutAndCBFallback(fallback.UnwrapHelper(func(ctx context.Context, req, resp interface{}, err error) (fbResp interface{}, fbErr error) {
if errors.Is(err, kerrors.ErrRPCTimeout) {
isTimeout = true
}
return &retStr, nil
}))),
WithTracer(mockTracer),
)
// reset
isTimeout = false
errForReportIsNil = true
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == nil, err)
test.Assert(t, *rpcResult.(utils.KitexResult).GetResult().(*string) == retStr, rpcResult)
test.Assert(t, isTimeout, err)
test.Assert(t, !errForReportIsNil)
// case 6: use TimeoutAndCBFallback, non-timeout and non-CB error cannot do fallback
var fallbackExecuted bool
cli = newMockClient(t, ctrl,
WithMiddleware(mockErrMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(fallback.TimeoutAndCBFallback(func(ctx context.Context, args utils.KitexArgs, result utils.KitexResult, err error) (fbErr error) {
fallbackExecuted = true
return
})),
WithTracer(mockTracer),
)
// reset
errForReportIsNil = true
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err != nil, err)
test.Assert(t, !fallbackExecuted)
// case 7: fallback return nil-resp and nil-err, framework will return the original resp and err
cli = newMockClient(t, ctrl,
WithMiddleware(mockErrMW),
WithRPCTimeout(100*time.Millisecond),
WithFallback(fallback.NewFallbackPolicy(func(ctx context.Context, args utils.KitexArgs, result utils.KitexResult, err error) (fbErr error) {
return
})),
WithTracer(mockTracer),
)
mtd = mocks.MockMethod
rpcResult = mockthrift.NewMockTestResult()
err = cli.Call(context.Background(), mtd, mockthrift.NewMockTestArgs(), rpcResult)
test.Assert(t, err == mockErr)
test.Assert(t, !errForReportIsNil)
}
func TestClientFinalizer(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
debug.SetGCPercent(-1)
defer debug.SetGCPercent(100)
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
t.Logf("Before new clients, allocation: %f Mb, Number of allocation: %d\n", mb(ms.HeapAlloc), ms.HeapObjects)
var (
closeCalledCnt int32
succeedCnt = 10000
failedCnt = 10000
cliCnt = succeedCnt + failedCnt
)
clis := make([]Client, cliCnt)
// clients that init successfully.
for i := 0; i < succeedCnt; i++ {
svcInfo := mocks.ServiceInfo()
mockClient, err := NewClient(svcInfo, WithDestService("destService"), WithShortConnection(),
WithCloseCallbacks(func() error {
atomic.AddInt32(&closeCalledCnt, 1)
return nil
}))
test.Assert(t, err == nil, err)
clis[i] = mockClient
}
// clients that init failed, closeCallback should be called
for i := succeedCnt; i < cliCnt; i++ {
mockClient, err := NewClient(svcInfo, WithDestService(""), WithShortConnection(),
WithCloseCallbacks(func() error {
atomic.AddInt32(&closeCalledCnt, 1)
return nil
}))
test.Assert(t, err != nil, err)
clis[i] = mockClient
}
runtime.ReadMemStats(&ms)
t.Logf("After new clients, allocation: %f Mb, Number of allocation: %d\n", mb(ms.HeapAlloc), ms.HeapObjects)
runtime.GC()
runtime.ReadMemStats(&ms)
firstGCHeapAlloc, firstGCHeapObjects := mb(ms.HeapAlloc), ms.HeapObjects
t.Logf("After first GC, allocation: %f Mb, Number of allocation: %d\n", firstGCHeapAlloc, firstGCHeapObjects)
time.Sleep(200 * time.Millisecond) // ensure the finalizer be executed
test.Assert(t, atomic.LoadInt32(&closeCalledCnt) == int32(cliCnt)) // ensure CloseCallback of client has been called
runtime.GC()
runtime.ReadMemStats(&ms)
secondGCHeapAlloc, secondGCHeapObjects := mb(ms.HeapAlloc), ms.HeapObjects
t.Logf("After second GC, allocation: %f Mb, Number of allocation: %d\n", secondGCHeapAlloc, secondGCHeapObjects)
// test.Assert(t, secondGCHeapAlloc < firstGCHeapAlloc/2 && secondGCHeapObjects < firstGCHeapObjects/2)
}
func TestPanicInMiddleware(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
reportPanic := false
mockTracer := mocksstats.NewMockTracer(ctrl)
mockTracer.EXPECT().Start(gomock.Any()).DoAndReturn(func(ctx context.Context) context.Context {
return ctx
}).AnyTimes()
mockTracer.EXPECT().Finish(gomock.Any()).DoAndReturn(func(ctx context.Context) {
if ok, _ := rpcinfo.GetRPCInfo(ctx).Stats().Panicked(); ok {
reportPanic = true
}
}).AnyTimes()
panicMW := func(endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, request, response interface{}) (err error) {
panic(panicMsg)
}
}
// panic with timeout, the panic is recovered in timeout mw
cli := newMockClient(t, ctrl,
WithMiddleware(panicMW),
WithRPCTimeout(100*time.Millisecond),
WithTracer(mockTracer))
mtd := mocks.MockMethod
req, res := new(MockTStruct), new(MockTStruct)
err := cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err != nil)
test.Assert(t, strings.Contains(err.Error(), panicMsg), err)
test.Assert(t, reportPanic, err)
// panic without timeout, the panic is recovered in client.Call
reportPanic = false
cli = newMockClient(t, ctrl,
WithMiddleware(panicMW),
WithRPCTimeout(0),
WithTracer(mockTracer))
req, res = new(MockTStruct), new(MockTStruct)
err = cli.Call(context.Background(), mtd, req, res)
test.Assert(t, err != nil)
test.Assert(t, strings.Contains(err.Error(), panicMsg), err)
test.Assert(t, reportPanic, err)
}
func TestMethodInfoIsNil(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
cli := newMockClient(t, ctrl)
req, res := new(MockTStruct), new(MockTStruct)
err := cli.Call(context.Background(), "notExist", req, res)
test.Assert(t, err != nil)
test.Assert(t, err.Error() == "internal exception: non-existent method, service: MockService, method: notExist")
}
func mb(byteSize uint64) float32 {
return float32(byteSize) / float32(1024*1024)
}
func Test_initTransportProtocol(t *testing.T) {
t.Run("kitex_pb", func(t *testing.T) {
svcInfo := &serviceinfo.ServiceInfo{
PayloadCodec: serviceinfo.Protobuf,
}
rpcConfig := rpcinfo.NewRPCConfig()
initTransportProtocol(svcInfo, rpcConfig)
test.Assert(t, rpcConfig.PayloadCodec() == serviceinfo.Protobuf, rpcConfig.PayloadCodec())
test.Assert(t, rpcConfig.TransportProtocol() == transport.TTHeaderFramed, rpcConfig.TransportProtocol())
})
t.Run("grpc_pb", func(t *testing.T) {
svcInfo := &serviceinfo.ServiceInfo{
PayloadCodec: serviceinfo.Protobuf,
}
rpcConfig := rpcinfo.NewRPCConfig()
rpcinfo.AsMutableRPCConfig(rpcConfig).SetTransportProtocol(transport.GRPC)
initTransportProtocol(svcInfo, rpcConfig)
test.Assert(t, rpcConfig.PayloadCodec() == serviceinfo.Protobuf, rpcConfig.PayloadCodec())
test.Assert(t, rpcConfig.TransportProtocol()&transport.GRPC == transport.GRPC, rpcConfig.TransportProtocol())
})
t.Run("grpc_thrift", func(t *testing.T) {
svcInfo := &serviceinfo.ServiceInfo{
PayloadCodec: serviceinfo.Thrift,
}
rpcConfig := rpcinfo.NewRPCConfig()
rpcinfo.AsMutableRPCConfig(rpcConfig).SetTransportProtocol(transport.GRPC)
initTransportProtocol(svcInfo, rpcConfig)
test.Assert(t, rpcConfig.PayloadCodec() == serviceinfo.Thrift, rpcConfig.PayloadCodec())
test.Assert(t, rpcConfig.TransportProtocol()&transport.GRPC == transport.GRPC, rpcConfig.TransportProtocol())
})
}
type mockTracerForInitMW struct {
stats.Tracer
rpcinfo.StreamEventReporter
}
func Test_kClient_initMiddlewares(t *testing.T) {
ctl := &rpcinfo.TraceController{}
ctl.Append(mockTracerForInitMW{})
c := &kClient{
opt: &client.Options{
TracerCtl: ctl,
Streaming: internal_stream.StreamingConfig{},
},
}
c.initMiddlewares(context.Background())
test.Assert(t, len(c.opt.Streaming.RecvMiddlewares) == 0, "init middlewares failed")
test.Assert(t, len(c.opt.Streaming.SendMiddlewares) == 0, "init middlewares failed")
}
func TestRewriteProtocol(t *testing.T) {
tcases := []struct {
tp transport.Protocol
streamCall bool
want transport.Protocol
}{
{
tp: transport.PurePayload,
want: transport.PurePayload,
},
{
tp: transport.TTHeaderFramed,
want: transport.TTHeaderFramed,
},
{
tp: transport.TTHeader,
want: transport.TTHeader,
},
{
tp: transport.TTHeader | transport.GRPC,
want: transport.GRPC,
},
{
tp: transport.TTHeader | transport.GRPCStreaming,
want: transport.TTHeader,
},
{
tp: transport.TTHeaderFramed | transport.TTHeaderStreaming,
want: transport.TTHeaderFramed,
},
{
tp: transport.TTHeaderFramed | transport.GRPCStreaming | transport.TTHeaderStreaming,
want: transport.TTHeaderFramed,
},
{
tp: transport.TTHeaderFramed | transport.GRPC | transport.TTHeaderStreaming | transport.GRPCStreaming,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2 | transport.TTHeaderStreaming,
want: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2,
},
{
tp: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2 | transport.TTHeaderStreaming | transport.GRPCStreaming,
want: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2,
},
{
tp: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2 | transport.GRPC,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.HTTP | transport.HESSIAN2 | transport.GRPC | transport.GRPCStreaming,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.GRPCStreaming,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.GRPC | transport.GRPCStreaming,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.GRPC | transport.GRPCStreaming | transport.TTHeaderStreaming,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.GRPC | transport.GRPCStreaming | transport.TTHeaderStreaming | transport.HTTP | transport.HESSIAN2,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeaderFramed | transport.TTHeaderStreaming | transport.HTTP | transport.HESSIAN2,
streamCall: true,
want: transport.TTHeaderStreaming | transport.TTHeaderFramed,
},
{
tp: transport.TTHeaderFramed,
streamCall: true,
want: transport.TTHeaderFramed,
},
{
tp: transport.TTHeaderFramed | transport.GRPC,
streamCall: true,
want: transport.GRPC,
},
{
tp: transport.TTHeader,
streamCall: true,
want: transport.TTHeader,
},
{
tp: transport.Framed,
streamCall: true,
want: transport.Framed,
},
{
tp: transport.PurePayload,
streamCall: true,
want: transport.PurePayload,
},
}
for _, tc := range tcases {
cfg := rpcinfo.NewRPCConfig()
mcfg := rpcinfo.AsMutableRPCConfig(cfg)
mcfg.SetTransportProtocol(tc.tp)
purifyProtocol(mcfg, tc.tp, tc.streamCall)
test.Assert(t, cfg.TransportProtocol() == tc.want)
}
}
func Test_initRPCInfoWithStreamClientCallOption(t *testing.T) {
mtd := mocks.MockMethod
svcInfo := mocks.ServiceInfo()
callOptTimeout := 1 * time.Second
testService := "testService"
// config call option
cliIntf, err := NewClient(svcInfo, WithTransportProtocol(transport.TTHeaderStreaming), WithDestService(testService))
test.Assert(t, err == nil, err)
cli := cliIntf.(*kcFinalizerClient)
ctx := NewCtxWithCallOptions(context.Background(), streamcall.GetCallOptions([]streamcall.Option{streamcall.WithRecvTimeout(callOptTimeout)}))
_, ri, _ := cli.initRPCInfo(ctx, mtd, 0, nil, true)
test.Assert(t, ri.Config().StreamRecvTimeout() == callOptTimeout)
// call option has higher priority
cliTimeout := 2 * time.Second
cliIntf, err = NewClient(svcInfo, WithTransportProtocol(transport.TTHeaderStreaming), WithStreamOptions(WithStreamRecvTimeout(cliTimeout)), WithDestService(testService))
test.Assert(t, err == nil, err)
cli = cliIntf.(*kcFinalizerClient)
ctx = NewCtxWithCallOptions(context.Background(), streamcall.GetCallOptions([]streamcall.Option{streamcall.WithRecvTimeout(callOptTimeout)}))
_, ri, _ = cli.initRPCInfo(ctx, mtd, 0, nil, true)
test.Assert(t, ri.Config().StreamRecvTimeout() == callOptTimeout)
}
func Test_WithStreamEventHandler(t *testing.T) {
svcInfo := mocks.ServiceInfo()
testService := "testService"
cliIntf, err := NewClient(svcInfo, WithDestService(testService))
test.Assert(t, err == nil, err)
cli := cliIntf.(*kcFinalizerClient)
test.Assert(t, len(cli.opt.StreamOptions.StreamEventHandlers) == 0, cli.opt)
cliIntf, err = NewClient(svcInfo,
WithDestService(testService),
WithStreamOptions(
WithStreamEventHandler(rpcinfo.ClientStreamEventHandler{}),
WithStreamEventHandler(rpcinfo.ClientStreamEventHandler{
HandleStreamStartEvent: func(ctx context.Context, ri rpcinfo.RPCInfo, evt rpcinfo.StreamStartEvent) {},
HandleStreamRecvEvent: func(ctx context.Context, ri rpcinfo.RPCInfo, evt rpcinfo.StreamRecvEvent) {},
HandleStreamSendEvent: func(ctx context.Context, ri rpcinfo.RPCInfo, evt rpcinfo.StreamSendEvent) {},
HandleStreamRecvHeaderEvent: func(ctx context.Context, ri rpcinfo.RPCInfo, evt rpcinfo.StreamRecvHeaderEvent) {},
HandleStreamFinishEvent: func(ctx context.Context, ri rpcinfo.RPCInfo, evt rpcinfo.StreamFinishEvent) {},
}),
))
test.Assert(t, err == nil, err)
cli = cliIntf.(*kcFinalizerClient)
test.Assert(t, len(cli.opt.StreamOptions.StreamEventHandlers) == 2, cli.opt)
}
func Test_WithStreamRecvTimeoutConfig(t *testing.T) {
t.Run("WithStreamRecvTimeoutConfig", func(t *testing.T) {
cliIntf, err := NewClient(svcInfo, WithDestService("destService"),
WithStreamOptions(
WithStreamRecvTimeoutConfig(streaming.TimeoutConfig{
Timeout: 1 * time.Second,
DisableCancelRemote: true,
}),
))
test.Assert(t, err == nil, err)
cli := cliIntf.(*kcFinalizerClient)
test.Assert(t, cli.opt.StreamOptions.RecvTimeoutConfig.Timeout == 1*time.Second, cli.opt)
test.Assert(t, cli.opt.StreamOptions.RecvTimeoutConfig.DisableCancelRemote, cli.opt)
})
t.Run("WithStreamRecvTimeout - deprecated", func(t *testing.T) {
cliIntf, err := NewClient(svcInfo, WithDestService("destService"),
WithStreamOptions(
WithStreamRecvTimeout(2*time.Second),
))
test.Assert(t, err == nil, err)
cli := cliIntf.(*kcFinalizerClient)
test.Assert(t, cli.opt.StreamOptions.RecvTimeout == 2*time.Second, cli.opt)
})
t.Run("both set", func(t *testing.T) {
cliIntf, err := NewClient(svcInfo, WithDestService("destService"),
WithStreamOptions(
WithStreamRecvTimeout(5*time.Second),
WithStreamRecvTimeoutConfig(streaming.TimeoutConfig{
Timeout: 1 * time.Second,
DisableCancelRemote: true,
}),
))
test.Assert(t, err == nil, err)
cli := cliIntf.(*kcFinalizerClient)
// both should be set
test.Assert(t, cli.opt.StreamOptions.RecvTimeout == 5*time.Second, cli.opt)
test.Assert(t, cli.opt.StreamOptions.RecvTimeoutConfig.Timeout == 1*time.Second, cli.opt)
test.Assert(t, cli.opt.StreamOptions.RecvTimeoutConfig.DisableCancelRemote, cli.opt)
})
}
================================================
FILE: client/context.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"github.com/cloudwego/kitex/client/callopt"
)
type ctxKeyType int
const (
ctxCallOptionKey ctxKeyType = iota
ctxCallOptionInfoKey
)
// NewCtxWithCallOptions returns a new context associated with the given call-Options.
func NewCtxWithCallOptions(ctx context.Context, opts []callopt.Option) context.Context {
if ctx == nil || len(opts) == 0 {
return ctx
}
return context.WithValue(ctx, ctxCallOptionKey, opts)
}
// CallOptionsFromCtx retrieves call-Options from the given context.
func CallOptionsFromCtx(ctx context.Context) (res []callopt.Option) {
if ctx == nil {
return
}
res, _ = ctx.Value(ctxCallOptionKey).([]callopt.Option)
return
}
// CallOptionInfoFromCtx retrieves the call Options debug information from the given context.
func CallOptionInfoFromCtx(ctx context.Context) (res string) {
if ctx != nil {
res, _ = ctx.Value(ctxCallOptionInfoKey).(string)
}
return
}
================================================
FILE: client/context_middleware.go
================================================
/*
* Copyright 2022 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"github.com/cloudwego/kitex/pkg/endpoint"
)
type ctxMWChainKey struct{}
// WithContextMiddlewares add middlewares into current ctx
// Every client receive this ctx will execute the middlewares.
// Note that ContextMiddleware is prior to the ClientMiddleware.
func WithContextMiddlewares(ctx context.Context, mws ...endpoint.Middleware) context.Context {
if len(mws) == 0 {
return ctx
}
mw := getContextMiddleware(ctx)
if mw != nil {
mws = append([]endpoint.Middleware{mw}, mws...)
}
mw = endpoint.Chain(mws...)
return context.WithValue(ctx, ctxMWChainKey{}, mw)
}
func getContextMiddleware(ctx context.Context) endpoint.Middleware {
mws, _ := ctx.Value(ctxMWChainKey{}).(endpoint.Middleware)
return mws
}
// contextMW execute the ContextMiddlewares in ctx
func contextMW(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
mw := getContextMiddleware(ctx)
if mw != nil {
return mw(next)(ctx, req, resp)
}
return next(ctx, req, resp)
}
}
================================================
FILE: client/context_middleware_test.go
================================================
/*
* Copyright 2022 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"testing"
"github.com/golang/mock/gomock"
"github.com/cloudwego/kitex/internal/mocks"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/endpoint"
)
func TestContextMiddlewares(t *testing.T) {
ctx := context.Background()
var mw endpoint.Middleware = func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
return next(ctx, req, resp)
}
}
cmw := getContextMiddleware(ctx)
test.Assert(t, cmw == nil)
ctx = WithContextMiddlewares(ctx, mw)
cmw = getContextMiddleware(ctx)
test.Assert(t, cmw != nil)
}
func TestCallWithContextMiddlewares(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mtd := mocks.MockMethod
var beforeCall, afterCall int
var mw1 endpoint.Middleware = func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
beforeCall++
err = next(ctx, req, resp)
afterCall++
return err
}
}
var mw2 endpoint.Middleware = func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
beforeCall++
err = next(ctx, req, resp)
afterCall++
return err
}
}
ctx := context.Background()
cli := newMockClient(t, ctrl)
req, res := new(MockTStruct), new(MockTStruct)
err := cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
test.Assert(t, beforeCall == 0)
test.Assert(t, afterCall == 0)
ctx = WithContextMiddlewares(ctx, mw1)
err = cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
test.Assert(t, beforeCall == 1)
test.Assert(t, afterCall == 1)
beforeCall = 0
afterCall = 0
ctx = WithContextMiddlewares(ctx, mw2)
err = cli.Call(ctx, mtd, req, res)
test.Assert(t, err == nil)
test.Assert(t, beforeCall == 2)
test.Assert(t, afterCall == 2)
}
================================================
FILE: client/context_test.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"testing"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/internal/test"
)
const (
mockHostPort = "127.0.0.1:18888"
mockCallOptsInfo = "mock call option info"
)
func TestContextWithCallOptions(t *testing.T) {
defer func() {
p := recover()
test.Assert(t, p == nil, p)
}()
var ctx context.Context
var opts []callopt.Option
// nil ctx
ctxWithNilParent := NewCtxWithCallOptions(ctx, opts)
test.Assert(t, ctxWithNilParent == nil, ctxWithNilParent)
// length of opts is 0
ctx = context.Background()
ctxWithNilOpts := NewCtxWithCallOptions(ctx, nil)
test.Assert(t, ctxWithNilOpts == ctx)
// with opts
ctxWithCallOpts := NewCtxWithCallOptions(ctx, opts)
callOpts := CallOptionsFromCtx(ctxWithCallOpts)
test.DeepEqual(t, opts, callOpts)
// read call opts info
ctxWithCallOptsInfo := context.WithValue(ctx, ctxCallOptionInfoKey, mockCallOptsInfo)
test.Assert(t, CallOptionInfoFromCtx(ctxWithCallOptsInfo) == mockCallOptsInfo)
}
================================================
FILE: client/deprecated.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"github.com/cloudwego/kitex/internal/client"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/utils"
"github.com/cloudwego/kitex/transport"
)
// WithFramedTransport to use framed transport
//
// Deprecated: Use WithTransportProtocol(transport.Framed) instead.
//
// IMPORTANT: this option will be deleted in the future!!!
func WithFramedTransport() Option {
return Option{F: func(o *client.Options, di *utils.Slice) {
di.Push("WithFramedTransport()")
rpcinfo.AsMutableRPCConfig(o.Configs).SetTransportProtocol(transport.Framed)
}}
}
// WithConnMetric to enable reporting connection pool stats.
//
// Deprecated: Use WithConnReporterEnabled instead.
func WithConnMetric() Option {
return Option{F: func(o *client.Options, di *utils.Slice) {
di.Push("WithConnMetric()")
o.RemoteOpt.EnableConnPoolReporter = true
}}
}
================================================
FILE: client/doc.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Package client contains core part of Kitex client.
// Users should not directly use any method here other than the options and call options.
// Users should call NewClient in the generated code, which wraps the NewClient call in this package.
package client
================================================
FILE: client/genericclient/client.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Package genericclient ...
package genericclient
import (
"context"
"runtime"
"github.com/cloudwego/kitex/client"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/client/callopt/streamcall"
igeneric "github.com/cloudwego/kitex/internal/generic"
"github.com/cloudwego/kitex/pkg/generic"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/serviceinfo"
"github.com/cloudwego/kitex/pkg/streaming"
"github.com/cloudwego/kitex/transport"
)
var _ Client = &genericServiceClient{}
// NewClient create a generic client
func NewClient(destService string, g generic.Generic, opts ...client.Option) (Client, error) {
svcInfo := generic.ServiceInfoWithGeneric(g)
return NewClientWithServiceInfo(destService, g, svcInfo, opts...)
}
// NewClientWithServiceInfo create a generic client with serviceInfo
func NewClientWithServiceInfo(destService string, g generic.Generic, svcInfo *serviceinfo.ServiceInfo, opts ...client.Option) (Client, error) {
var options []client.Option
options = append(options, client.WithGeneric(g))
options = append(options, client.WithDestService(destService))
options = append(options, client.WithTransportProtocol(transport.TTHeaderStreaming))
options = append(options, opts...)
kc, err := client.NewClient(svcInfo, options...)
if err != nil {
return nil, err
}
cli := &genericServiceClient{
svcInfo: svcInfo,
kClient: kc,
sClient: kc.(client.Streaming),
g: g,
}
cli.isBinaryGeneric, _ = g.GetExtra(igeneric.IsBinaryGeneric).(bool)
cli.getMethodFunc, _ = g.GetExtra(igeneric.GetMethodNameByRequestFuncKey).(generic.GetMethodNameByRequestFunc)
runtime.SetFinalizer(cli, (*genericServiceClient).Close)
return cli, nil
}
// Client generic client
type Client interface {
generic.Closer
// GenericCall generic call
GenericCall(ctx context.Context, method string, request interface{}, callOptions ...callopt.Option) (response interface{}, err error)
// ClientStreaming creates an implementation of ClientStreamingClient
ClientStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (ClientStreamingClient, error)
// ServerStreaming creates an implementation of ServerStreamingClient
ServerStreaming(ctx context.Context, method string, req interface{}, callOptions ...streamcall.Option) (ServerStreamingClient, error)
// BidirectionalStreaming creates an implementation of BidiStreamingClient
BidirectionalStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (BidiStreamingClient, error)
}
type genericServiceClient struct {
svcInfo *serviceinfo.ServiceInfo
kClient client.Client
sClient client.Streaming
g generic.Generic
// binary generic need method info context
isBinaryGeneric bool
// http generic get method name by request
getMethodFunc generic.GetMethodNameByRequestFunc
}
func (gc *genericServiceClient) GenericCall(ctx context.Context, method string, request interface{}, callOptions ...callopt.Option) (response interface{}, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
if gc.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingNone)
}
if gc.getMethodFunc != nil {
// get method name from http generic by request
method, _ = gc.getMethodFunc(request)
}
var _args *generic.Args
var _result *generic.Result
mtInfo := gc.svcInfo.MethodInfo(ctx, method)
if mtInfo != nil {
_args = mtInfo.NewArgs().(*generic.Args)
_args.Method = method
_args.Request = request
_result = mtInfo.NewResult().(*generic.Result)
} else {
// To correctly report the unknown method error, an empty object is returned here.
_args = &generic.Args{}
_result = &generic.Result{}
}
if err = gc.kClient.Call(ctx, method, _args, _result); err != nil {
return
}
return _result.GetSuccess(), nil
}
func (gc *genericServiceClient) Close() error {
// no need a finalizer anymore
runtime.SetFinalizer(gc, nil)
// Notice: don't need to close kClient because finalizer will close it.
return gc.g.Close()
}
func (gc *genericServiceClient) ClientStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (ClientStreamingClient, error) {
ctx = client.NewCtxWithCallOptions(ctx, streamcall.GetCallOptions(callOptions))
if gc.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingClient)
}
st, err := gc.sClient.StreamX(ctx, method)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(st.Context())
return newClientStreamingClient(ri.Invocation().MethodInfo(), method, st), nil
}
func (gc *genericServiceClient) ServerStreaming(ctx context.Context, method string, req interface{}, callOptions ...streamcall.Option) (ServerStreamingClient, error) {
ctx = client.NewCtxWithCallOptions(ctx, streamcall.GetCallOptions(callOptions))
if gc.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingServer)
}
st, err := gc.sClient.StreamX(ctx, method)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(st.Context())
stream := newServerStreamingClient(ri.Invocation().MethodInfo(), method, st).(*serverStreamingClient)
args := stream.methodInfo.NewArgs().(*generic.Args)
args.Method = stream.method
args.Request = req
if err := st.SendMsg(st.Context(), args); err != nil {
return nil, err
}
if err := stream.Streaming().CloseSend(st.Context()); err != nil {
return nil, err
}
return stream, nil
}
func (gc *genericServiceClient) BidirectionalStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (BidiStreamingClient, error) {
ctx = client.NewCtxWithCallOptions(ctx, streamcall.GetCallOptions(callOptions))
if gc.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingBidirectional)
}
st, err := gc.sClient.StreamX(ctx, method)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(st.Context())
return newBidiStreamingClient(ri.Invocation().MethodInfo(), method, st), nil
}
// ClientStreamingClient define client side generic client streaming APIs
type ClientStreamingClient interface {
// Send sends a message to the server.
Send(ctx context.Context, req interface{}) error
// CloseAndRecv closes the send direction of the stream and returns the response from the server.
CloseAndRecv(ctx context.Context) (interface{}, error)
// Header inherits from the underlying streaming.ClientStream.
Header() (streaming.Header, error)
// Trailer inherits from the underlying streaming.ClientStream.
Trailer() (streaming.Trailer, error)
// CloseSend inherits from the underlying streaming.ClientStream.
CloseSend(ctx context.Context) error
// Context inherits from the underlying streaming.ClientStream.
Context() context.Context
// Streaming returns the underlying streaming.ClientStream.
Streaming() streaming.ClientStream
}
type clientStreamingClient struct {
methodInfo serviceinfo.MethodInfo
method string
streaming streaming.ClientStream
}
func newClientStreamingClient(methodInfo serviceinfo.MethodInfo, method string, st streaming.ClientStream) ClientStreamingClient {
return &clientStreamingClient{
methodInfo: methodInfo,
method: method,
streaming: st,
}
}
func (c *clientStreamingClient) Send(ctx context.Context, req interface{}) error {
args := c.methodInfo.NewArgs().(*generic.Args)
args.Method = c.method
args.Request = req
return c.streaming.SendMsg(ctx, args)
}
func (c *clientStreamingClient) CloseAndRecv(ctx context.Context) (interface{}, error) {
if err := c.streaming.CloseSend(ctx); err != nil {
return nil, err
}
res := c.methodInfo.NewResult().(*generic.Result)
if err := c.streaming.RecvMsg(ctx, res); err != nil {
return nil, err
}
return res.GetSuccess(), nil
}
func (c *clientStreamingClient) Header() (streaming.Header, error) {
return c.streaming.Header()
}
func (c *clientStreamingClient) Trailer() (streaming.Trailer, error) {
return c.streaming.Trailer()
}
func (c *clientStreamingClient) CloseSend(ctx context.Context) error {
return c.streaming.CloseSend(ctx)
}
func (c *clientStreamingClient) Context() context.Context {
return c.streaming.Context()
}
func (c *clientStreamingClient) Streaming() streaming.ClientStream {
return c.streaming
}
// ServerStreamingClient define client side generic server streaming APIs
type ServerStreamingClient interface {
// Recv receives a message from the server.
Recv(ctx context.Context) (interface{}, error)
// Header inherits from the underlying streaming.ClientStream.
Header() (streaming.Header, error)
// Trailer inherits from the underlying streaming.ClientStream.
Trailer() (streaming.Trailer, error)
// CloseSend inherits from the underlying streaming.ClientStream.
CloseSend(ctx context.Context) error
// Context inherits from the underlying streaming.ClientStream.
Context() context.Context
// Streaming returns the underlying streaming.ClientStream.
Streaming() streaming.ClientStream
}
type serverStreamingClient struct {
methodInfo serviceinfo.MethodInfo
method string
streaming streaming.ClientStream
}
func newServerStreamingClient(methodInfo serviceinfo.MethodInfo, method string, st streaming.ClientStream) ServerStreamingClient {
return &serverStreamingClient{
methodInfo: methodInfo,
method: method,
streaming: st,
}
}
func (c *serverStreamingClient) Recv(ctx context.Context) (interface{}, error) {
res := c.methodInfo.NewResult().(*generic.Result)
if err := c.streaming.RecvMsg(ctx, res); err != nil {
return nil, err
}
return res.GetSuccess(), nil
}
func (c *serverStreamingClient) Header() (streaming.Header, error) {
return c.streaming.Header()
}
func (c *serverStreamingClient) Trailer() (streaming.Trailer, error) {
return c.streaming.Trailer()
}
func (c *serverStreamingClient) CloseSend(ctx context.Context) error {
return c.streaming.CloseSend(ctx)
}
func (c *serverStreamingClient) Context() context.Context {
return c.streaming.Context()
}
func (c *serverStreamingClient) Streaming() streaming.ClientStream {
return c.streaming
}
// BidiStreamingClient define client side generic bidirectional streaming APIs
type BidiStreamingClient interface {
// Send sends a message to the server.
Send(ctx context.Context, req interface{}) error
// Recv receives a message from the server.
Recv(ctx context.Context) (interface{}, error)
// Header inherits from the underlying streaming.ClientStream.
Header() (streaming.Header, error)
// Trailer inherits from the underlying streaming.ClientStream.
Trailer() (streaming.Trailer, error)
// CloseSend inherits from the underlying streaming.ClientStream.
CloseSend(ctx context.Context) error
// Context inherits from the underlying streaming.ClientStream.
Context() context.Context
// Streaming returns the underlying streaming.ClientStream.
Streaming() streaming.ClientStream
}
type bidiStreamingClient struct {
methodInfo serviceinfo.MethodInfo
method string
streaming streaming.ClientStream
}
func newBidiStreamingClient(methodInfo serviceinfo.MethodInfo, method string, st streaming.ClientStream) BidiStreamingClient {
return &bidiStreamingClient{
methodInfo: methodInfo,
method: method,
streaming: st,
}
}
func (c *bidiStreamingClient) Send(ctx context.Context, req interface{}) error {
args := c.methodInfo.NewArgs().(*generic.Args)
args.Method = c.method
args.Request = req
return c.streaming.SendMsg(ctx, args)
}
func (c *bidiStreamingClient) Recv(ctx context.Context) (interface{}, error) {
res := c.methodInfo.NewResult().(*generic.Result)
if err := c.streaming.RecvMsg(ctx, res); err != nil {
return nil, err
}
return res.GetSuccess(), nil
}
func (c *bidiStreamingClient) Header() (streaming.Header, error) {
return c.streaming.Header()
}
func (c *bidiStreamingClient) Trailer() (streaming.Trailer, error) {
return c.streaming.Trailer()
}
func (c *bidiStreamingClient) CloseSend(ctx context.Context) error {
return c.streaming.CloseSend(ctx)
}
func (c *bidiStreamingClient) Context() context.Context {
return c.streaming.Context()
}
func (c *bidiStreamingClient) Streaming() streaming.ClientStream {
return c.streaming
}
================================================
FILE: client/genericclient/deprecated.go
================================================
/*
* Copyright 2024 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// NOTE: The basic generic streaming functions have been completed, but the interface needs adjustments. The feature is expected to be released later.
package genericclient
import (
"context"
"errors"
"github.com/cloudwego/kitex/client"
"github.com/cloudwego/kitex/client/callopt"
igeneric "github.com/cloudwego/kitex/internal/generic"
"github.com/cloudwego/kitex/pkg/generic"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/serviceinfo"
"github.com/cloudwego/kitex/pkg/streaming"
)
// Deprecated, use generic.ServiceInfoWithGeneric instead
func StreamingServiceInfo(g generic.Generic) *serviceinfo.ServiceInfo {
return generic.ServiceInfoWithGeneric(g)
}
type ClientStreaming interface {
streaming.Stream
Send(req interface{}) error
CloseAndRecv() (resp interface{}, err error)
}
type ServerStreaming interface {
streaming.Stream
Recv() (resp interface{}, err error)
}
type BidirectionalStreaming interface {
streaming.Stream
Send(req interface{}) error
Recv() (resp interface{}, err error)
}
// Deprecated: use NewClient instead.
func NewStreamingClient(destService string, g generic.Generic, opts ...client.Option) (Client, error) {
return NewClient(destService, g, opts...)
}
// Deprecated: use NewClientWithServiceInfo instead.
func NewStreamingClientWithServiceInfo(destService string, g generic.Generic, svcInfo *serviceinfo.ServiceInfo, opts ...client.Option) (Client, error) {
return NewClientWithServiceInfo(destService, g, svcInfo, opts...)
}
type deprecatedClientStreamingClient struct {
streaming.Stream
method string
methodInfo serviceinfo.MethodInfo
}
func NewClientStreaming(ctx context.Context, genericCli Client, method string, callOpts ...callopt.Option) (ClientStreaming, error) {
gCli, ok := genericCli.(*genericServiceClient)
if !ok {
return nil, errors.New("invalid generic client")
}
if gCli.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingClient)
}
stream, err := getStream(ctx, gCli, method, callOpts...)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(stream.Context())
return &deprecatedClientStreamingClient{stream, method, ri.Invocation().MethodInfo()}, nil
}
func (cs *deprecatedClientStreamingClient) Send(req interface{}) error {
_args := cs.methodInfo.NewArgs().(*generic.Args)
_args.Method = cs.method
_args.Request = req
return cs.Stream.SendMsg(_args)
}
func (cs *deprecatedClientStreamingClient) CloseAndRecv() (resp interface{}, err error) {
if err := cs.Stream.Close(); err != nil {
return nil, err
}
_result := cs.methodInfo.NewResult().(*generic.Result)
if err = cs.Stream.RecvMsg(_result); err != nil {
return nil, err
}
return _result.GetSuccess(), nil
}
type deprecatedServerStreamingClient struct {
streaming.Stream
methodInfo serviceinfo.MethodInfo
}
func NewServerStreaming(ctx context.Context, genericCli Client, method string, req interface{}, callOpts ...callopt.Option) (ServerStreaming, error) {
gCli, ok := genericCli.(*genericServiceClient)
if !ok {
return nil, errors.New("invalid generic client")
}
if gCli.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingServer)
}
stream, err := getStream(ctx, gCli, method, callOpts...)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(stream.Context())
mtInfo := ri.Invocation().MethodInfo()
ss := &deprecatedServerStreamingClient{stream, mtInfo}
_args := mtInfo.NewArgs().(*generic.Args)
_args.Method = method
_args.Request = req
if err = ss.Stream.SendMsg(_args); err != nil {
return nil, err
}
if err = ss.Stream.Close(); err != nil {
return nil, err
}
return ss, nil
}
func (ss *deprecatedServerStreamingClient) Recv() (resp interface{}, err error) {
_result := ss.methodInfo.NewResult().(*generic.Result)
if err = ss.Stream.RecvMsg(_result); err != nil {
return nil, err
}
return _result.GetSuccess(), nil
}
type deprecatedBidirectionalStreamingClient struct {
streaming.Stream
method string
methodInfo serviceinfo.MethodInfo
}
func NewBidirectionalStreaming(ctx context.Context, genericCli Client, method string, callOpts ...callopt.Option) (BidirectionalStreaming, error) {
gCli, ok := genericCli.(*genericServiceClient)
if !ok {
return nil, errors.New("invalid generic client")
}
if gCli.isBinaryGeneric {
// To be compatible with binary generic calls, streaming mode must be passed in.
ctx = igeneric.WithGenericStreamingMode(ctx, serviceinfo.StreamingBidirectional)
}
stream, err := getStream(ctx, gCli, method, callOpts...)
if err != nil {
return nil, err
}
ri := rpcinfo.GetRPCInfo(stream.Context())
return &deprecatedBidirectionalStreamingClient{stream, method, ri.Invocation().MethodInfo()}, nil
}
func (bs *deprecatedBidirectionalStreamingClient) Send(req interface{}) error {
_args := bs.methodInfo.NewArgs().(*generic.Args)
_args.Method = bs.method
_args.Request = req
return bs.Stream.SendMsg(_args)
}
func (bs *deprecatedBidirectionalStreamingClient) Recv() (resp interface{}, err error) {
_result := bs.methodInfo.NewResult().(*generic.Result)
if err = bs.Stream.RecvMsg(_result); err != nil {
return nil, err
}
return _result.GetSuccess(), nil
}
func getStream(ctx context.Context, genericCli *genericServiceClient, method string, callOpts ...callopt.Option) (streaming.Stream, error) {
ctx = client.NewCtxWithCallOptions(ctx, callOpts)
res := new(streaming.Result)
err := genericCli.sClient.Stream(ctx, method, nil, res)
if err != nil {
return nil, err
}
return res.Stream, nil
}
================================================
FILE: client/middlewares.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"errors"
"fmt"
"reflect"
"strings"
"time"
"github.com/cloudwego/kitex/internal"
"github.com/cloudwego/kitex/pkg/discovery"
"github.com/cloudwego/kitex/pkg/endpoint"
"github.com/cloudwego/kitex/pkg/event"
"github.com/cloudwego/kitex/pkg/kerrors"
"github.com/cloudwego/kitex/pkg/klog"
"github.com/cloudwego/kitex/pkg/loadbalance/lbcache"
"github.com/cloudwego/kitex/pkg/proxy"
"github.com/cloudwego/kitex/pkg/remote"
"github.com/cloudwego/kitex/pkg/remote/codec/protobuf"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
)
const maxRetry = 6
func newProxyMW(prx proxy.ForwardProxy) endpoint.Middleware {
// If you want to customize the processing logic of proxy middleware,
// you can implement this interface to replace the default implementation.
if p, ok := prx.(proxy.WithMiddleware); ok {
return p.ProxyMiddleware()
}
return func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, request, response interface{}) error {
err := prx.ResolveProxyInstance(ctx)
if err != nil {
return err
}
err = next(ctx, request, response)
return err
}
}
}
func discoveryEventHandler(name string, bus event.Bus, queue event.Queue) func(d *discovery.Change) {
return func(d *discovery.Change) {
now := time.Now()
bus.Dispatch(&event.Event{
Name: name,
Time: now,
Extra: d,
})
queue.Push(&event.Event{
Name: name,
Time: now,
Extra: map[string]interface{}{
"Cacheable": d.Result.Cacheable,
"CacheKey": d.Result.CacheKey,
"Added": wrapInstances(d.Added),
"Updated": wrapInstances(d.Updated),
"Removed": wrapInstances(d.Removed),
},
})
}
}
// newResolveMWBuilder creates a middleware for service discovery.
// This middleware selects an appropriate instance based on the resolver and loadbalancer given.
// If retryable error is encountered, it will retry until timeout or an unretryable error is returned.
func newResolveMWBuilder(lbf *lbcache.BalancerFactory) endpoint.MiddlewareBuilder {
return func(ctx context.Context) endpoint.Middleware {
return func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, request, response interface{}) error {
rpcInfo := rpcinfo.GetRPCInfo(ctx)
dest := rpcInfo.To()
if dest == nil {
return kerrors.ErrNoDestService
}
remote := remoteinfo.AsRemoteInfo(dest)
if remote == nil {
err := fmt.Errorf("unsupported target EndpointInfo type: %T", dest)
return kerrors.ErrInternalException.WithCause(err)
}
if remote.GetInstance() != nil {
return next(ctx, request, response)
}
lb, err := lbf.Get(ctx, dest)
if err != nil {
return kerrors.ErrServiceDiscovery.WithCause(err)
}
var lastErr error
for i := 0; i < maxRetry; i++ {
select {
case <-ctx.Done():
return kerrors.ErrRPCTimeout
default:
}
// we always need to get a new picker every time, because when downstream update deployment,
// we may get an old picker that include all outdated instances which will cause connect always failed.
picker := lb.GetPicker()
ins := picker.Next(ctx, request)
if ins == nil {
err = kerrors.ErrNoMoreInstance.WithCause(fmt.Errorf("last error: %w", lastErr))
} else {
remote.SetInstance(ins)
// TODO: generalize retry strategy
err = next(ctx, request, response)
}
if r, ok := picker.(internal.Reusable); ok {
r.Recycle()
}
if err == nil {
return nil
}
if retryable(err) {
lastErr = err
klog.CtxWarnf(ctx, "KITEX: auto retry retryable error, to_service=%s, retry=%d error=%s", dest.ServiceName(), i+1, err.Error())
continue
}
return err
}
return lastErr
}
}
}
}
// newIOErrorHandleMW provides a hook point for io error handling.
func newIOErrorHandleMW(errHandle func(context.Context, error) error) endpoint.Middleware {
if errHandle == nil {
errHandle = DefaultClientErrorHandler
}
return func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, request, response interface{}) (err error) {
err = next(ctx, request, response)
if err == nil {
return
}
return errHandle(ctx, err)
}
}
}
func isRemoteErr(err error) bool {
if err == nil {
return false
}
switch err.(type) {
// for thrift、KitexProtobuf, actually check *remote.TransError is enough
case *remote.TransError, protobuf.PBError:
return true
default:
// case thrift.TApplicationException ?
// XXX: we'd like to get rid of apache pkg, should be ok to check by type name
// for thrift v0.13.0, it's "*thrift.tApplicationException"
}
return strings.HasSuffix(reflect.TypeOf(err).String(), "ApplicationException")
}
// DefaultClientErrorHandler is Default ErrorHandler for client
// when no ErrorHandler is specified with Option `client.WithErrorHandler`, this ErrorHandler will be injected.
// for thrift、KitexProtobuf, >= v0.4.0 wrap protocol error to TransError, which will be more friendly.
func DefaultClientErrorHandler(ctx context.Context, err error) error {
if isRemoteErr(err) {
// Add 'remote' prefix to distinguish with local err.
// Because it cannot make sure which side err when decode err happen
return kerrors.ErrRemoteOrNetwork.WithCauseAndExtraMsg(err, "remote")
}
return kerrors.ErrRemoteOrNetwork.WithCause(err)
}
// ClientErrorHandlerWithAddr is ErrorHandler for client, which will add remote addr info into error
func ClientErrorHandlerWithAddr(ctx context.Context, err error) error {
addrStr := getRemoteAddr(ctx)
if isRemoteErr(err) {
// Add 'remote' prefix to distinguish with local err.
// Because it cannot make sure which side err when decode err happen
extraMsg := "remote"
if addrStr != "" {
extraMsg = "remote-" + addrStr
}
return kerrors.ErrRemoteOrNetwork.WithCauseAndExtraMsg(err, extraMsg)
}
return kerrors.ErrRemoteOrNetwork.WithCauseAndExtraMsg(err, addrStr)
}
type instInfo struct {
Address string
Weight int
}
func wrapInstances(insts []discovery.Instance) []*instInfo {
if len(insts) == 0 {
return nil
}
instInfos := make([]*instInfo, 0, len(insts))
for i := range insts {
inst := insts[i]
addr := fmt.Sprintf("%s://%s", inst.Address().Network(), inst.Address().String())
instInfos = append(instInfos, &instInfo{Address: addr, Weight: inst.Weight()})
}
return instInfos
}
func retryable(err error) bool {
return errors.Is(err, kerrors.ErrGetConnection) || errors.Is(err, kerrors.ErrCircuitBreak)
}
func getRemoteAddr(ctx context.Context) string {
if ri := rpcinfo.GetRPCInfo(ctx); ri != nil && ri.To() != nil && ri.To().Address() != nil {
return ri.To().Address().String()
}
return ""
}
================================================
FILE: client/middlewares_test.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client
import (
"context"
"errors"
"net"
"testing"
"github.com/golang/mock/gomock"
"github.com/cloudwego/gopkg/protocol/thrift"
"github.com/cloudwego/kitex/internal/mocks"
mocksdiscovery "github.com/cloudwego/kitex/internal/mocks/discovery"
mocksproxy "github.com/cloudwego/kitex/internal/mocks/proxy"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/discovery"
"github.com/cloudwego/kitex/pkg/endpoint"
"github.com/cloudwego/kitex/pkg/event"
"github.com/cloudwego/kitex/pkg/kerrors"
"github.com/cloudwego/kitex/pkg/proxy"
"github.com/cloudwego/kitex/pkg/remote/codec/protobuf"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/status"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/pkg/rpcinfo/remoteinfo"
)
var (
instance404 = []discovery.Instance{
discovery.NewInstance("tcp", "localhost:404", 1, make(map[string]string)),
}
instance505 = discovery.NewInstance("tcp", "localhost:505", 1, make(map[string]string))
ctx = func() context.Context {
ctx := context.Background()
ctx = context.WithValue(ctx, endpoint.CtxEventBusKey, event.NewEventBus())
ctx = context.WithValue(ctx, endpoint.CtxEventQueueKey, event.NewQueue(10))
return ctx
}()
tcpAddrStr = "127.0.0.1:9909"
)
func resolver404(ctrl *gomock.Controller) discovery.Resolver {
resolver := mocksdiscovery.NewMockResolver(ctrl)
resolver.EXPECT().Resolve(gomock.Any(), gomock.Any()).Return(discovery.Result{
Cacheable: true,
CacheKey: "test",
Instances: instance404,
}, nil).AnyTimes()
resolver.EXPECT().Diff(gomock.Any(), gomock.Any(), gomock.Any()).Return(discovery.Change{}, false).AnyTimes()
resolver.EXPECT().Name().Return("middlewares_test").AnyTimes()
resolver.EXPECT().Target(gomock.Any(), gomock.Any()).AnyTimes()
return resolver
}
func TestNoResolver(t *testing.T) {
svcInfo := mocks.ServiceInfo()
cli, err := NewClient(svcInfo, WithDestService("destService"))
test.Assert(t, err == nil)
err = cli.Call(context.Background(), "mock", mocks.NewMockArgs(), mocks.NewMockResult())
test.Assert(t, errors.Is(err, kerrors.ErrNoResolver))
}
func TestResolverMW(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
var invoked bool
cli := newMockClient(t, ctrl).(*kcFinalizerClient)
mw := newResolveMWBuilder(cli.lbf)(ctx)
ep := func(ctx context.Context, request, response interface{}) error {
invoked = true
return nil
}
to := remoteinfo.NewRemoteInfo(&rpcinfo.EndpointBasicInfo{}, "")
ri := rpcinfo.NewRPCInfo(nil, to, rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
ctx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
req := new(MockTStruct)
res := new(MockTStruct)
err := mw(ep)(ctx, req, res)
test.Assert(t, err == nil)
test.Assert(t, invoked)
test.Assert(t, to.GetInstance() == instance404[0])
}
func TestResolverMWErrGetConnection(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
cli := newMockClient(t, ctrl).(*kcFinalizerClient)
mw := newResolveMWBuilder(cli.lbf)(ctx)
ep := func(ctx context.Context, request, response interface{}) error {
return kerrors.ErrGetConnection
}
to := remoteinfo.NewRemoteInfo(&rpcinfo.EndpointBasicInfo{ServiceName: "mock_to_service"}, "")
ri := rpcinfo.NewRPCInfo(nil, to, rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
ctx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
req := new(MockTStruct)
res := new(MockTStruct)
err := mw(ep)(ctx, req, res)
test.Assert(t, err == kerrors.ErrGetConnection)
}
func TestResolverMWOutOfInstance(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
resolver := &discovery.SynthesizedResolver{
ResolveFunc: func(ctx context.Context, key string) (discovery.Result, error) {
return discovery.Result{}, nil
},
NameFunc: func() string { return t.Name() },
}
var invoked bool
cli := newMockClient(t, ctrl, WithResolver(resolver)).(*kcFinalizerClient)
mw := newResolveMWBuilder(cli.lbf)(ctx)
ep := func(ctx context.Context, request, response interface{}) error {
invoked = true
return nil
}
to := remoteinfo.NewRemoteInfo(&rpcinfo.EndpointBasicInfo{}, "")
ri := rpcinfo.NewRPCInfo(nil, to, rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
ctx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
req := new(MockTStruct)
res := new(MockTStruct)
err := mw(ep)(ctx, req, res)
test.Assert(t, err != nil, err)
test.Assert(t, errors.Is(err, kerrors.ErrNoMoreInstance))
test.Assert(t, to.GetInstance() == nil)
test.Assert(t, !invoked)
}
func TestDefaultErrorHandler(t *testing.T) {
tcpAddr, _ := net.ResolveTCPAddr("tcp", tcpAddrStr)
ri := rpcinfo.NewRPCInfo(nil, rpcinfo.NewEndpointInfo("mockService", "mockMethod", tcpAddr, nil),
rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
reqCtx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
// Test TApplicationException
err := DefaultClientErrorHandler(context.Background(), thrift.NewApplicationException(100, "mock"))
test.Assert(t, err.Error() == "remote or network error[remote]: mock", err.Error())
var te *thrift.ApplicationException
ok := errors.As(err, &te)
test.Assert(t, ok)
test.Assert(t, te.TypeID() == 100)
// Test TApplicationException with remote addr
err = ClientErrorHandlerWithAddr(reqCtx, thrift.NewApplicationException(100, "mock"))
test.Assert(t, err.Error() == "remote or network error[remote-"+tcpAddrStr+"]: mock", err.Error())
ok = errors.As(err, &te)
test.Assert(t, ok)
test.Assert(t, te.TypeID() == 100)
// Test PbError
err = DefaultClientErrorHandler(context.Background(), protobuf.NewPbError(100, "mock"))
test.Assert(t, err.Error() == "remote or network error[remote]: mock")
var pe protobuf.PBError
ok = errors.As(err, &pe)
test.Assert(t, ok)
test.Assert(t, te.TypeID() == 100)
// Test PbError with remote addr
err = ClientErrorHandlerWithAddr(reqCtx, protobuf.NewPbError(100, "mock"))
test.Assert(t, err.Error() == "remote or network error[remote-"+tcpAddrStr+"]: mock", err.Error())
ok = errors.As(err, &pe)
test.Assert(t, ok)
test.Assert(t, te.TypeID() == 100)
// Test status.Error
err = DefaultClientErrorHandler(context.Background(), status.Err(100, "mock"))
test.Assert(t, err.Error() == "remote or network error: rpc error: code = 100 desc = mock", err.Error())
// Test status.Error with remote addr
err = ClientErrorHandlerWithAddr(reqCtx, status.Err(100, "mock"))
test.Assert(t, err.Error() == "remote or network error["+tcpAddrStr+"]: rpc error: code = 100 desc = mock", err.Error())
// Test other error
err = DefaultClientErrorHandler(context.Background(), errors.New("mock"))
test.Assert(t, err.Error() == "remote or network error: mock")
// Test other error with remote addr
err = ClientErrorHandlerWithAddr(reqCtx, errors.New("mock"))
test.Assert(t, err.Error() == "remote or network error["+tcpAddrStr+"]: mock")
}
func TestNewProxyMW(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
p := mocksproxy.NewMockForwardProxy(ctrl)
p.EXPECT().ResolveProxyInstance(gomock.Any()).Return(nil).Times(1)
mw := newProxyMW(p)
err := mw(func(ctx context.Context, req, resp interface{}) (err error) {
return nil
})(context.Background(), nil, nil)
test.Assert(t, err == nil)
tp := mocksproxy.NewMockWithMiddleware(ctrl)
tp.EXPECT().ProxyMiddleware().DoAndReturn(func() endpoint.Middleware {
return func(e endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, req, resp interface{}) (err error) {
return errors.New("execute proxy middleware")
}
}
}).Times(1)
mw = newProxyMW(&struct {
proxy.ForwardProxy
proxy.WithMiddleware
}{
WithMiddleware: tp,
})
err = mw(func(ctx context.Context, req, resp interface{}) (err error) {
return nil
})(context.Background(), nil, nil)
test.Assert(t, err.Error() == "execute proxy middleware")
}
func BenchmarkResolverMW(b *testing.B) {
ctrl := gomock.NewController(b)
defer ctrl.Finish()
cli := newMockClient(b, ctrl).(*kcFinalizerClient)
mw := newResolveMWBuilder(cli.lbf)(ctx)
ep := func(ctx context.Context, request, response interface{}) error { return nil }
ri := rpcinfo.NewRPCInfo(nil, nil, rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
ctx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
req := new(MockTStruct)
res := new(MockTStruct)
b.ResetTimer()
for i := 0; i < b.N; i++ {
mw(ep)(ctx, req, res)
}
}
func BenchmarkResolverMWParallel(b *testing.B) {
ctrl := gomock.NewController(b)
defer ctrl.Finish()
cli := newMockClient(b, ctrl).(*kcFinalizerClient)
mw := newResolveMWBuilder(cli.lbf)(ctx)
ep := func(ctx context.Context, request, response interface{}) error { return nil }
ri := rpcinfo.NewRPCInfo(nil, nil, rpcinfo.NewInvocation("", ""), nil, rpcinfo.NewRPCStats())
ctx := rpcinfo.NewCtxWithRPCInfo(context.Background(), ri)
req := new(MockTStruct)
res := new(MockTStruct)
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
mw(ep)(ctx, req, res)
}
})
}
func TestDiscoveryEventHandler(t *testing.T) {
bus, queue := event.NewEventBus(), event.NewQueue(200)
h := discoveryEventHandler(discovery.ChangeEventName, bus, queue)
ins := []discovery.Instance{discovery.NewInstance("tcp", "addr", 10, nil)}
cacheKey := "testCacheKey"
c := &discovery.Change{
Result: discovery.Result{
Cacheable: true,
CacheKey: cacheKey,
},
Added: ins,
}
h(c)
events := queue.Dump().([]*event.Event)
test.Assert(t, len(events) == 1)
extra, ok := events[0].Extra.(map[string]interface{})
test.Assert(t, ok)
test.Assert(t, extra["Cacheable"] == true)
test.Assert(t, extra["CacheKey"] == cacheKey)
added := extra["Added"].([]*instInfo)
test.Assert(t, len(added) == 1)
}
================================================
FILE: client/mocks_test.go
================================================
/*
* Copyright 2021 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance wi
gitextract_8ctnl3nt/ ├── .codecov.yml ├── .github/ │ ├── CODEOWNERS │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ ├── claude-review-fork.yml │ ├── claude.yml │ ├── pr-check.yml │ └── tests.yml ├── .gitignore ├── .golangci.yaml ├── .licenserc.yaml ├── .typos.toml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── README_cn.md ├── ROADMAP.md ├── client/ │ ├── callopt/ │ │ ├── options.go │ │ ├── options_test.go │ │ └── streamcall/ │ │ ├── call_options.go │ │ ├── call_options_test.go │ │ ├── definition.go │ │ └── grpc_options.go │ ├── client.go │ ├── client_test.go │ ├── context.go │ ├── context_middleware.go │ ├── context_middleware_test.go │ ├── context_test.go │ ├── deprecated.go │ ├── doc.go │ ├── genericclient/ │ │ ├── client.go │ │ └── deprecated.go │ ├── middlewares.go │ ├── middlewares_test.go │ ├── mocks_test.go │ ├── option.go │ ├── option_advanced.go │ ├── option_stream.go │ ├── option_test.go │ ├── option_ttstream.go │ ├── option_unary.go │ ├── rpctimeout.go │ ├── rpctimeout_pool.go │ ├── rpctimeout_pool_test.go │ ├── rpctimeout_test.go │ ├── service_inline.go │ ├── service_inline_test.go │ ├── stream.go │ ├── stream_test.go │ └── streamclient/ │ ├── client_option.go │ ├── client_option_advanced.go │ ├── definition.go │ ├── grpc_option.go │ └── option.go ├── go.mod ├── go.sum ├── internal/ │ ├── client/ │ │ ├── lock.go │ │ ├── option.go │ │ ├── option_ttstream.go │ │ ├── remote_option.go │ │ └── remote_option_windows.go │ ├── configutil/ │ │ ├── config.go │ │ ├── config_test.go │ │ ├── once.go │ │ └── once_test.go │ ├── generic/ │ │ ├── context.go │ │ ├── generic_service.go │ │ ├── proto/ │ │ │ └── type.go │ │ ├── utils.go │ │ └── utils_test.go │ ├── mocks/ │ │ ├── README.md │ │ ├── bufiox/ │ │ │ └── bufreader.go │ │ ├── conn.go │ │ ├── diagnosis/ │ │ │ └── service.go │ │ ├── discovery/ │ │ │ └── discovery.go │ │ ├── doc.go │ │ ├── generic/ │ │ │ ├── generic_service.go │ │ │ └── thrift.go │ │ ├── klog/ │ │ │ └── log.go │ │ ├── limiter/ │ │ │ └── limiter.go │ │ ├── loadbalance/ │ │ │ └── loadbalancer.go │ │ ├── message/ │ │ │ └── message.go │ │ ├── net/ │ │ │ └── net.go │ │ ├── netpoll/ │ │ │ ├── connection.go │ │ │ └── nocopy.go │ │ ├── proto/ │ │ │ ├── kitex_gen/ │ │ │ │ └── pbapi/ │ │ │ │ └── mock/ │ │ │ │ ├── client.go │ │ │ │ ├── invoker.go │ │ │ │ ├── mock.go │ │ │ │ ├── pbapi.pb.go │ │ │ │ └── server.go │ │ │ └── pbapi.proto │ │ ├── proxy/ │ │ │ └── proxy.go │ │ ├── remote/ │ │ │ ├── bytebuf.go │ │ │ ├── codec.go │ │ │ ├── conn_wrapper.go │ │ │ ├── connpool.go │ │ │ ├── dialer.go │ │ │ ├── payload_codec.go │ │ │ ├── servicesearcher.go │ │ │ ├── trans_handler.go │ │ │ ├── trans_meta.go │ │ │ └── trans_pipeline.go │ │ ├── rpc_info/ │ │ │ └── timeout_provider.go │ │ ├── serviceinfo.go │ │ ├── stats/ │ │ │ └── tracer.go │ │ ├── thrift/ │ │ │ ├── gen.sh │ │ │ ├── k-consts.go │ │ │ ├── k-stream.go │ │ │ ├── k-test.go │ │ │ ├── stream.go │ │ │ ├── stream.thrift │ │ │ ├── test.go │ │ │ └── test.thrift │ │ ├── transhandlerclient.go │ │ ├── transhandlerserver.go │ │ ├── update.sh │ │ └── utils/ │ │ └── sharedticker.go │ ├── reusable.go │ ├── server/ │ │ ├── config.go │ │ ├── option.go │ │ ├── register_option.go │ │ ├── remote_option.go │ │ └── remote_option_windows.go │ ├── stream/ │ │ ├── cancel.go │ │ ├── stream_option.go │ │ └── stream_option_test.go │ ├── test/ │ │ ├── assert.go │ │ ├── assert_test.go │ │ └── port.go │ └── utils/ │ └── safemcache/ │ ├── safemcache.go │ └── safemcache_test.go ├── licenses/ │ ├── LICENSE-gjson │ ├── LICENSE-go-genproto-main │ ├── LICENSE-grpc.txt │ ├── LICENSE-httprouter │ ├── LICENSE-json-iterator.txt │ ├── LICENSE-pid │ ├── LICENSE-protobuf.txt │ ├── LICENSE-thrift │ ├── LICENSE-xxhash.txt │ └── LICENSE-yaml.v3 ├── pkg/ │ ├── acl/ │ │ ├── acl.go │ │ └── acl_test.go │ ├── circuitbreak/ │ │ ├── cbsuite.go │ │ ├── cbsuite_option.go │ │ ├── cbsuite_option_test.go │ │ ├── cbsuite_test.go │ │ ├── circuitbreak.go │ │ ├── circuitbreak_test.go │ │ ├── default.go │ │ ├── default_test.go │ │ ├── doc.go │ │ └── item_circuit_breaker.go │ ├── connpool/ │ │ ├── config.go │ │ └── config_test.go │ ├── consts/ │ │ └── ctx.go │ ├── diagnosis/ │ │ ├── interface.go │ │ └── interface_test.go │ ├── discovery/ │ │ ├── constants.go │ │ ├── discovery.go │ │ └── discovery_test.go │ ├── endpoint/ │ │ ├── cep/ │ │ │ └── endpoint.go │ │ ├── deprecated.go │ │ ├── endpoint.go │ │ ├── endpoint_test.go │ │ ├── sep/ │ │ │ └── endpoint.go │ │ └── unary_endpoint.go │ ├── event/ │ │ ├── bus.go │ │ ├── bus_test.go │ │ ├── event.go │ │ ├── queue.go │ │ └── queue_test.go │ ├── exception/ │ │ ├── deprecated.go │ │ └── deprecated_test.go │ ├── fallback/ │ │ ├── fallback.go │ │ └── fallback_test.go │ ├── generic/ │ │ ├── binary_test/ │ │ │ ├── generic_init.go │ │ │ └── generic_test.go │ │ ├── binarypb_codec.go │ │ ├── binarypb_codec_test.go │ │ ├── binarythrift_codec.go │ │ ├── binarythrift_codec_test.go │ │ ├── binarythrift_codec_v2.go │ │ ├── closer.go │ │ ├── descriptor/ │ │ │ ├── annotation.go │ │ │ ├── descriptor.go │ │ │ ├── field_mapping.go │ │ │ ├── field_mapping_test.go │ │ │ ├── http.go │ │ │ ├── http_mapping.go │ │ │ ├── http_test.go │ │ │ ├── render.go │ │ │ ├── route.go │ │ │ ├── router.go │ │ │ ├── tree.go │ │ │ ├── tree_test.go │ │ │ ├── type.go │ │ │ ├── type_test.go │ │ │ ├── util.go │ │ │ ├── value_mapping.go │ │ │ └── value_mapping_test.go │ │ ├── descriptor_provider.go │ │ ├── generic.go │ │ ├── generic_service.go │ │ ├── generic_service_test.go │ │ ├── generic_test.go │ │ ├── grpcjson_test/ │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ └── api.thrift │ │ ├── grpcjsonpb_test/ │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── pbapi.proto │ │ │ └── pbapi_multi_service.proto │ │ ├── http_test/ │ │ │ ├── conf/ │ │ │ │ └── kitex.yml │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── baseline.thrift │ │ │ ├── binary_echo.thrift │ │ │ ├── dynamicgo_go_tag_error.thrift │ │ │ ├── http_annotation.thrift │ │ │ └── mock.thrift │ │ ├── httppb_test/ │ │ │ ├── conf/ │ │ │ │ └── kitex.yml │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── echo.pb.go │ │ │ ├── echo.proto │ │ │ └── echo.thrift │ │ ├── httppbthrift_codec.go │ │ ├── httppbthrift_codec_test.go │ │ ├── httpthrift_codec.go │ │ ├── httpthrift_codec_test.go │ │ ├── json_test/ │ │ │ ├── conf/ │ │ │ │ └── kitex.yml │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── base.thrift │ │ │ ├── baseline.thrift │ │ │ ├── binary_echo.thrift │ │ │ ├── example.thrift │ │ │ ├── example_multi_service.thrift │ │ │ ├── extend.thrift │ │ │ ├── mock.thrift │ │ │ ├── mock_unknown_method.thrift │ │ │ └── self_ref.thrift │ │ ├── jsonpb_codec.go │ │ ├── jsonpb_codec_test.go │ │ ├── jsonpb_test/ │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── echo.proto │ │ │ ├── echo_import.proto │ │ │ ├── example.proto │ │ │ └── example2.proto │ │ ├── jsonthrift_codec.go │ │ ├── jsonthrift_codec_test.go │ │ ├── map_test/ │ │ │ ├── conf/ │ │ │ │ └── kitex.yml │ │ │ ├── generic_init.go │ │ │ ├── generic_test.go │ │ │ └── idl/ │ │ │ ├── base.thrift │ │ │ ├── example.thrift │ │ │ ├── mock.thrift │ │ │ └── self_ref.thrift │ │ ├── mapthrift_codec.go │ │ ├── mapthrift_codec_test.go │ │ ├── option.go │ │ ├── option_test.go │ │ ├── pb_descriptor_provider.go │ │ ├── pbidl_provider.go │ │ ├── pbidl_provider_test.go │ │ ├── proto/ │ │ │ ├── json.go │ │ │ ├── json_test.go │ │ │ ├── protobuf.go │ │ │ ├── raw.go │ │ │ ├── raw_test.go │ │ │ └── type.go │ │ ├── reflect_test/ │ │ │ ├── idl/ │ │ │ │ ├── base.thrift │ │ │ │ ├── example.thrift │ │ │ │ └── self_ref.thrift │ │ │ ├── map_test.go │ │ │ └── reflect_test.go │ │ ├── streaming.go │ │ ├── thrift/ │ │ │ ├── base.go │ │ │ ├── base_test.go │ │ │ ├── binary.go │ │ │ ├── http.go │ │ │ ├── http_pb.go │ │ │ ├── json.go │ │ │ ├── parse.go │ │ │ ├── parse_option.go │ │ │ ├── parse_test.go │ │ │ ├── raw.go │ │ │ ├── raw_test.go │ │ │ ├── read.go │ │ │ ├── read_test.go │ │ │ ├── struct.go │ │ │ ├── thrift.go │ │ │ ├── util.go │ │ │ ├── util_test.go │ │ │ ├── write.go │ │ │ └── write_test.go │ │ ├── thriftidl_provider.go │ │ ├── thriftidl_provider_option.go │ │ └── thriftidl_provider_test.go │ ├── gofunc/ │ │ ├── go.go │ │ └── go_test.go │ ├── http/ │ │ ├── resolver.go │ │ └── resolver_test.go │ ├── kerrors/ │ │ ├── bizerrors.go │ │ ├── bizerrors_test.go │ │ ├── kerrors.go │ │ ├── kerrors_test.go │ │ └── streaming_errors.go │ ├── klog/ │ │ ├── default.go │ │ ├── default_test.go │ │ └── log.go │ ├── limit/ │ │ ├── limit.go │ │ └── limit_test.go │ ├── limiter/ │ │ ├── connection_limiter.go │ │ ├── connection_limiter_test.go │ │ ├── dummy.go │ │ ├── item_limiter.go │ │ ├── limiter.go │ │ ├── limiter_test.go │ │ ├── qps_limiter.go │ │ └── qps_limiter_test.go │ ├── loadbalance/ │ │ ├── consist.go │ │ ├── consist_test.go │ │ ├── dummy_picker.go │ │ ├── interleaved_weighted_round_robin.go │ │ ├── iterator.go │ │ ├── lbcache/ │ │ │ ├── cache.go │ │ │ ├── cache_test.go │ │ │ ├── hookable.go │ │ │ ├── hookable_test.go │ │ │ └── shared_ticker.go │ │ ├── loadbalancer.go │ │ ├── weighted_balancer.go │ │ ├── weighted_balancer_test.go │ │ ├── weighted_random.go │ │ ├── weighted_random_with_alias_method.go │ │ ├── weighted_round_robin.go │ │ └── weighted_round_robin_test.go │ ├── logid/ │ │ ├── logid.go │ │ ├── streaming.go │ │ └── streaming_test.go │ ├── mem/ │ │ ├── span.go │ │ └── span_test.go │ ├── profiler/ │ │ ├── profiler.go │ │ └── profiler_test.go │ ├── protocol/ │ │ └── bthrift/ │ │ ├── README.md │ │ ├── apache/ │ │ │ ├── apache.go │ │ │ ├── apache_test.go │ │ │ ├── binary_protocol.go │ │ │ ├── binary_protocol_test.go │ │ │ └── thrift.go │ │ ├── binary.go │ │ ├── binary_test.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── interface.go │ │ ├── internal/ │ │ │ └── test/ │ │ │ ├── README.md │ │ │ ├── assert.go │ │ │ └── assert_test.go │ │ ├── unknown.go │ │ └── unknown_test.go │ ├── proxy/ │ │ └── proxy.go │ ├── registry/ │ │ └── registry.go │ ├── remote/ │ │ ├── bound/ │ │ │ ├── limiter_inbound.go │ │ │ ├── limiter_inbound_test.go │ │ │ ├── transmeta_bound.go │ │ │ └── transmeta_bound_test.go │ │ ├── bufiox2buffer.go │ │ ├── bytebuf.go │ │ ├── codec/ │ │ │ ├── bytebuf_util.go │ │ │ ├── default_codec.go │ │ │ ├── default_codec_test.go │ │ │ ├── grpc/ │ │ │ │ ├── grpc.go │ │ │ │ ├── grpc_compress.go │ │ │ │ └── grpc_test.go │ │ │ ├── header_codec.go │ │ │ ├── header_codec_test.go │ │ │ ├── perrors/ │ │ │ │ ├── protocol_error.go │ │ │ │ └── protocol_error_test.go │ │ │ ├── protobuf/ │ │ │ │ ├── encoding/ │ │ │ │ │ ├── encoding.go │ │ │ │ │ └── gzip/ │ │ │ │ │ └── gzip.go │ │ │ │ ├── error.pb.go │ │ │ │ ├── error.proto │ │ │ │ ├── pberror.go │ │ │ │ ├── protobuf.go │ │ │ │ ├── protobuf_test.go │ │ │ │ ├── test.pb.go │ │ │ │ └── test.proto │ │ │ ├── thrift/ │ │ │ │ ├── codec.go │ │ │ │ ├── codec_apache.go │ │ │ │ ├── codec_apache_test.go │ │ │ │ ├── codec_fast.go │ │ │ │ ├── codec_frugal.go │ │ │ │ ├── codec_frugal_test.go │ │ │ │ ├── thrift.go │ │ │ │ ├── thrift_data.go │ │ │ │ ├── thrift_data_test.go │ │ │ │ └── thrift_test.go │ │ │ ├── util.go │ │ │ ├── util_test.go │ │ │ ├── validate.go │ │ │ └── validate_test.go │ │ ├── codec.go │ │ ├── compression.go │ │ ├── connpool/ │ │ │ ├── dummy.go │ │ │ ├── long_pool.go │ │ │ ├── long_pool_test.go │ │ │ ├── reporter.go │ │ │ ├── short_pool.go │ │ │ ├── short_pool_test.go │ │ │ └── utils.go │ │ ├── connpool.go │ │ ├── custom_meta_handler.go │ │ ├── custom_meta_handler_test.go │ │ ├── default_bytebuf.go │ │ ├── default_bytebuf_test.go │ │ ├── dialer.go │ │ ├── doc.go │ │ ├── message.go │ │ ├── option.go │ │ ├── payload_codec.go │ │ ├── profiler_meta.go │ │ ├── remotecli/ │ │ │ ├── client.go │ │ │ ├── client_test.go │ │ │ ├── conn_wrapper.go │ │ │ ├── conn_wrapper_test.go │ │ │ ├── stream.go │ │ │ └── stream_test.go │ │ ├── remotesvr/ │ │ │ ├── server.go │ │ │ └── server_test.go │ │ ├── role.go │ │ ├── trans/ │ │ │ ├── common.go │ │ │ ├── default_client_handler.go │ │ │ ├── default_client_handler_test.go │ │ │ ├── default_server_handler.go │ │ │ ├── default_server_handler_test.go │ │ │ ├── detection/ │ │ │ │ ├── noop.go │ │ │ │ ├── server_handler.go │ │ │ │ └── server_handler_test.go │ │ │ ├── gonet/ │ │ │ │ ├── bytebuffer.go │ │ │ │ ├── bytebuffer_test.go │ │ │ │ ├── client_handler.go │ │ │ │ ├── conn.go │ │ │ │ ├── conn_extension.go │ │ │ │ ├── conn_extension_test.go │ │ │ │ ├── conn_test.go │ │ │ │ ├── dialer.go │ │ │ │ ├── mocks_test.go │ │ │ │ ├── server_handler.go │ │ │ │ ├── server_handler_test.go │ │ │ │ ├── trans_server.go │ │ │ │ └── trans_server_test.go │ │ │ ├── invoke/ │ │ │ │ ├── conn_extension.go │ │ │ │ ├── conn_extension_test.go │ │ │ │ ├── invoke.go │ │ │ │ ├── invoke_handler.go │ │ │ │ ├── invoke_handler_test.go │ │ │ │ ├── message.go │ │ │ │ └── message_test.go │ │ │ ├── listen_config.go │ │ │ ├── listen_config_windows.go │ │ │ ├── mocks_test.go │ │ │ ├── netpoll/ │ │ │ │ ├── bytebuf.go │ │ │ │ ├── bytebuf_test.go │ │ │ │ ├── client_handler.go │ │ │ │ ├── conn_extension.go │ │ │ │ ├── dialer.go │ │ │ │ ├── http_client.go │ │ │ │ ├── http_client_handler.go │ │ │ │ ├── http_client_handler_test.go │ │ │ │ ├── mocks_test.go │ │ │ │ ├── server_handler.go │ │ │ │ ├── server_handler_test.go │ │ │ │ ├── trans_server.go │ │ │ │ └── trans_server_test.go │ │ │ ├── netpollmux/ │ │ │ │ ├── client_handler.go │ │ │ │ ├── client_handler_test.go │ │ │ │ ├── control_frame.go │ │ │ │ ├── doc.go │ │ │ │ ├── mocks_test.go │ │ │ │ ├── mux_conn.go │ │ │ │ ├── mux_conn_test.go │ │ │ │ ├── mux_pool.go │ │ │ │ ├── mux_pool_test.go │ │ │ │ ├── mux_transport.go │ │ │ │ ├── mux_transport_test.go │ │ │ │ ├── server_handler.go │ │ │ │ ├── server_handler_test.go │ │ │ │ ├── shard_map.go │ │ │ │ └── shard_map_test.go │ │ │ ├── nphttp2/ │ │ │ │ ├── buffer.go │ │ │ │ ├── buffer_test.go │ │ │ │ ├── client_conn.go │ │ │ │ ├── client_conn_test.go │ │ │ │ ├── client_handler.go │ │ │ │ ├── client_handler_test.go │ │ │ │ ├── codes/ │ │ │ │ │ ├── code_string.go │ │ │ │ │ ├── codes.go │ │ │ │ │ └── codes_test.go │ │ │ │ ├── codes.go │ │ │ │ ├── codes_test.go │ │ │ │ ├── conn_pool.go │ │ │ │ ├── conn_pool_test.go │ │ │ │ ├── doc.go │ │ │ │ ├── grpc/ │ │ │ │ │ ├── bdp_estimator.go │ │ │ │ │ ├── bdp_estimator_test.go │ │ │ │ │ ├── context.go │ │ │ │ │ ├── context_test.go │ │ │ │ │ ├── controlbuf.go │ │ │ │ │ ├── controlbuf_test.go │ │ │ │ │ ├── defaults.go │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── flowcontrol.go │ │ │ │ │ ├── flowcontrol_test.go │ │ │ │ │ ├── framer.go │ │ │ │ │ ├── graceful_shutdown_test.go │ │ │ │ │ ├── grpcframe/ │ │ │ │ │ │ ├── errors.go │ │ │ │ │ │ ├── errors_test.go │ │ │ │ │ │ ├── frame_parser.go │ │ │ │ │ │ ├── frame_reader.go │ │ │ │ │ │ ├── frame_reader_test.go │ │ │ │ │ │ └── frame_writer.go │ │ │ │ │ ├── http2_client.go │ │ │ │ │ ├── http2_server.go │ │ │ │ │ ├── http_util.go │ │ │ │ │ ├── http_util_test.go │ │ │ │ │ ├── keepalive.go │ │ │ │ │ ├── keepalive_test.go │ │ │ │ │ ├── mocks_test.go │ │ │ │ │ ├── syscall/ │ │ │ │ │ │ ├── syscall_linux.go │ │ │ │ │ │ └── syscall_nonlinux.go │ │ │ │ │ ├── testutils/ │ │ │ │ │ │ ├── channel.go │ │ │ │ │ │ ├── leakcheck/ │ │ │ │ │ │ │ ├── leakcheck.go │ │ │ │ │ │ │ └── leakcheck_test.go │ │ │ │ │ │ ├── status_equal.go │ │ │ │ │ │ └── status_equal_test.go │ │ │ │ │ ├── trace.go │ │ │ │ │ ├── trace_test.go │ │ │ │ │ ├── transport.go │ │ │ │ │ └── transport_test.go │ │ │ │ ├── meta_api.go │ │ │ │ ├── meta_api_test.go │ │ │ │ ├── metadata/ │ │ │ │ │ ├── metadata.go │ │ │ │ │ └── metadata_test.go │ │ │ │ ├── mocks_test.go │ │ │ │ ├── peer/ │ │ │ │ │ ├── peer.go │ │ │ │ │ └── peer_test.go │ │ │ │ ├── server_conn.go │ │ │ │ ├── server_conn_test.go │ │ │ │ ├── server_handler.go │ │ │ │ ├── server_handler_test.go │ │ │ │ ├── status/ │ │ │ │ │ ├── mock_test.go │ │ │ │ │ ├── status.go │ │ │ │ │ └── status_test.go │ │ │ │ ├── stream.go │ │ │ │ └── stream_test.go │ │ │ └── ttstream/ │ │ │ ├── client_handler.go │ │ │ ├── client_handler_option.go │ │ │ ├── client_stream_cleanup.go │ │ │ ├── client_trans_pool.go │ │ │ ├── client_trans_pool_longconn.go │ │ │ ├── client_trans_pool_muxconn.go │ │ │ ├── client_trans_pool_shortconn.go │ │ │ ├── container/ │ │ │ │ ├── linklist.go │ │ │ │ ├── object_pool.go │ │ │ │ ├── object_pool_test.go │ │ │ │ ├── pipe.go │ │ │ │ ├── pipe_test.go │ │ │ │ ├── queue.go │ │ │ │ ├── queue_test.go │ │ │ │ ├── stack.go │ │ │ │ └── stack_test.go │ │ │ ├── context.go │ │ │ ├── exception.go │ │ │ ├── exception_test.go │ │ │ ├── frame.go │ │ │ ├── frame_handler.go │ │ │ ├── frame_test.go │ │ │ ├── metadata.go │ │ │ ├── mock_test.go │ │ │ ├── server_handler.go │ │ │ ├── server_handler_option.go │ │ │ ├── server_handler_test.go │ │ │ ├── stream.go │ │ │ ├── stream_client.go │ │ │ ├── stream_client_test.go │ │ │ ├── stream_reader.go │ │ │ ├── stream_reader_test.go │ │ │ ├── stream_server.go │ │ │ ├── stream_server_test.go │ │ │ ├── stream_test.go │ │ │ ├── stream_writer.go │ │ │ ├── test_utils.go │ │ │ ├── trace_test.go │ │ │ ├── transport.go │ │ │ ├── transport_buffer.go │ │ │ ├── transport_buffer_test.go │ │ │ ├── transport_client.go │ │ │ ├── transport_server.go │ │ │ └── transport_test.go │ │ ├── trans_errors.go │ │ ├── trans_errors_test.go │ │ ├── trans_handler.go │ │ ├── trans_meta.go │ │ ├── trans_pipeline.go │ │ ├── trans_server.go │ │ └── transmeta/ │ │ ├── http_metakey.go │ │ └── metakey.go │ ├── retry/ │ │ ├── backup.go │ │ ├── backup_retryer.go │ │ ├── backup_test.go │ │ ├── failure.go │ │ ├── failure_retryer.go │ │ ├── failure_test.go │ │ ├── item_retry.go │ │ ├── mixed.go │ │ ├── mixed_retryer.go │ │ ├── mixed_test.go │ │ ├── percentage_limit.go │ │ ├── policy.go │ │ ├── policy_test.go │ │ ├── retryer.go │ │ ├── retryer_test.go │ │ ├── util.go │ │ └── util_test.go │ ├── rpcinfo/ │ │ ├── basicinfo.go │ │ ├── convert.go │ │ ├── convert_test.go │ │ ├── copy.go │ │ ├── copy_test.go │ │ ├── ctx.go │ │ ├── ctx_test.go │ │ ├── endpointInfo.go │ │ ├── endpointInfo_test.go │ │ ├── interface.go │ │ ├── invocation.go │ │ ├── invocation_test.go │ │ ├── mocks_test.go │ │ ├── mutable.go │ │ ├── remoteinfo/ │ │ │ ├── remoteInfo.go │ │ │ └── remoteInfo_test.go │ │ ├── rpcconfig.go │ │ ├── rpcconfig_test.go │ │ ├── rpcinfo.go │ │ ├── rpcinfo_test.go │ │ ├── rpcstats.go │ │ ├── rpcstats_test.go │ │ ├── stats_util.go │ │ ├── stats_util_test.go │ │ ├── stream_tracer.go │ │ ├── stream_tracer_test.go │ │ ├── tracer.go │ │ └── tracer_test.go │ ├── rpctimeout/ │ │ ├── item_rpc_timeout.go │ │ └── rpctimeout.go │ ├── serviceinfo/ │ │ ├── serviceinfo.go │ │ └── serviceinfo_test.go │ ├── stats/ │ │ ├── event.go │ │ ├── event_test.go │ │ ├── status.go │ │ └── tracer.go │ ├── streaming/ │ │ ├── context.go │ │ ├── streaming.go │ │ ├── streamx.go │ │ ├── timeout.go │ │ ├── timeout_test.go │ │ ├── util.go │ │ └── util_test.go │ ├── transmeta/ │ │ ├── http2.go │ │ ├── http2_test.go │ │ ├── metainfo.go │ │ ├── metainfo_test.go │ │ ├── ttheader.go │ │ └── ttheader_test.go │ ├── utils/ │ │ ├── byte2str.go │ │ ├── byte2str_test.go │ │ ├── config.go │ │ ├── config_test.go │ │ ├── contextmap/ │ │ │ ├── contextmap.go │ │ │ └── contextmap_test.go │ │ ├── counter.go │ │ ├── counter_test.go │ │ ├── err_chain.go │ │ ├── err_chain_test.go │ │ ├── fastthrift/ │ │ │ ├── fastthrift.go │ │ │ └── fastthrift_test.go │ │ ├── func.go │ │ ├── func_test.go │ │ ├── int_len.go │ │ ├── int_len_test.go │ │ ├── interface.go │ │ ├── json.go │ │ ├── json_fuzz_test.go │ │ ├── json_sonic.go │ │ ├── json_test.go │ │ ├── kitexutil/ │ │ │ ├── kitexutil.go │ │ │ └── kitexutil_test.go │ │ ├── max_counter.go │ │ ├── max_counter_test.go │ │ ├── netaddr.go │ │ ├── netaddr_test.go │ │ ├── ring.go │ │ ├── ring_single.go │ │ ├── ring_test.go │ │ ├── rpcstats.go │ │ ├── rpcstats_test.go │ │ ├── runtimex.go │ │ ├── runtimex_test.go │ │ ├── sharedticker.go │ │ ├── sharedticker_test.go │ │ ├── slice.go │ │ ├── slice_test.go │ │ ├── strbuf.go │ │ ├── strbuf_test.go │ │ ├── strings.go │ │ ├── strings_test.go │ │ ├── thrift.go │ │ ├── thrift_test.go │ │ ├── yaml.go │ │ └── yaml_test.go │ ├── warmup/ │ │ ├── pool_helper.go │ │ ├── pool_helper_test.go │ │ └── warmup.go │ └── xds/ │ └── xds.go ├── scripts/ │ ├── .utils/ │ │ ├── check_go_mod.sh │ │ ├── check_version.sh │ │ └── funcs.sh │ ├── release-hotfix.sh │ └── release.sh ├── server/ │ ├── deprecated.go │ ├── genericserver/ │ │ ├── server.go │ │ ├── server_test.go │ │ └── unknownservice.go │ ├── hooks.go │ ├── invoke/ │ │ ├── message.go │ │ └── message_test.go │ ├── invoke.go │ ├── invoke_test.go │ ├── middlewares.go │ ├── middlewares_test.go │ ├── mocks_test.go │ ├── option.go │ ├── option_advanced.go │ ├── option_advanced_test.go │ ├── option_stream.go │ ├── option_stream_test.go │ ├── option_test.go │ ├── option_ttstream.go │ ├── option_unary.go │ ├── register_option.go │ ├── register_option_test.go │ ├── server.go │ ├── server_test.go │ ├── service.go │ ├── service_inline.go │ ├── service_inline_test.go │ ├── service_test.go │ ├── stream.go │ └── stream_test.go ├── tool/ │ ├── cmd/ │ │ └── kitex/ │ │ ├── args/ │ │ │ ├── args.go │ │ │ ├── args_test.go │ │ │ ├── deprecated.go │ │ │ └── deprecated_test.go │ │ ├── main.go │ │ ├── sdk/ │ │ │ └── kitex_sdk.go │ │ ├── utils/ │ │ │ └── utils.go │ │ └── versions/ │ │ ├── dependencies.go │ │ ├── dependencies_test.go │ │ ├── version.go │ │ └── version_test.go │ └── internal_pkg/ │ ├── doc.go │ ├── generator/ │ │ ├── completer.go │ │ ├── custom_template.go │ │ ├── feature.go │ │ ├── generator.go │ │ ├── generator_test.go │ │ ├── template.go │ │ ├── template_test.go │ │ ├── type.go │ │ └── type_test.go │ ├── log/ │ │ └── log.go │ ├── pluginmode/ │ │ ├── protoc/ │ │ │ ├── plugin.go │ │ │ ├── protoc.go │ │ │ └── util.go │ │ └── thriftgo/ │ │ ├── ast.go │ │ ├── convertor.go │ │ ├── file_tpl.go │ │ ├── hessian2.go │ │ ├── hessian2_test.go │ │ ├── patcher.go │ │ ├── plugin.go │ │ ├── register_tpl.go │ │ └── struct_tpl.go │ ├── prutal/ │ │ ├── prutal.go │ │ └── prutal_test.go │ ├── tpl/ │ │ ├── bootstrap.sh.go │ │ ├── build.sh.go │ │ ├── client.go │ │ ├── client_v2.go │ │ ├── handler.go │ │ ├── handler.method.go │ │ ├── invoker.go │ │ ├── main.go │ │ ├── pbtpl/ │ │ │ ├── pbtpl.go │ │ │ └── pbtpl_test.go │ │ ├── server.go │ │ ├── service.go │ │ ├── service_v2.go │ │ ├── templates_test.go │ │ └── tool_version.go │ └── util/ │ ├── dump.go │ ├── env/ │ │ ├── env.go │ │ └── env_test.go │ ├── util.go │ └── util_test.go ├── transport/ │ └── keys.go └── version.go
Showing preview only (784K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (8588 symbols across 718 files)
FILE: client/callopt/options.go
type CallOptions (line 40) | type CallOptions struct
method Recycle (line 63) | func (co *CallOptions) Recycle() {
function newOptions (line 54) | func newOptions() interface{} {
type Option (line 76) | type Option struct
method F (line 83) | func (o Option) F() func(o *CallOptions, di *strings.Builder) {
function NewOption (line 89) | func NewOption(f func(o *CallOptions, di *strings.Builder)) Option {
function WithHostPort (line 95) | func WithHostPort(hostport string) Option {
function setInstance (line 107) | func setInstance(svr remoteinfo.RemoteInfo, hostport string) error {
function WithURL (line 120) | func WithURL(url string) Option {
function WithHTTPHost (line 139) | func WithHTTPHost(host string) Option {
function WithRPCTimeout (line 148) | func WithRPCTimeout(d time.Duration) Option {
function WithConnectTimeout (line 162) | func WithConnectTimeout(d time.Duration) Option {
function WithTag (line 172) | func WithTag(key, val string) Option {
function WithRetryPolicy (line 201) | func WithRetryPolicy(p retry.Policy) Option {
function WithFallback (line 224) | func WithFallback(fb *fallback.Policy) Option {
function WithGRPCCompressor (line 237) | func WithGRPCCompressor(compressorName string) Option {
function WithBinaryGenericIDLService (line 258) | func WithBinaryGenericIDLService(svcName string) Option {
function Apply (line 271) | func Apply(cos []Option, cfg rpcinfo.MutableRPCConfig, svr remoteinfo.Re...
FILE: client/callopt/options_test.go
constant mockHostPort (line 47) | mockHostPort = "127.0.0.1:8888"
constant mockURL (line 48) | mockURL = "www.cloudwego.com"
constant mockHTTPHost (line 49) | mockHTTPHost = "www.cloudwego.com"
constant mockRPCTimeout (line 50) | mockRPCTimeout = 1000 * time.Millisecond
constant mockRPCTimeoutStr (line 51) | mockRPCTimeoutStr = "1000ms"
constant mockConnectTimeout (line 52) | mockConnectTimeout = 500 * time.Millisecond
constant mockConnectTimeoutStr (line 53) | mockConnectTimeoutStr = "500ms"
constant mockKey (line 54) | mockKey = "mock_key"
constant mockVal (line 55) | mockVal = "mock_val"
function TestApply (line 59) | func TestApply(t *testing.T) {
function BenchmarkStringsBuilder (line 138) | func BenchmarkStringsBuilder(b *testing.B) {
FILE: client/callopt/streamcall/call_options.go
function WithHostPort (line 32) | func WithHostPort(hostPort string) Option {
function WithURL (line 38) | func WithURL(url string) Option {
function WithConnectTimeout (line 43) | func WithConnectTimeout(d time.Duration) Option {
function WithTag (line 48) | func WithTag(key, val string) Option {
function WithRecvTimeout (line 58) | func WithRecvTimeout(d time.Duration) Option {
function WithRecvTimeoutConfig (line 82) | func WithRecvTimeoutConfig(cfg streaming.TimeoutConfig) Option {
function WithBinaryGenericIDLService (line 101) | func WithBinaryGenericIDLService(svcName string) Option {
FILE: client/callopt/streamcall/call_options_test.go
function TestWithRecvTimeout (line 29) | func TestWithRecvTimeout(t *testing.T) {
function TestWithRecvTimeoutConfig (line 38) | func TestWithRecvTimeoutConfig(t *testing.T) {
function TestWithBinaryGenericIDLService (line 59) | func TestWithBinaryGenericIDLService(t *testing.T) {
FILE: client/callopt/streamcall/definition.go
type Option (line 26) | type Option struct
method GetCallOption (line 32) | func (o Option) GetCallOption() callopt.Option {
function ConvertOptionFrom (line 41) | func ConvertOptionFrom(option callopt.Option) Option {
function GetCallOptions (line 46) | func GetCallOptions(ops []Option) []callopt.Option {
FILE: client/callopt/streamcall/grpc_options.go
function WithGRPCCompressor (line 22) | func WithGRPCCompressor(compressorName string) Option {
FILE: client/client.go
type Client (line 67) | type Client interface
type kClient (line 71) | type kClient struct
method init (line 114) | func (kc *kClient) init() (err error) {
method checkOptions (line 148) | func (kc *kClient) checkOptions() (err error) {
method initCircuitBreaker (line 155) | func (kc *kClient) initCircuitBreaker() error {
method initRetryer (line 162) | func (kc *kClient) initRetryer() error {
method initContext (line 172) | func (kc *kClient) initContext() context.Context {
method initProxy (line 183) | func (kc *kClient) initProxy() error {
method initConnPool (line 209) | func (kc *kClient) initConnPool() error {
method initLBCache (line 236) | func (kc *kClient) initLBCache() error {
method initMiddlewares (line 297) | func (kc *kClient) initMiddlewares(ctx context.Context) (mw middleware) {
method initRPCInfo (line 347) | func (kc *kClient) initRPCInfo(ctx context.Context, method string, ret...
method Call (line 365) | func (kc *kClient) Call(ctx context.Context, method string, request, r...
method rpcCallWithRetry (line 429) | func (kc *kClient) rpcCallWithRetry(ri rpcinfo.RPCInfo, method string)...
method initDebugService (line 451) | func (kc *kClient) initDebugService() {
method richRemoteOption (line 460) | func (kc *kClient) richRemoteOption() {
method buildInvokeChain (line 479) | func (kc *kClient) buildInvokeChain(mw middleware) error {
method invokeHandleEndpoint (line 506) | func (kc *kClient) invokeHandleEndpoint() (endpoint.Endpoint, error) {
method Close (line 550) | func (kc *kClient) Close() error {
method warmingUp (line 601) | func (kc *kClient) warmingUp() error {
type kcFinalizerClient (line 86) | type kcFinalizerClient struct
method Call (line 90) | func (kf *kcFinalizerClient) Call(ctx context.Context, method string, ...
function NewClient (line 96) | func NewClient(svcInfo *serviceinfo.ServiceInfo, opts ...Option) (Client...
type middleware (line 278) | type middleware struct
function richMWsWithBuilder (line 337) | func richMWsWithBuilder(ctx context.Context, mwBs []endpoint.MiddlewareB...
function applyCallOptions (line 353) | func applyCallOptions(ctx context.Context, cfg rpcinfo.MutableRPCConfig,...
function newCliTransHandler (line 577) | func newCliTransHandler(opt *remote.ClientOption) (remote.ClientTransHan...
function initTransportProtocol (line 592) | func initTransportProtocol(svcInfo *serviceinfo.ServiceInfo, cfg rpcinfo...
function validateForCall (line 687) | func validateForCall(ctx context.Context, inited, closed bool) {
function getCalloptRetryPolicy (line 699) | func getCalloptRetryPolicy(callOpts *callopt.CallOptions) (callOptRetry ...
function doFallbackIfNeeded (line 708) | func doFallbackIfNeeded(ctx context.Context, ri rpcinfo.RPCInfo, request...
function getFallbackPolicy (line 730) | func getFallbackPolicy(cliOptFB *fallback.Policy, callOpts *callopt.Call...
function purifyProtocol (line 746) | func purifyProtocol(cfg rpcinfo.MutableRPCConfig, tp transport.Protocol,...
function initRPCInfo (line 767) | func initRPCInfo(ctx context.Context, method string, opt *client.Options...
FILE: client/client_test.go
function newMockConn (line 83) | func newMockConn(ctrl *gomock.Controller) netpoll.Connection {
function newDialer (line 97) | func newDialer(ctrl *gomock.Controller) remote.Dialer {
function newMockCliTransHandlerFactory (line 104) | func newMockCliTransHandlerFactory(ctrl *gomock.Controller) remote.Clien...
function newMockClient (line 125) | func newMockClient(tb testing.TB, ctrl *gomock.Controller, extra ...Opti...
function TestCall (line 141) | func TestCall(t *testing.T) {
function TestCallWithContextBackup (line 155) | func TestCallWithContextBackup(t *testing.T) {
function TestWithRetryOption (line 198) | func TestWithRetryOption(t *testing.T) {
function BenchmarkCall (line 208) | func BenchmarkCall(b *testing.B) {
function BenchmarkCallParallel (line 224) | func BenchmarkCallParallel(b *testing.B) {
function TestTagOptions (line 242) | func TestTagOptions(t *testing.T) {
function TestTagOptionLocks0 (line 301) | func TestTagOptionLocks0(t *testing.T) {
function TestTagOptionLocks1 (line 333) | func TestTagOptionLocks1(t *testing.T) {
function TestTagOptionLocks2 (line 365) | func TestTagOptionLocks2(t *testing.T) {
function TestWarmingUpOption (line 399) | func TestWarmingUpOption(t *testing.T) {
function TestTimeoutOptions (line 410) | func TestTimeoutOptions(t *testing.T) {
function TestTimeoutCtxCall (line 449) | func TestTimeoutCtxCall(t *testing.T) {
function TestTimeoutOptionsLock0 (line 475) | func TestTimeoutOptionsLock0(t *testing.T) {
function TestAdjustTimeout (line 525) | func TestAdjustTimeout(t *testing.T) {
function TestRetry (line 562) | func TestRetry(t *testing.T) {
function TestRetryWithDifferentTimeout (line 623) | func TestRetryWithDifferentTimeout(t *testing.T) {
function TestRetryWithResultRetry (line 683) | func TestRetryWithResultRetry(t *testing.T) {
function TestFallbackForError (line 770) | func TestFallbackForError(t *testing.T) {
function TestClientFinalizer (line 978) | func TestClientFinalizer(t *testing.T) {
function TestPanicInMiddleware (line 1035) | func TestPanicInMiddleware(t *testing.T) {
function TestMethodInfoIsNil (line 1080) | func TestMethodInfoIsNil(t *testing.T) {
function mb (line 1090) | func mb(byteSize uint64) float32 {
function Test_initTransportProtocol (line 1094) | func Test_initTransportProtocol(t *testing.T) {
type mockTracerForInitMW (line 1131) | type mockTracerForInitMW struct
function Test_kClient_initMiddlewares (line 1136) | func Test_kClient_initMiddlewares(t *testing.T) {
function TestRewriteProtocol (line 1151) | func TestRewriteProtocol(t *testing.T) {
function Test_initRPCInfoWithStreamClientCallOption (line 1266) | func Test_initRPCInfoWithStreamClientCallOption(t *testing.T) {
function Test_WithStreamEventHandler (line 1290) | func Test_WithStreamEventHandler(t *testing.T) {
function Test_WithStreamRecvTimeoutConfig (line 1316) | func Test_WithStreamRecvTimeoutConfig(t *testing.T) {
FILE: client/context.go
type ctxKeyType (line 25) | type ctxKeyType
constant ctxCallOptionKey (line 28) | ctxCallOptionKey ctxKeyType = iota
constant ctxCallOptionInfoKey (line 29) | ctxCallOptionInfoKey
function NewCtxWithCallOptions (line 33) | func NewCtxWithCallOptions(ctx context.Context, opts []callopt.Option) c...
function CallOptionsFromCtx (line 41) | func CallOptionsFromCtx(ctx context.Context) (res []callopt.Option) {
function CallOptionInfoFromCtx (line 50) | func CallOptionInfoFromCtx(ctx context.Context) (res string) {
FILE: client/context_middleware.go
type ctxMWChainKey (line 25) | type ctxMWChainKey struct
function WithContextMiddlewares (line 30) | func WithContextMiddlewares(ctx context.Context, mws ...endpoint.Middlew...
function getContextMiddleware (line 42) | func getContextMiddleware(ctx context.Context) endpoint.Middleware {
function contextMW (line 48) | func contextMW(next endpoint.Endpoint) endpoint.Endpoint {
FILE: client/context_middleware_test.go
function TestContextMiddlewares (line 30) | func TestContextMiddlewares(t *testing.T) {
function TestCallWithContextMiddlewares (line 45) | func TestCallWithContextMiddlewares(t *testing.T) {
FILE: client/context_test.go
constant mockHostPort (line 28) | mockHostPort = "127.0.0.1:18888"
constant mockCallOptsInfo (line 29) | mockCallOptsInfo = "mock call option info"
function TestContextWithCallOptions (line 32) | func TestContextWithCallOptions(t *testing.T) {
FILE: client/deprecated.go
function WithFramedTransport (line 31) | func WithFramedTransport() Option {
function WithConnMetric (line 41) | func WithConnMetric() Option {
FILE: client/genericclient/client.go
function NewClient (line 38) | func NewClient(destService string, g generic.Generic, opts ...client.Opt...
function NewClientWithServiceInfo (line 44) | func NewClientWithServiceInfo(destService string, g generic.Generic, svc...
type Client (line 69) | type Client interface
type genericServiceClient (line 82) | type genericServiceClient struct
method GenericCall (line 93) | func (gc *genericServiceClient) GenericCall(ctx context.Context, metho...
method Close (line 123) | func (gc *genericServiceClient) Close() error {
method ClientStreaming (line 131) | func (gc *genericServiceClient) ClientStreaming(ctx context.Context, m...
method ServerStreaming (line 145) | func (gc *genericServiceClient) ServerStreaming(ctx context.Context, m...
method BidirectionalStreaming (line 170) | func (gc *genericServiceClient) BidirectionalStreaming(ctx context.Con...
type ClientStreamingClient (line 185) | type ClientStreamingClient interface
type clientStreamingClient (line 202) | type clientStreamingClient struct
method Send (line 216) | func (c *clientStreamingClient) Send(ctx context.Context, req interfac...
method CloseAndRecv (line 223) | func (c *clientStreamingClient) CloseAndRecv(ctx context.Context) (int...
method Header (line 234) | func (c *clientStreamingClient) Header() (streaming.Header, error) {
method Trailer (line 238) | func (c *clientStreamingClient) Trailer() (streaming.Trailer, error) {
method CloseSend (line 242) | func (c *clientStreamingClient) CloseSend(ctx context.Context) error {
method Context (line 246) | func (c *clientStreamingClient) Context() context.Context {
method Streaming (line 250) | func (c *clientStreamingClient) Streaming() streaming.ClientStream {
function newClientStreamingClient (line 208) | func newClientStreamingClient(methodInfo serviceinfo.MethodInfo, method ...
type ServerStreamingClient (line 255) | type ServerStreamingClient interface
type serverStreamingClient (line 270) | type serverStreamingClient struct
method Recv (line 284) | func (c *serverStreamingClient) Recv(ctx context.Context) (interface{}...
method Header (line 292) | func (c *serverStreamingClient) Header() (streaming.Header, error) {
method Trailer (line 296) | func (c *serverStreamingClient) Trailer() (streaming.Trailer, error) {
method CloseSend (line 300) | func (c *serverStreamingClient) CloseSend(ctx context.Context) error {
method Context (line 304) | func (c *serverStreamingClient) Context() context.Context {
method Streaming (line 308) | func (c *serverStreamingClient) Streaming() streaming.ClientStream {
function newServerStreamingClient (line 276) | func newServerStreamingClient(methodInfo serviceinfo.MethodInfo, method ...
type BidiStreamingClient (line 313) | type BidiStreamingClient interface
type bidiStreamingClient (line 330) | type bidiStreamingClient struct
method Send (line 344) | func (c *bidiStreamingClient) Send(ctx context.Context, req interface{...
method Recv (line 351) | func (c *bidiStreamingClient) Recv(ctx context.Context) (interface{}, ...
method Header (line 359) | func (c *bidiStreamingClient) Header() (streaming.Header, error) {
method Trailer (line 363) | func (c *bidiStreamingClient) Trailer() (streaming.Trailer, error) {
method CloseSend (line 367) | func (c *bidiStreamingClient) CloseSend(ctx context.Context) error {
method Context (line 371) | func (c *bidiStreamingClient) Context() context.Context {
method Streaming (line 375) | func (c *bidiStreamingClient) Streaming() streaming.ClientStream {
function newBidiStreamingClient (line 336) | func newBidiStreamingClient(methodInfo serviceinfo.MethodInfo, method st...
FILE: client/genericclient/deprecated.go
function StreamingServiceInfo (line 35) | func StreamingServiceInfo(g generic.Generic) *serviceinfo.ServiceInfo {
type ClientStreaming (line 39) | type ClientStreaming interface
type ServerStreaming (line 45) | type ServerStreaming interface
type BidirectionalStreaming (line 50) | type BidirectionalStreaming interface
function NewStreamingClient (line 57) | func NewStreamingClient(destService string, g generic.Generic, opts ...c...
function NewStreamingClientWithServiceInfo (line 62) | func NewStreamingClientWithServiceInfo(destService string, g generic.Gen...
type deprecatedClientStreamingClient (line 66) | type deprecatedClientStreamingClient struct
method Send (line 89) | func (cs *deprecatedClientStreamingClient) Send(req interface{}) error {
method CloseAndRecv (line 96) | func (cs *deprecatedClientStreamingClient) CloseAndRecv() (resp interf...
function NewClientStreaming (line 72) | func NewClientStreaming(ctx context.Context, genericCli Client, method s...
type deprecatedServerStreamingClient (line 107) | type deprecatedServerStreamingClient struct
method Recv (line 140) | func (ss *deprecatedServerStreamingClient) Recv() (resp interface{}, e...
function NewServerStreaming (line 112) | func NewServerStreaming(ctx context.Context, genericCli Client, method s...
type deprecatedBidirectionalStreamingClient (line 148) | type deprecatedBidirectionalStreamingClient struct
method Send (line 171) | func (bs *deprecatedBidirectionalStreamingClient) Send(req interface{}...
method Recv (line 178) | func (bs *deprecatedBidirectionalStreamingClient) Recv() (resp interfa...
function NewBidirectionalStreaming (line 154) | func NewBidirectionalStreaming(ctx context.Context, genericCli Client, m...
function getStream (line 186) | func getStream(ctx context.Context, genericCli *genericServiceClient, me...
FILE: client/middlewares.go
constant maxRetry (line 41) | maxRetry = 6
function newProxyMW (line 43) | func newProxyMW(prx proxy.ForwardProxy) endpoint.Middleware {
function discoveryEventHandler (line 61) | func discoveryEventHandler(name string, bus event.Bus, queue event.Queue...
function newResolveMWBuilder (line 86) | func newResolveMWBuilder(lbf *lbcache.BalancerFactory) endpoint.Middlewa...
function newIOErrorHandleMW (line 149) | func newIOErrorHandleMW(errHandle func(context.Context, error) error) en...
function isRemoteErr (line 164) | func isRemoteErr(err error) bool {
function DefaultClientErrorHandler (line 183) | func DefaultClientErrorHandler(ctx context.Context, err error) error {
function ClientErrorHandlerWithAddr (line 193) | func ClientErrorHandlerWithAddr(ctx context.Context, err error) error {
type instInfo (line 207) | type instInfo struct
function wrapInstances (line 212) | func wrapInstances(insts []discovery.Instance) []*instInfo {
function retryable (line 225) | func retryable(err error) bool {
function getRemoteAddr (line 229) | func getRemoteAddr(ctx context.Context) string {
FILE: client/middlewares_test.go
function resolver404 (line 59) | func resolver404(ctrl *gomock.Controller) discovery.Resolver {
function TestNoResolver (line 72) | func TestNoResolver(t *testing.T) {
function TestResolverMW (line 81) | func TestResolverMW(t *testing.T) {
function TestResolverMWErrGetConnection (line 105) | func TestResolverMWErrGetConnection(t *testing.T) {
function TestResolverMWOutOfInstance (line 125) | func TestResolverMWOutOfInstance(t *testing.T) {
function TestDefaultErrorHandler (line 157) | func TestDefaultErrorHandler(t *testing.T) {
function TestNewProxyMW (line 206) | func TestNewProxyMW(t *testing.T) {
function BenchmarkResolverMW (line 240) | func BenchmarkResolverMW(b *testing.B) {
function BenchmarkResolverMWParallel (line 259) | func BenchmarkResolverMWParallel(b *testing.B) {
function TestDiscoveryEventHandler (line 280) | func TestDiscoveryEventHandler(t *testing.T) {
FILE: client/mocks_test.go
type MockTStruct (line 21) | type MockTStruct struct
FILE: client/option.go
type Suite (line 69) | type Suite interface
function WithTransportProtocol (line 74) | func WithTransportProtocol(tp transport.Protocol) Option {
function WithSuite (line 86) | func WithSuite(suite Suite) Option {
function WithMiddleware (line 102) | func WithMiddleware(mw endpoint.Middleware) Option {
function WithMiddlewareBuilder (line 113) | func WithMiddlewareBuilder(mwb endpoint.MiddlewareBuilder) Option {
function WithInstanceMW (line 121) | func WithInstanceMW(mw endpoint.Middleware) Option {
function WithDestService (line 132) | func WithDestService(svr string) Option {
function WithHostPorts (line 142) | func WithHostPorts(hostports ...string) Option {
function WithResolver (line 181) | func WithResolver(r discovery.Resolver) Option {
function WithHTTPResolver (line 190) | func WithHTTPResolver(r http.Resolver) Option {
function WithShortConnection (line 199) | func WithShortConnection() Option {
function WithLongConnection (line 208) | func WithLongConnection(cfg connpool.IdleConfig) Option {
function WithMuxConnection (line 218) | func WithMuxConnection(connNum int) Option {
function WithLogger (line 230) | func WithLogger(logger klog.FormatLogger) Option {
function WithLoadBalancer (line 235) | func WithLoadBalancer(lb loadbalance.Loadbalancer, opts ...*lbcache.Opti...
function WithRPCTimeout (line 249) | func WithRPCTimeout(d time.Duration) Option {
function WithConnectTimeout (line 259) | func WithConnectTimeout(d time.Duration) Option {
function WithTimeoutProvider (line 273) | func WithTimeoutProvider(p rpcinfo.TimeoutProvider) Option {
function WithTag (line 281) | func WithTag(key, val string) Option {
function WithTracer (line 291) | func WithTracer(c stats.Tracer) Option {
function WithStatsLevel (line 303) | func WithStatsLevel(level stats.Level) Option {
function WithCodec (line 312) | func WithCodec(c remote.Codec) Option {
function WithPayloadCodec (line 321) | func WithPayloadCodec(c remote.PayloadCodec) Option {
function WithConnReporterEnabled (line 330) | func WithConnReporterEnabled() Option {
function WithFailureRetry (line 342) | func WithFailureRetry(p *retry.FailurePolicy) Option {
function WithBackupRequest (line 363) | func WithBackupRequest(p *retry.BackupPolicy) Option {
function WithMixedRetry (line 384) | func WithMixedRetry(p *retry.MixedPolicy) Option {
function WithRetryMethodPolicies (line 406) | func WithRetryMethodPolicies(mp map[string]retry.Policy) Option {
function WithSpecifiedResultRetry (line 431) | func WithSpecifiedResultRetry(rr *retry.ShouldResultRetry) Option {
function WithFallback (line 453) | func WithFallback(fb *fallback.Policy) Option {
function WithCircuitBreaker (line 464) | func WithCircuitBreaker(s *circuitbreak.CBSuite) Option {
function WithGRPCConnPoolSize (line 474) | func WithGRPCConnPoolSize(s uint32) Option {
function WithGRPCWriteBufferSize (line 489) | func WithGRPCWriteBufferSize(s uint32) Option {
function WithGRPCReadBufferSize (line 502) | func WithGRPCReadBufferSize(s uint32) Option {
function WithGRPCInitialWindowSize (line 512) | func WithGRPCInitialWindowSize(s uint32) Option {
function WithGRPCInitialConnWindowSize (line 522) | func WithGRPCInitialConnWindowSize(s uint32) Option {
function WithGRPCMaxHeaderListSize (line 532) | func WithGRPCMaxHeaderListSize(s uint32) Option {
function WithGRPCKeepaliveParams (line 541) | func WithGRPCKeepaliveParams(kp grpc.ClientKeepalive) Option {
function WithGRPCReuseWriteBuffer (line 566) | func WithGRPCReuseWriteBuffer(cfg grpc.ReuseWriteBufferConfig) Option {
function WithWarmingUp (line 574) | func WithWarmingUp(wuo *warmup.ClientOption) Option {
function WithXDSSuite (line 582) | func WithXDSSuite(suite xds.ClientSuite) Option {
function WithContextBackup (line 596) | func WithContextBackup(backupHandler func(prev, cur context.Context) (ct...
function TailOption (line 607) | func TailOption(opt Option) Option {
FILE: client/option_advanced.go
function WithHTTPConnection (line 44) | func WithHTTPConnection() Option {
function WithClientBasicInfo (line 54) | func WithClientBasicInfo(ebi *rpcinfo.EndpointBasicInfo) Option {
function WithDiagnosisService (line 64) | func WithDiagnosisService(ds diagnosis.Service) Option {
function WithACLRules (line 74) | func WithACLRules(rules ...acl.RejectFunc) Option {
function WithFirstMetaHandler (line 87) | func WithFirstMetaHandler(h remote.MetaHandler) Option {
function WithMetaHandler (line 97) | func WithMetaHandler(h remote.MetaHandler) client.Option {
function WithProxy (line 106) | func WithProxy(p proxy.ForwardProxy) Option {
function WithTransHandlerFactory (line 118) | func WithTransHandlerFactory(f remote.ClientTransHandlerFactory) Option {
function WithDialer (line 128) | func WithDialer(d remote.Dialer) Option {
function WithConnPool (line 144) | func WithConnPool(pool remote.ConnPool) Option {
function WithRetryContainer (line 157) | func WithRetryContainer(rc *retry.Container) Option {
function WithGeneric (line 172) | func WithGeneric(g generic.Generic) Option {
function WithCloseCallbacks (line 185) | func WithCloseCallbacks(callback func() error) Option {
function WithErrorHandler (line 197) | func WithErrorHandler(f func(context.Context, error) error) Option {
function WithBoundHandler (line 207) | func WithBoundHandler(h remote.BoundHandler) Option {
function WithGRPCTLSConfig (line 238) | func WithGRPCTLSConfig(tlsConfig *tls.Config) Option {
FILE: client/option_stream.go
function WithStreamOptions (line 32) | func WithStreamOptions(opts ...StreamOption) Option {
function WithStreamRecvTimeout (line 50) | func WithStreamRecvTimeout(d time.Duration) StreamOption {
function WithStreamRecvTimeoutConfig (line 72) | func WithStreamRecvTimeoutConfig(cfg streaming.TimeoutConfig) StreamOpti...
function WithStreamMiddleware (line 81) | func WithStreamMiddleware(mw cep.StreamMiddleware) StreamOption {
function WithStreamMiddlewareBuilder (line 90) | func WithStreamMiddlewareBuilder(mwb cep.StreamMiddlewareBuilder) Stream...
function WithStreamRecvMiddleware (line 99) | func WithStreamRecvMiddleware(mw cep.StreamRecvMiddleware) StreamOption {
function WithStreamRecvMiddlewareBuilder (line 108) | func WithStreamRecvMiddlewareBuilder(mwb cep.StreamRecvMiddlewareBuilder...
function WithStreamSendMiddleware (line 117) | func WithStreamSendMiddleware(mw cep.StreamSendMiddleware) StreamOption {
function WithStreamSendMiddlewareBuilder (line 126) | func WithStreamSendMiddlewareBuilder(mwb cep.StreamSendMiddlewareBuilder...
function WithStreamEventHandler (line 135) | func WithStreamEventHandler(hdl rpcinfo.ClientStreamEventHandler) Stream...
FILE: client/option_test.go
function TestRetryOptionDebugInfo (line 59) | func TestRetryOptionDebugInfo(t *testing.T) {
function TestRetryOption (line 132) | func TestRetryOption(t *testing.T) {
function TestTransportProtocolOption (line 148) | func TestTransportProtocolOption(t *testing.T) {
function TestWithHostPorts (line 165) | func TestWithHostPorts(t *testing.T) {
function TestForwardProxy (line 175) | func TestForwardProxy(t *testing.T) {
function TestProxyWithResolver (line 224) | func TestProxyWithResolver(t *testing.T) {
function TestProxyWithBalancer (line 264) | func TestProxyWithBalancer(t *testing.T) {
function TestProxyWithResolverAndBalancer (line 314) | func TestProxyWithResolverAndBalancer(t *testing.T) {
function TestProxyWithConnPool (line 361) | func TestProxyWithConnPool(t *testing.T) {
type mockDiagnosis (line 428) | type mockDiagnosis struct
method RegisterProbeFunc (line 432) | func (m *mockDiagnosis) RegisterProbeFunc(name diagnosis.ProbeName, pr...
method ProbePairs (line 436) | func (m *mockDiagnosis) ProbePairs() map[diagnosis.ProbeName]diagnosis...
function TestWithInstanceMW (line 440) | func TestWithInstanceMW(t *testing.T) {
function TestWithHTTPResolver (line 445) | func TestWithHTTPResolver(t *testing.T) {
function TestShortConnection (line 450) | func TestShortConnection(t *testing.T) {
function TestWithMuxConnection (line 455) | func TestWithMuxConnection(t *testing.T) {
function TestWithTimeoutProvider (line 463) | func TestWithTimeoutProvider(t *testing.T) {
function TestWithStatsLevel (line 472) | func TestWithStatsLevel(t *testing.T) {
function TestWithCodec (line 477) | func TestWithCodec(t *testing.T) {
function TestWithPayloadCodec (line 486) | func TestWithPayloadCodec(t *testing.T) {
function TestWithConnReporterEnabled (line 495) | func TestWithConnReporterEnabled(t *testing.T) {
function TestWithCircuitBreaker (line 500) | func TestWithCircuitBreaker(t *testing.T) {
constant mockUint32Size (line 507) | mockUint32Size uint32 = 0
function TestWithGRPCConnPoolSize (line 509) | func TestWithGRPCConnPoolSize(t *testing.T) {
function TestWithGRPCInitialWindowSize (line 514) | func TestWithGRPCInitialWindowSize(t *testing.T) {
function TestWithGRPCInitialConnWindowSize (line 519) | func TestWithGRPCInitialConnWindowSize(t *testing.T) {
function TestWithGRPCMaxHeaderListSize (line 525) | func TestWithGRPCMaxHeaderListSize(t *testing.T) {
function TestWithGRPCKeepaliveParams (line 533) | func TestWithGRPCKeepaliveParams(t *testing.T) {
function TestWithHTTPConnection (line 549) | func TestWithHTTPConnection(t *testing.T) {
function TestWithClientBasicInfo (line 554) | func TestWithClientBasicInfo(t *testing.T) {
function TestWithDiagnosisService (line 560) | func TestWithDiagnosisService(t *testing.T) {
function mockACLRule (line 570) | func mockACLRule(ctx context.Context, request interface{}) (reason error) {
function TestWithACLRules (line 574) | func TestWithACLRules(t *testing.T) {
function TestWithFirstMetaHandler (line 579) | func TestWithFirstMetaHandler(t *testing.T) {
function TestWithMetaHandler (line 585) | func TestWithMetaHandler(t *testing.T) {
function TestWithConnPool (line 591) | func TestWithConnPool(t *testing.T) {
function TestWithRetryContainer (line 600) | func TestWithRetryContainer(t *testing.T) {
function TestWithGeneric (line 606) | func TestWithGeneric(t *testing.T) {
function TestWithCloseCallbacks (line 612) | func TestWithCloseCallbacks(t *testing.T) {
function TestWithErrorHandler (line 617) | func TestWithErrorHandler(t *testing.T) {
function TestWithBoundHandler (line 623) | func TestWithBoundHandler(t *testing.T) {
type mockSuite (line 665) | type mockSuite struct
method Options (line 673) | func (m *mockSuite) Options() []Option {
function TestWithSuite (line 681) | func TestWithSuite(t *testing.T) {
function TestWithLongConnectionOption (line 692) | func TestWithLongConnectionOption(t *testing.T) {
function TestWithWarmingUpOption (line 703) | func TestWithWarmingUpOption(t *testing.T) {
function TestWithFramedTransport (line 711) | func TestWithFramedTransport(t *testing.T) {
function TestWithConnMetric (line 719) | func TestWithConnMetric(t *testing.T) {
function TestWithXDSSuite (line 727) | func TestWithXDSSuite(t *testing.T) {
function TestWithGRPCTLSConfig (line 752) | func TestWithGRPCTLSConfig(t *testing.T) {
function TestWithGRPCReuseWriteBuffer (line 758) | func TestWithGRPCReuseWriteBuffer(t *testing.T) {
function TestTailOption (line 769) | func TestTailOption(t *testing.T) {
function checkOneOptionDebugInfo (line 784) | func checkOneOptionDebugInfo(t *testing.T, opt Option, expectStr string)...
FILE: client/option_ttstream.go
function WithTTHeaderStreamingOptions (line 28) | func WithTTHeaderStreamingOptions(opts ...TTHeaderStreamingOption) Option {
function WithTTHeaderStreamingTransportOptions (line 41) | func WithTTHeaderStreamingTransportOptions(opt ...ttstream.ClientHandler...
FILE: client/option_unary.go
function WithUnaryOptions (line 30) | func WithUnaryOptions(opts ...UnaryOption) Option {
function WithUnaryRPCTimeout (line 43) | func WithUnaryRPCTimeout(d time.Duration) UnaryOption {
function WithUnaryMiddleware (line 52) | func WithUnaryMiddleware(mw endpoint.UnaryMiddleware) UnaryOption {
function WithUnaryMiddlewareBuilder (line 61) | func WithUnaryMiddlewareBuilder(mwb endpoint.UnaryMiddlewareBuilder) Una...
FILE: client/rpctimeout.go
function makeTimeoutErr (line 36) | func makeTimeoutErr(ctx context.Context, start time.Time, timeout time.D...
function isBusinessTimeout (line 76) | func isBusinessTimeout(start time.Time, kitexTimeout time.Duration, actu...
function rpcTimeoutMW (line 84) | func rpcTimeoutMW(mwCtx context.Context) endpoint.UnaryMiddleware {
FILE: client/rpctimeout_pool.go
type timeoutPool (line 33) | type timeoutPool struct
method Size (line 57) | func (p *timeoutPool) Size() int32 {
method createTicker (line 61) | func (p *timeoutPool) createTicker() {
method createWorker (line 97) | func (p *timeoutPool) createWorker(t *timeoutTask) bool {
method RunTask (line 137) | func (p *timeoutPool) RunTask(ctx context.Context, timeout time.Duration,
function newTimeoutPool (line 48) | func newTimeoutPool(maxIdle int, maxIdleTime time.Duration) *timeoutPool {
type timeoutTask (line 161) | type timeoutTask struct
method recycle (line 188) | func (t *timeoutTask) recycle() {
method Cancel (line 199) | func (t *timeoutTask) Cancel(err error) {
method Run (line 204) | func (t *timeoutTask) Run() {
method Wait (line 232) | func (t *timeoutTask) Wait() (context.Context, error) {
method waitNoTimeout (line 261) | func (t *timeoutTask) waitNoTimeout() (context.Context, error) {
function newTimeoutTask (line 172) | func newTimeoutTask(ctx context.Context, timeout time.Duration,
type timeoutContext (line 276) | type timeoutContext struct
method Deadline (line 302) | func (p *timeoutContext) Deadline() (deadline time.Time, ok bool) {
method Done (line 306) | func (p *timeoutContext) Done() <-chan struct{} {
method Err (line 310) | func (p *timeoutContext) Err() error {
method Cancel (line 320) | func (p *timeoutContext) Cancel(err error) {
function newTimeoutContext (line 286) | func newTimeoutContext(ctx context.Context, timeout time.Duration) *time...
FILE: client/rpctimeout_pool_test.go
function TestTimeoutPool (line 32) | func TestTimeoutPool(t *testing.T) {
function noop (line 62) | func noop(ctx context.Context, req, resp interface{}) error { return nil }
function BenchmarkTimeoutPool (line 64) | func BenchmarkTimeoutPool(b *testing.B) {
function TestTask (line 78) | func TestTask(t *testing.T) {
FILE: client/rpctimeout_test.go
function block (line 35) | func block(ctx context.Context, request, response interface{}) (err erro...
function pass (line 40) | func pass(ctx context.Context, request, response interface{}) (err error) {
function panicEp (line 45) | func panicEp(ctx context.Context, request, response interface{}) (err er...
function TestNewRPCTimeoutMW (line 49) | func TestNewRPCTimeoutMW(t *testing.T) {
function TestIsBusinessTimeout (line 117) | func TestIsBusinessTimeout(t *testing.T) {
function TestRpcTimeoutMWTimeoutByBusiness (line 160) | func TestRpcTimeoutMWTimeoutByBusiness(t *testing.T) {
function TestRpcTimeoutMWCancelByBusiness (line 210) | func TestRpcTimeoutMWCancelByBusiness(t *testing.T) {
function mockRPCInfo (line 245) | func mockRPCInfo(timeout time.Duration) rpcinfo.RPCInfo {
function Test_isBusinessTimeout (line 253) | func Test_isBusinessTimeout(t *testing.T) {
function BenchmarkRPCTimeoutMW (line 317) | func BenchmarkRPCTimeoutMW(b *testing.B) {
FILE: client/service_inline.go
type ContextServiceInlineHandler (line 37) | type ContextServiceInlineHandler interface
type serviceInlineClient (line 42) | type serviceInlineClient struct
method SetContextServiceInlineHandler (line 77) | func (kc *serviceInlineClient) SetContextServiceInlineHandler(simh Con...
method init (line 81) | func (kc *serviceInlineClient) init() (err error) {
method checkOptions (line 95) | func (kc *serviceInlineClient) checkOptions() (err error) {
method initContext (line 102) | func (kc *serviceInlineClient) initContext() context.Context {
method initMiddlewares (line 109) | func (kc *serviceInlineClient) initMiddlewares(ctx context.Context) {
method initRPCInfo (line 116) | func (kc *serviceInlineClient) initRPCInfo(ctx context.Context, method...
method Call (line 121) | func (kc *serviceInlineClient) Call(ctx context.Context, method string...
method richRemoteOption (line 153) | func (kc *serviceInlineClient) richRemoteOption() {
method buildInvokeChain (line 157) | func (kc *serviceInlineClient) buildInvokeChain() error {
method invokeHandleEndpoint (line 166) | func (kc *serviceInlineClient) invokeHandleEndpoint() (endpoint.Endpoi...
method Close (line 194) | func (kc *serviceInlineClient) Close() error {
type ServerInitialInfo (line 57) | type ServerInitialInfo interface
function NewServiceInlineClient (line 62) | func NewServiceInlineClient(svcInfo *serviceinfo.ServiceInfo, s ServerIn...
FILE: client/service_inline_test.go
type serverInitialInfoImpl (line 40) | type serverInitialInfoImpl struct
method BuildServiceInlineInvokeChain (line 44) | func (s serverInitialInfoImpl) BuildServiceInlineInvokeChain() endpoin...
function newMockServerInitialInfo (line 53) | func newMockServerInitialInfo() ServerInitialInfo {
function newMockServiceInlineClient (line 57) | func newMockServiceInlineClient(tb testing.TB, ctrl *gomock.Controller, ...
function TestServiceInlineCall (line 73) | func TestServiceInlineCall(t *testing.T) {
function TestServiceInlineTagOptions (line 87) | func TestServiceInlineTagOptions(t *testing.T) {
function TestServiceInlineTagOptionLocks0 (line 146) | func TestServiceInlineTagOptionLocks0(t *testing.T) {
function TestServiceInlineTagOptionLocks1 (line 178) | func TestServiceInlineTagOptionLocks1(t *testing.T) {
function TestServiceInlineTagOptionLocks2 (line 210) | func TestServiceInlineTagOptionLocks2(t *testing.T) {
function TestServiceInlineTimeoutOptions (line 244) | func TestServiceInlineTimeoutOptions(t *testing.T) {
function TestServiceInlineClientFinalizer (line 283) | func TestServiceInlineClientFinalizer(t *testing.T) {
FILE: client/stream.go
type Streaming (line 44) | type Streaming interface
method Stream (line 52) | func (kc *kClient) Stream(ctx context.Context, method string, request, r...
method StreamX (line 116) | func (kc *kClient) StreamX(ctx context.Context, method string) (streamin...
method invokeStreamingEndpoint (line 163) | func (kc *kClient) invokeStreamingEndpoint() (endpoint.Endpoint, error) {
constant recvTimeoutErrTpl (line 201) | recvTimeoutErrTpl = "stream Recv timeout, timeout config=%+v"
type stream (line 204) | type stream struct
method Header (line 256) | func (s *stream) Header() (hd streaming.Header, err error) {
method RecvMsg (line 265) | func (s *stream) RecvMsg(ctx context.Context, m interface{}) (err erro...
method handleStreamRecvEvent (line 289) | func (s *stream) handleStreamRecvEvent(err error) {
method recvWithTimeout (line 295) | func (s *stream) recvWithTimeout(ctx context.Context, m interface{}) e...
method cancel (line 307) | func (s *stream) cancel(err error) {
method SendMsg (line 316) | func (s *stream) SendMsg(ctx context.Context, m interface{}) (err erro...
method handleStreamSendEvent (line 332) | func (s *stream) handleStreamSendEvent(err error) {
method DoFinish (line 340) | func (s *stream) DoFinish(err error) {
method GetGRPCStream (line 355) | func (s *stream) GetGRPCStream() streaming.Stream {
function newStream (line 227) | func newStream(ctx context.Context, s streaming.ClientStream, scm *remot...
function newGRPCStream (line 362) | func newGRPCStream(st streaming.Stream, sendEP endpoint.SendEndpoint, re...
type grpcStream (line 373) | type grpcStream struct
method Header (line 385) | func (s *grpcStream) Header() (md metadata.MD, err error) {
method RecvMsg (line 392) | func (s *grpcStream) RecvMsg(m interface{}) (err error) {
method recvWithTimeout (line 406) | func (s *grpcStream) recvWithTimeout(m interface{}) error {
method SendMsg (line 419) | func (s *grpcStream) SendMsg(m interface{}) (err error) {
method DoFinish (line 428) | func (s *grpcStream) DoFinish(err error) {
function callWithTimeout (line 432) | func callWithTimeout(tmCfg streaming.TimeoutConfig, call func() error, c...
function isRPCError (line 460) | func isRPCError(err error) bool {
FILE: client/stream_test.go
function newOpts (line 56) | func newOpts(ctrl *gomock.Controller) []Option {
function TestStream (line 65) | func TestStream(t *testing.T) {
function TestStreamNoMethod (line 93) | func TestStreamNoMethod(t *testing.T) {
function TestStreaming (line 109) | func TestStreaming(t *testing.T) {
function TestUninitClient (line 176) | func TestUninitClient(t *testing.T) {
function TestClosedClient (line 194) | func TestClosedClient(t *testing.T) {
type mockStream (line 214) | type mockStream struct
method Context (line 224) | func (s *mockStream) Context() context.Context {
method Header (line 228) | func (s *mockStream) Header() (streaming.Header, error) {
method RecvMsg (line 232) | func (s *mockStream) RecvMsg(ctx context.Context, msg any) error {
method SendMsg (line 236) | func (s *mockStream) SendMsg(ctx context.Context, msg any) error {
method CloseSend (line 240) | func (s *mockStream) CloseSend(ctx context.Context) error {
method CancelWithErr (line 244) | func (s *mockStream) CancelWithErr(err error) {
method Close (line 248) | func (s *mockStream) Close() error {
function Test_newStream (line 255) | func Test_newStream(t *testing.T) {
type mockTracer (line 299) | type mockTracer struct
method Start (line 305) | func (m *mockTracer) Start(ctx context.Context) context.Context {
method Finish (line 309) | func (m *mockTracer) Finish(ctx context.Context) {
function Test_stream_Header (line 313) | func Test_stream_Header(t *testing.T) {
function Test_stream_RecvMsg (line 369) | func Test_stream_RecvMsg(t *testing.T) {
function Test_stream_SendMsg (line 466) | func Test_stream_SendMsg(t *testing.T) {
function Test_stream_Close (line 530) | func Test_stream_Close(t *testing.T) {
function Test_stream_DoFinish (line 550) | func Test_stream_DoFinish(t *testing.T) {
function Test_isRPCError (line 676) | func Test_isRPCError(t *testing.T) {
function TestContextFallback (line 691) | func TestContextFallback(t *testing.T) {
function createErrorMiddleware (line 740) | func createErrorMiddleware(injectErr error) cep.StreamMiddleware {
function TestStreamDoFinish (line 749) | func TestStreamDoFinish(t *testing.T) {
function TestStreamXDoFinish (line 792) | func TestStreamXDoFinish(t *testing.T) {
function TestRecvTimeout (line 834) | func TestRecvTimeout(t *testing.T) {
type mockGRPCStreamWrapper (line 1074) | type mockGRPCStreamWrapper struct
method GetGRPCStream (line 1079) | func (s *mockGRPCStreamWrapper) GetGRPCStream() streaming.Stream {
type mockGRPCInnerStream (line 1084) | type mockGRPCInnerStream struct
method Context (line 1089) | func (s *mockGRPCInnerStream) Context() context.Context {
method SetHeader (line 1096) | func (s *mockGRPCInnerStream) SetHeader(md metadata.MD) error {
method SendHeader (line 1100) | func (s *mockGRPCInnerStream) SendHeader(md metadata.MD) error {
method SetTrailer (line 1104) | func (s *mockGRPCInnerStream) SetTrailer(md metadata.MD) {
method Header (line 1107) | func (s *mockGRPCInnerStream) Header() (metadata.MD, error) {
method Trailer (line 1111) | func (s *mockGRPCInnerStream) Trailer() metadata.MD {
method RecvMsg (line 1115) | func (s *mockGRPCInnerStream) RecvMsg(m interface{}) error {
method SendMsg (line 1122) | func (s *mockGRPCInnerStream) SendMsg(m interface{}) error {
method Close (line 1126) | func (s *mockGRPCInnerStream) Close() error {
FILE: client/streamclient/client_option.go
function WithSuite (line 41) | func WithSuite(suite client.Suite) Option {
function WithMiddleware (line 46) | func WithMiddleware(mw endpoint.Middleware) Option {
function WithMiddlewareBuilder (line 51) | func WithMiddlewareBuilder(mwb endpoint.MiddlewareBuilder) Option {
function WithInstanceMW (line 56) | func WithInstanceMW(mw endpoint.Middleware) Option {
function WithDestService (line 61) | func WithDestService(svr string) Option {
function WithHostPorts (line 66) | func WithHostPorts(hostPorts ...string) Option {
function WithResolver (line 71) | func WithResolver(r discovery.Resolver) Option {
function WithHTTPResolver (line 76) | func WithHTTPResolver(r http.Resolver) Option {
function WithLoadBalancer (line 81) | func WithLoadBalancer(lb loadbalance.Loadbalancer, opts ...*lbcache.Opti...
function WithConnectTimeout (line 86) | func WithConnectTimeout(d time.Duration) Option {
function WithTag (line 91) | func WithTag(key, val string) Option {
function WithTracer (line 96) | func WithTracer(c stats.Tracer) Option {
function WithStatsLevel (line 101) | func WithStatsLevel(level stats.Level) Option {
function WithPayloadCodec (line 106) | func WithPayloadCodec(c remote.PayloadCodec) Option {
function WithConnReporterEnabled (line 111) | func WithConnReporterEnabled() Option {
function WithWarmingUp (line 116) | func WithWarmingUp(wuo *warmup.ClientOption) Option {
function WithXDSSuite (line 121) | func WithXDSSuite(suite xds.ClientSuite) Option {
function WithContextBackup (line 126) | func WithContextBackup(backupHandler func(prev, cur context.Context) (ct...
FILE: client/streamclient/client_option_advanced.go
function WithClientBasicInfo (line 31) | func WithClientBasicInfo(ebi *rpcinfo.EndpointBasicInfo) Option {
function WithDiagnosisService (line 36) | func WithDiagnosisService(ds diagnosis.Service) Option {
function WithACLRules (line 41) | func WithACLRules(rules ...acl.RejectFunc) Option {
function WithFirstMetaHandler (line 46) | func WithFirstMetaHandler(h remote.MetaHandler) Option {
function WithMetaHandler (line 51) | func WithMetaHandler(h remote.MetaHandler) Option {
function WithProxy (line 56) | func WithProxy(p proxy.ForwardProxy) Option {
function WithDialer (line 61) | func WithDialer(d remote.Dialer) Option {
function WithCloseCallbacks (line 66) | func WithCloseCallbacks(callback func() error) Option {
function WithErrorHandler (line 71) | func WithErrorHandler(f func(context.Context, error) error) Option {
FILE: client/streamclient/definition.go
type Option (line 24) | type Option struct
method GetClientOption (line 30) | func (o *Option) GetClientOption() client.Option {
function ConvertOptionFrom (line 39) | func ConvertOptionFrom(opt client.Option) Option {
function GetClientOptions (line 44) | func GetClientOptions(ops []Option) []client.Option {
FILE: client/streamclient/grpc_option.go
function WithGRPCConnPoolSize (line 27) | func WithGRPCConnPoolSize(s uint32) Option {
function WithGRPCWriteBufferSize (line 32) | func WithGRPCWriteBufferSize(s uint32) Option {
function WithGRPCReadBufferSize (line 37) | func WithGRPCReadBufferSize(s uint32) Option {
function WithGRPCInitialWindowSize (line 42) | func WithGRPCInitialWindowSize(s uint32) Option {
function WithGRPCInitialConnWindowSize (line 47) | func WithGRPCInitialConnWindowSize(s uint32) Option {
function WithGRPCMaxHeaderListSize (line 52) | func WithGRPCMaxHeaderListSize(s uint32) Option {
function WithGRPCKeepaliveParams (line 57) | func WithGRPCKeepaliveParams(kp grpc.ClientKeepalive) Option {
function WithGRPCTLSConfig (line 62) | func WithGRPCTLSConfig(tlsConfig *tls.Config) Option {
FILE: client/streamclient/option.go
function WithRecvMiddleware (line 29) | func WithRecvMiddleware(mw endpoint.RecvMiddleware) Option {
function WithRecvMiddlewareBuilder (line 40) | func WithRecvMiddlewareBuilder(mwb endpoint.RecvMiddlewareBuilder) Option {
function WithSendMiddleware (line 48) | func WithSendMiddleware(mw endpoint.SendMiddleware) Option {
function WithSendMiddlewareBuilder (line 59) | func WithSendMiddlewareBuilder(mwb endpoint.SendMiddlewareBuilder) Option {
FILE: internal/client/lock.go
type ConfigLocks (line 25) | type ConfigLocks struct
method ApplyLocks (line 38) | func (cl *ConfigLocks) ApplyLocks(cfg rpcinfo.MutableRPCConfig, svr re...
method Merge (line 50) | func (cl *ConfigLocks) Merge(c2 *ConfigLocks) {
method Zero (line 58) | func (cl *ConfigLocks) Zero() {
function NewConfigLocks (line 31) | func NewConfigLocks() *ConfigLocks {
FILE: internal/client/option.go
function init (line 59) | func init() {
type UnaryOption (line 64) | type UnaryOption struct
type UnaryOptions (line 68) | type UnaryOptions struct
method InitMiddlewares (line 84) | func (o *UnaryOptions) InitMiddlewares(ctx context.Context) {
method SetUnaryRPCTimeout (line 94) | func (o *UnaryOptions) SetUnaryRPCTimeout(d time.Duration) {
type StreamOption (line 99) | type StreamOption struct
type StreamOptions (line 103) | type StreamOptions struct
method InitMiddlewares (line 115) | func (o *StreamOptions) InitMiddlewares(ctx context.Context) {
method BuildRecvChain (line 139) | func (o *StreamOptions) BuildRecvChain(recvEndpoint cep.StreamRecvEndp...
method BuildSendChain (line 143) | func (o *StreamOptions) BuildSendChain(sendEndpoint cep.StreamSendEndp...
type Options (line 148) | type Options struct
method Apply (line 214) | func (o *Options) Apply(opts []Option) {
method initTraceController (line 272) | func (o *Options) initTraceController() {
method initRemoteOpt (line 278) | func (o *Options) initRemoteOpt() {
method InitRetryContainer (line 331) | func (o *Options) InitRetryContainer() {
type Option (line 225) | type Option struct
function NewOptions (line 230) | func NewOptions(opts []Option) *Options {
FILE: internal/client/option_ttstream.go
type TTHeaderStreamingOption (line 24) | type TTHeaderStreamingOption struct
type TTHeaderStreamingOptions (line 28) | type TTHeaderStreamingOptions struct
FILE: internal/client/remote_option.go
function newClientRemoteOption (line 29) | func newClientRemoteOption() *remote.ClientOption {
FILE: internal/client/remote_option_windows.go
function newClientRemoteOption (line 29) | func newClientRemoteOption() *remote.ClientOption {
FILE: internal/configutil/config.go
type Config (line 22) | type Config interface
type Container (line 27) | type Container interface
type DefaultConfig (line 33) | type DefaultConfig interface
type RichTypeConfig (line 38) | type RichTypeConfig interface
type RichTypeDefaultConfig (line 48) | type RichTypeDefaultConfig interface
type dummyConfig (line 58) | type dummyConfig struct
method Get (line 60) | func (dc *dummyConfig) Get(key string) (val interface{}, ok bool) { re...
function NewDummyConfig (line 63) | func NewDummyConfig() Config {
type configs (line 68) | type configs struct
method Get (line 77) | func (cc *configs) Get(key string) (val interface{}, ok bool) {
method AddPriorSource (line 87) | func (cc *configs) AddPriorSource(src Config) error {
function NewConfigContainer (line 73) | func NewConfigContainer() Container {
type defaultConfig (line 93) | type defaultConfig struct
method Get (line 102) | func (dc *defaultConfig) Get(key string, def interface{}) interface{} {
function NewDefaultConfig (line 98) | func NewDefaultConfig(c Config) DefaultConfig {
type richTypeConfig (line 110) | type richTypeConfig struct
method GetBool (line 119) | func (rd *richTypeConfig) GetBool(key string) (val, ok bool) {
method GetInt (line 124) | func (rd *richTypeConfig) GetInt(key string) (val int, ok bool) {
method GetString (line 129) | func (rd *richTypeConfig) GetString(key string) (val string, ok bool) {
method GetInt64 (line 134) | func (rd *richTypeConfig) GetInt64(key string) (val int64, ok bool) {
method GetFloat (line 144) | func (rd *richTypeConfig) GetFloat(key string) (val float64, ok bool) {
method GetDuration (line 149) | func (rd *richTypeConfig) GetDuration(key string) (val time.Duration, ...
function NewRichTypeConfig (line 115) | func NewRichTypeConfig(c Config) RichTypeConfig {
type richTypeDefaultConfig (line 155) | type richTypeDefaultConfig struct
method GetBool (line 164) | func (rd *richTypeDefaultConfig) GetBool(key string, def bool) bool {
method GetInt (line 171) | func (rd *richTypeDefaultConfig) GetInt(key string, def int) int {
method GetString (line 178) | func (rd *richTypeDefaultConfig) GetString(key, def string) string {
method GetInt64 (line 185) | func (rd *richTypeDefaultConfig) GetInt64(key string, def int64) int64 {
method GetFloat (line 192) | func (rd *richTypeDefaultConfig) GetFloat(key string, def float64) flo...
method GetDuration (line 199) | func (rd *richTypeDefaultConfig) GetDuration(key string, def time.Dura...
function NewRichTypeDefaultConfig (line 160) | func NewRichTypeDefaultConfig(rtc RichTypeConfig) RichTypeDefaultConfig {
FILE: internal/configutil/config_test.go
type mockConfig (line 26) | type mockConfig struct
method Get (line 30) | func (c *mockConfig) Get(key string) (interface{}, bool) {
function TestConfigs_Get (line 35) | func TestConfigs_Get(t *testing.T) {
function TestConfigs_AddPriorSource (line 99) | func TestConfigs_AddPriorSource(t *testing.T) {
function TestDefaultConfig_Get (line 125) | func TestDefaultConfig_Get(t *testing.T) {
function TestDummyConfig_Get (line 147) | func TestDummyConfig_Get(t *testing.T) {
function TestRichTypeConfig_GetBool (line 155) | func TestRichTypeConfig_GetBool(t *testing.T) {
function TestRichTypeConfig_GetDuration (line 193) | func TestRichTypeConfig_GetDuration(t *testing.T) {
function TestRichTypeConfig_GetFloat (line 231) | func TestRichTypeConfig_GetFloat(t *testing.T) {
function TestRichTypeConfig_GetInt (line 269) | func TestRichTypeConfig_GetInt(t *testing.T) {
function TestRichTypeConfig_GetInt64 (line 307) | func TestRichTypeConfig_GetInt64(t *testing.T) {
function TestRichTypeConfig_GetString (line 345) | func TestRichTypeConfig_GetString(t *testing.T) {
function TestRichTypeDefaultConfig_GetBool (line 383) | func TestRichTypeDefaultConfig_GetBool(t *testing.T) {
function TestRichTypeDefaultConfig_GetDuration (line 424) | func TestRichTypeDefaultConfig_GetDuration(t *testing.T) {
function TestRichTypeDefaultConfig_GetFloat (line 465) | func TestRichTypeDefaultConfig_GetFloat(t *testing.T) {
function TestRichTypeDefaultConfig_GetInt (line 506) | func TestRichTypeDefaultConfig_GetInt(t *testing.T) {
function TestRichTypeDefaultConfig_GetInt64 (line 547) | func TestRichTypeDefaultConfig_GetInt64(t *testing.T) {
function TestRichTypeDefaultConfig_GetString (line 588) | func TestRichTypeDefaultConfig_GetString(t *testing.T) {
FILE: internal/configutil/once.go
type OptionOnce (line 26) | type OptionOnce struct
method OnceOrPanic (line 38) | func (o *OptionOnce) OnceOrPanic() {
function NewOptionOnce (line 31) | func NewOptionOnce() *OptionOnce {
FILE: internal/configutil/once_test.go
function TestOnceOrPanic (line 25) | func TestOnceOrPanic(t *testing.T) {
FILE: internal/generic/context.go
type genericStreamingKey (line 25) | type genericStreamingKey struct
function WithGenericStreamingMode (line 30) | func WithGenericStreamingMode(ctx context.Context, sm serviceinfo.Stream...
function GetGenericStreamingMode (line 35) | func GetGenericStreamingMode(ctx context.Context) serviceinfo.StreamingM...
FILE: internal/generic/generic_service.go
constant BinaryThriftGenericV1PayloadCodecKey (line 33) | BinaryThriftGenericV1PayloadCodecKey = "binary_thrift_generic_v1_payload...
constant GetMethodNameByRequestFuncKey (line 35) | GetMethodNameByRequestFuncKey = "get_method_name_by_request_func"
constant IsBinaryGeneric (line 37) | IsBinaryGeneric = "is_binary_generic"
type Args (line 41) | type Args struct
method SetCodec (line 53) | func (g *Args) SetCodec(inner interface{}) {
method GetOrSetBase (line 57) | func (g *Args) GetOrSetBase() interface{} {
method Write (line 65) | func (g *Args) Write(ctx context.Context, method string, out bufiox.Wr...
method WritePb (line 75) | func (g *Args) WritePb(ctx context.Context, method string) (interface{...
method Read (line 86) | func (g *Args) Read(ctx context.Context, method string, dataLen int, i...
method ReadPb (line 99) | func (g *Args) ReadPb(ctx context.Context, method string, in []byte) e...
method GetFirstArgument (line 113) | func (g *Args) GetFirstArgument() interface{} {
type Result (line 118) | type Result struct
method SetCodec (line 129) | func (r *Result) SetCodec(inner interface{}) {
method Write (line 134) | func (r *Result) Write(ctx context.Context, method string, out bufiox....
method WritePb (line 144) | func (r *Result) WritePb(ctx context.Context, method string) (interfac...
method Read (line 155) | func (r *Result) Read(ctx context.Context, method string, dataLen int,...
method ReadPb (line 167) | func (r *Result) ReadPb(ctx context.Context, method string, in []byte)...
method GetSuccess (line 180) | func (r *Result) GetSuccess() interface{} {
method SetSuccess (line 188) | func (r *Result) SetSuccess(x interface{}) {
method IsSetSuccess (line 193) | func (r *Result) IsSetSuccess() bool {
method GetResult (line 198) | func (r *Result) GetResult() interface{} {
type ThriftWriter (line 202) | type ThriftWriter interface
type ThriftReader (line 206) | type ThriftReader interface
FILE: internal/generic/proto/type.go
type Message (line 30) | type Message interface
function NewMessage (line 37) | func NewMessage(descriptor MessageDescriptor) Message {
FILE: internal/generic/utils.go
function BinaryGenericSupportsMultiService (line 24) | func BinaryGenericSupportsMultiService(svcInfo *serviceinfo.ServiceInfo)...
FILE: internal/generic/utils_test.go
function TestBinaryGenericSupportsMultiService (line 26) | func TestBinaryGenericSupportsMultiService(t *testing.T) {
FILE: internal/mocks/bufiox/bufreader.go
type MockReader (line 30) | type MockReader struct
method EXPECT (line 48) | func (m *MockReader) EXPECT() *MockReaderMockRecorder {
method Next (line 53) | func (m *MockReader) Next(n int) ([]byte, error) {
method Peek (line 68) | func (m *MockReader) Peek(n int) ([]byte, error) {
method ReadBinary (line 83) | func (m *MockReader) ReadBinary(bs []byte) (int, error) {
method ReadLen (line 98) | func (m *MockReader) ReadLen() int {
method Release (line 112) | func (m *MockReader) Release(e error) error {
method Skip (line 126) | func (m *MockReader) Skip(n int) error {
type MockReaderMockRecorder (line 36) | type MockReaderMockRecorder struct
method Next (line 62) | func (mr *MockReaderMockRecorder) Next(n interface{}) *gomock.Call {
method Peek (line 77) | func (mr *MockReaderMockRecorder) Peek(n interface{}) *gomock.Call {
method ReadBinary (line 92) | func (mr *MockReaderMockRecorder) ReadBinary(bs interface{}) *gomock.C...
method ReadLen (line 106) | func (mr *MockReaderMockRecorder) ReadLen() *gomock.Call {
method Release (line 120) | func (mr *MockReaderMockRecorder) Release(e interface{}) *gomock.Call {
method Skip (line 134) | func (mr *MockReaderMockRecorder) Skip(n interface{}) *gomock.Call {
function NewMockReader (line 41) | func NewMockReader(ctrl *gomock.Controller) *MockReader {
FILE: internal/mocks/conn.go
type Conn (line 30) | type Conn struct
method Read (line 42) | func (m Conn) Read(b []byte) (n int, err error) {
method Write (line 50) | func (m Conn) Write(b []byte) (n int, err error) {
method Close (line 58) | func (m Conn) Close() (e error) {
method LocalAddr (line 66) | func (m Conn) LocalAddr() (r net.Addr) {
method RemoteAddr (line 74) | func (m Conn) RemoteAddr() (r net.Addr) {
method SetDeadline (line 82) | func (m Conn) SetDeadline(t time.Time) (e error) {
method SetReadDeadline (line 90) | func (m Conn) SetReadDeadline(t time.Time) (e error) {
method SetWriteDeadline (line 98) | func (m Conn) SetWriteDeadline(t time.Time) (e error) {
function NewIOConn (line 105) | func NewIOConn() *Conn {
type MockConnWithBufioxReader (line 117) | type MockConnWithBufioxReader struct
method Reader (line 122) | func (c *MockConnWithBufioxReader) Reader() bufiox.Reader {
FILE: internal/mocks/diagnosis/service.go
type MockService (line 32) | type MockService struct
method EXPECT (line 50) | func (m *MockService) EXPECT() *MockServiceMockRecorder {
method RegisterProbeFunc (line 55) | func (m *MockService) RegisterProbeFunc(arg0 diagnosis.ProbeName, arg1...
type MockServiceMockRecorder (line 38) | type MockServiceMockRecorder struct
method RegisterProbeFunc (line 61) | func (mr *MockServiceMockRecorder) RegisterProbeFunc(arg0, arg1 interf...
function NewMockService (line 43) | func NewMockService(ctrl *gomock.Controller) *MockService {
FILE: internal/mocks/discovery/discovery.go
type MockResolver (line 35) | type MockResolver struct
method EXPECT (line 53) | func (m *MockResolver) EXPECT() *MockResolverMockRecorder {
method Diff (line 58) | func (m *MockResolver) Diff(cacheKey string, prev, next discovery.Resu...
method Name (line 73) | func (m *MockResolver) Name() string {
method Resolve (line 87) | func (m *MockResolver) Resolve(ctx context.Context, desc string) (disc...
method Target (line 102) | func (m *MockResolver) Target(ctx context.Context, target rpcinfo.Endp...
type MockResolverMockRecorder (line 41) | type MockResolverMockRecorder struct
method Diff (line 67) | func (mr *MockResolverMockRecorder) Diff(cacheKey, prev, next interfac...
method Name (line 81) | func (mr *MockResolverMockRecorder) Name() *gomock.Call {
method Resolve (line 96) | func (mr *MockResolverMockRecorder) Resolve(ctx, desc interface{}) *go...
method Target (line 110) | func (mr *MockResolverMockRecorder) Target(ctx, target interface{}) *g...
function NewMockResolver (line 46) | func NewMockResolver(ctrl *gomock.Controller) *MockResolver {
type MockInstance (line 116) | type MockInstance struct
method EXPECT (line 134) | func (m *MockInstance) EXPECT() *MockInstanceMockRecorder {
method Address (line 139) | func (m *MockInstance) Address() net.Addr {
method Tag (line 153) | func (m *MockInstance) Tag(key string) (string, bool) {
method Weight (line 168) | func (m *MockInstance) Weight() int {
type MockInstanceMockRecorder (line 122) | type MockInstanceMockRecorder struct
method Address (line 147) | func (mr *MockInstanceMockRecorder) Address() *gomock.Call {
method Tag (line 162) | func (mr *MockInstanceMockRecorder) Tag(key interface{}) *gomock.Call {
method Weight (line 176) | func (mr *MockInstanceMockRecorder) Weight() *gomock.Call {
function NewMockInstance (line 127) | func NewMockInstance(ctrl *gomock.Controller) *MockInstance {
FILE: internal/mocks/generic/generic_service.go
type MockService (line 32) | type MockService struct
method EXPECT (line 50) | func (m *MockService) EXPECT() *MockServiceMockRecorder {
method GenericCall (line 55) | func (m *MockService) GenericCall(ctx context.Context, method string, ...
type MockServiceMockRecorder (line 38) | type MockServiceMockRecorder struct
method GenericCall (line 64) | func (mr *MockServiceMockRecorder) GenericCall(ctx, method, request in...
function NewMockService (line 43) | func NewMockService(ctrl *gomock.Controller) *MockService {
type MockWithCodec (line 70) | type MockWithCodec struct
method EXPECT (line 88) | func (m *MockWithCodec) EXPECT() *MockWithCodecMockRecorder {
method SetCodec (line 93) | func (m *MockWithCodec) SetCodec(codec interface{}) {
type MockWithCodecMockRecorder (line 76) | type MockWithCodecMockRecorder struct
method SetCodec (line 99) | func (mr *MockWithCodecMockRecorder) SetCodec(codec interface{}) *gomo...
function NewMockWithCodec (line 81) | func NewMockWithCodec(ctrl *gomock.Controller) *MockWithCodec {
FILE: internal/mocks/generic/thrift.go
type MockMessageReader (line 34) | type MockMessageReader struct
method EXPECT (line 52) | func (m *MockMessageReader) EXPECT() *MockMessageReaderMockRecorder {
method Read (line 57) | func (m *MockMessageReader) Read(ctx context.Context, method string, i...
type MockMessageReaderMockRecorder (line 40) | type MockMessageReaderMockRecorder struct
method Read (line 66) | func (mr *MockMessageReaderMockRecorder) Read(ctx, method, isClient, d...
function NewMockMessageReader (line 45) | func NewMockMessageReader(ctrl *gomock.Controller) *MockMessageReader {
type MockMessageWriter (line 72) | type MockMessageWriter struct
method EXPECT (line 90) | func (m *MockMessageWriter) EXPECT() *MockMessageWriterMockRecorder {
method Write (line 95) | func (m *MockMessageWriter) Write(ctx context.Context, out bufiox.Writ...
type MockMessageWriterMockRecorder (line 78) | type MockMessageWriterMockRecorder struct
method Write (line 103) | func (mr *MockMessageWriterMockRecorder) Write(ctx, out, msg, method, ...
function NewMockMessageWriter (line 83) | func NewMockMessageWriter(ctrl *gomock.Controller) *MockMessageWriter {
FILE: internal/mocks/klog/log.go
type MockFormatLogger (line 34) | type MockFormatLogger struct
method EXPECT (line 52) | func (m *MockFormatLogger) EXPECT() *MockFormatLoggerMockRecorder {
method Debugf (line 57) | func (m *MockFormatLogger) Debugf(format string, v ...interface{}) {
method Errorf (line 74) | func (m *MockFormatLogger) Errorf(format string, v ...interface{}) {
method Fatalf (line 91) | func (m *MockFormatLogger) Fatalf(format string, v ...interface{}) {
method Infof (line 108) | func (m *MockFormatLogger) Infof(format string, v ...interface{}) {
method Noticef (line 125) | func (m *MockFormatLogger) Noticef(format string, v ...interface{}) {
method Tracef (line 142) | func (m *MockFormatLogger) Tracef(format string, v ...interface{}) {
method Warnf (line 159) | func (m *MockFormatLogger) Warnf(format string, v ...interface{}) {
type MockFormatLoggerMockRecorder (line 40) | type MockFormatLoggerMockRecorder struct
method Debugf (line 67) | func (mr *MockFormatLoggerMockRecorder) Debugf(format interface{}, v ....
method Errorf (line 84) | func (mr *MockFormatLoggerMockRecorder) Errorf(format interface{}, v ....
method Fatalf (line 101) | func (mr *MockFormatLoggerMockRecorder) Fatalf(format interface{}, v ....
method Infof (line 118) | func (mr *MockFormatLoggerMockRecorder) Infof(format interface{}, v .....
method Noticef (line 135) | func (mr *MockFormatLoggerMockRecorder) Noticef(format interface{}, v ...
method Tracef (line 152) | func (mr *MockFormatLoggerMockRecorder) Tracef(format interface{}, v ....
method Warnf (line 169) | func (mr *MockFormatLoggerMockRecorder) Warnf(format interface{}, v .....
function NewMockFormatLogger (line 45) | func NewMockFormatLogger(ctrl *gomock.Controller) *MockFormatLogger {
type MockLogger (line 176) | type MockLogger struct
method EXPECT (line 194) | func (m *MockLogger) EXPECT() *MockLoggerMockRecorder {
method Debug (line 199) | func (m *MockLogger) Debug(v ...interface{}) {
method Error (line 215) | func (m *MockLogger) Error(v ...interface{}) {
method Fatal (line 231) | func (m *MockLogger) Fatal(v ...interface{}) {
method Info (line 247) | func (m *MockLogger) Info(v ...interface{}) {
method Notice (line 263) | func (m *MockLogger) Notice(v ...interface{}) {
method Trace (line 279) | func (m *MockLogger) Trace(v ...interface{}) {
method Warn (line 295) | func (m *MockLogger) Warn(v ...interface{}) {
type MockLoggerMockRecorder (line 182) | type MockLoggerMockRecorder struct
method Debug (line 209) | func (mr *MockLoggerMockRecorder) Debug(v ...interface{}) *gomock.Call {
method Error (line 225) | func (mr *MockLoggerMockRecorder) Error(v ...interface{}) *gomock.Call {
method Fatal (line 241) | func (mr *MockLoggerMockRecorder) Fatal(v ...interface{}) *gomock.Call {
method Info (line 257) | func (mr *MockLoggerMockRecorder) Info(v ...interface{}) *gomock.Call {
method Notice (line 273) | func (mr *MockLoggerMockRecorder) Notice(v ...interface{}) *gomock.Call {
method Trace (line 289) | func (mr *MockLoggerMockRecorder) Trace(v ...interface{}) *gomock.Call {
method Warn (line 305) | func (mr *MockLoggerMockRecorder) Warn(v ...interface{}) *gomock.Call {
function NewMockLogger (line 187) | func NewMockLogger(ctrl *gomock.Controller) *MockLogger {
type MockCtxLogger (line 311) | type MockCtxLogger struct
method EXPECT (line 329) | func (m *MockCtxLogger) EXPECT() *MockCtxLoggerMockRecorder {
method CtxDebugf (line 334) | func (m *MockCtxLogger) CtxDebugf(ctx context.Context, format string, ...
method CtxErrorf (line 351) | func (m *MockCtxLogger) CtxErrorf(ctx context.Context, format string, ...
method CtxFatalf (line 368) | func (m *MockCtxLogger) CtxFatalf(ctx context.Context, format string, ...
method CtxInfof (line 385) | func (m *MockCtxLogger) CtxInfof(ctx context.Context, format string, v...
method CtxNoticef (line 402) | func (m *MockCtxLogger) CtxNoticef(ctx context.Context, format string,...
method CtxTracef (line 419) | func (m *MockCtxLogger) CtxTracef(ctx context.Context, format string, ...
method CtxWarnf (line 436) | func (m *MockCtxLogger) CtxWarnf(ctx context.Context, format string, v...
type MockCtxLoggerMockRecorder (line 317) | type MockCtxLoggerMockRecorder struct
method CtxDebugf (line 344) | func (mr *MockCtxLoggerMockRecorder) CtxDebugf(ctx, format interface{}...
method CtxErrorf (line 361) | func (mr *MockCtxLoggerMockRecorder) CtxErrorf(ctx, format interface{}...
method CtxFatalf (line 378) | func (mr *MockCtxLoggerMockRecorder) CtxFatalf(ctx, format interface{}...
method CtxInfof (line 395) | func (mr *MockCtxLoggerMockRecorder) CtxInfof(ctx, format interface{},...
method CtxNoticef (line 412) | func (mr *MockCtxLoggerMockRecorder) CtxNoticef(ctx, format interface{...
method CtxTracef (line 429) | func (mr *MockCtxLoggerMockRecorder) CtxTracef(ctx, format interface{}...
method CtxWarnf (line 446) | func (mr *MockCtxLoggerMockRecorder) CtxWarnf(ctx, format interface{},...
function NewMockCtxLogger (line 322) | func NewMockCtxLogger(ctrl *gomock.Controller) *MockCtxLogger {
type MockControl (line 453) | type MockControl struct
method EXPECT (line 471) | func (m *MockControl) EXPECT() *MockControlMockRecorder {
method SetLevel (line 476) | func (m *MockControl) SetLevel(arg0 klog.Level) {
method SetOutput (line 488) | func (m *MockControl) SetOutput(arg0 io.Writer) {
type MockControlMockRecorder (line 459) | type MockControlMockRecorder struct
method SetLevel (line 482) | func (mr *MockControlMockRecorder) SetLevel(arg0 interface{}) *gomock....
method SetOutput (line 494) | func (mr *MockControlMockRecorder) SetOutput(arg0 interface{}) *gomock...
function NewMockControl (line 464) | func NewMockControl(ctrl *gomock.Controller) *MockControl {
type MockFullLogger (line 500) | type MockFullLogger struct
method EXPECT (line 518) | func (m *MockFullLogger) EXPECT() *MockFullLoggerMockRecorder {
method CtxDebugf (line 523) | func (m *MockFullLogger) CtxDebugf(ctx context.Context, format string,...
method CtxErrorf (line 540) | func (m *MockFullLogger) CtxErrorf(ctx context.Context, format string,...
method CtxFatalf (line 557) | func (m *MockFullLogger) CtxFatalf(ctx context.Context, format string,...
method CtxInfof (line 574) | func (m *MockFullLogger) CtxInfof(ctx context.Context, format string, ...
method CtxNoticef (line 591) | func (m *MockFullLogger) CtxNoticef(ctx context.Context, format string...
method CtxTracef (line 608) | func (m *MockFullLogger) CtxTracef(ctx context.Context, format string,...
method CtxWarnf (line 625) | func (m *MockFullLogger) CtxWarnf(ctx context.Context, format string, ...
method Debug (line 642) | func (m *MockFullLogger) Debug(v ...interface{}) {
method Debugf (line 658) | func (m *MockFullLogger) Debugf(format string, v ...interface{}) {
method Error (line 675) | func (m *MockFullLogger) Error(v ...interface{}) {
method Errorf (line 691) | func (m *MockFullLogger) Errorf(format string, v ...interface{}) {
method Fatal (line 708) | func (m *MockFullLogger) Fatal(v ...interface{}) {
method Fatalf (line 724) | func (m *MockFullLogger) Fatalf(format string, v ...interface{}) {
method Info (line 741) | func (m *MockFullLogger) Info(v ...interface{}) {
method Infof (line 757) | func (m *MockFullLogger) Infof(format string, v ...interface{}) {
method Notice (line 774) | func (m *MockFullLogger) Notice(v ...interface{}) {
method Noticef (line 790) | func (m *MockFullLogger) Noticef(format string, v ...interface{}) {
method SetLevel (line 807) | func (m *MockFullLogger) SetLevel(arg0 klog.Level) {
method SetOutput (line 819) | func (m *MockFullLogger) SetOutput(arg0 io.Writer) {
method Trace (line 831) | func (m *MockFullLogger) Trace(v ...interface{}) {
method Tracef (line 847) | func (m *MockFullLogger) Tracef(format string, v ...interface{}) {
method Warn (line 864) | func (m *MockFullLogger) Warn(v ...interface{}) {
method Warnf (line 880) | func (m *MockFullLogger) Warnf(format string, v ...interface{}) {
type MockFullLoggerMockRecorder (line 506) | type MockFullLoggerMockRecorder struct
method CtxDebugf (line 533) | func (mr *MockFullLoggerMockRecorder) CtxDebugf(ctx, format interface{...
method CtxErrorf (line 550) | func (mr *MockFullLoggerMockRecorder) CtxErrorf(ctx, format interface{...
method CtxFatalf (line 567) | func (mr *MockFullLoggerMockRecorder) CtxFatalf(ctx, format interface{...
method CtxInfof (line 584) | func (mr *MockFullLoggerMockRecorder) CtxInfof(ctx, format interface{}...
method CtxNoticef (line 601) | func (mr *MockFullLoggerMockRecorder) CtxNoticef(ctx, format interface...
method CtxTracef (line 618) | func (mr *MockFullLoggerMockRecorder) CtxTracef(ctx, format interface{...
method CtxWarnf (line 635) | func (mr *MockFullLoggerMockRecorder) CtxWarnf(ctx, format interface{}...
method Debug (line 652) | func (mr *MockFullLoggerMockRecorder) Debug(v ...interface{}) *gomock....
method Debugf (line 668) | func (mr *MockFullLoggerMockRecorder) Debugf(format interface{}, v ......
method Error (line 685) | func (mr *MockFullLoggerMockRecorder) Error(v ...interface{}) *gomock....
method Errorf (line 701) | func (mr *MockFullLoggerMockRecorder) Errorf(format interface{}, v ......
method Fatal (line 718) | func (mr *MockFullLoggerMockRecorder) Fatal(v ...interface{}) *gomock....
method Fatalf (line 734) | func (mr *MockFullLoggerMockRecorder) Fatalf(format interface{}, v ......
method Info (line 751) | func (mr *MockFullLoggerMockRecorder) Info(v ...interface{}) *gomock.C...
method Infof (line 767) | func (mr *MockFullLoggerMockRecorder) Infof(format interface{}, v ...i...
method Notice (line 784) | func (mr *MockFullLoggerMockRecorder) Notice(v ...interface{}) *gomock...
method Noticef (line 800) | func (mr *MockFullLoggerMockRecorder) Noticef(format interface{}, v .....
method SetLevel (line 813) | func (mr *MockFullLoggerMockRecorder) SetLevel(arg0 interface{}) *gomo...
method SetOutput (line 825) | func (mr *MockFullLoggerMockRecorder) SetOutput(arg0 interface{}) *gom...
method Trace (line 841) | func (mr *MockFullLoggerMockRecorder) Trace(v ...interface{}) *gomock....
method Tracef (line 857) | func (mr *MockFullLoggerMockRecorder) Tracef(format interface{}, v ......
method Warn (line 874) | func (mr *MockFullLoggerMockRecorder) Warn(v ...interface{}) *gomock.C...
method Warnf (line 890) | func (mr *MockFullLoggerMockRecorder) Warnf(format interface{}, v ...i...
function NewMockFullLogger (line 511) | func NewMockFullLogger(ctrl *gomock.Controller) *MockFullLogger {
FILE: internal/mocks/limiter/limiter.go
type MockConcurrencyLimiter (line 33) | type MockConcurrencyLimiter struct
method EXPECT (line 51) | func (m *MockConcurrencyLimiter) EXPECT() *MockConcurrencyLimiterMockR...
method Acquire (line 56) | func (m *MockConcurrencyLimiter) Acquire(ctx context.Context) bool {
method Release (line 70) | func (m *MockConcurrencyLimiter) Release(ctx context.Context) {
method Status (line 82) | func (m *MockConcurrencyLimiter) Status(ctx context.Context) (int, int) {
type MockConcurrencyLimiterMockRecorder (line 39) | type MockConcurrencyLimiterMockRecorder struct
method Acquire (line 64) | func (mr *MockConcurrencyLimiterMockRecorder) Acquire(ctx interface{})...
method Release (line 76) | func (mr *MockConcurrencyLimiterMockRecorder) Release(ctx interface{})...
method Status (line 91) | func (mr *MockConcurrencyLimiterMockRecorder) Status(ctx interface{}) ...
function NewMockConcurrencyLimiter (line 44) | func NewMockConcurrencyLimiter(ctrl *gomock.Controller) *MockConcurrency...
type MockRateLimiter (line 97) | type MockRateLimiter struct
method EXPECT (line 115) | func (m *MockRateLimiter) EXPECT() *MockRateLimiterMockRecorder {
method Acquire (line 120) | func (m *MockRateLimiter) Acquire(ctx context.Context) bool {
method Status (line 134) | func (m *MockRateLimiter) Status(ctx context.Context) (int, int, time....
type MockRateLimiterMockRecorder (line 103) | type MockRateLimiterMockRecorder struct
method Acquire (line 128) | func (mr *MockRateLimiterMockRecorder) Acquire(ctx interface{}) *gomoc...
method Status (line 144) | func (mr *MockRateLimiterMockRecorder) Status(ctx interface{}) *gomock...
function NewMockRateLimiter (line 108) | func NewMockRateLimiter(ctrl *gomock.Controller) *MockRateLimiter {
type MockUpdatable (line 150) | type MockUpdatable struct
method EXPECT (line 168) | func (m *MockUpdatable) EXPECT() *MockUpdatableMockRecorder {
method UpdateLimit (line 173) | func (m *MockUpdatable) UpdateLimit(limit int) {
type MockUpdatableMockRecorder (line 156) | type MockUpdatableMockRecorder struct
method UpdateLimit (line 179) | func (mr *MockUpdatableMockRecorder) UpdateLimit(limit interface{}) *g...
function NewMockUpdatable (line 161) | func NewMockUpdatable(ctrl *gomock.Controller) *MockUpdatable {
type MockLimitReporter (line 185) | type MockLimitReporter struct
method EXPECT (line 203) | func (m *MockLimitReporter) EXPECT() *MockLimitReporterMockRecorder {
method ConnOverloadReport (line 208) | func (m *MockLimitReporter) ConnOverloadReport() {
method QPSOverloadReport (line 220) | func (m *MockLimitReporter) QPSOverloadReport() {
type MockLimitReporterMockRecorder (line 191) | type MockLimitReporterMockRecorder struct
method ConnOverloadReport (line 214) | func (mr *MockLimitReporterMockRecorder) ConnOverloadReport() *gomock....
method QPSOverloadReport (line 226) | func (mr *MockLimitReporterMockRecorder) QPSOverloadReport() *gomock.C...
function NewMockLimitReporter (line 196) | func NewMockLimitReporter(ctrl *gomock.Controller) *MockLimitReporter {
FILE: internal/mocks/loadbalance/loadbalancer.go
type MockPicker (line 34) | type MockPicker struct
method EXPECT (line 52) | func (m *MockPicker) EXPECT() *MockPickerMockRecorder {
method Next (line 57) | func (m *MockPicker) Next(ctx context.Context, request interface{}) di...
type MockPickerMockRecorder (line 40) | type MockPickerMockRecorder struct
method Next (line 65) | func (mr *MockPickerMockRecorder) Next(ctx, request interface{}) *gomo...
function NewMockPicker (line 45) | func NewMockPicker(ctrl *gomock.Controller) *MockPicker {
type MockLoadbalancer (line 71) | type MockLoadbalancer struct
method EXPECT (line 89) | func (m *MockLoadbalancer) EXPECT() *MockLoadbalancerMockRecorder {
method GetPicker (line 94) | func (m *MockLoadbalancer) GetPicker(arg0 discovery.Result) loadbalanc...
method Name (line 108) | func (m *MockLoadbalancer) Name() string {
type MockLoadbalancerMockRecorder (line 77) | type MockLoadbalancerMockRecorder struct
method GetPicker (line 102) | func (mr *MockLoadbalancerMockRecorder) GetPicker(arg0 interface{}) *g...
method Name (line 116) | func (mr *MockLoadbalancerMockRecorder) Name() *gomock.Call {
function NewMockLoadbalancer (line 82) | func NewMockLoadbalancer(ctrl *gomock.Controller) *MockLoadbalancer {
type MockRebalancer (line 122) | type MockRebalancer struct
method EXPECT (line 140) | func (m *MockRebalancer) EXPECT() *MockRebalancerMockRecorder {
method Delete (line 145) | func (m *MockRebalancer) Delete(arg0 discovery.Change) {
method Rebalance (line 157) | func (m *MockRebalancer) Rebalance(arg0 discovery.Change) {
type MockRebalancerMockRecorder (line 128) | type MockRebalancerMockRecorder struct
method Delete (line 151) | func (mr *MockRebalancerMockRecorder) Delete(arg0 interface{}) *gomock...
method Rebalance (line 163) | func (mr *MockRebalancerMockRecorder) Rebalance(arg0 interface{}) *gom...
function NewMockRebalancer (line 133) | func NewMockRebalancer(ctrl *gomock.Controller) *MockRebalancer {
FILE: internal/mocks/message/message.go
type MockMessage (line 26) | type MockMessage struct
method RPCInfo (line 42) | func (m *MockMessage) RPCInfo() rpcinfo.RPCInfo {
method Data (line 49) | func (m *MockMessage) Data() interface{} {
method NewData (line 56) | func (m *MockMessage) NewData(method string) (ok bool) {
method MessageType (line 63) | func (m *MockMessage) MessageType() (mt remote.MessageType) {
method SetMessageType (line 70) | func (m *MockMessage) SetMessageType(mt remote.MessageType) {
method RPCRole (line 76) | func (m *MockMessage) RPCRole() (r remote.RPCRole) {
method PayloadLen (line 83) | func (m *MockMessage) PayloadLen() int {
method SetPayloadLen (line 90) | func (m *MockMessage) SetPayloadLen(size int) {
method TransInfo (line 96) | func (m *MockMessage) TransInfo() remote.TransInfo {
method Tags (line 103) | func (m *MockMessage) Tags() map[string]interface{} {
method ProtocolInfo (line 110) | func (m *MockMessage) ProtocolInfo() remote.ProtocolInfo {
method PayloadCodec (line 118) | func (m *MockMessage) PayloadCodec() remote.PayloadCodec {
method SetPayloadCodec (line 125) | func (m *MockMessage) SetPayloadCodec(pc remote.PayloadCodec) {
method Recycle (line 131) | func (m *MockMessage) Recycle() {
FILE: internal/mocks/net/net.go
type MockAddr (line 33) | type MockAddr struct
method EXPECT (line 51) | func (m *MockAddr) EXPECT() *MockAddrMockRecorder {
method Network (line 56) | func (m *MockAddr) Network() string {
method String (line 70) | func (m *MockAddr) String() string {
type MockAddrMockRecorder (line 39) | type MockAddrMockRecorder struct
method Network (line 64) | func (mr *MockAddrMockRecorder) Network() *gomock.Call {
method String (line 78) | func (mr *MockAddrMockRecorder) String() *gomock.Call {
function NewMockAddr (line 44) | func NewMockAddr(ctrl *gomock.Controller) *MockAddr {
type MockConn (line 84) | type MockConn struct
method EXPECT (line 102) | func (m *MockConn) EXPECT() *MockConnMockRecorder {
method Close (line 107) | func (m *MockConn) Close() error {
method LocalAddr (line 121) | func (m *MockConn) LocalAddr() net.Addr {
method Read (line 135) | func (m *MockConn) Read(b []byte) (int, error) {
method RemoteAddr (line 150) | func (m *MockConn) RemoteAddr() net.Addr {
method SetDeadline (line 164) | func (m *MockConn) SetDeadline(t time.Time) error {
method SetReadDeadline (line 178) | func (m *MockConn) SetReadDeadline(t time.Time) error {
method SetWriteDeadline (line 192) | func (m *MockConn) SetWriteDeadline(t time.Time) error {
method Write (line 206) | func (m *MockConn) Write(b []byte) (int, error) {
type MockConnMockRecorder (line 90) | type MockConnMockRecorder struct
method Close (line 115) | func (mr *MockConnMockRecorder) Close() *gomock.Call {
method LocalAddr (line 129) | func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call {
method Read (line 144) | func (mr *MockConnMockRecorder) Read(b interface{}) *gomock.Call {
method RemoteAddr (line 158) | func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call {
method SetDeadline (line 172) | func (mr *MockConnMockRecorder) SetDeadline(t interface{}) *gomock.Call {
method SetReadDeadline (line 186) | func (mr *MockConnMockRecorder) SetReadDeadline(t interface{}) *gomock...
method SetWriteDeadline (line 200) | func (mr *MockConnMockRecorder) SetWriteDeadline(t interface{}) *gomoc...
method Write (line 215) | func (mr *MockConnMockRecorder) Write(b interface{}) *gomock.Call {
function NewMockConn (line 95) | func NewMockConn(ctrl *gomock.Controller) *MockConn {
type MockPacketConn (line 221) | type MockPacketConn struct
method EXPECT (line 239) | func (m *MockPacketConn) EXPECT() *MockPacketConnMockRecorder {
method Close (line 244) | func (m *MockPacketConn) Close() error {
method LocalAddr (line 258) | func (m *MockPacketConn) LocalAddr() net.Addr {
method ReadFrom (line 272) | func (m *MockPacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
method SetDeadline (line 288) | func (m *MockPacketConn) SetDeadline(t time.Time) error {
method SetReadDeadline (line 302) | func (m *MockPacketConn) SetReadDeadline(t time.Time) error {
method SetWriteDeadline (line 316) | func (m *MockPacketConn) SetWriteDeadline(t time.Time) error {
method WriteTo (line 330) | func (m *MockPacketConn) WriteTo(p []byte, addr net.Addr) (int, error) {
type MockPacketConnMockRecorder (line 227) | type MockPacketConnMockRecorder struct
method Close (line 252) | func (mr *MockPacketConnMockRecorder) Close() *gomock.Call {
method LocalAddr (line 266) | func (mr *MockPacketConnMockRecorder) LocalAddr() *gomock.Call {
method ReadFrom (line 282) | func (mr *MockPacketConnMockRecorder) ReadFrom(p interface{}) *gomock....
method SetDeadline (line 296) | func (mr *MockPacketConnMockRecorder) SetDeadline(t interface{}) *gomo...
method SetReadDeadline (line 310) | func (mr *MockPacketConnMockRecorder) SetReadDeadline(t interface{}) *...
method SetWriteDeadline (line 324) | func (mr *MockPacketConnMockRecorder) SetWriteDeadline(t interface{}) ...
method WriteTo (line 339) | func (mr *MockPacketConnMockRecorder) WriteTo(p, addr interface{}) *go...
function NewMockPacketConn (line 232) | func NewMockPacketConn(ctrl *gomock.Controller) *MockPacketConn {
type MockListener (line 345) | type MockListener struct
method EXPECT (line 363) | func (m *MockListener) EXPECT() *MockListenerMockRecorder {
method Accept (line 368) | func (m *MockListener) Accept() (net.Conn, error) {
method Addr (line 383) | func (m *MockListener) Addr() net.Addr {
method Close (line 397) | func (m *MockListener) Close() error {
type MockListenerMockRecorder (line 351) | type MockListenerMockRecorder struct
method Accept (line 377) | func (mr *MockListenerMockRecorder) Accept() *gomock.Call {
method Addr (line 391) | func (mr *MockListenerMockRecorder) Addr() *gomock.Call {
method Close (line 405) | func (mr *MockListenerMockRecorder) Close() *gomock.Call {
function NewMockListener (line 356) | func NewMockListener(ctrl *gomock.Controller) *MockListener {
type MockError (line 411) | type MockError struct
method EXPECT (line 429) | func (m *MockError) EXPECT() *MockErrorMockRecorder {
method Error (line 434) | func (m *MockError) Error() string {
method Temporary (line 448) | func (m *MockError) Temporary() bool {
method Timeout (line 462) | func (m *MockError) Timeout() bool {
type MockErrorMockRecorder (line 417) | type MockErrorMockRecorder struct
method Error (line 442) | func (mr *MockErrorMockRecorder) Error() *gomock.Call {
method Temporary (line 456) | func (mr *MockErrorMockRecorder) Temporary() *gomock.Call {
method Timeout (line 470) | func (mr *MockErrorMockRecorder) Timeout() *gomock.Call {
function NewMockError (line 422) | func NewMockError(ctrl *gomock.Controller) *MockError {
type Mocktimeout (line 476) | type Mocktimeout struct
method EXPECT (line 494) | func (m *Mocktimeout) EXPECT() *MocktimeoutMockRecorder {
method Timeout (line 499) | func (m *Mocktimeout) Timeout() bool {
type MocktimeoutMockRecorder (line 482) | type MocktimeoutMockRecorder struct
method Timeout (line 507) | func (mr *MocktimeoutMockRecorder) Timeout() *gomock.Call {
function NewMocktimeout (line 487) | func NewMocktimeout(ctrl *gomock.Controller) *Mocktimeout {
type Mocktemporary (line 513) | type Mocktemporary struct
method EXPECT (line 531) | func (m *Mocktemporary) EXPECT() *MocktemporaryMockRecorder {
method Temporary (line 536) | func (m *Mocktemporary) Temporary() bool {
type MocktemporaryMockRecorder (line 519) | type MocktemporaryMockRecorder struct
method Temporary (line 544) | func (mr *MocktemporaryMockRecorder) Temporary() *gomock.Call {
function NewMocktemporary (line 524) | func NewMocktemporary(ctrl *gomock.Controller) *Mocktemporary {
type MockbuffersWriter (line 550) | type MockbuffersWriter struct
method EXPECT (line 568) | func (m *MockbuffersWriter) EXPECT() *MockbuffersWriterMockRecorder {
method writeBuffers (line 573) | func (m *MockbuffersWriter) writeBuffers(arg0 *net.Buffers) (int64, er...
type MockbuffersWriterMockRecorder (line 556) | type MockbuffersWriterMockRecorder struct
method writeBuffers (line 582) | func (mr *MockbuffersWriterMockRecorder) writeBuffers(arg0 interface{}...
function NewMockbuffersWriter (line 561) | func NewMockbuffersWriter(ctrl *gomock.Controller) *MockbuffersWriter {
FILE: internal/mocks/netpoll/connection.go
type MockConnection (line 34) | type MockConnection struct
method EXPECT (line 52) | func (m *MockConnection) EXPECT() *MockConnectionMockRecorder {
method AddCloseCallback (line 57) | func (m *MockConnection) AddCloseCallback(callback netpoll.CloseCallba...
method Close (line 71) | func (m *MockConnection) Close() error {
method IsActive (line 85) | func (m *MockConnection) IsActive() bool {
method LocalAddr (line 99) | func (m *MockConnection) LocalAddr() net.Addr {
method Read (line 113) | func (m *MockConnection) Read(b []byte) (int, error) {
method Reader (line 128) | func (m *MockConnection) Reader() netpoll.Reader {
method RemoteAddr (line 142) | func (m *MockConnection) RemoteAddr() net.Addr {
method SetDeadline (line 156) | func (m *MockConnection) SetDeadline(t time.Time) error {
method SetIdleTimeout (line 170) | func (m *MockConnection) SetIdleTimeout(timeout time.Duration) error {
method SetOnRequest (line 184) | func (m *MockConnection) SetOnRequest(on netpoll.OnRequest) error {
method SetReadDeadline (line 198) | func (m *MockConnection) SetReadDeadline(t time.Time) error {
method SetReadTimeout (line 212) | func (m *MockConnection) SetReadTimeout(timeout time.Duration) error {
method SetWriteDeadline (line 226) | func (m *MockConnection) SetWriteDeadline(t time.Time) error {
method SetWriteTimeout (line 240) | func (m *MockConnection) SetWriteTimeout(timeout time.Duration) error {
method Write (line 254) | func (m *MockConnection) Write(b []byte) (int, error) {
method Writer (line 269) | func (m *MockConnection) Writer() netpoll.Writer {
type MockConnectionMockRecorder (line 40) | type MockConnectionMockRecorder struct
method AddCloseCallback (line 65) | func (mr *MockConnectionMockRecorder) AddCloseCallback(callback interf...
method Close (line 79) | func (mr *MockConnectionMockRecorder) Close() *gomock.Call {
method IsActive (line 93) | func (mr *MockConnectionMockRecorder) IsActive() *gomock.Call {
method LocalAddr (line 107) | func (mr *MockConnectionMockRecorder) LocalAddr() *gomock.Call {
method Read (line 122) | func (mr *MockConnectionMockRecorder) Read(b interface{}) *gomock.Call {
method Reader (line 136) | func (mr *MockConnectionMockRecorder) Reader() *gomock.Call {
method RemoteAddr (line 150) | func (mr *MockConnectionMockRecorder) RemoteAddr() *gomock.Call {
method SetDeadline (line 164) | func (mr *MockConnectionMockRecorder) SetDeadline(t interface{}) *gomo...
method SetIdleTimeout (line 178) | func (mr *MockConnectionMockRecorder) SetIdleTimeout(timeout interface...
method SetOnRequest (line 192) | func (mr *MockConnectionMockRecorder) SetOnRequest(on interface{}) *go...
method SetReadDeadline (line 206) | func (mr *MockConnectionMockRecorder) SetReadDeadline(t interface{}) *...
method SetReadTimeout (line 220) | func (mr *MockConnectionMockRecorder) SetReadTimeout(timeout interface...
method SetWriteDeadline (line 234) | func (mr *MockConnectionMockRecorder) SetWriteDeadline(t interface{}) ...
method SetWriteTimeout (line 248) | func (mr *MockConnectionMockRecorder) SetWriteTimeout(timeout interfac...
method Write (line 263) | func (mr *MockConnectionMockRecorder) Write(b interface{}) *gomock.Call {
method Writer (line 277) | func (mr *MockConnectionMockRecorder) Writer() *gomock.Call {
function NewMockConnection (line 45) | func NewMockConnection(ctrl *gomock.Controller) *MockConnection {
type MockConn (line 283) | type MockConn struct
method EXPECT (line 301) | func (m *MockConn) EXPECT() *MockConnMockRecorder {
method Close (line 306) | func (m *MockConn) Close() error {
method Fd (line 320) | func (m *MockConn) Fd() int {
method LocalAddr (line 334) | func (m *MockConn) LocalAddr() net.Addr {
method Read (line 348) | func (m *MockConn) Read(b []byte) (int, error) {
method RemoteAddr (line 363) | func (m *MockConn) RemoteAddr() net.Addr {
method SetDeadline (line 377) | func (m *MockConn) SetDeadline(t time.Time) error {
method SetReadDeadline (line 391) | func (m *MockConn) SetReadDeadline(t time.Time) error {
method SetWriteDeadline (line 405) | func (m *MockConn) SetWriteDeadline(t time.Time) error {
method Write (line 419) | func (m *MockConn) Write(b []byte) (int, error) {
type MockConnMockRecorder (line 289) | type MockConnMockRecorder struct
method Close (line 314) | func (mr *MockConnMockRecorder) Close() *gomock.Call {
method Fd (line 328) | func (mr *MockConnMockRecorder) Fd() *gomock.Call {
method LocalAddr (line 342) | func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call {
method Read (line 357) | func (mr *MockConnMockRecorder) Read(b interface{}) *gomock.Call {
method RemoteAddr (line 371) | func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call {
method SetDeadline (line 385) | func (mr *MockConnMockRecorder) SetDeadline(t interface{}) *gomock.Call {
method SetReadDeadline (line 399) | func (mr *MockConnMockRecorder) SetReadDeadline(t interface{}) *gomock...
method SetWriteDeadline (line 413) | func (mr *MockConnMockRecorder) SetWriteDeadline(t interface{}) *gomoc...
method Write (line 428) | func (mr *MockConnMockRecorder) Write(b interface{}) *gomock.Call {
function NewMockConn (line 294) | func NewMockConn(ctrl *gomock.Controller) *MockConn {
type MockListener (line 434) | type MockListener struct
method EXPECT (line 452) | func (m *MockListener) EXPECT() *MockListenerMockRecorder {
method Accept (line 457) | func (m *MockListener) Accept() (net.Conn, error) {
method Addr (line 472) | func (m *MockListener) Addr() net.Addr {
method Close (line 486) | func (m *MockListener) Close() error {
method Fd (line 500) | func (m *MockListener) Fd() int {
type MockListenerMockRecorder (line 440) | type MockListenerMockRecorder struct
method Accept (line 466) | func (mr *MockListenerMockRecorder) Accept() *gomock.Call {
method Addr (line 480) | func (mr *MockListenerMockRecorder) Addr() *gomock.Call {
method Close (line 494) | func (mr *MockListenerMockRecorder) Close() *gomock.Call {
method Fd (line 508) | func (mr *MockListenerMockRecorder) Fd() *gomock.Call {
function NewMockListener (line 445) | func NewMockListener(ctrl *gomock.Controller) *MockListener {
type MockDialer (line 514) | type MockDialer struct
method EXPECT (line 532) | func (m *MockDialer) EXPECT() *MockDialerMockRecorder {
method DialConnection (line 537) | func (m *MockDialer) DialConnection(network, address string, timeout t...
method DialTimeout (line 552) | func (m *MockDialer) DialTimeout(network, address string, timeout time...
type MockDialerMockRecorder (line 520) | type MockDialerMockRecorder struct
method DialConnection (line 546) | func (mr *MockDialerMockRecorder) DialConnection(network, address, tim...
method DialTimeout (line 561) | func (mr *MockDialerMockRecorder) DialTimeout(network, address, timeou...
function NewMockDialer (line 525) | func NewMockDialer(ctrl *gomock.Controller) *MockDialer {
FILE: internal/mocks/netpoll/nocopy.go
type MockReader (line 31) | type MockReader struct
method EXPECT (line 49) | func (m *MockReader) EXPECT() *MockReaderMockRecorder {
method Len (line 54) | func (m *MockReader) Len() int {
method Next (line 68) | func (m *MockReader) Next(n int) ([]byte, error) {
method Peek (line 83) | func (m *MockReader) Peek(n int) ([]byte, error) {
method ReadBinary (line 98) | func (m *MockReader) ReadBinary(n int) ([]byte, error) {
method ReadByte (line 113) | func (m *MockReader) ReadByte() (byte, error) {
method ReadString (line 128) | func (m *MockReader) ReadString(n int) (string, error) {
method Release (line 143) | func (m *MockReader) Release() error {
method Skip (line 157) | func (m *MockReader) Skip(n int) error {
method Slice (line 171) | func (m *MockReader) Slice(n int) (netpoll.Reader, error) {
method Until (line 186) | func (m *MockReader) Until(delim byte) ([]byte, error) {
type MockReaderMockRecorder (line 37) | type MockReaderMockRecorder struct
method Len (line 62) | func (mr *MockReaderMockRecorder) Len() *gomock.Call {
method Next (line 77) | func (mr *MockReaderMockRecorder) Next(n interface{}) *gomock.Call {
method Peek (line 92) | func (mr *MockReaderMockRecorder) Peek(n interface{}) *gomock.Call {
method ReadBinary (line 107) | func (mr *MockReaderMockRecorder) ReadBinary(n interface{}) *gomock.Ca...
method ReadByte (line 122) | func (mr *MockReaderMockRecorder) ReadByte() *gomock.Call {
method ReadString (line 137) | func (mr *MockReaderMockRecorder) ReadString(n interface{}) *gomock.Ca...
method Release (line 151) | func (mr *MockReaderMockRecorder) Release() *gomock.Call {
method Skip (line 165) | func (mr *MockReaderMockRecorder) Skip(n interface{}) *gomock.Call {
method Slice (line 180) | func (mr *MockReaderMockRecorder) Slice(n interface{}) *gomock.Call {
method Until (line 195) | func (mr *MockReaderMockRecorder) Until(delim interface{}) *gomock.Call {
function NewMockReader (line 42) | func NewMockReader(ctrl *gomock.Controller) *MockReader {
type MockWriter (line 201) | type MockWriter struct
method EXPECT (line 219) | func (m *MockWriter) EXPECT() *MockWriterMockRecorder {
method Append (line 224) | func (m *MockWriter) Append(w netpoll.Writer) error {
method Flush (line 238) | func (m *MockWriter) Flush() error {
method Malloc (line 252) | func (m *MockWriter) Malloc(n int) ([]byte, error) {
method MallocAck (line 267) | func (m *MockWriter) MallocAck(n int) error {
method MallocLen (line 281) | func (m *MockWriter) MallocLen() int {
method WriteBinary (line 295) | func (m *MockWriter) WriteBinary(b []byte) (int, error) {
method WriteByte (line 310) | func (m *MockWriter) WriteByte(b byte) error {
method WriteDirect (line 324) | func (m *MockWriter) WriteDirect(p []byte, remainCap int) error {
method WriteString (line 338) | func (m *MockWriter) WriteString(s string) (int, error) {
type MockWriterMockRecorder (line 207) | type MockWriterMockRecorder struct
method Append (line 232) | func (mr *MockWriterMockRecorder) Append(w interface{}) *gomock.Call {
method Flush (line 246) | func (mr *MockWriterMockRecorder) Flush() *gomock.Call {
method Malloc (line 261) | func (mr *MockWriterMockRecorder) Malloc(n interface{}) *gomock.Call {
method MallocAck (line 275) | func (mr *MockWriterMockRecorder) MallocAck(n interface{}) *gomock.Call {
method MallocLen (line 289) | func (mr *MockWriterMockRecorder) MallocLen() *gomock.Call {
method WriteBinary (line 304) | func (mr *MockWriterMockRecorder) WriteBinary(b interface{}) *gomock.C...
method WriteByte (line 318) | func (mr *MockWriterMockRecorder) WriteByte(b interface{}) *gomock.Call {
method WriteDirect (line 332) | func (mr *MockWriterMockRecorder) WriteDirect(p, remainCap interface{}...
method WriteString (line 347) | func (mr *MockWriterMockRecorder) WriteString(s interface{}) *gomock.C...
function NewMockWriter (line 212) | func NewMockWriter(ctrl *gomock.Controller) *MockWriter {
type MockReadWriter (line 353) | type MockReadWriter struct
method EXPECT (line 371) | func (m *MockReadWriter) EXPECT() *MockReadWriterMockRecorder {
method Append (line 376) | func (m *MockReadWriter) Append(w netpoll.Writer) error {
method Flush (line 390) | func (m *MockReadWriter) Flush() error {
method Len (line 404) | func (m *MockReadWriter) Len() int {
method Malloc (line 418) | func (m *MockReadWriter) Malloc(n int) ([]byte, error) {
method MallocAck (line 433) | func (m *MockReadWriter) MallocAck(n int) error {
method MallocLen (line 447) | func (m *MockReadWriter) MallocLen() int {
method Next (line 461) | func (m *MockReadWriter) Next(n int) ([]byte, error) {
method Peek (line 476) | func (m *MockReadWriter) Peek(n int) ([]byte, error) {
method ReadBinary (line 491) | func (m *MockReadWriter) ReadBinary(n int) ([]byte, error) {
method ReadByte (line 506) | func (m *MockReadWriter) ReadByte() (byte, error) {
method ReadString (line 521) | func (m *MockReadWriter) ReadString(n int) (string, error) {
method Release (line 536) | func (m *MockReadWriter) Release() error {
method Skip (line 550) | func (m *MockReadWriter) Skip(n int) error {
method Slice (line 564) | func (m *MockReadWriter) Slice(n int) (netpoll.Reader, error) {
method Until (line 579) | func (m *MockReadWriter) Until(delim byte) ([]byte, error) {
method WriteBinary (line 594) | func (m *MockReadWriter) WriteBinary(b []byte) (int, error) {
method WriteByte (line 609) | func (m *MockReadWriter) WriteByte(b byte) error {
method WriteDirect (line 623) | func (m *MockReadWriter) WriteDirect(p []byte, remainCap int) error {
method WriteString (line 637) | func (m *MockReadWriter) WriteString(s string) (int, error) {
type MockReadWriterMockRecorder (line 359) | type MockReadWriterMockRecorder struct
method Append (line 384) | func (mr *MockReadWriterMockRecorder) Append(w interface{}) *gomock.Ca...
method Flush (line 398) | func (mr *MockReadWriterMockRecorder) Flush() *gomock.Call {
method Len (line 412) | func (mr *MockReadWriterMockRecorder) Len() *gomock.Call {
method Malloc (line 427) | func (mr *MockReadWriterMockRecorder) Malloc(n interface{}) *gomock.Ca...
method MallocAck (line 441) | func (mr *MockReadWriterMockRecorder) MallocAck(n interface{}) *gomock...
method MallocLen (line 455) | func (mr *MockReadWriterMockRecorder) MallocLen() *gomock.Call {
method Next (line 470) | func (mr *MockReadWriterMockRecorder) Next(n interface{}) *gomock.Call {
method Peek (line 485) | func (mr *MockReadWriterMockRecorder) Peek(n interface{}) *gomock.Call {
method ReadBinary (line 500) | func (mr *MockReadWriterMockRecorder) ReadBinary(n interface{}) *gomoc...
method ReadByte (line 515) | func (mr *MockReadWriterMockRecorder) ReadByte() *gomock.Call {
method ReadString (line 530) | func (mr *MockReadWriterMockRecorder) ReadString(n interface{}) *gomoc...
method Release (line 544) | func (mr *MockReadWriterMockRecorder) Release() *gomock.Call {
method Skip (line 558) | func (mr *MockReadWriterMockRecorder) Skip(n interface{}) *gomock.Call {
method Slice (line 573) | func (mr *MockReadWriterMockRecorder) Slice(n interface{}) *gomock.Call {
method Until (line 588) | func (mr *MockReadWriterMockRecorder) Until(delim interface{}) *gomock...
method WriteBinary (line 603) | func (mr *MockReadWriterMockRecorder) WriteBinary(b interface{}) *gomo...
method WriteByte (line 617) | func (mr *MockReadWriterMockRecorder) WriteByte(b interface{}) *gomock...
method WriteDirect (line 631) | func (mr *MockReadWriterMockRecorder) WriteDirect(p, remainCap interfa...
method WriteString (line 646) | func (mr *MockReadWriterMockRecorder) WriteString(s interface{}) *gomo...
function NewMockReadWriter (line 364) | func NewMockReadWriter(ctrl *gomock.Controller) *MockReadWriter {
FILE: internal/mocks/proto/kitex_gen/pbapi/mock/client.go
type Client (line 32) | type Client interface
type StreamClient (line 40) | type StreamClient interface
type Mock_ClientStreamingTestClient (line 46) | type Mock_ClientStreamingTestClient interface
type Mock_ServerStreamingTestClient (line 52) | type Mock_ServerStreamingTestClient interface
type Mock_BidirectionalStreamingTestClient (line 57) | type Mock_BidirectionalStreamingTestClient interface
function NewClient (line 64) | func NewClient(destService string, opts ...client.Option) (Client, error) {
function MustNewClient (line 82) | func MustNewClient(destService string, opts ...client.Option) Client {
type kMockClient (line 90) | type kMockClient struct
method UnaryTest (line 94) | func (p *kMockClient) UnaryTest(ctx context.Context, Req *MockReq, cal...
method ClientStreamingTest (line 99) | func (p *kMockClient) ClientStreamingTest(ctx context.Context, callOpt...
method ServerStreamingTest (line 104) | func (p *kMockClient) ServerStreamingTest(ctx context.Context, Req *Mo...
method BidirectionalStreamingTest (line 109) | func (p *kMockClient) BidirectionalStreamingTest(ctx context.Context, ...
function NewStreamClient (line 115) | func NewStreamClient(destService string, opts ...streamclient.Option) (S...
function MustNewStreamClient (line 132) | func MustNewStreamClient(destService string, opts ...streamclient.Option...
type kMockStreamClient (line 140) | type kMockStreamClient struct
method ClientStreamingTest (line 144) | func (p *kMockStreamClient) ClientStreamingTest(ctx context.Context, c...
method ServerStreamingTest (line 149) | func (p *kMockStreamClient) ServerStreamingTest(ctx context.Context, R...
method BidirectionalStreamingTest (line 154) | func (p *kMockStreamClient) BidirectionalStreamingTest(ctx context.Con...
FILE: internal/mocks/proto/kitex_gen/pbapi/mock/invoker.go
function NewInvoker (line 26) | func NewInvoker(handler Mock, opts ...server.Option) server.Invoker {
FILE: internal/mocks/proto/kitex_gen/pbapi/mock/mock.go
function serviceInfo (line 71) | func serviceInfo() *kitex.ServiceInfo {
function serviceInfoForStreamClient (line 76) | func serviceInfoForStreamClient() *kitex.ServiceInfo {
function serviceInfoForClient (line 81) | func serviceInfoForClient() *kitex.ServiceInfo {
function NewServiceInfo (line 86) | func NewServiceInfo() *kitex.ServiceInfo {
function NewServiceInfoForClient (line 91) | func NewServiceInfoForClient() *kitex.ServiceInfo {
function NewServiceInfoForStreamClient (line 94) | func NewServiceInfoForStreamClient() *kitex.ServiceInfo {
function newServiceInfo (line 98) | func newServiceInfo(hasStreaming bool, keepStreamingMethods bool, keepNo...
function unaryTestHandler (line 128) | func unaryTestHandler(ctx context.Context, handler interface{}, arg, res...
function newUnaryTestArgs (line 153) | func newUnaryTestArgs() interface{} {
function newUnaryTestResult (line 157) | func newUnaryTestResult() interface{} {
type UnaryTestArgs (line 161) | type UnaryTestArgs struct
method Marshal (line 165) | func (p *UnaryTestArgs) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 172) | func (p *UnaryTestArgs) Unmarshal(in []byte) error {
method GetReq (line 183) | func (p *UnaryTestArgs) GetReq() *MockReq {
method IsSetReq (line 190) | func (p *UnaryTestArgs) IsSetReq() bool {
method GetFirstArgument (line 194) | func (p *UnaryTestArgs) GetFirstArgument() interface{} {
type UnaryTestResult (line 198) | type UnaryTestResult struct
method Marshal (line 204) | func (p *UnaryTestResult) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 211) | func (p *UnaryTestResult) Unmarshal(in []byte) error {
method GetSuccess (line 220) | func (p *UnaryTestResult) GetSuccess() *MockResp {
method SetSuccess (line 227) | func (p *UnaryTestResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 231) | func (p *UnaryTestResult) IsSetSuccess() bool {
method GetResult (line 235) | func (p *UnaryTestResult) GetResult() interface{} {
function clientStreamingTestHandler (line 239) | func clientStreamingTestHandler(ctx context.Context, handler interface{}...
type mockClientStreamingTestClient (line 249) | type mockClientStreamingTestClient struct
method DoFinish (line 253) | func (x *mockClientStreamingTestClient) DoFinish(err error) {
method Send (line 260) | func (x *mockClientStreamingTestClient) Send(m *MockReq) error {
method CloseAndRecv (line 263) | func (x *mockClientStreamingTestClient) CloseAndRecv() (*MockResp, err...
type mockClientStreamingTestServer (line 271) | type mockClientStreamingTestServer struct
method SendAndClose (line 275) | func (x *mockClientStreamingTestServer) SendAndClose(m *MockResp) error {
method Recv (line 279) | func (x *mockClientStreamingTestServer) Recv() (*MockReq, error) {
function newClientStreamingTestArgs (line 284) | func newClientStreamingTestArgs() interface{} {
function newClientStreamingTestResult (line 288) | func newClientStreamingTestResult() interface{} {
type ClientStreamingTestArgs (line 292) | type ClientStreamingTestArgs struct
method Marshal (line 296) | func (p *ClientStreamingTestArgs) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 303) | func (p *ClientStreamingTestArgs) Unmarshal(in []byte) error {
method GetReq (line 314) | func (p *ClientStreamingTestArgs) GetReq() *MockReq {
method IsSetReq (line 321) | func (p *ClientStreamingTestArgs) IsSetReq() bool {
method GetFirstArgument (line 325) | func (p *ClientStreamingTestArgs) GetFirstArgument() interface{} {
type ClientStreamingTestResult (line 329) | type ClientStreamingTestResult struct
method Marshal (line 335) | func (p *ClientStreamingTestResult) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 342) | func (p *ClientStreamingTestResult) Unmarshal(in []byte) error {
method GetSuccess (line 351) | func (p *ClientStreamingTestResult) GetSuccess() *MockResp {
method SetSuccess (line 358) | func (p *ClientStreamingTestResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 362) | func (p *ClientStreamingTestResult) IsSetSuccess() bool {
method GetResult (line 366) | func (p *ClientStreamingTestResult) GetResult() interface{} {
function serverStreamingTestHandler (line 370) | func serverStreamingTestHandler(ctx context.Context, handler interface{}...
type mockServerStreamingTestClient (line 384) | type mockServerStreamingTestClient struct
method DoFinish (line 388) | func (x *mockServerStreamingTestClient) DoFinish(err error) {
method Recv (line 395) | func (x *mockServerStreamingTestClient) Recv() (*MockResp, error) {
type mockServerStreamingTestServer (line 400) | type mockServerStreamingTestServer struct
method Send (line 404) | func (x *mockServerStreamingTestServer) Send(m *MockResp) error {
function newServerStreamingTestArgs (line 408) | func newServerStreamingTestArgs() interface{} {
function newServerStreamingTestResult (line 412) | func newServerStreamingTestResult() interface{} {
type ServerStreamingTestArgs (line 416) | type ServerStreamingTestArgs struct
method Marshal (line 420) | func (p *ServerStreamingTestArgs) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 427) | func (p *ServerStreamingTestArgs) Unmarshal(in []byte) error {
method GetReq (line 438) | func (p *ServerStreamingTestArgs) GetReq() *MockReq {
method IsSetReq (line 445) | func (p *ServerStreamingTestArgs) IsSetReq() bool {
method GetFirstArgument (line 449) | func (p *ServerStreamingTestArgs) GetFirstArgument() interface{} {
type ServerStreamingTestResult (line 453) | type ServerStreamingTestResult struct
method Marshal (line 459) | func (p *ServerStreamingTestResult) Marshal(out []byte) ([]byte, error) {
method Unmarshal (line 466) | func (p *ServerStreamingTestResult) Unmarshal(in []byte) error {
method GetSuccess (line 475) | func (p *ServerStreamingTestResult) GetSuccess() *MockResp {
method SetSuccess (line 482) | func (p *ServerStreamingTestResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 486) | func (p *ServerStreamingTestResult) IsSetSuccess() bool {
method GetResult (line 490) | func (p *ServerStreamingTestResult) GetResult() interface{} {
function bidirectionalStreamingTestHandler (line 494) | func bidirectionalStreamingTestHandler(ctx context.Context, handler inte...
type mockBidirectionalStreamingTestClient (line 504) | type mockBidirectionalStreamingTestClient struct
method DoFinish (line 508) | func (x *mockBidirectionalStreamingTestClient) DoFinish(err error) {
method Send (line 515) | func (x *mockBidirectionalStreamingTestClient) Send(m *MockReq) error {
method Recv (line 518) | func (x *mockBidirectionalStreamingTestClient) Recv() (*MockResp, erro...
type mockBidirectionalStreamingTestServer (line 523) | type mockBidirectionalStreamingTestServer struct
method Send (line 527) | func (x *mockBidirectionalStreamingTestServer) Send(m *MockResp) error {
method Recv (line 531) | func (x *mockBidirectionalStreamingTestServer) Recv() (*MockReq, error) {
function newBidirectionalStreamingTestArgs (line 536) | func newBidirectionalStreamingTestArgs() interface{} {
function newBidirectionalStreamingTestResult (line 540) | func newBidirectionalStreamingTestResult() interface{} {
type BidirectionalStreamingTestArgs (line 544) | type BidirectionalStreamingTestArgs struct
method Marshal (line 548) | func (p *BidirectionalStreamingTestArgs) Marshal(out []byte) ([]byte, ...
method Unmarshal (line 555) | func (p *BidirectionalStreamingTestArgs) Unmarshal(in []byte) error {
method GetReq (line 566) | func (p *BidirectionalStreamingTestArgs) GetReq() *MockReq {
method IsSetReq (line 573) | func (p *BidirectionalStreamingTestArgs) IsSetReq() bool {
method GetFirstArgument (line 577) | func (p *BidirectionalStreamingTestArgs) GetFirstArgument() interface{} {
type BidirectionalStreamingTestResult (line 581) | type BidirectionalStreamingTestResult struct
method Marshal (line 587) | func (p *BidirectionalStreamingTestResult) Marshal(out []byte) ([]byte...
method Unmarshal (line 594) | func (p *BidirectionalStreamingTestResult) Unmarshal(in []byte) error {
method GetSuccess (line 603) | func (p *BidirectionalStreamingTestResult) GetSuccess() *MockResp {
method SetSuccess (line 610) | func (p *BidirectionalStreamingTestResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 614) | func (p *BidirectionalStreamingTestResult) IsSetSuccess() bool {
method GetResult (line 618) | func (p *BidirectionalStreamingTestResult) GetResult() interface{} {
type kClient (line 622) | type kClient struct
method UnaryTest (line 632) | func (p *kClient) UnaryTest(ctx context.Context, Req *MockReq) (r *Moc...
method ClientStreamingTest (line 642) | func (p *kClient) ClientStreamingTest(ctx context.Context) (Mock_Clien...
method ServerStreamingTest (line 656) | func (p *kClient) ServerStreamingTest(ctx context.Context, req *MockRe...
method BidirectionalStreamingTest (line 677) | func (p *kClient) BidirectionalStreamingTest(ctx context.Context) (Moc...
function newServiceClient (line 626) | func newServiceClient(c client.Client) *kClient {
FILE: internal/mocks/proto/kitex_gen/pbapi/mock/pbapi.pb.go
constant _ (line 36) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 38) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type MockReq (line 41) | type MockReq struct
method Reset (line 49) | func (x *MockReq) Reset() {
method String (line 58) | func (x *MockReq) String() string {
method ProtoMessage (line 62) | func (*MockReq) ProtoMessage() {}
method ProtoReflect (line 64) | func (x *MockReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 77) | func (*MockReq) Descriptor() ([]byte, []int) {
method GetMessage (line 81) | func (x *MockReq) GetMessage() string {
type MockResp (line 88) | type MockResp struct
method Reset (line 96) | func (x *MockResp) Reset() {
method String (line 105) | func (x *MockResp) String() string {
method ProtoMessage (line 109) | func (*MockResp) ProtoMessage() {}
method ProtoReflect (line 111) | func (x *MockResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 124) | func (*MockResp) Descriptor() ([]byte, []int) {
method GetMessage (line 128) | func (x *MockResp) GetMessage() string {
function file_pbapi_proto_rawDescGZIP (line 171) | func file_pbapi_proto_rawDescGZIP() []byte {
function init (line 199) | func init() { file_pbapi_proto_init() }
function file_pbapi_proto_init (line 200) | func file_pbapi_proto_init() {
type Mock (line 254) | type Mock interface
type Mock_ClientStreamingTestServer (line 261) | type Mock_ClientStreamingTestServer interface
type Mock_ServerStreamingTestServer (line 267) | type Mock_ServerStreamingTestServer interface
type Mock_BidirectionalStreamingTestServer (line 272) | type Mock_BidirectionalStreamingTestServer interface
FILE: internal/mocks/proto/kitex_gen/pbapi/mock/server.go
function NewServer (line 25) | func NewServer(handler Mock, opts ...server.Option) server.Server {
function RegisterService (line 37) | func RegisterService(svr server.Server, handler Mock, opts ...server.Reg...
FILE: internal/mocks/proxy/proxy.go
type MockForwardProxy (line 35) | type MockForwardProxy struct
method EXPECT (line 53) | func (m *MockForwardProxy) EXPECT() *MockForwardProxyMockRecorder {
method Configure (line 58) | func (m *MockForwardProxy) Configure(arg0 *proxy.Config) error {
method ResolveProxyInstance (line 72) | func (m *MockForwardProxy) ResolveProxyInstance(ctx context.Context) e...
type MockForwardProxyMockRecorder (line 41) | type MockForwardProxyMockRecorder struct
method Configure (line 66) | func (mr *MockForwardProxyMockRecorder) Configure(arg0 interface{}) *g...
method ResolveProxyInstance (line 80) | func (mr *MockForwardProxyMockRecorder) ResolveProxyInstance(ctx inter...
function NewMockForwardProxy (line 46) | func NewMockForwardProxy(ctrl *gomock.Controller) *MockForwardProxy {
type MockWithMiddleware (line 86) | type MockWithMiddleware struct
method EXPECT (line 104) | func (m *MockWithMiddleware) EXPECT() *MockWithMiddlewareMockRecorder {
method ProxyMiddleware (line 109) | func (m *MockWithMiddleware) ProxyMiddleware() endpoint.Middleware {
type MockWithMiddlewareMockRecorder (line 92) | type MockWithMiddlewareMockRecorder struct
method ProxyMiddleware (line 117) | func (mr *MockWithMiddlewareMockRecorder) ProxyMiddleware() *gomock.Ca...
function NewMockWithMiddleware (line 97) | func NewMockWithMiddleware(ctrl *gomock.Controller) *MockWithMiddleware {
type MockReverseProxy (line 123) | type MockReverseProxy struct
method EXPECT (line 141) | func (m *MockReverseProxy) EXPECT() *MockReverseProxyMockRecorder {
method Replace (line 146) | func (m *MockReverseProxy) Replace(arg0 net.Addr) (net.Addr, error) {
type MockReverseProxyMockRecorder (line 129) | type MockReverseProxyMockRecorder struct
method Replace (line 155) | func (mr *MockReverseProxyMockRecorder) Replace(arg0 interface{}) *gom...
function NewMockReverseProxy (line 134) | func NewMockReverseProxy(ctrl *gomock.Controller) *MockReverseProxy {
type MockContextHandler (line 161) | type MockContextHandler struct
method EXPECT (line 179) | func (m *MockContextHandler) EXPECT() *MockContextHandlerMockRecorder {
method HandleContext (line 184) | func (m *MockContextHandler) HandleContext(arg0 context.Context) conte...
type MockContextHandlerMockRecorder (line 167) | type MockContextHandlerMockRecorder struct
method HandleContext (line 192) | func (mr *MockContextHandlerMockRecorder) HandleContext(arg0 interface...
function NewMockContextHandler (line 172) | func NewMockContextHandler(ctrl *gomock.Controller) *MockContextHandler {
FILE: internal/mocks/remote/bytebuf.go
type MockByteBufferFactory (line 33) | type MockByteBufferFactory struct
method EXPECT (line 51) | func (m *MockByteBufferFactory) EXPECT() *MockByteBufferFactoryMockRec...
method NewByteBuffer (line 56) | func (m *MockByteBufferFactory) NewByteBuffer(conn net.Conn) (remote.B...
type MockByteBufferFactoryMockRecorder (line 39) | type MockByteBufferFactoryMockRecorder struct
method NewByteBuffer (line 65) | func (mr *MockByteBufferFactoryMockRecorder) NewByteBuffer(conn interf...
function NewMockByteBufferFactory (line 44) | func NewMockByteBufferFactory(ctrl *gomock.Controller) *MockByteBufferFa...
type MockNocopyWrite (line 71) | type MockNocopyWrite struct
method EXPECT (line 89) | func (m *MockNocopyWrite) EXPECT() *MockNocopyWriteMockRecorder {
method MallocAck (line 94) | func (m *MockNocopyWrite) MallocAck(n int) error {
method WriteDirect (line 108) | func (m *MockNocopyWrite) WriteDirect(buf []byte, remainCap int) error {
type MockNocopyWriteMockRecorder (line 77) | type MockNocopyWriteMockRecorder struct
method MallocAck (line 102) | func (mr *MockNocopyWriteMockRecorder) MallocAck(n interface{}) *gomoc...
method WriteDirect (line 116) | func (mr *MockNocopyWriteMockRecorder) WriteDirect(buf, remainCap inte...
function NewMockNocopyWrite (line 82) | func NewMockNocopyWrite(ctrl *gomock.Controller) *MockNocopyWrite {
type MockFrameWrite (line 122) | type MockFrameWrite struct
method EXPECT (line 140) | func (m *MockFrameWrite) EXPECT() *MockFrameWriteMockRecorder {
method WriteData (line 145) | func (m *MockFrameWrite) WriteData(buf []byte) error {
method WriteHeader (line 159) | func (m *MockFrameWrite) WriteHeader(buf []byte) error {
type MockFrameWriteMockRecorder (line 128) | type MockFrameWriteMockRecorder struct
method WriteData (line 153) | func (mr *MockFrameWriteMockRecorder) WriteData(buf interface{}) *gomo...
method WriteHeader (line 167) | func (mr *MockFrameWriteMockRecorder) WriteHeader(buf interface{}) *go...
function NewMockFrameWrite (line 133) | func NewMockFrameWrite(ctrl *gomock.Controller) *MockFrameWrite {
type MockByteBuffer (line 173) | type MockByteBuffer struct
method EXPECT (line 191) | func (m *MockByteBuffer) EXPECT() *MockByteBufferMockRecorder {
method AppendBuffer (line 196) | func (m *MockByteBuffer) AppendBuffer(buf remote.ByteBuffer) error {
method Bytes (line 210) | func (m *MockByteBuffer) Bytes() ([]byte, error) {
method Flush (line 225) | func (m *MockByteBuffer) Flush() error {
method Malloc (line 239) | func (m *MockByteBuffer) Malloc(n int) ([]byte, error) {
method NewBuffer (line 254) | func (m *MockByteBuffer) NewBuffer() remote.ByteBuffer {
method Next (line 268) | func (m *MockByteBuffer) Next(n int) ([]byte, error) {
method Peek (line 283) | func (m *MockByteBuffer) Peek(n int) ([]byte, error) {
method Read (line 298) | func (m *MockByteBuffer) Read(p []byte) (int, error) {
method ReadBinary (line 313) | func (m *MockByteBuffer) ReadBinary(p []byte) (int, error) {
method ReadLen (line 328) | func (m *MockByteBuffer) ReadLen() int {
method ReadString (line 342) | func (m *MockByteBuffer) ReadString(n int) (string, error) {
method ReadableLen (line 357) | func (m *MockByteBuffer) ReadableLen() int {
method Release (line 371) | func (m *MockByteBuffer) Release(e error) error {
method Skip (line 385) | func (m *MockByteBuffer) Skip(n int) error {
method Write (line 399) | func (m *MockByteBuffer) Write(p []byte) (int, error) {
method WriteBinary (line 414) | func (m *MockByteBuffer) WriteBinary(b []byte) (int, error) {
method WriteString (line 429) | func (m *MockByteBuffer) WriteString(s string) (int, error) {
method WrittenLen (line 444) | func (m *MockByteBuffer) WrittenLen() int {
type MockByteBufferMockRecorder (line 179) | type MockByteBufferMockRecorder struct
method AppendBuffer (line 204) | func (mr *MockByteBufferMockRecorder) AppendBuffer(buf interface{}) *g...
method Bytes (line 219) | func (mr *MockByteBufferMockRecorder) Bytes() *gomock.Call {
method Flush (line 233) | func (mr *MockByteBufferMockRecorder) Flush() *gomock.Call {
method Malloc (line 248) | func (mr *MockByteBufferMockRecorder) Malloc(n interface{}) *gomock.Ca...
method NewBuffer (line 262) | func (mr *MockByteBufferMockRecorder) NewBuffer() *gomock.Call {
method Next (line 277) | func (mr *MockByteBufferMockRecorder) Next(n interface{}) *gomock.Call {
method Peek (line 292) | func (mr *MockByteBufferMockRecorder) Peek(n interface{}) *gomock.Call {
method Read (line 307) | func (mr *MockByteBufferMockRecorder) Read(p interface{}) *gomock.Call {
method ReadBinary (line 322) | func (mr *MockByteBufferMockRecorder) ReadBinary(p interface{}) *gomoc...
method ReadLen (line 336) | func (mr *MockByteBufferMockRecorder) ReadLen() *gomock.Call {
method ReadString (line 351) | func (mr *MockByteBufferMockRecorder) ReadString(n interface{}) *gomoc...
method ReadableLen (line 365) | func (mr *MockByteBufferMockRecorder) ReadableLen() *gomock.Call {
method Release (line 379) | func (mr *MockByteBufferMockRecorder) Release(e interface{}) *gomock.C...
method Skip (line 393) | func (mr *MockByteBufferMockRecorder) Skip(n interface{}) *gomock.Call {
method Write (line 408) | func (mr *MockByteBufferMockRecorder) Write(p interface{}) *gomock.Call {
method WriteBinary (line 423) | func (mr *MockByteBufferMockRecorder) WriteBinary(b interface{}) *gomo...
method WriteString (line 438) | func (mr *MockByteBufferMockRecorder) WriteString(s interface{}) *gomo...
method WrittenLen (line 452) | func (mr *MockByteBufferMockRecorder) WrittenLen() *gomock.Call {
function NewMockByteBuffer (line 184) | func NewMockByteBuffer(ctrl *gomock.Controller) *MockByteBuffer {
FILE: internal/mocks/remote/codec.go
type MockCodec (line 33) | type MockCodec struct
method EXPECT (line 51) | func (m *MockCodec) EXPECT() *MockCodecMockRecorder {
method Decode (line 56) | func (m *MockCodec) Decode(ctx context.Context, msg remote.Message, in...
method Encode (line 70) | func (m *MockCodec) Encode(ctx context.Context, msg remote.Message, ou...
method Name (line 84) | func (m *MockCodec) Name() string {
type MockCodecMockRecorder (line 39) | type MockCodecMockRecorder struct
method Decode (line 64) | func (mr *MockCodecMockRecorder) Decode(ctx, msg, in interface{}) *gom...
method Encode (line 78) | func (mr *MockCodecMockRecorder) Encode(ctx, msg, out interface{}) *go...
method Name (line 92) | func (mr *MockCodecMockRecorder) Name() *gomock.Call {
function NewMockCodec (line 44) | func NewMockCodec(ctrl *gomock.Controller) *MockCodec {
type MockMetaEncoder (line 98) | type MockMetaEncoder struct
method EXPECT (line 116) | func (m *MockMetaEncoder) EXPECT() *MockMetaEncoderMockRecorder {
method EncodeMetaAndPayload (line 121) | func (m *MockMetaEncoder) EncodeMetaAndPayload(ctx context.Context, ms...
method EncodePayload (line 135) | func (m *MockMetaEncoder) EncodePayload(ctx context.Context, msg remot...
type MockMetaEncoderMockRecorder (line 104) | type MockMetaEncoderMockRecorder struct
method EncodeMetaAndPayload (line 129) | func (mr *MockMetaEncoderMockRecorder) EncodeMetaAndPayload(ctx, msg, ...
method EncodePayload (line 143) | func (mr *MockMetaEncoderMockRecorder) EncodePayload(ctx, msg, out int...
function NewMockMetaEncoder (line 109) | func NewMockMetaEncoder(ctrl *gomock.Controller) *MockMetaEncoder {
type MockMetaDecoder (line 149) | type MockMetaDecoder struct
method EXPECT (line 167) | func (m *MockMetaDecoder) EXPECT() *MockMetaDecoderMockRecorder {
method DecodeMeta (line 172) | func (m *MockMetaDecoder) DecodeMeta(ctx context.Context, msg remote.M...
method DecodePayload (line 186) | func (m *MockMetaDecoder) DecodePayload(ctx context.Context, msg remot...
type MockMetaDecoderMockRecorder (line 155) | type MockMetaDecoderMockRecorder struct
method DecodeMeta (line 180) | func (mr *MockMetaDecoderMockRecorder) DecodeMeta(ctx, msg, in interfa...
method DecodePayload (line 194) | func (mr *MockMetaDecoderMockRecorder) DecodePayload(ctx, msg, in inte...
function NewMockMetaDecoder (line 160) | func NewMockMetaDecoder(ctrl *gomock.Controller) *MockMetaDecoder {
FILE: internal/mocks/remote/conn_wrapper.go
type MockConnReleaser (line 32) | type MockConnReleaser struct
method EXPECT (line 50) | func (m *MockConnReleaser) EXPECT() *MockConnReleaserMockRecorder {
method ReleaseConn (line 55) | func (m *MockConnReleaser) ReleaseConn(err error, ri rpcinfo.RPCInfo) {
type MockConnReleaserMockRecorder (line 38) | type MockConnReleaserMockRecorder struct
method ReleaseConn (line 61) | func (mr *MockConnReleaserMockRecorder) ReleaseConn(err, ri interface{...
function NewMockConnReleaser (line 43) | func NewMockConnReleaser(ctrl *gomock.Controller) *MockConnReleaser {
FILE: internal/mocks/remote/connpool.go
type MockConnPool (line 34) | type MockConnPool struct
method EXPECT (line 52) | func (m *MockConnPool) EXPECT() *MockConnPoolMockRecorder {
method Close (line 57) | func (m *MockConnPool) Close() error {
method Discard (line 71) | func (m *MockConnPool) Discard(conn net.Conn) error {
method Get (line 85) | func (m *MockConnPool) Get(ctx context.Context, network, address strin...
method Put (line 100) | func (m *MockConnPool) Put(conn net.Conn) error {
type MockConnPoolMockRecorder (line 40) | type MockConnPoolMockRecorder struct
method Close (line 65) | func (mr *MockConnPoolMockRecorder) Close() *gomock.Call {
method Discard (line 79) | func (mr *MockConnPoolMockRecorder) Discard(conn interface{}) *gomock....
method Get (line 94) | func (mr *MockConnPoolMockRecorder) Get(ctx, network, address, opt int...
method Put (line 108) | func (mr *MockConnPoolMockRecorder) Put(conn interface{}) *gomock.Call {
function NewMockConnPool (line 45) | func NewMockConnPool(ctrl *gomock.Controller) *MockConnPool {
type MockLongConnPool (line 114) | type MockLongConnPool struct
method EXPECT (line 132) | func (m *MockLongConnPool) EXPECT() *MockLongConnPoolMockRecorder {
method Clean (line 137) | func (m *MockLongConnPool) Clean(network, address string) {
method Close (line 149) | func (m *MockLongConnPool) Close() error {
method Discard (line 163) | func (m *MockLongConnPool) Discard(conn net.Conn) error {
method Get (line 177) | func (m *MockLongConnPool) Get(ctx context.Context, network, address s...
method Put (line 192) | func (m *MockLongConnPool) Put(conn net.Conn) error {
type MockLongConnPoolMockRecorder (line 120) | type MockLongConnPoolMockRecorder struct
method Clean (line 143) | func (mr *MockLongConnPoolMockRecorder) Clean(network, address interfa...
method Close (line 157) | func (mr *MockLongConnPoolMockRecorder) Close() *gomock.Call {
method Discard (line 171) | func (mr *MockLongConnPoolMockRecorder) Discard(conn interface{}) *gom...
method Get (line 186) | func (mr *MockLongConnPoolMockRecorder) Get(ctx, network, address, opt...
method Put (line 200) | func (mr *MockLongConnPoolMockRecorder) Put(conn interface{}) *gomock....
function NewMockLongConnPool (line 125) | func NewMockLongConnPool(ctrl *gomock.Controller) *MockLongConnPool {
type MockConnPoolReporter (line 206) | type MockConnPoolReporter struct
method EXPECT (line 224) | func (m *MockConnPoolReporter) EXPECT() *MockConnPoolReporterMockRecor...
method EnableReporter (line 229) | func (m *MockConnPoolReporter) EnableReporter() {
type MockConnPoolReporterMockRecorder (line 212) | type MockConnPoolReporterMockRecorder struct
method EnableReporter (line 235) | func (mr *MockConnPoolReporterMockRecorder) EnableReporter() *gomock.C...
function NewMockConnPoolReporter (line 217) | func NewMockConnPoolReporter(ctrl *gomock.Controller) *MockConnPoolRepor...
type MockRawConn (line 241) | type MockRawConn struct
method EXPECT (line 259) | func (m *MockRawConn) EXPECT() *MockRawConnMockRecorder {
method RawConn (line 264) | func (m *MockRawConn) RawConn() net.Conn {
type MockRawConnMockRecorder (line 247) | type MockRawConnMockRecorder struct
method RawConn (line 272) | func (mr *MockRawConnMockRecorder) RawConn() *gomock.Call {
function NewMockRawConn (line 252) | func NewMockRawConn(ctrl *gomock.Controller) *MockRawConn {
type MockIsActive (line 278) | type MockIsActive struct
method EXPECT (line 296) | func (m *MockIsActive) EXPECT() *MockIsActiveMockRecorder {
method IsActive (line 301) | func (m *MockIsActive) IsActive() bool {
type MockIsActiveMockRecorder (line 284) | type MockIsActiveMockRecorder struct
method IsActive (line 309) | func (mr *MockIsActiveMockRecorder) IsActive() *gomock.Call {
function NewMockIsActive (line 289) | func NewMockIsActive(ctrl *gomock.Controller) *MockIsActive {
FILE: internal/mocks/remote/dialer.go
type MockDialer (line 33) | type MockDialer struct
method EXPECT (line 51) | func (m *MockDialer) EXPECT() *MockDialerMockRecorder {
method DialTimeout (line 56) | func (m *MockDialer) DialTimeout(network, address string, timeout time...
type MockDialerMockRecorder (line 39) | type MockDialerMockRecorder struct
method DialTimeout (line 65) | func (mr *MockDialerMockRecorder) DialTimeout(network, address, timeou...
function NewMockDialer (line 44) | func NewMockDialer(ctrl *gomock.Controller) *MockDialer {
FILE: internal/mocks/remote/payload_codec.go
type MockPayloadCodec (line 33) | type MockPayloadCodec struct
method EXPECT (line 51) | func (m *MockPayloadCodec) EXPECT() *MockPayloadCodecMockRecorder {
method Marshal (line 56) | func (m *MockPayloadCodec) Marshal(ctx context.Context, message remote...
method Name (line 70) | func (m *MockPayloadCodec) Name() string {
method Unmarshal (line 84) | func (m *MockPayloadCodec) Unmarshal(ctx context.Context, message remo...
type MockPayloadCodecMockRecorder (line 39) | type MockPayloadCodecMockRecorder struct
method Marshal (line 64) | func (mr *MockPayloadCodecMockRecorder) Marshal(ctx, message, out inte...
method Name (line 78) | func (mr *MockPayloadCodecMockRecorder) Name() *gomock.Call {
method Unmarshal (line 92) | func (mr *MockPayloadCodecMockRecorder) Unmarshal(ctx, message, in int...
function NewMockPayloadCodec (line 44) | func NewMockPayloadCodec(ctrl *gomock.Controller) *MockPayloadCodec {
FILE: internal/mocks/remote/servicesearcher.go
type MockSvcSearcher (line 24) | type MockSvcSearcher struct
method SearchService (line 62) | func (s *MockSvcSearcher) SearchService(svcName, methodName string, st...
function NewMockSvcSearcher (line 30) | func NewMockSvcSearcher(svcMap map[string]*serviceinfo.ServiceInfo) *Moc...
function NewDefaultSvcSearcher (line 47) | func NewDefaultSvcSearcher() *MockSvcSearcher {
FILE: internal/mocks/remote/trans_handler.go
type MockClientTransHandlerFactory (line 35) | type MockClientTransHandlerFactory struct
method EXPECT (line 53) | func (m *MockClientTransHandlerFactory) EXPECT() *MockClientTransHandl...
method NewTransHandler (line 58) | func (m *MockClientTransHandlerFactory) NewTransHandler(opt *remote.Cl...
type MockClientTransHandlerFactoryMockRecorder (line 41) | type MockClientTransHandlerFactoryMockRecorder struct
method NewTransHandler (line 67) | func (mr *MockClientTransHandlerFactoryMockRecorder) NewTransHandler(o...
function NewMockClientTransHandlerFactory (line 46) | func NewMockClientTransHandlerFactory(ctrl *gomock.Controller) *MockClie...
type MockServerTransHandlerFactory (line 73) | type MockServerTransHandlerFactory struct
method EXPECT (line 91) | func (m *MockServerTransHandlerFactory) EXPECT() *MockServerTransHandl...
method NewTransHandler (line 96) | func (m *MockServerTransHandlerFactory) NewTransHandler(opt *remote.Se...
type MockServerTransHandlerFactoryMockRecorder (line 79) | type MockServerTransHandlerFactoryMockRecorder struct
method NewTransHandler (line 105) | func (mr *MockServerTransHandlerFactoryMockRecorder) NewTransHandler(o...
function NewMockServerTransHandlerFactory (line 84) | func NewMockServerTransHandlerFactory(ctrl *gomock.Controller) *MockServ...
type MockTransReadWriter (line 111) | type MockTransReadWriter struct
method EXPECT (line 129) | func (m *MockTransReadWriter) EXPECT() *MockTransReadWriterMockRecorder {
method Read (line 134) | func (m *MockTransReadWriter) Read(ctx context.Context, conn net.Conn,...
method Write (line 149) | func (m *MockTransReadWriter) Write(ctx context.Context, conn net.Conn...
type MockTransReadWriterMockRecorder (line 117) | type MockTransReadWriterMockRecorder struct
method Read (line 143) | func (mr *MockTransReadWriterMockRecorder) Read(ctx, conn, msg interfa...
method Write (line 158) | func (mr *MockTransReadWriterMockRecorder) Write(ctx, conn, send inter...
function NewMockTransReadWriter (line 122) | func NewMockTransReadWriter(ctrl *gomock.Controller) *MockTransReadWriter {
type MockTransHandler (line 164) | type MockTransHandler struct
method EXPECT (line 182) | func (m *MockTransHandler) EXPECT() *MockTransHandlerMockRecorder {
method OnError (line 187) | func (m *MockTransHandler) OnError(ctx context.Context, err error, con...
method OnInactive (line 199) | func (m *MockTransHandler) OnInactive(ctx context.Context, conn net.Co...
method OnMessage (line 211) | func (m *MockTransHandler) OnMessage(ctx context.Context, args, result...
method Read (line 226) | func (m *MockTransHandler) Read(ctx context.Context, conn net.Conn, ms...
method SetPipeline (line 241) | func (m *MockTransHandler) SetPipeline(pipeline *remote.TransPipeline) {
method Write (line 253) | func (m *MockTransHandler) Write(ctx context.Context, conn net.Conn, s...
type MockTransHandlerMockRecorder (line 170) | type MockTransHandlerMockRecorder struct
method OnError (line 193) | func (mr *MockTransHandlerMockRecorder) OnError(ctx, err, conn interfa...
method OnInactive (line 205) | func (mr *MockTransHandlerMockRecorder) OnInactive(ctx, conn interface...
method OnMessage (line 220) | func (mr *MockTransHandlerMockRecorder) OnMessage(ctx, args, result in...
method Read (line 235) | func (mr *MockTransHandlerMockRecorder) Read(ctx, conn, msg interface{...
method SetPipeline (line 247) | func (mr *MockTransHandlerMockRecorder) SetPipeline(pipeline interface...
method Write (line 262) | func (mr *MockTransHandlerMockRecorder) Write(ctx, conn, send interfac...
function NewMockTransHandler (line 175) | func NewMockTransHandler(ctrl *gomock.Controller) *MockTransHandler {
type MockClientTransHandler (line 268) | type MockClientTransHandler struct
method EXPECT (line 286) | func (m *MockClientTransHandler) EXPECT() *MockClientTransHandlerMockR...
method OnError (line 291) | func (m *MockClientTransHandler) OnError(ctx context.Context, err erro...
method OnInactive (line 303) | func (m *MockClientTransHandler) OnInactive(ctx context.Context, conn ...
method OnMessage (line 315) | func (m *MockClientTransHandler) OnMessage(ctx context.Context, args, ...
method Read (line 330) | func (m *MockClientTransHandler) Read(ctx context.Context, conn net.Co...
method SetPipeline (line 345) | func (m *MockClientTransHandler) SetPipeline(pipeline *remote.TransPip...
method Write (line 357) | func (m *MockClientTransHandler) Write(ctx context.Context, conn net.C...
type MockClientTransHandlerMockRecorder (line 274) | type MockClientTransHandlerMockRecorder struct
method OnError (line 297) | func (mr *MockClientTransHandlerMockRecorder) OnError(ctx, err, conn i...
method OnInactive (line 309) | func (mr *MockClientTransHandlerMockRecorder) OnInactive(ctx, conn int...
method OnMessage (line 324) | func (mr *MockClientTransHandlerMockRecorder) OnMessage(ctx, args, res...
method Read (line 339) | func (mr *MockClientTransHandlerMockRecorder) Read(ctx, conn, msg inte...
method SetPipeline (line 351) | func (mr *MockClientTransHandlerMockRecorder) SetPipeline(pipeline int...
method Write (line 366) | func (mr *MockClientTransHandlerMockRecorder) Write(ctx, conn, send in...
function NewMockClientTransHandler (line 279) | func NewMockClientTransHandler(ctrl *gomock.Controller) *MockClientTrans...
type MockServerTransHandler (line 372) | type MockServerTransHandler struct
method EXPECT (line 390) | func (m *MockServerTransHandler) EXPECT() *MockServerTransHandlerMockR...
method OnActive (line 395) | func (m *MockServerTransHandler) OnActive(ctx context.Context, conn ne...
method OnError (line 410) | func (m *MockServerTransHandler) OnError(ctx context.Context, err erro...
method OnInactive (line 422) | func (m *MockServerTransHandler) OnInactive(ctx context.Context, conn ...
method OnMessage (line 434) | func (m *MockServerTransHandler) OnMessage(ctx context.Context, args, ...
method OnRead (line 449) | func (m *MockServerTransHandler) OnRead(ctx context.Context, conn net....
method Read (line 463) | func (m *MockServerTransHandler) Read(ctx context.Context, conn net.Co...
method SetPipeline (line 478) | func (m *MockServerTransHandler) SetPipeline(pipeline *remote.TransPip...
method Write (line 490) | func (m *MockServerTransHandler) Write(ctx context.Context, conn net.C...
type MockServerTransHandlerMockRecorder (line 378) | type MockServerTransHandlerMockRecorder struct
method OnActive (line 404) | func (mr *MockServerTransHandlerMockRecorder) OnActive(ctx, conn inter...
method OnError (line 416) | func (mr *MockServerTransHandlerMockRecorder) OnError(ctx, err, conn i...
method OnInactive (line 428) | func (mr *MockServerTransHandlerMockRecorder) OnInactive(ctx, conn int...
method OnMessage (line 443) | func (mr *MockServerTransHandlerMockRecorder) OnMessage(ctx, args, res...
method OnRead (line 457) | func (mr *MockServerTransHandlerMockRecorder) OnRead(ctx, conn interfa...
method Read (line 472) | func (mr *MockServerTransHandlerMockRecorder) Read(ctx, conn, msg inte...
method SetPipeline (line 484) | func (mr *MockServerTransHandlerMockRecorder) SetPipeline(pipeline int...
method Write (line 499) | func (mr *MockServerTransHandlerMockRecorder) Write(ctx, conn, send in...
function NewMockServerTransHandler (line 383) | func NewMockServerTransHandler(ctrl *gomock.Controller) *MockServerTrans...
type MockInvokeHandleFuncSetter (line 505) | type MockInvokeHandleFuncSetter struct
method EXPECT (line 523) | func (m *MockInvokeHandleFuncSetter) EXPECT() *MockInvokeHandleFuncSet...
method SetInvokeHandleFunc (line 528) | func (m *MockInvokeHandleFuncSetter) SetInvokeHandleFunc(inkHdlFunc en...
type MockInvokeHandleFuncSetterMockRecorder (line 511) | type MockInvokeHandleFuncSetterMockRecorder struct
method SetInvokeHandleFunc (line 534) | func (mr *MockInvokeHandleFuncSetterMockRecorder) SetInvokeHandleFunc(...
function NewMockInvokeHandleFuncSetter (line 516) | func NewMockInvokeHandleFuncSetter(ctrl *gomock.Controller) *MockInvokeH...
type MockGracefulShutdown (line 540) | type MockGracefulShutdown struct
method EXPECT (line 558) | func (m *MockGracefulShutdown) EXPECT() *MockGracefulShutdownMockRecor...
method GracefulShutdown (line 563) | func (m *MockGracefulShutdown) GracefulShutdown(ctx context.Context) e...
type MockGracefulShutdownMockRecorder (line 546) | type MockGracefulShutdownMockRecorder struct
method GracefulShutdown (line 571) | func (mr *MockGracefulShutdownMockRecorder) GracefulShutdown(ctx inter...
function NewMockGracefulShutdown (line 551) | func NewMockGracefulShutdown(ctrl *gomock.Controller) *MockGracefulShutd...
FILE: internal/mocks/remote/trans_meta.go
type MockMetaHandler (line 33) | type MockMetaHandler struct
method EXPECT (line 51) | func (m *MockMetaHandler) EXPECT() *MockMetaHandlerMockRecorder {
method ReadMeta (line 56) | func (m *MockMetaHandler) ReadMeta(ctx context.Context, msg remote.Mes...
method WriteMeta (line 71) | func (m *MockMetaHandler) WriteMeta(ctx context.Context, msg remote.Me...
type MockMetaHandlerMockRecorder (line 39) | type MockMetaHandlerMockRecorder struct
method ReadMeta (line 65) | func (mr *MockMetaHandlerMockRecorder) ReadMeta(ctx, msg interface{}) ...
method WriteMeta (line 80) | func (mr *MockMetaHandlerMockRecorder) WriteMeta(ctx, msg interface{})...
function NewMockMetaHandler (line 44) | func NewMockMetaHandler(ctrl *gomock.Controller) *MockMetaHandler {
type MockStreamingMetaHandler (line 86) | type MockStreamingMetaHandler struct
method EXPECT (line 104) | func (m *MockStreamingMetaHandler) EXPECT() *MockStreamingMetaHandlerM...
method OnConnectStream (line 109) | func (m *MockStreamingMetaHandler) OnConnectStream(ctx context.Context...
method OnReadStream (line 124) | func (m *MockStreamingMetaHandler) OnReadStream(ctx context.Context) (...
type MockStreamingMetaHandlerMockRecorder (line 92) | type MockStreamingMetaHandlerMockRecorder struct
method OnConnectStream (line 118) | func (mr *MockStreamingMetaHandlerMockRecorder) OnConnectStream(ctx in...
method OnReadStream (line 133) | func (mr *MockStreamingMetaHandlerMockRecorder) OnReadStream(ctx inter...
function NewMockStreamingMetaHandler (line 97) | func NewMockStreamingMetaHandler(ctrl *gomock.Controller) *MockStreaming...
FILE: internal/mocks/remote/trans_pipeline.go
type MockBoundHandler (line 34) | type MockBoundHandler struct
method EXPECT (line 52) | func (m *MockBoundHandler) EXPECT() *MockBoundHandlerMockRecorder {
type MockBoundHandlerMockRecorder (line 40) | type MockBoundHandlerMockRecorder struct
function NewMockBoundHandler (line 45) | func NewMockBoundHandler(ctrl *gomock.Controller) *MockBoundHandler {
type MockOutboundHandler (line 57) | type MockOutboundHandler struct
method EXPECT (line 75) | func (m *MockOutboundHandler) EXPECT() *MockOutboundHandlerMockRecorder {
method Write (line 80) | func (m *MockOutboundHandler) Write(ctx context.Context, conn net.Conn...
type MockOutboundHandlerMockRecorder (line 63) | type MockOutboundHandlerMockRecorder struct
method Write (line 89) | func (mr *MockOutboundHandlerMockRecorder) Write(ctx, conn, send inter...
function NewMockOutboundHandler (line 68) | func NewMockOutboundHandler(ctrl *gomock.Controller) *MockOutboundHandler {
type MockInboundHandler (line 95) | type MockInboundHandler struct
method EXPECT (line 113) | func (m *MockInboundHandler) EXPECT() *MockInboundHandlerMockRecorder {
method OnActive (line 118) | func (m *MockInboundHandler) OnActive(ctx context.Context, conn net.Co...
method OnInactive (line 133) | func (m *MockInboundHandler) OnInactive(ctx context.Context, conn net....
method OnMessage (line 147) | func (m *MockInboundHandler) OnMessage(ctx context.Context, args, resu...
method OnRead (line 162) | func (m *MockInboundHandler) OnRead(ctx context.Context, conn net.Conn...
type MockInboundHandlerMockRecorder (line 101) | type MockInboundHandlerMockRecorder struct
method OnActive (line 127) | func (mr *MockInboundHandlerMockRecorder) OnActive(ctx, conn interface...
method OnInactive (line 141) | func (mr *MockInboundHandlerMockRecorder) OnInactive(ctx, conn interfa...
method OnMessage (line 156) | func (mr *MockInboundHandlerMockRecorder) OnMessage(ctx, args, result ...
method OnRead (line 171) | func (mr *MockInboundHandlerMockRecorder) OnRead(ctx, conn interface{}...
function NewMockInboundHandler (line 106) | func NewMockInboundHandler(ctrl *gomock.Controller) *MockInboundHandler {
type MockDuplexBoundHandler (line 177) | type MockDuplexBoundHandler struct
method EXPECT (line 195) | func (m *MockDuplexBoundHandler) EXPECT() *MockDuplexBoundHandlerMockR...
method OnActive (line 200) | func (m *MockDuplexBoundHandler) OnActive(ctx context.Context, conn ne...
method OnInactive (line 215) | func (m *MockDuplexBoundHandler) OnInactive(ctx context.Context, conn ...
method OnMessage (line 229) | func (m *MockDuplexBoundHandler) OnMessage(ctx context.Context, args, ...
method OnRead (line 244) | func (m *MockDuplexBoundHandler) OnRead(ctx context.Context, conn net....
method Write (line 259) | func (m *MockDuplexBoundHandler) Write(ctx context.Context, conn net.C...
type MockDuplexBoundHandlerMockRecorder (line 183) | type MockDuplexBoundHandlerMockRecorder struct
method OnActive (line 209) | func (mr *MockDuplexBoundHandlerMockRecorder) OnActive(ctx, conn inter...
method OnInactive (line 223) | func (mr *MockDuplexBoundHandlerMockRecorder) OnInactive(ctx, conn int...
method OnMessage (line 238) | func (mr *MockDuplexBoundHandlerMockRecorder) OnMessage(ctx, args, res...
method OnRead (line 253) | func (mr *MockDuplexBoundHandlerMockRecorder) OnRead(ctx, conn interfa...
method Write (line 268) | func (mr *MockDuplexBoundHandlerMockRecorder) Write(ctx, conn, send in...
function NewMockDuplexBoundHandler (line 188) | func NewMockDuplexBoundHandler(ctrl *gomock.Controller) *MockDuplexBound...
FILE: internal/mocks/rpc_info/timeout_provider.go
type MockTimeoutProvider (line 32) | type MockTimeoutProvider struct
method EXPECT (line 50) | func (m *MockTimeoutProvider) EXPECT() *MockTimeoutProviderMockRecorder {
method Timeouts (line 55) | func (m *MockTimeoutProvider) Timeouts(arg0 rpcinfo.RPCInfo) rpcinfo.T...
type MockTimeoutProviderMockRecorder (line 38) | type MockTimeoutProviderMockRecorder struct
method Timeouts (line 63) | func (mr *MockTimeoutProviderMockRecorder) Timeouts(arg0 interface{}) ...
function NewMockTimeoutProvider (line 43) | func NewMockTimeoutProvider(ctrl *gomock.Controller) *MockTimeoutProvider {
FILE: internal/mocks/serviceinfo.go
constant MockServiceName (line 31) | MockServiceName = "MockService"
constant MockService2Name (line 32) | MockService2Name = "MockService2"
constant MockService3Name (line 33) | MockService3Name = "MockService3"
constant MockMethod (line 34) | MockMethod string = "mock"
constant Mock2Method (line 35) | Mock2Method string = "mock2"
constant MockExceptionMethod (line 36) | MockExceptionMethod string = "mockException"
constant MockErrorMethod (line 37) | MockErrorMethod string = "mockError"
constant MockOnewayMethod (line 38) | MockOnewayMethod string = "mockOneway"
constant MockStreamingMethod (line 39) | MockStreamingMethod string = "mockStreaming"
function ServiceInfo (line 43) | func ServiceInfo() *serviceinfo.ServiceInfo {
function newServiceInfo (line 49) | func newServiceInfo() *serviceinfo.ServiceInfo {
function Service2Info (line 72) | func Service2Info() *serviceinfo.ServiceInfo {
function newService2Info (line 78) | func newService2Info() *serviceinfo.ServiceInfo {
function Service3Info (line 94) | func Service3Info() *serviceinfo.ServiceInfo {
function newService3Info (line 100) | func newService3Info() *serviceinfo.ServiceInfo {
function mockHandler (line 115) | func mockHandler(ctx context.Context, handler, args, result interface{})...
function mock2Handler (line 126) | func mock2Handler(ctx context.Context, handler, args, result interface{}...
function NewMockArgs (line 137) | func NewMockArgs() interface{} {
function NewMockResult (line 141) | func NewMockResult() interface{} {
function mockExceptionHandler (line 145) | func mockExceptionHandler(ctx context.Context, handler, args, result int...
function mockErrorHandler (line 162) | func mockErrorHandler(ctx context.Context, handler, args, result interfa...
function newMockExceptionResult (line 173) | func newMockExceptionResult() interface{} {
function mockOnewayHandler (line 177) | func mockOnewayHandler(ctx context.Context, handler, args, result interf...
type MyService (line 187) | type MyService interface
type myServiceMockArgs (line 195) | type myServiceMockArgs struct
method BLength (line 199) | func (p *myServiceMockArgs) BLength() int ...
method FastWriteNocopy (line 200) | func (p *myServiceMockArgs) FastWriteNocopy(buf []byte, bw thrift.Noco...
method FastRead (line 201) | func (p *myServiceMockArgs) FastRead(buf []byte) (int, error) ...
type MyRequest (line 204) | type MyRequest struct
type myServiceMockResult (line 208) | type myServiceMockResult struct
method BLength (line 212) | func (p *myServiceMockResult) BLength() int ...
method FastWriteNocopy (line 213) | func (p *myServiceMockResult) FastWriteNocopy(buf []byte, bw thrift.No...
method FastRead (line 214) | func (p *myServiceMockResult) FastRead(buf []byte) (int, error) ...
type MyResponse (line 217) | type MyResponse struct
type myServiceMockExceptionResult (line 221) | type myServiceMockExceptionResult struct
method BLength (line 226) | func (p *myServiceMockExceptionResult) BLength() int { return 1 }
method FastWriteNocopy (line 227) | func (p *myServiceMockExceptionResult) FastWriteNocopy(buf []byte, bw ...
method FastRead (line 230) | func (p *myServiceMockExceptionResult) FastRead(buf []byte) (int, erro...
type MyException (line 233) | type MyException struct
method Error (line 237) | func (p *MyException) Error() string {
function MyServiceHandler (line 242) | func MyServiceHandler() interface{} {
function MockFuncHandler (line 247) | func MockFuncHandler(mf func(ctx context.Context, req *MyRequest) (r *My...
type myServiceHandler (line 251) | type myServiceHandler struct
method Mock (line 255) | func (h *myServiceHandler) Mock(ctx context.Context, req *MyRequest) (...
method Mock2 (line 262) | func (h *myServiceHandler) Mock2(ctx context.Context, req *MyRequest) ...
method MockException (line 269) | func (h *myServiceHandler) MockException(ctx context.Context, req *MyR...
method MockError (line 273) | func (h *myServiceHandler) MockError(ctx context.Context, req *MyReque...
method MockOneway (line 277) | func (h *myServiceHandler) MockOneway(ctx context.Context, req *MyRequ...
FILE: internal/mocks/stats/tracer.go
type MockTracer (line 32) | type MockTracer struct
method EXPECT (line 50) | func (m *MockTracer) EXPECT() *MockTracerMockRecorder {
method Finish (line 55) | func (m *MockTracer) Finish(ctx context.Context) {
method Start (line 67) | func (m *MockTracer) Start(ctx context.Context) context.Context {
type MockTracerMockRecorder (line 38) | type MockTracerMockRecorder struct
method Finish (line 61) | func (mr *MockTracerMockRecorder) Finish(ctx interface{}) *gomock.Call {
method Start (line 75) | func (mr *MockTracerMockRecorder) Start(ctx interface{}) *gomock.Call {
function NewMockTracer (line 43) | func NewMockTracer(ctrl *gomock.Controller) *MockTracer {
FILE: internal/mocks/thrift/k-stream.go
method FastRead (line 39) | func (p *Request) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 95) | func (p *Request) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 110) | func (p *Request) FastWrite(buf []byte) int {
method FastWriteNocopy (line 114) | func (p *Request) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int {
method BLength (line 123) | func (p *Request) BLength() int {
method fastWriteField1 (line 132) | func (p *Request) fastWriteField1(buf []byte, w thrift.NocopyWriter) int {
method field1Length (line 139) | func (p *Request) field1Length() int {
method FastRead (line 146) | func (p *Response) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 202) | func (p *Response) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 217) | func (p *Response) FastWrite(buf []byte) int {
method FastWriteNocopy (line 221) | func (p *Response) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int {
method BLength (line 230) | func (p *Response) BLength() int {
method fastWriteField1 (line 239) | func (p *Response) fastWriteField1(buf []byte, w thrift.NocopyWriter) int {
method field1Length (line 246) | func (p *Response) field1Length() int {
method FastRead (line 253) | func (p *TestServiceEchoArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 301) | func (p *TestServiceEchoArgs) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 314) | func (p *TestServiceEchoArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 318) | func (p *TestServiceEchoArgs) FastWriteNocopy(buf []byte, w thrift.Nocop...
method BLength (line 327) | func (p *TestServiceEchoArgs) BLength() int {
method fastWriteField1 (line 336) | func (p *TestServiceEchoArgs) fastWriteField1(buf []byte, w thrift.Nocop...
method field1Length (line 343) | func (p *TestServiceEchoArgs) field1Length() int {
method FastRead (line 350) | func (p *TestServiceEchoResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 398) | func (p *TestServiceEchoResult) FastReadField0(buf []byte) (int, error) {
method FastWrite (line 411) | func (p *TestServiceEchoResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 415) | func (p *TestServiceEchoResult) FastWriteNocopy(buf []byte, w thrift.Noc...
method BLength (line 424) | func (p *TestServiceEchoResult) BLength() int {
method fastWriteField0 (line 433) | func (p *TestServiceEchoResult) fastWriteField0(buf []byte, w thrift.Noc...
method field0Length (line 442) | func (p *TestServiceEchoResult) field0Length() int {
method FastRead (line 451) | func (p *TestServiceEchoClientArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 499) | func (p *TestServiceEchoClientArgs) FastReadField1(buf []byte) (int, err...
method FastWrite (line 512) | func (p *TestServiceEchoClientArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 516) | func (p *TestServiceEchoClientArgs) FastWriteNocopy(buf []byte, w thrift...
method BLength (line 525) | func (p *TestServiceEchoClientArgs) BLength() int {
method fastWriteField1 (line 534) | func (p *TestServiceEchoClientArgs) fastWriteField1(buf []byte, w thrift...
method field1Length (line 541) | func (p *TestServiceEchoClientArgs) field1Length() int {
method FastRead (line 548) | func (p *TestServiceEchoClientResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 596) | func (p *TestServiceEchoClientResult) FastReadField0(buf []byte) (int, e...
method FastWrite (line 609) | func (p *TestServiceEchoClientResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 613) | func (p *TestServiceEchoClientResult) FastWriteNocopy(buf []byte, w thri...
method BLength (line 622) | func (p *TestServiceEchoClientResult) BLength() int {
method fastWriteField0 (line 631) | func (p *TestServiceEchoClientResult) fastWriteField0(buf []byte, w thri...
method field0Length (line 640) | func (p *TestServiceEchoClientResult) field0Length() int {
method FastRead (line 649) | func (p *TestServiceEchoServerArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 697) | func (p *TestServiceEchoServerArgs) FastReadField1(buf []byte) (int, err...
method FastWrite (line 710) | func (p *TestServiceEchoServerArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 714) | func (p *TestServiceEchoServerArgs) FastWriteNocopy(buf []byte, w thrift...
method BLength (line 723) | func (p *TestServiceEchoServerArgs) BLength() int {
method fastWriteField1 (line 732) | func (p *TestServiceEchoServerArgs) fastWriteField1(buf []byte, w thrift...
method field1Length (line 739) | func (p *TestServiceEchoServerArgs) field1Length() int {
method FastRead (line 746) | func (p *TestServiceEchoServerResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 794) | func (p *TestServiceEchoServerResult) FastReadField0(buf []byte) (int, e...
method FastWrite (line 807) | func (p *TestServiceEchoServerResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 811) | func (p *TestServiceEchoServerResult) FastWriteNocopy(buf []byte, w thri...
method BLength (line 820) | func (p *TestServiceEchoServerResult) BLength() int {
method fastWriteField0 (line 829) | func (p *TestServiceEchoServerResult) fastWriteField0(buf []byte, w thri...
method field0Length (line 838) | func (p *TestServiceEchoServerResult) field0Length() int {
method FastRead (line 847) | func (p *TestServiceEchoUnaryArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 895) | func (p *TestServiceEchoUnaryArgs) FastReadField1(buf []byte) (int, erro...
method FastWrite (line 908) | func (p *TestServiceEchoUnaryArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 912) | func (p *TestServiceEchoUnaryArgs) FastWriteNocopy(buf []byte, w thrift....
method BLength (line 921) | func (p *TestServiceEchoUnaryArgs) BLength() int {
method fastWriteField1 (line 930) | func (p *TestServiceEchoUnaryArgs) fastWriteField1(buf []byte, w thrift....
method field1Length (line 937) | func (p *TestServiceEchoUnaryArgs) field1Length() int {
method FastRead (line 944) | func (p *TestServiceEchoUnaryResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 992) | func (p *TestServiceEchoUnaryResult) FastReadField0(buf []byte) (int, er...
method FastWrite (line 1005) | func (p *TestServiceEchoUnaryResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 1009) | func (p *TestServiceEchoUnaryResult) FastWriteNocopy(buf []byte, w thrif...
method BLength (line 1018) | func (p *TestServiceEchoUnaryResult) BLength() int {
method fastWriteField0 (line 1027) | func (p *TestServiceEchoUnaryResult) fastWriteField0(buf []byte, w thrif...
method field0Length (line 1036) | func (p *TestServiceEchoUnaryResult) field0Length() int {
method FastRead (line 1045) | func (p *TestServiceEchoBizExceptionArgs) FastRead(buf []byte) (int, err...
method FastReadField1 (line 1093) | func (p *TestServiceEchoBizExceptionArgs) FastReadField1(buf []byte) (in...
method FastWrite (line 1106) | func (p *TestServiceEchoBizExceptionArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 1110) | func (p *TestServiceEchoBizExceptionArgs) FastWriteNocopy(buf []byte, w ...
method BLength (line 1119) | func (p *TestServiceEchoBizExceptionArgs) BLength() int {
method fastWriteField1 (line 1128) | func (p *TestServiceEchoBizExceptionArgs) fastWriteField1(buf []byte, w ...
method field1Length (line 1135) | func (p *TestServiceEchoBizExceptionArgs) field1Length() int {
method FastRead (line 1142) | func (p *TestServiceEchoBizExceptionResult) FastRead(buf []byte) (int, e...
method FastReadField0 (line 1190) | func (p *TestServiceEchoBizExceptionResult) FastReadField0(buf []byte) (...
method FastWrite (line 1203) | func (p *TestServiceEchoBizExceptionResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 1207) | func (p *TestServiceEchoBizExceptionResult) FastWriteNocopy(buf []byte, ...
method BLength (line 1216) | func (p *TestServiceEchoBizExceptionResult) BLength() int {
method fastWriteField0 (line 1225) | func (p *TestServiceEchoBizExceptionResult) fastWriteField0(buf []byte, ...
method field0Length (line 1234) | func (p *TestServiceEchoBizExceptionResult) field0Length() int {
method FastRead (line 1243) | func (p *TestServiceEchoPingPongArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 1291) | func (p *TestServiceEchoPingPongArgs) FastReadField1(buf []byte) (int, e...
method FastWrite (line 1304) | func (p *TestServiceEchoPingPongArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 1308) | func (p *TestServiceEchoPingPongArgs) FastWriteNocopy(buf []byte, w thri...
method BLength (line 1317) | func (p *TestServiceEchoPingPongArgs) BLength() int {
method fastWriteField1 (line 1326) | func (p *TestServiceEchoPingPongArgs) fastWriteField1(buf []byte, w thri...
method field1Length (line 1333) | func (p *TestServiceEchoPingPongArgs) field1Length() int {
method FastRead (line 1340) | func (p *TestServiceEchoPingPongResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 1388) | func (p *TestServiceEchoPingPongResult) FastReadField0(buf []byte) (int,...
method FastWrite (line 1401) | func (p *TestServiceEchoPingPongResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 1405) | func (p *TestServiceEchoPingPongResult) FastWriteNocopy(buf []byte, w th...
method BLength (line 1414) | func (p *TestServiceEchoPingPongResult) BLength() int {
method fastWriteField0 (line 1423) | func (p *TestServiceEchoPingPongResult) fastWriteField0(buf []byte, w th...
method field0Length (line 1432) | func (p *TestServiceEchoPingPongResult) field0Length() int {
method GetFirstArgument (line 1441) | func (p *TestServiceEchoArgs) GetFirstArgument() interface{} {
method GetResult (line 1445) | func (p *TestServiceEchoResult) GetResult() interface{} {
method GetFirstArgument (line 1449) | func (p *TestServiceEchoClientArgs) GetFirstArgument() interface{} {
method GetResult (line 1453) | func (p *TestServiceEchoClientResult) GetResult() interface{} {
method GetFirstArgument (line 1457) | func (p *TestServiceEchoServerArgs) GetFirstArgument() interface{} {
method GetResult (line 1461) | func (p *TestServiceEchoServerResult) GetResult() interface{} {
method GetFirstArgument (line 1465) | func (p *TestServiceEchoUnaryArgs) GetFirstArgument() interface{} {
method GetResult (line 1469) | func (p *TestServiceEchoUnaryResult) GetResult() interface{} {
method GetFirstArgument (line 1473) | func (p *TestServiceEchoBizExceptionArgs) GetFirstArgument() interface{} {
method GetResult (line 1477) | func (p *TestServiceEchoBizExceptionResult) GetResult() interface{} {
method GetFirstArgument (line 1481) | func (p *TestServiceEchoPingPongArgs) GetFirstArgument() interface{} {
method GetResult (line 1485) | func (p *TestServiceEchoPingPongResult) GetResult() interface{} {
FILE: internal/mocks/thrift/k-test.go
method FastRead (line 39) | func (p *MockReq) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 115) | func (p *MockReq) FastReadField1(buf []byte) (int, error) {
method FastReadField2 (line 129) | func (p *MockReq) FastReadField2(buf []byte) (int, error) {
method FastReadField3 (line 161) | func (p *MockReq) FastReadField3(buf []byte) (int, error) {
method FastWrite (line 186) | func (p *MockReq) FastWrite(buf []byte) int {
method FastWriteNocopy (line 190) | func (p *MockReq) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int {
method BLength (line 201) | func (p *MockReq) BLength() int {
method fastWriteField1 (line 212) | func (p *MockReq) fastWriteField1(buf []byte, w thrift.NocopyWriter) int {
method fastWriteField2 (line 219) | func (p *MockReq) fastWriteField2(buf []byte, w thrift.NocopyWriter) int {
method fastWriteField3 (line 234) | func (p *MockReq) fastWriteField3(buf []byte, w thrift.NocopyWriter) int {
method field1Length (line 248) | func (p *MockReq) field1Length() int {
method field2Length (line 255) | func (p *MockReq) field2Length() int {
method field3Length (line 268) | func (p *MockReq) field3Length() int {
method FastRead (line 279) | func (p *Exception) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 341) | func (p *Exception) FastReadField1(buf []byte) (int, error) {
method FastReadField255 (line 355) | func (p *Exception) FastReadField255(buf []byte) (int, error) {
method FastWrite (line 370) | func (p *Exception) FastWrite(buf []byte) int {
method FastWriteNocopy (line 374) | func (p *Exception) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) i...
method BLength (line 384) | func (p *Exception) BLength() int {
method fastWriteField1 (line 394) | func (p *Exception) fastWriteField1(buf []byte, w thrift.NocopyWriter) i...
method fastWriteField255 (line 401) | func (p *Exception) fastWriteField255(buf []byte, w thrift.NocopyWriter)...
method field1Length (line 408) | func (p *Exception) field1Length() int {
method field255Length (line 415) | func (p *Exception) field255Length() int {
method FastRead (line 422) | func (p *MockTestArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 470) | func (p *MockTestArgs) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 483) | func (p *MockTestArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 487) | func (p *MockTestArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter...
method BLength (line 496) | func (p *MockTestArgs) BLength() int {
method fastWriteField1 (line 505) | func (p *MockTestArgs) fastWriteField1(buf []byte, w thrift.NocopyWriter...
method field1Length (line 512) | func (p *MockTestArgs) field1Length() int {
method FastRead (line 519) | func (p *MockTestResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 567) | func (p *MockTestResult) FastReadField0(buf []byte) (int, error) {
method FastWrite (line 582) | func (p *MockTestResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 586) | func (p *MockTestResult) FastWriteNocopy(buf []byte, w thrift.NocopyWrit...
method BLength (line 595) | func (p *MockTestResult) BLength() int {
method fastWriteField0 (line 604) | func (p *MockTestResult) fastWriteField0(buf []byte, w thrift.NocopyWrit...
method field0Length (line 613) | func (p *MockTestResult) field0Length() int {
method FastRead (line 622) | func (p *MockExceptionTestArgs) FastRead(buf []byte) (int, error) {
method FastReadField1 (line 670) | func (p *MockExceptionTestArgs) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 683) | func (p *MockExceptionTestArgs) FastWrite(buf []byte) int {
method FastWriteNocopy (line 687) | func (p *MockExceptionTestArgs) FastWriteNocopy(buf []byte, w thrift.Noc...
method BLength (line 696) | func (p *MockExceptionTestArgs) BLength() int {
method fastWriteField1 (line 705) | func (p *MockExceptionTestArgs) fastWriteField1(buf []byte, w thrift.Noc...
method field1Length (line 712) | func (p *MockExceptionTestArgs) field1Length() int {
method FastRead (line 719) | func (p *MockExceptionTestResult) FastRead(buf []byte) (int, error) {
method FastReadField0 (line 781) | func (p *MockExceptionTestResult) FastReadField0(buf []byte) (int, error) {
method FastReadField1 (line 795) | func (p *MockExceptionTestResult) FastReadField1(buf []byte) (int, error) {
method FastWrite (line 808) | func (p *MockExceptionTestResult) FastWrite(buf []byte) int {
method FastWriteNocopy (line 812) | func (p *MockExceptionTestResult) FastWriteNocopy(buf []byte, w thrift.N...
method BLength (line 822) | func (p *MockExceptionTestResult) BLength() int {
method fastWriteField0 (line 832) | func (p *MockExceptionTestResult) fastWriteField0(buf []byte, w thrift.N...
method fastWriteField1 (line 841) | func (p *MockExceptionTestResult) fastWriteField1(buf []byte, w thrift.N...
method field0Length (line 850) | func (p *MockExceptionTestResult) field0Length() int {
method field1Length (line 859) | func (p *MockExceptionTestResult) field1Length() int {
method GetFirstArgument (line 868) | func (p *MockTestArgs) GetFirstArgument() interface{} {
method GetResult (line 872) | func (p *MockTestResult) GetResult() interface{} {
method GetFirstArgument (line 876) | func (p *MockExceptionTestArgs) GetFirstArgument() interface{} {
method GetResult (line 880) | func (p *MockExceptionTestResult) GetResult() interface{} {
FILE: internal/mocks/thrift/stream.go
type Request (line 28) | type Request struct
method InitDefault (line 36) | func (p *Request) InitDefault() {
method GetMessage (line 39) | func (p *Request) GetMessage() (v string) {
method SetMessage (line 42) | func (p *Request) SetMessage(val string) {
method String (line 46) | func (p *Request) String() string {
method DeepEqual (line 53) | func (p *Request) DeepEqual(ano *Request) bool {
method Field1DeepEqual (line 65) | func (p *Request) Field1DeepEqual(src string) bool {
function NewRequest (line 32) | func NewRequest() *Request {
type Response (line 77) | type Response struct
method InitDefault (line 85) | func (p *Response) InitDefault() {
method GetMessage (line 88) | func (p *Response) GetMessage() (v string) {
method SetMessage (line 91) | func (p *Response) SetMessage(val string) {
method String (line 95) | func (p *Response) String() string {
method DeepEqual (line 102) | func (p *Response) DeepEqual(ano *Response) bool {
method Field1DeepEqual (line 114) | func (p *Response) Field1DeepEqual(src string) bool {
function NewResponse (line 81) | func NewResponse() *Response {
type TestService (line 126) | type TestService interface
type TestServiceEchoArgs (line 140) | type TestServiceEchoArgs struct
method InitDefault (line 148) | func (p *TestServiceEchoArgs) InitDefault() {
method GetReq (line 153) | func (p *TestServiceEchoArgs) GetReq() (v *Request) {
method SetReq (line 159) | func (p *TestServiceEchoArgs) SetReq(val *Request) {
method IsSetReq (line 163) | func (p *TestServiceEchoArgs) IsSetReq() bool {
method String (line 167) | func (p *TestServiceEchoArgs) String() string {
method DeepEqual (line 174) | func (p *TestServiceEchoArgs) DeepEqual(ano *TestServiceEchoArgs) bool {
method Field1DeepEqual (line 186) | func (p *TestServiceEchoArgs) Field1DeepEqual(src *Request) bool {
function NewTestServiceEchoArgs (line 144) | func NewTestServiceEchoArgs() *TestServiceEchoArgs {
type TestServiceEchoResult (line 198) | type TestServiceEchoResult struct
method InitDefault (line 206) | func (p *TestServiceEchoResult) InitDefault() {
method GetSuccess (line 211) | func (p *TestServiceEchoResult) GetSuccess() (v *Response) {
method SetSuccess (line 217) | func (p *TestServiceEchoResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 221) | func (p *TestServiceEchoResult) IsSetSuccess() bool {
method String (line 225) | func (p *TestServiceEchoResult) String() string {
method DeepEqual (line 232) | func (p *TestServiceEchoResult) DeepEqual(ano *TestServiceEchoResult) ...
method Field0DeepEqual (line 244) | func (p *TestServiceEchoResult) Field0DeepEqual(src *Response) bool {
function NewTestServiceEchoResult (line 202) | func NewTestServiceEchoResult() *TestServiceEchoResult {
type TestService_EchoServer (line 256) | type TestService_EchoServer interface
type TestServiceEchoClientArgs (line 264) | type TestServiceEchoClientArgs struct
method InitDefault (line 272) | func (p *TestServiceEchoClientArgs) InitDefault() {
method GetReq (line 277) | func (p *TestServiceEchoClientArgs) GetReq() (v *Request) {
method SetReq (line 283) | func (p *TestServiceEchoClientArgs) SetReq(val *Request) {
method IsSetReq (line 287) | func (p *TestServiceEchoClientArgs) IsSetReq() bool {
method String (line 291) | func (p *TestServiceEchoClientArgs) String() string {
method DeepEqual (line 298) | func (p *TestServiceEchoClientArgs) DeepEqual(ano *TestServiceEchoClie...
method Field1DeepEqual (line 310) | func (p *TestServiceEchoClientArgs) Field1DeepEqual(src *Request) bool {
function NewTestServiceEchoClientArgs (line 268) | func NewTestServiceEchoClientArgs() *TestServiceEchoClientArgs {
type TestServiceEchoClientResult (line 322) | type TestServiceEchoClientResult struct
method InitDefault (line 330) | func (p *TestServiceEchoClientResult) InitDefault() {
method GetSuccess (line 335) | func (p *TestServiceEchoClientResult) GetSuccess() (v *Response) {
method SetSuccess (line 341) | func (p *TestServiceEchoClientResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 345) | func (p *TestServiceEchoClientResult) IsSetSuccess() bool {
method String (line 349) | func (p *TestServiceEchoClientResult) String() string {
method DeepEqual (line 356) | func (p *TestServiceEchoClientResult) DeepEqual(ano *TestServiceEchoCl...
method Field0DeepEqual (line 368) | func (p *TestServiceEchoClientResult) Field0DeepEqual(src *Response) b...
function NewTestServiceEchoClientResult (line 326) | func NewTestServiceEchoClientResult() *TestServiceEchoClientResult {
type TestService_EchoClientServer (line 380) | type TestService_EchoClientServer interface
type TestServiceEchoServerArgs (line 388) | type TestServiceEchoServerArgs struct
method InitDefault (line 396) | func (p *TestServiceEchoServerArgs) InitDefault() {
method GetReq (line 401) | func (p *TestServiceEchoServerArgs) GetReq() (v *Request) {
method SetReq (line 407) | func (p *TestServiceEchoServerArgs) SetReq(val *Request) {
method IsSetReq (line 411) | func (p *TestServiceEchoServerArgs) IsSetReq() bool {
method String (line 415) | func (p *TestServiceEchoServerArgs) String() string {
method DeepEqual (line 422) | func (p *TestServiceEchoServerArgs) DeepEqual(ano *TestServiceEchoServ...
method Field1DeepEqual (line 434) | func (p *TestServiceEchoServerArgs) Field1DeepEqual(src *Request) bool {
function NewTestServiceEchoServerArgs (line 392) | func NewTestServiceEchoServerArgs() *TestServiceEchoServerArgs {
type TestServiceEchoServerResult (line 446) | type TestServiceEchoServerResult struct
method InitDefault (line 454) | func (p *TestServiceEchoServerResult) InitDefault() {
method GetSuccess (line 459) | func (p *TestServiceEchoServerResult) GetSuccess() (v *Response) {
method SetSuccess (line 465) | func (p *TestServiceEchoServerResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 469) | func (p *TestServiceEchoServerResult) IsSetSuccess() bool {
method String (line 473) | func (p *TestServiceEchoServerResult) String() string {
method DeepEqual (line 480) | func (p *TestServiceEchoServerResult) DeepEqual(ano *TestServiceEchoSe...
method Field0DeepEqual (line 492) | func (p *TestServiceEchoServerResult) Field0DeepEqual(src *Response) b...
function NewTestServiceEchoServerResult (line 450) | func NewTestServiceEchoServerResult() *TestServiceEchoServerResult {
type TestService_EchoServerServer (line 504) | type TestService_EchoServerServer interface
type TestServiceEchoUnaryArgs (line 510) | type TestServiceEchoUnaryArgs struct
method InitDefault (line 518) | func (p *TestServiceEchoUnaryArgs) InitDefault() {
method GetReq (line 523) | func (p *TestServiceEchoUnaryArgs) GetReq() (v *Request) {
method SetReq (line 529) | func (p *TestServiceEchoUnaryArgs) SetReq(val *Request) {
method IsSetReq (line 533) | func (p *TestServiceEchoUnaryArgs) IsSetReq() bool {
method String (line 537) | func (p *TestServiceEchoUnaryArgs) String() string {
method DeepEqual (line 544) | func (p *TestServiceEchoUnaryArgs) DeepEqual(ano *TestServiceEchoUnary...
method Field1DeepEqual (line 556) | func (p *TestServiceEchoUnaryArgs) Field1DeepEqual(src *Request) bool {
function NewTestServiceEchoUnaryArgs (line 514) | func NewTestServiceEchoUnaryArgs() *TestServiceEchoUnaryArgs {
type TestServiceEchoUnaryResult (line 568) | type TestServiceEchoUnaryResult struct
method InitDefault (line 576) | func (p *TestServiceEchoUnaryResult) InitDefault() {
method GetSuccess (line 581) | func (p *TestServiceEchoUnaryResult) GetSuccess() (v *Response) {
method SetSuccess (line 587) | func (p *TestServiceEchoUnaryResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 591) | func (p *TestServiceEchoUnaryResult) IsSetSuccess() bool {
method String (line 595) | func (p *TestServiceEchoUnaryResult) String() string {
method DeepEqual (line 602) | func (p *TestServiceEchoUnaryResult) DeepEqual(ano *TestServiceEchoUna...
method Field0DeepEqual (line 614) | func (p *TestServiceEchoUnaryResult) Field0DeepEqual(src *Response) bo...
function NewTestServiceEchoUnaryResult (line 572) | func NewTestServiceEchoUnaryResult() *TestServiceEchoUnaryResult {
type TestServiceEchoBizExceptionArgs (line 626) | type TestServiceEchoBizExceptionArgs struct
method InitDefault (line 634) | func (p *TestServiceEchoBizExceptionArgs) InitDefault() {
method GetReq (line 639) | func (p *TestServiceEchoBizExceptionArgs) GetReq() (v *Request) {
method SetReq (line 645) | func (p *TestServiceEchoBizExceptionArgs) SetReq(val *Request) {
method IsSetReq (line 649) | func (p *TestServiceEchoBizExceptionArgs) IsSetReq() bool {
method String (line 653) | func (p *TestServiceEchoBizExceptionArgs) String() string {
method DeepEqual (line 660) | func (p *TestServiceEchoBizExceptionArgs) DeepEqual(ano *TestServiceEc...
method Field1DeepEqual (line 672) | func (p *TestServiceEchoBizExceptionArgs) Field1DeepEqual(src *Request...
function NewTestServiceEchoBizExceptionArgs (line 630) | func NewTestServiceEchoBizExceptionArgs() *TestServiceEchoBizExceptionAr...
type TestServiceEchoBizExceptionResult (line 684) | type TestServiceEchoBizExceptionResult struct
method InitDefault (line 692) | func (p *TestServiceEchoBizExceptionResult) InitDefault() {
method GetSuccess (line 697) | func (p *TestServiceEchoBizExceptionResult) GetSuccess() (v *Response) {
method SetSuccess (line 703) | func (p *TestServiceEchoBizExceptionResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 707) | func (p *TestServiceEchoBizExceptionResult) IsSetSuccess() bool {
method String (line 711) | func (p *TestServiceEchoBizExceptionResult) String() string {
method DeepEqual (line 718) | func (p *TestServiceEchoBizExceptionResult) DeepEqual(ano *TestService...
method Field0DeepEqual (line 730) | func (p *TestServiceEchoBizExceptionResult) Field0DeepEqual(src *Respo...
function NewTestServiceEchoBizExceptionResult (line 688) | func NewTestServiceEchoBizExceptionResult() *TestServiceEchoBizException...
type TestService_EchoBizExceptionServer (line 742) | type TestService_EchoBizExceptionServer interface
type TestServiceEchoPingPongArgs (line 750) | type TestServiceEchoPingPongArgs struct
method InitDefault (line 758) | func (p *TestServiceEchoPingPongArgs) InitDefault() {
method GetReq (line 763) | func (p *TestServiceEchoPingPongArgs) GetReq() (v *Request) {
method SetReq (line 769) | func (p *TestServiceEchoPingPongArgs) SetReq(val *Request) {
method IsSetReq (line 773) | func (p *TestServiceEchoPingPongArgs) IsSetReq() bool {
method String (line 777) | func (p *TestServiceEchoPingPongArgs) String() string {
method DeepEqual (line 784) | func (p *TestServiceEchoPingPongArgs) DeepEqual(ano *TestServiceEchoPi...
method Field1DeepEqual (line 796) | func (p *TestServiceEchoPingPongArgs) Field1DeepEqual(src *Request) bo...
function NewTestServiceEchoPingPongArgs (line 754) | func NewTestServiceEchoPingPongArgs() *TestServiceEchoPingPongArgs {
type TestServiceEchoPingPongResult (line 808) | type TestServiceEchoPingPongResult struct
method InitDefault (line 816) | func (p *TestServiceEchoPingPongResult) InitDefault() {
method GetSuccess (line 821) | func (p *TestServiceEchoPingPongResult) GetSuccess() (v *Response) {
method SetSuccess (line 827) | func (p *TestServiceEchoPingPongResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 831) | func (p *TestServiceEchoPingPongResult) IsSetSuccess() bool {
method String (line 835) | func (p *TestServiceEchoPingPongResult) String() string {
method DeepEqual (line 842) | func (p *TestServiceEchoPingPongResult) DeepEqual(ano *TestServiceEcho...
method Field0DeepEqual (line 854) | func (p *TestServiceEchoPingPongResult) Field0DeepEqual(src *Response)...
function NewTestServiceEchoPingPongResult (line 812) | func NewTestServiceEchoPingPongResult() *TestServiceEchoPingPongResult {
FILE: internal/mocks/thrift/test.go
type MockReq (line 27) | type MockReq struct
method InitDefault (line 37) | func (p *MockReq) InitDefault() {
method GetMsg (line 40) | func (p *MockReq) GetMsg() (v string) {
method GetStrMap (line 44) | func (p *MockReq) GetStrMap() (v map[string]string) {
method GetStrList (line 48) | func (p *MockReq) GetStrList() (v []string) {
method SetMsg (line 51) | func (p *MockReq) SetMsg(val string) {
method SetStrMap (line 54) | func (p *MockReq) SetStrMap(val map[string]string) {
method SetStrList (line 57) | func (p *MockReq) SetStrList(val []string) {
method String (line 61) | func (p *MockReq) String() string {
method DeepEqual (line 68) | func (p *MockReq) DeepEqual(ano *MockReq) bool {
method Field1DeepEqual (line 86) | func (p *MockReq) Field1DeepEqual(src string) bool {
method Field2DeepEqual (line 93) | func (p *MockReq) Field2DeepEqual(src map[string]string) bool {
method Field3DeepEqual (line 106) | func (p *MockReq) Field3DeepEqual(src []string) bool {
function NewMockReq (line 33) | func NewMockReq() *MockReq {
type Exception (line 126) | type Exception struct
method InitDefault (line 135) | func (p *Exception) InitDefault() {
method GetCode (line 138) | func (p *Exception) GetCode() (v int32) {
method GetMsg (line 142) | func (p *Exception) GetMsg() (v string) {
method SetCode (line 145) | func (p *Exception) SetCode(val int32) {
method SetMsg (line 148) | func (p *Exception) SetMsg(val string) {
method String (line 152) | func (p *Exception) String() string {
method Error (line 158) | func (p *Exception) Error() string {
method DeepEqual (line 162) | func (p *Exception) DeepEqual(ano *Exception) bool {
method Field1DeepEqual (line 177) | func (p *Exception) Field1DeepEqual(src int32) bool {
method Field255DeepEqual (line 184) | func (p *Exception) Field255DeepEqual(src string) bool {
function NewException (line 131) | func NewException() *Exception {
type Mock (line 197) | type Mock interface
type MockTestArgs (line 203) | type MockTestArgs struct
method InitDefault (line 211) | func (p *MockTestArgs) InitDefault() {
method GetReq (line 216) | func (p *MockTestArgs) GetReq() (v *MockReq) {
method SetReq (line 222) | func (p *MockTestArgs) SetReq(val *MockReq) {
method IsSetReq (line 226) | func (p *MockTestArgs) IsSetReq() bool {
method String (line 230) | func (p *MockTestArgs) String() string {
method DeepEqual (line 237) | func (p *MockTestArgs) DeepEqual(ano *MockTestArgs) bool {
method Field1DeepEqual (line 249) | func (p *MockTestArgs) Field1DeepEqual(src *MockReq) bool {
function NewMockTestArgs (line 207) | func NewMockTestArgs() *MockTestArgs {
type MockTestResult (line 261) | type MockTestResult struct
method InitDefault (line 269) | func (p *MockTestResult) InitDefault() {
method GetSuccess (line 274) | func (p *MockTestResult) GetSuccess() (v string) {
method SetSuccess (line 280) | func (p *MockTestResult) SetSuccess(x interface{}) {
method IsSetSuccess (line 284) | func (p *MockTestResult) IsSetSuccess() bool {
method String (line 288) | func (p *MockTestResult) String() string {
method DeepEqual (line 295) | func (p *MockTestResult) DeepEqual(ano *MockTestResult) bool {
method Field0DeepEqual (line 307) | func (p *MockTestResult) Field0DeepEqual(src *string) bool {
function NewMockTestResult (line 265) | func NewMockTestResult() *MockTestResult {
type MockExceptionTestArgs (line 324) | type MockExceptionTestArgs struct
method InitDefault (line 332) | func (p *MockExceptionTestArgs) InitDefault() {
method GetReq (line 337) | func (p *MockExceptionTestArgs) GetReq() (v *MockReq) {
method SetReq (line 343) | func (p *MockExceptionTestArgs) SetReq(val *MockReq) {
method IsSetReq (line 347) | func (p *MockExceptionTestArgs) IsSetReq() bool {
method String (line 351) | func (p *MockExceptionTestArgs) String() string {
method DeepEqual (line 358) | func (p *MockExceptionTestArgs) DeepEqual(ano *MockExceptionTestArgs) ...
method Field1DeepEqual (line 370) | func (p *MockExceptionTestArgs) Field1DeepEqual(src *MockReq) bool {
function NewMockExceptionTestArgs (line 328) | func NewMockExceptionTestArgs() *MockExceptionTestArgs {
type MockExceptionTestResult (line 382) | type MockExceptionTestResult struct
method InitDefault (line 391) | func (p *MockExceptionTestResult) InitDefault() {
method GetSuccess (line 396) | func (p *MockExceptionTestResult) GetSuccess() (v string) {
method GetErr (line 405) | func (p *MockExceptionTestResult) GetErr() (v *Exception) {
method SetSuccess (line 411) | func (p *MockExceptionTestResult) SetSuccess(x interface{}) {
method SetErr (line 414) | func (p *MockExceptionTestResult) SetErr(val *Exception) {
method IsSetSuccess (line 418) | func (p *MockExceptionTestResult) IsSetSuccess() bool {
method IsSetErr (line 422) | func (p *MockExceptionTestResult) IsSetErr() bool {
method String (line 426) | func (p *MockExceptionTestResult) String() string {
method DeepEqual (line 433) | func (p *MockExceptionTestResult) DeepEqual(ano *MockExceptionTestResu...
method Field0DeepEqual (line 448) | func (p *MockExceptionTestResult) Field0DeepEqual(src *string) bool {
method Field1DeepEqual (line 460) | func (p *MockExceptionTestResult) Field1DeepEqual(src *Exception) bool {
function NewMockExceptionTestResult (line 387) | func NewMockExceptionTestResult() *MockExceptionTestResult {
FILE: internal/mocks/transhandlerclient.go
type mockCliTransHandlerFactory (line 28) | type mockCliTransHandlerFactory struct
method NewTransHandler (line 37) | func (f *mockCliTransHandlerFactory) NewTransHandler(opt *remote.Clien...
function NewMockCliTransHandlerFactory (line 33) | func NewMockCliTransHandlerFactory(hdrl *MockCliTransHandler) remote.Cli...
type MockCliTransHandler (line 43) | type MockCliTransHandler struct
method Write (line 55) | func (t *MockCliTransHandler) Write(ctx context.Context, conn net.Conn...
method Read (line 63) | func (t *MockCliTransHandler) Read(ctx context.Context, conn net.Conn,...
method OnMessage (line 71) | func (t *MockCliTransHandler) OnMessage(ctx context.Context, args, res...
method OnActive (line 79) | func (t *MockCliTransHandler) OnActive(ctx context.Context, conn net.C...
method OnInactive (line 85) | func (t *MockCliTransHandler) OnInactive(ctx context.Context, conn net...
method OnError (line 90) | func (t *MockCliTransHandler) OnError(ctx context.Context, err error, ...
method SetPipeline (line 99) | func (t *MockCliTransHandler) SetPipeline(p *remote.TransPipeline) {
FILE: internal/mocks/transhandlerserver.go
type mockSvrTransHandlerFactory (line 29) | type mockSvrTransHandlerFactory struct
method NewTransHandler (line 38) | func (f *mockSvrTransHandlerFactory) NewTransHandler(opt *remote.Serve...
function NewMockSvrTransHandlerFactory (line 34) | func NewMockSvrTransHandlerFactory(hdrl *MockSvrTransHandler) remote.Ser...
type MockSvrTransHandler (line 44) | type MockSvrTransHandler struct
method OnRead (line 56) | func (t *MockSvrTransHandler) OnRead(ctx context.Context, conn net.Con...
method Write (line 64) | func (t *MockSvrTransHandler) Write(ctx context.Context, conn net.Conn...
method Read (line 72) | func (t *MockSvrTransHandler) Read(ctx context.Context, conn net.Conn,...
method OnMessage (line 80) | func (t *MockSvrTransHandler) OnMessage(ctx context.Context, args, res...
method OnActive (line 86) | func (t *MockSvrTransHandler) OnActive(ctx context.Context, conn net.C...
method OnInactive (line 94) | func (t *MockSvrTransHandler) OnInactive(ctx context.Context, conn net...
method OnError (line 99) | func (t *MockSvrTransHandler) OnError(ctx context.Context, err error, ...
method GracefulShutdown (line 107) | func (t *MockSvrTransHandler) GracefulShutdown(ctx context.Context) (e...
method SetPipeline (line 115) | func (t *MockSvrTransHandler) SetPipeline(p *remote.TransPipeline) {
type MockTransServerFactory (line 120) | type MockTransServerFactory struct
method NewTransServer (line 130) | func (t *MockTransServerFactory) NewTransServer(opt *remote.ServerOpti...
function NewMockTransServerFactory (line 125) | func NewMockTransServerFactory(transSvr *MockTransServer) remote.TransSe...
type MockTransServer (line 137) | type MockTransServer struct
method CreateListener (line 148) | func (t *MockTransServer) CreateListener(addr net.Addr) (ln net.Listen...
method BootstrapServer (line 156) | func (t *MockTransServer) BootstrapServer(ln net.Listener) (err error) {
method Shutdown (line 164) | func (t *MockTransServer) Shutdown() (err error) {
method ConnCount (line 172) | func (t *MockTransServer) ConnCount() (r utils.AtomicInt) {
FILE: internal/mocks/utils/sharedticker.go
type MockTickerTask (line 31) | type MockTickerTask struct
method EXPECT (line 49) | func (m *MockTickerTask) EXPECT() *MockTickerTaskMockRecorder {
method Tick (line 54) | func (m *MockTickerTask) Tick() {
type MockTickerTaskMockRecorder (line 37) | type MockTickerTaskMockRecorder struct
method Tick (line 60) | func (mr *MockTickerTaskMockRecorder) Tick() *gomock.Call {
function NewMockTickerTask (line 42) | func NewMockTickerTask(ctrl *gomock.Controller) *MockTickerTask {
FILE: internal/reusable.go
type Reusable (line 20) | type Reusable interface
FILE: internal/server/config.go
constant defaultExitWaitTime (line 27) | defaultExitWaitTime = 5 * time.Second
constant defaultAcceptFailedDelayTime (line 28) | defaultAcceptFailedDelayTime = 10 * time.Millisecond
constant defaultConnectionIdleTime (line 29) | defaultConnectionIdleTime = 10 * time.Minute
type Config (line 35) | type Config struct
function NewConfig (line 49) | func NewConfig() *Config {
FILE: internal/server/option.go
function init (line 51) | func init() {
type UnaryOption (line 56) | type UnaryOption struct
type UnaryOptions (line 60) | type UnaryOptions struct
method InitMiddlewares (line 65) | func (o *UnaryOptions) InitMiddlewares(ctx context.Context) {
type StreamOption (line 75) | type StreamOption struct
type StreamOptions (line 79) | type StreamOptions struct
method InitMiddlewares (line 89) | func (o *StreamOptions) InitMiddlewares(ctx context.Context) {
method BuildRecvChain (line 113) | func (o *StreamOptions) BuildRecvChain() sep.StreamRecvEndpoint {
method BuildSendChain (line 119) | func (o *StreamOptions) BuildSendChain() sep.StreamSendEndpoint {
type Option (line 126) | type Option struct
type Options (line 131) | type Options struct
method initTraceController (line 176) | func (o *Options) initTraceController() {
type Limit (line 182) | type Limit struct
function NewOptions (line 195) | func NewOptions(opts []Option) *Options {
function ApplyOptions (line 227) | func ApplyOptions(opts []Option, o *Options) {
function DefaultSysExitSignal (line 233) | func DefaultSysExitSignal() <-chan error {
function SysExitSignal (line 244) | func SysExitSignal() chan os.Signal {
FILE: internal/server/register_option.go
type RegisterOption (line 20) | type RegisterOption struct
function WithUnknownService (line 24) | func WithUnknownService() RegisterOption {
type RegisterOptions (line 31) | type RegisterOptions struct
function NewRegisterOptions (line 37) | func NewRegisterOptions(opts []RegisterOption) *RegisterOptions {
function ApplyRegisterOptions (line 44) | func ApplyRegisterOptions(opts []RegisterOption, o *RegisterOptions) {
FILE: internal/server/remote_option.go
function newServerRemoteOption (line 34) | func newServerRemoteOption() *remote.ServerOption {
FILE: internal/server/remote_option_windows.go
function newServerRemoteOption (line 33) | func newServerRemoteOption() *remote.ServerOption {
FILE: internal/stream/cancel.go
type CancelableClientStream (line 21) | type CancelableClientStream interface
FILE: internal/stream/stream_option.go
type StreamingConfig (line 31) | type StreamingConfig struct
method InitMiddlewares (line 39) | func (c *StreamingConfig) InitMiddlewares(ctx context.Context) {
method BuildRecvInvokeChain (line 57) | func (c *StreamingConfig) BuildRecvInvokeChain() endpoint.RecvEndpoint {
method BuildSendInvokeChain (line 63) | func (c *StreamingConfig) BuildSendInvokeChain() endpoint.SendEndpoint {
FILE: internal/stream/stream_option_test.go
function TestStreamingConfig_InitMiddlewares (line 29) | func TestStreamingConfig_InitMiddlewares(t *testing.T) {
FILE: internal/test/assert.go
type testingTB (line 22) | type testingTB interface
function Assert (line 29) | func Assert(t testingTB, cond bool, val ...interface{}) {
function Assertf (line 42) | func Assertf(t testingTB, cond bool, format string, val ...interface{}) {
function DeepEqual (line 50) | func DeepEqual(t testingTB, a, b interface{}) {
function Panic (line 58) | func Panic(t testingTB, fn func()) {
function PanicAt (line 75) | func PanicAt(t testingTB, fn func(), expect func(err interface{}) bool) {
FILE: internal/test/assert_test.go
type mockTesting (line 24) | type mockTesting struct
method Reset (line 33) | func (m *mockTesting) Reset() {
method ExpectFatal (line 39) | func (m *mockTesting) ExpectFatal(args ...interface{}) {
method ExpectFatalf (line 43) | func (m *mockTesting) ExpectFatalf(format string, args ...interface{}) {
method Fatal (line 47) | func (m *mockTesting) Fatal(args ...interface{}) {
method Fatalf (line 58) | func (m *mockTesting) Fatalf(format string, args ...interface{}) {
method Helper (line 69) | func (m *mockTesting) Helper() { m.helper = true }
function TestAssert (line 71) | func TestAssert(t *testing.T) {
FILE: internal/test/port.go
constant UnixUserPortStart (line 31) | UnixUserPortStart = 1023
Condensed preview — 823 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,778K chars).
[
{
"path": ".codecov.yml",
"chars": 248,
"preview": "github_checks:\n annotations: false\n\nignore:\n - \"tool/**/*.go\"\n\ncoverage:\n status:\n project:\n default:\n "
},
{
"path": ".github/CODEOWNERS",
"chars": 262,
"preview": "# For more information, please refer to https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-f"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 655,
"preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the b"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 599,
"preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your fea"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 2046,
"preview": "#### What type of PR is this?\n<!--\nAdd one of the following kinds:\n\nbuild: Changes that affect the build system or exter"
},
{
"path": ".github/workflows/claude-review-fork.yml",
"chars": 2357,
"preview": "name: Claude Review Fork PR\n\n# Manual workflow to review PRs from forks\n# Usage: Go to Actions tab > Claude Review Fork "
},
{
"path": ".github/workflows/claude.yml",
"chars": 1885,
"preview": "name: Claude Code\n\non:\n issue_comment:\n types: [created]\n pull_request_review_comment:\n types: [created]\n issue"
},
{
"path": ".github/workflows/pr-check.yml",
"chars": 946,
"preview": "name: Pull Request Check\n\non: [ pull_request ]\n\njobs:\n compliant:\n runs-on: ubuntu-latest\n steps:\n - uses: a"
},
{
"path": ".github/workflows/tests.yml",
"chars": 3889,
"preview": "name: Tests\n\non: [ pull_request ]\n\njobs:\n unit-scenario-test:\n strategy:\n matrix:\n go: [ \"1.21\", \"1.26\" "
},
{
"path": ".gitignore",
"chars": 699,
"preview": "# Files generated by IDEs\n.idea/\n*.iml\n\n# Vim swap files\n*.swp\n\n# Vscode files\n.vscode\n\n# Emacs save files\n*~\n\\#*\\#\n.\\#*"
},
{
"path": ".golangci.yaml",
"chars": 639,
"preview": "version: \"2\"\nlinters:\n default: none\n enable:\n - govet\n - ineffassign\n - staticcheck\n - unconvert\n - un"
},
{
"path": ".licenserc.yaml",
"chars": 1425,
"preview": "header:\n license:\n spdx-id: Apache-2.0\n copyright-owner: CloudWeGo Authors\n\n paths:\n - \"**/*.go\"\n - \"**/*."
},
{
"path": ".typos.toml",
"chars": 376,
"preview": "# Typo check: https://github.com/crate-ci/typos\n\n[files]\nextend-exclude = [\"go.mod\", \"go.sum\"]\n\n[default.extend-words]\nt"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5222,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": "CONTRIBUTING.md",
"chars": 3822,
"preview": "# How to Contribute\n\n## Your First Pull Request\nWe use github for our codebase. You can start by reading [How To Pull Re"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "NOTICE",
"chars": 218,
"preview": "CloudWeGo\nCopyright 2021 CloudWeGo Authors.\n\nApache Thrift\nCopyright (C) 2006 - 2019, The Apache Software Foundation\n\nTh"
},
{
"path": "README.md",
"chars": 7580,
"preview": "# CloudWeGo-Kitex\n\nEnglish | [中文](README_cn.md)\n\n[](h"
},
{
"path": "README_cn.md",
"chars": 5410,
"preview": "# CloudWeGo-Kitex\n\n[English](README.md) | 中文\n\n[](http"
},
{
"path": "ROADMAP.md",
"chars": 1374,
"preview": "# Kitex RoadMap\n\nThis document shows key roadmap of Kitex development from the year of 2021 to 2022. It may help users k"
},
{
"path": "client/callopt/options.go",
"chars": 9187,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/callopt/options_test.go",
"chars": 6201,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/callopt/streamcall/call_options.go",
"chars": 3918,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/callopt/streamcall/call_options_test.go",
"chars": 2780,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/callopt/streamcall/definition.go",
"chars": 1825,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/callopt/streamcall/grpc_options.go",
"chars": 877,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/client.go",
"chars": 28215,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/client_test.go",
"chars": 43883,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/context.go",
"chars": 1537,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/context_middleware.go",
"chars": 1668,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/context_middleware_test.go",
"chars": 2490,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/context_test.go",
"chars": 1619,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/deprecated.go",
"chars": 1485,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/doc.go",
"chars": 863,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/genericclient/client.go",
"chars": 13112,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/genericclient/deprecated.go",
"chars": 6339,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/middlewares.go",
"chars": 7407,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/middlewares_test.go",
"chars": 10339,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/mocks_test.go",
"chars": 797,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option.go",
"chars": 22995,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option_advanced.go",
"chars": 7474,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option_stream.go",
"chars": 5446,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option_test.go",
"chars": 29572,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option_ttstream.go",
"chars": 1607,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/option_unary.go",
"chars": 2177,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/rpctimeout.go",
"chars": 4957,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/rpctimeout_pool.go",
"chars": 7451,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/rpctimeout_pool_test.go",
"chars": 4016,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/rpctimeout_test.go",
"chars": 10259,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/service_inline.go",
"chars": 6383,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/service_inline_test.go",
"chars": 9842,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/stream.go",
"chars": 13686,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/stream_test.go",
"chars": 34354,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/streamclient/client_option.go",
"chars": 5219,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/streamclient/client_option_advanced.go",
"chars": 2770,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/streamclient/definition.go",
"chars": 1772,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/streamclient/grpc_option.go",
"chars": 2504,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "client/streamclient/option.go",
"chars": 2556,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "go.mod",
"chars": 1828,
"preview": "module github.com/cloudwego/kitex\n\ngo 1.20\n\nrequire (\n\tgithub.com/bytedance/gopkg v0.1.3\n\tgithub.com/bytedance/sonic v1."
},
{
"path": "go.sum",
"chars": 25445,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ngithub.com/BurntSushi/toml v0.3.1/go."
},
{
"path": "internal/client/lock.go",
"chars": 1632,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/client/option.go",
"chars": 11483,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/client/option_ttstream.go",
"chars": 911,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/client/remote_option.go",
"chars": 1118,
"preview": "//go:build !windows\n// +build !windows\n\n/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, "
},
{
"path": "internal/client/remote_option_windows.go",
"chars": 1110,
"preview": "//go:build windows\n// +build windows\n\n/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Ve"
},
{
"path": "internal/configutil/config.go",
"chars": 5385,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/configutil/config_test.go",
"chars": 17729,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/configutil/once.go",
"chars": 1267,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/configutil/once_test.go",
"chars": 844,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/generic/context.go",
"chars": 1353,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/generic/generic_service.go",
"chars": 5631,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/generic/proto/type.go",
"chars": 1150,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/generic/utils.go",
"chars": 1081,
"preview": "/*\n * Copyright 2026 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/generic/utils_test.go",
"chars": 2253,
"preview": "/*\n * Copyright 2026 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/README.md",
"chars": 608,
"preview": "# Running Prerequisites\n\n- Run command `go install github.com/golang/mock/mockgen@latest` to install gomock\n- Run comman"
},
{
"path": "internal/mocks/bufiox/bufreader.go",
"chars": 4115,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/conn.go",
"chars": 2904,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/diagnosis/service.go",
"chars": 2079,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/discovery/discovery.go",
"chars": 5581,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/doc.go",
"chars": 663,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/generic/generic_service.go",
"chars": 3191,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/generic/thrift.go",
"chars": 3723,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/klog/log.go",
"chars": 30030,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/limiter/limiter.go",
"chars": 7546,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/loadbalance/loadbalancer.go",
"chars": 5241,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/message/message.go",
"chars": 3116,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/net/net.go",
"chars": 17698,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/netpoll/connection.go",
"chars": 18096,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/netpoll/nocopy.go",
"chars": 20459,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/kitex_gen/pbapi/mock/client.go",
"chars": 6138,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/kitex_gen/pbapi/mock/invoker.go",
"chars": 1114,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/kitex_gen/pbapi/mock/mock.go",
"chars": 16465,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/kitex_gen/pbapi/mock/pbapi.pb.go",
"chars": 9374,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/kitex_gen/pbapi/mock/server.go",
"chars": 1221,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/proto/pbapi.proto",
"chars": 425,
"preview": "syntax = \"proto3\";\npackage pbapi;\n\noption go_package = \"pbapi\";\n\nmessage MockReq {\n string message = 1;\n}\n\nmessage Mock"
},
{
"path": "internal/mocks/proxy/proxy.go",
"chars": 6481,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/bytebuf.go",
"chars": 14716,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/codec.go",
"chars": 6703,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/conn_wrapper.go",
"chars": 2063,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/connpool.go",
"chars": 9827,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/dialer.go",
"chars": 2085,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/payload_codec.go",
"chars": 3142,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/servicesearcher.go",
"chars": 2263,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/trans_handler.go",
"chars": 22075,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/trans_meta.go",
"chars": 4784,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/remote/trans_pipeline.go",
"chars": 9810,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/rpc_info/timeout_provider.go",
"chars": 2181,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/serviceinfo.go",
"chars": 8056,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/stats/tracer.go",
"chars": 2303,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/gen.sh",
"chars": 282,
"preview": "#! /bin/bash\n\nkitex -thrift no_default_serdes -module github.com/cloudwego/kitex -gen-path .. ./test.thrift\n\nkitex -thr"
},
{
"path": "internal/mocks/thrift/k-consts.go",
"chars": 732,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/k-stream.go",
"chars": 36478,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/k-test.go",
"chars": 20885,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/stream.go",
"chars": 18828,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/stream.thrift",
"chars": 588,
"preview": "namespace go thrift\n\nstruct Request {\n 1: required string message,\n}\n\nstruct Response {\n 1: required string messag"
},
{
"path": "internal/mocks/thrift/test.go",
"chars": 9519,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/thrift/test.thrift",
"chars": 288,
"preview": "namespace go thrift\n\nstruct MockReq {\n\t1: string Msg,\n\t2: map<string, string> strMap,\n\t3: list<string> strList,\n}\n\nexcep"
},
{
"path": "internal/mocks/transhandlerclient.go",
"chars": 3398,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/transhandlerserver.go",
"chars": 5374,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/mocks/update.sh",
"chars": 3079,
"preview": "#!/bin/bash\n\ncd $(dirname \"${BASH_SOURCE[0]}\")\n\n# source file => output file => package name\nfiles=(\n../../pkg/limiter/l"
},
{
"path": "internal/mocks/utils/sharedticker.go",
"chars": 1842,
"preview": "/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/reusable.go",
"chars": 699,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/server/config.go",
"chars": 1660,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/server/option.go",
"chars": 7868,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/server/register_option.go",
"chars": 1373,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/server/remote_option.go",
"chars": 1737,
"preview": "//go:build !windows\n// +build !windows\n\n/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, "
},
{
"path": "internal/server/remote_option_windows.go",
"chars": 1721,
"preview": "//go:build windows\n// +build windows\n\n/*\n * Copyright 2022 CloudWeGo Authors\n *\n * Licensed under the Apache License, Ve"
},
{
"path": "internal/stream/cancel.go",
"chars": 852,
"preview": "/*\n * Copyright 2026 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/stream/stream_option.go",
"chars": 2426,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/stream/stream_option_test.go",
"chars": 2658,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/test/assert.go",
"chars": 2349,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/test/assert_test.go",
"chars": 2407,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/test/port.go",
"chars": 2115,
"preview": "// Copyright 2023 CloudWeGo Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not"
},
{
"path": "internal/utils/safemcache/safemcache.go",
"chars": 2250,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "internal/utils/safemcache/safemcache_test.go",
"chars": 1161,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "licenses/LICENSE-gjson",
"chars": 1077,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2016 Josh Baker\n\nPermission is hereby granted, free of charge, to any person obtain"
},
{
"path": "licenses/LICENSE-go-genproto-main",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "licenses/LICENSE-grpc.txt",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "licenses/LICENSE-httprouter",
"chars": 1521,
"preview": "BSD 3-Clause License\n\nCopyright (c) 2013, Julien Schmidt\nAll rights reserved.\n\nRedistribution and use in source and bina"
},
{
"path": "licenses/LICENSE-json-iterator.txt",
"chars": 1069,
"preview": "MIT License\n\nCopyright (c) 2016 json-iterator\n\nPermission is hereby granted, free of charge, to any person obtaining a c"
},
{
"path": "licenses/LICENSE-pid",
"chars": 11325,
"preview": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licens"
},
{
"path": "licenses/LICENSE-protobuf.txt",
"chars": 1479,
"preview": "Copyright (c) 2018 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or with"
},
{
"path": "licenses/LICENSE-thrift",
"chars": 12610,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "licenses/LICENSE-xxhash.txt",
"chars": 1068,
"preview": "Copyright (c) 2016 Caleb Spare\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\na cop"
},
{
"path": "licenses/LICENSE-yaml.v3",
"chars": 2151,
"preview": "\nThis project is covered by two different licenses: MIT and Apache.\n\n#### MIT License ####\n\nThe following files were por"
},
{
"path": "pkg/acl/acl.go",
"chars": 1731,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/acl/acl_test.go",
"chars": 1547,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/cbsuite.go",
"chars": 11035,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/cbsuite_option.go",
"chars": 3174,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/cbsuite_option_test.go",
"chars": 2136,
"preview": "/*\n * Copyright 2024 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/cbsuite_test.go",
"chars": 16674,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/circuitbreak.go",
"chars": 4896,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/circuitbreak_test.go",
"chars": 5104,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/default.go",
"chars": 2188,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/default_test.go",
"chars": 1641,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/doc.go",
"chars": 685,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/circuitbreak/item_circuit_breaker.go",
"chars": 1742,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/connpool/config.go",
"chars": 1952,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/connpool/config_test.go",
"chars": 1839,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/consts/ctx.go",
"chars": 972,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/diagnosis/interface.go",
"chars": 2572,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/diagnosis/interface_test.go",
"chars": 1518,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/discovery/constants.go",
"chars": 744,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/discovery/discovery.go",
"chars": 5565,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/discovery/discovery_test.go",
"chars": 2119,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/cep/endpoint.go",
"chars": 3543,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/deprecated.go",
"chars": 2177,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/endpoint.go",
"chars": 2015,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/endpoint_test.go",
"chars": 2148,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/sep/endpoint.go",
"chars": 3098,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/endpoint/unary_endpoint.go",
"chars": 1133,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/event/bus.go",
"chars": 2783,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/event/bus_test.go",
"chars": 2156,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/event/event.go",
"chars": 752,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/event/queue.go",
"chars": 1933,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/event/queue_test.go",
"chars": 1568,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/exception/deprecated.go",
"chars": 1170,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/exception/deprecated_test.go",
"chars": 865,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/fallback/fallback.go",
"chars": 4874,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/fallback/fallback_test.go",
"chars": 7510,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binary_test/generic_init.go",
"chars": 5836,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binary_test/generic_test.go",
"chars": 5511,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binarypb_codec.go",
"chars": 1147,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binarypb_codec_test.go",
"chars": 1577,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binarythrift_codec.go",
"chars": 6296,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binarythrift_codec_test.go",
"chars": 5166,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/binarythrift_codec_v2.go",
"chars": 1117,
"preview": "/*\n * Copyright 2025 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/closer.go",
"chars": 738,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/annotation.go",
"chars": 3914,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/descriptor.go",
"chars": 3450,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/field_mapping.go",
"chars": 1544,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/field_mapping_test.go",
"chars": 1088,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/http.go",
"chars": 6404,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/http_mapping.go",
"chars": 6573,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/http_test.go",
"chars": 4231,
"preview": "/*\n * Copyright 2023 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/render.go",
"chars": 1453,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/route.go",
"chars": 2180,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/router.go",
"chars": 2539,
"preview": "/*\n * Copyright 2021 CloudWeGo Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may "
},
{
"path": "pkg/generic/descriptor/tree.go",
"chars": 11872,
"preview": "/*\n * Copyright 2013 Julien Schmidt. All rights reserved.\n * Use of this source code is governed by a BSD-style license "
},
{
"path": "pkg/generic/descriptor/tree_test.go",
"chars": 13907,
"preview": "/*\n * Copyright 2013 Julien Schmidt. All rights reserved.\n * Use of this source code is governed by a BSD-style license "
}
]
// ... and 623 more files (download for full content)
About this extraction
This page contains the full source code of the cloudwego/kitex GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 823 files (4.2 MB), approximately 1.1M tokens, and a symbol index with 8588 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.