@reptilestyle/grpc-js 1.9.14-compression.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +79 -0
- package/build/src/admin.d.ts +11 -0
- package/build/src/admin.js +30 -0
- package/build/src/admin.js.map +1 -0
- package/build/src/backoff-timeout.d.ts +90 -0
- package/build/src/backoff-timeout.js +174 -0
- package/build/src/backoff-timeout.js.map +1 -0
- package/build/src/call-credentials.d.ts +56 -0
- package/build/src/call-credentials.js +153 -0
- package/build/src/call-credentials.js.map +1 -0
- package/build/src/call-interface.d.ts +85 -0
- package/build/src/call-interface.js +84 -0
- package/build/src/call-interface.js.map +1 -0
- package/build/src/call-number.d.ts +1 -0
- package/build/src/call-number.js +24 -0
- package/build/src/call-number.js.map +1 -0
- package/build/src/call.d.ts +80 -0
- package/build/src/call.js +136 -0
- package/build/src/call.js.map +1 -0
- package/build/src/channel-credentials.d.ts +81 -0
- package/build/src/channel-credentials.js +177 -0
- package/build/src/channel-credentials.js.map +1 -0
- package/build/src/channel-options.d.ts +72 -0
- package/build/src/channel-options.js +69 -0
- package/build/src/channel-options.js.map +1 -0
- package/build/src/channel.d.ts +76 -0
- package/build/src/channel.js +68 -0
- package/build/src/channel.js.map +1 -0
- package/build/src/channelz.d.ts +108 -0
- package/build/src/channelz.js +637 -0
- package/build/src/channelz.js.map +1 -0
- package/build/src/client-interceptors.d.ts +120 -0
- package/build/src/client-interceptors.js +428 -0
- package/build/src/client-interceptors.js.map +1 -0
- package/build/src/client.d.ts +74 -0
- package/build/src/client.js +431 -0
- package/build/src/client.js.map +1 -0
- package/build/src/compression-algorithms.d.ts +5 -0
- package/build/src/compression-algorithms.js +26 -0
- package/build/src/compression-algorithms.js.map +1 -0
- package/build/src/compression-filter.d.ts +26 -0
- package/build/src/compression-filter.js +257 -0
- package/build/src/compression-filter.js.map +1 -0
- package/build/src/connectivity-state.d.ts +7 -0
- package/build/src/connectivity-state.js +28 -0
- package/build/src/connectivity-state.js.map +1 -0
- package/build/src/constants.d.ts +38 -0
- package/build/src/constants.js +64 -0
- package/build/src/constants.js.map +1 -0
- package/build/src/control-plane-status.d.ts +5 -0
- package/build/src/control-plane-status.js +42 -0
- package/build/src/control-plane-status.js.map +1 -0
- package/build/src/deadline.d.ts +14 -0
- package/build/src/deadline.js +97 -0
- package/build/src/deadline.js.map +1 -0
- package/build/src/duration.d.ts +7 -0
- package/build/src/duration.js +34 -0
- package/build/src/duration.js.map +1 -0
- package/build/src/error.d.ts +2 -0
- package/build/src/error.js +40 -0
- package/build/src/error.js.map +1 -0
- package/build/src/events.d.ts +9 -0
- package/build/src/events.js +19 -0
- package/build/src/events.js.map +1 -0
- package/build/src/experimental.d.ts +16 -0
- package/build/src/experimental.js +39 -0
- package/build/src/experimental.js.map +1 -0
- package/build/src/filter-stack.d.ts +21 -0
- package/build/src/filter-stack.js +82 -0
- package/build/src/filter-stack.js.map +1 -0
- package/build/src/filter.d.ts +25 -0
- package/build/src/filter.js +38 -0
- package/build/src/filter.js.map +1 -0
- package/build/src/generated/channelz.d.ts +72 -0
- package/build/src/generated/channelz.js +3 -0
- package/build/src/generated/channelz.js.map +1 -0
- package/build/src/generated/google/protobuf/Any.d.ts +9 -0
- package/build/src/generated/google/protobuf/Any.js +4 -0
- package/build/src/generated/google/protobuf/Any.js.map +1 -0
- package/build/src/generated/google/protobuf/BoolValue.d.ts +6 -0
- package/build/src/generated/google/protobuf/BoolValue.js +4 -0
- package/build/src/generated/google/protobuf/BoolValue.js.map +1 -0
- package/build/src/generated/google/protobuf/BytesValue.d.ts +6 -0
- package/build/src/generated/google/protobuf/BytesValue.js +4 -0
- package/build/src/generated/google/protobuf/BytesValue.js.map +1 -0
- package/build/src/generated/google/protobuf/DoubleValue.d.ts +6 -0
- package/build/src/generated/google/protobuf/DoubleValue.js +4 -0
- package/build/src/generated/google/protobuf/DoubleValue.js.map +1 -0
- package/build/src/generated/google/protobuf/Duration.d.ts +9 -0
- package/build/src/generated/google/protobuf/Duration.js +4 -0
- package/build/src/generated/google/protobuf/Duration.js.map +1 -0
- package/build/src/generated/google/protobuf/FloatValue.d.ts +6 -0
- package/build/src/generated/google/protobuf/FloatValue.js +4 -0
- package/build/src/generated/google/protobuf/FloatValue.js.map +1 -0
- package/build/src/generated/google/protobuf/Int32Value.d.ts +6 -0
- package/build/src/generated/google/protobuf/Int32Value.js +4 -0
- package/build/src/generated/google/protobuf/Int32Value.js.map +1 -0
- package/build/src/generated/google/protobuf/Int64Value.d.ts +7 -0
- package/build/src/generated/google/protobuf/Int64Value.js +4 -0
- package/build/src/generated/google/protobuf/Int64Value.js.map +1 -0
- package/build/src/generated/google/protobuf/StringValue.d.ts +6 -0
- package/build/src/generated/google/protobuf/StringValue.js +4 -0
- package/build/src/generated/google/protobuf/StringValue.js.map +1 -0
- package/build/src/generated/google/protobuf/Timestamp.d.ts +9 -0
- package/build/src/generated/google/protobuf/Timestamp.js +4 -0
- package/build/src/generated/google/protobuf/Timestamp.js.map +1 -0
- package/build/src/generated/google/protobuf/UInt32Value.d.ts +6 -0
- package/build/src/generated/google/protobuf/UInt32Value.js +4 -0
- package/build/src/generated/google/protobuf/UInt32Value.js.map +1 -0
- package/build/src/generated/google/protobuf/UInt64Value.d.ts +7 -0
- package/build/src/generated/google/protobuf/UInt64Value.js +4 -0
- package/build/src/generated/google/protobuf/UInt64Value.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Address.d.ts +79 -0
- package/build/src/generated/grpc/channelz/v1/Address.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Address.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Channel.d.ts +64 -0
- package/build/src/generated/grpc/channelz/v1/Channel.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Channel.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.d.ts +24 -0
- package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.js +14 -0
- package/build/src/generated/grpc/channelz/v1/ChannelConnectivityState.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ChannelData.d.ts +72 -0
- package/build/src/generated/grpc/channelz/v1/ChannelData.js +4 -0
- package/build/src/generated/grpc/channelz/v1/ChannelData.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ChannelRef.d.ts +27 -0
- package/build/src/generated/grpc/channelz/v1/ChannelRef.js +4 -0
- package/build/src/generated/grpc/channelz/v1/ChannelRef.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTrace.d.ts +41 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTrace.js +4 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTrace.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.d.ts +74 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.js +15 -0
- package/build/src/generated/grpc/channelz/v1/ChannelTraceEvent.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Channelz.d.ts +159 -0
- package/build/src/generated/grpc/channelz/v1/Channelz.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Channelz.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelRequest.d.ts +13 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelResponse.d.ts +15 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetChannelResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServerRequest.d.ts +13 -0
- package/build/src/generated/grpc/channelz/v1/GetServerRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServerRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServerResponse.d.ts +15 -0
- package/build/src/generated/grpc/channelz/v1/GetServerResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServerResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.d.ts +35 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.d.ts +29 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServerSocketsResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServersRequest.d.ts +33 -0
- package/build/src/generated/grpc/channelz/v1/GetServersRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServersRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetServersResponse.d.ts +29 -0
- package/build/src/generated/grpc/channelz/v1/GetServersResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetServersResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketRequest.d.ts +25 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketResponse.d.ts +15 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetSocketResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.d.ts +13 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.d.ts +15 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetSubchannelResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.d.ts +33 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsRequest.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.d.ts +29 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.js +4 -0
- package/build/src/generated/grpc/channelz/v1/GetTopChannelsResponse.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Security.d.ts +79 -0
- package/build/src/generated/grpc/channelz/v1/Security.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Security.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Server.d.ts +41 -0
- package/build/src/generated/grpc/channelz/v1/Server.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Server.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ServerData.d.ts +53 -0
- package/build/src/generated/grpc/channelz/v1/ServerData.js +4 -0
- package/build/src/generated/grpc/channelz/v1/ServerData.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/ServerRef.d.ts +27 -0
- package/build/src/generated/grpc/channelz/v1/ServerRef.js +4 -0
- package/build/src/generated/grpc/channelz/v1/ServerRef.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Socket.d.ts +66 -0
- package/build/src/generated/grpc/channelz/v1/Socket.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Socket.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketData.d.ts +146 -0
- package/build/src/generated/grpc/channelz/v1/SocketData.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketData.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketOption.d.ts +43 -0
- package/build/src/generated/grpc/channelz/v1/SocketOption.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketOption.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.d.ts +29 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionLinger.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.d.ts +70 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.d.ts +15 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketOptionTimeout.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SocketRef.d.ts +27 -0
- package/build/src/generated/grpc/channelz/v1/SocketRef.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SocketRef.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/Subchannel.d.ts +66 -0
- package/build/src/generated/grpc/channelz/v1/Subchannel.js +4 -0
- package/build/src/generated/grpc/channelz/v1/Subchannel.js.map +1 -0
- package/build/src/generated/grpc/channelz/v1/SubchannelRef.d.ts +27 -0
- package/build/src/generated/grpc/channelz/v1/SubchannelRef.js +4 -0
- package/build/src/generated/grpc/channelz/v1/SubchannelRef.js.map +1 -0
- package/build/src/http_proxy.d.ts +15 -0
- package/build/src/http_proxy.js +259 -0
- package/build/src/http_proxy.js.map +1 -0
- package/build/src/index.d.ts +76 -0
- package/build/src/index.js +140 -0
- package/build/src/index.js.map +1 -0
- package/build/src/internal-channel.d.ts +118 -0
- package/build/src/internal-channel.js +535 -0
- package/build/src/internal-channel.js.map +1 -0
- package/build/src/load-balancer-child-handler.d.ts +24 -0
- package/build/src/load-balancer-child-handler.js +151 -0
- package/build/src/load-balancer-child-handler.js.map +1 -0
- package/build/src/load-balancer-outlier-detection.d.ts +61 -0
- package/build/src/load-balancer-outlier-detection.js +608 -0
- package/build/src/load-balancer-outlier-detection.js.map +1 -0
- package/build/src/load-balancer-pick-first.d.ts +97 -0
- package/build/src/load-balancer-pick-first.js +393 -0
- package/build/src/load-balancer-pick-first.js.map +1 -0
- package/build/src/load-balancer-round-robin.d.ts +21 -0
- package/build/src/load-balancer-round-robin.js +174 -0
- package/build/src/load-balancer-round-robin.js.map +1 -0
- package/build/src/load-balancer.d.ts +97 -0
- package/build/src/load-balancer.js +102 -0
- package/build/src/load-balancer.js.map +1 -0
- package/build/src/load-balancing-call.d.ts +44 -0
- package/build/src/load-balancing-call.js +269 -0
- package/build/src/load-balancing-call.js.map +1 -0
- package/build/src/logging.d.ts +7 -0
- package/build/src/logging.js +114 -0
- package/build/src/logging.js.map +1 -0
- package/build/src/make-client.d.ts +71 -0
- package/build/src/make-client.js +143 -0
- package/build/src/make-client.js.map +1 -0
- package/build/src/max-message-size-filter.d.ts +15 -0
- package/build/src/max-message-size-filter.js +86 -0
- package/build/src/max-message-size-filter.js.map +1 -0
- package/build/src/metadata.d.ts +84 -0
- package/build/src/metadata.js +249 -0
- package/build/src/metadata.js.map +1 -0
- package/build/src/object-stream.d.ts +27 -0
- package/build/src/object-stream.js +19 -0
- package/build/src/object-stream.js.map +1 -0
- package/build/src/picker.d.ts +91 -0
- package/build/src/picker.js +78 -0
- package/build/src/picker.js.map +1 -0
- package/build/src/resolver-dns.d.ts +13 -0
- package/build/src/resolver-dns.js +328 -0
- package/build/src/resolver-dns.js.map +1 -0
- package/build/src/resolver-ip.d.ts +1 -0
- package/build/src/resolver-ip.js +104 -0
- package/build/src/resolver-ip.js.map +1 -0
- package/build/src/resolver-uds.d.ts +1 -0
- package/build/src/resolver-uds.js +50 -0
- package/build/src/resolver-uds.js.map +1 -0
- package/build/src/resolver.d.ts +105 -0
- package/build/src/resolver.js +87 -0
- package/build/src/resolver.js.map +1 -0
- package/build/src/resolving-call.d.ts +44 -0
- package/build/src/resolving-call.js +273 -0
- package/build/src/resolving-call.js.map +1 -0
- package/build/src/resolving-load-balancer.d.ts +67 -0
- package/build/src/resolving-load-balancer.js +304 -0
- package/build/src/resolving-load-balancer.js.map +1 -0
- package/build/src/retrying-call.d.ts +94 -0
- package/build/src/retrying-call.js +639 -0
- package/build/src/retrying-call.js.map +1 -0
- package/build/src/server-call.d.ts +159 -0
- package/build/src/server-call.js +700 -0
- package/build/src/server-call.js.map +1 -0
- package/build/src/server-credentials.d.ts +11 -0
- package/build/src/server-credentials.js +81 -0
- package/build/src/server-credentials.js.map +1 -0
- package/build/src/server.d.ts +56 -0
- package/build/src/server.js +892 -0
- package/build/src/server.js.map +1 -0
- package/build/src/service-config.d.ts +56 -0
- package/build/src/service-config.js +416 -0
- package/build/src/service-config.js.map +1 -0
- package/build/src/status-builder.d.ts +28 -0
- package/build/src/status-builder.js +68 -0
- package/build/src/status-builder.js.map +1 -0
- package/build/src/stream-decoder.d.ts +10 -0
- package/build/src/stream-decoder.js +96 -0
- package/build/src/stream-decoder.js.map +1 -0
- package/build/src/subchannel-address.d.ts +18 -0
- package/build/src/subchannel-address.js +65 -0
- package/build/src/subchannel-address.js.map +1 -0
- package/build/src/subchannel-call.d.ts +61 -0
- package/build/src/subchannel-call.js +461 -0
- package/build/src/subchannel-call.js.map +1 -0
- package/build/src/subchannel-interface.d.ts +49 -0
- package/build/src/subchannel-interface.js +59 -0
- package/build/src/subchannel-interface.js.map +1 -0
- package/build/src/subchannel-pool.d.ts +40 -0
- package/build/src/subchannel-pool.js +137 -0
- package/build/src/subchannel-pool.js.map +1 -0
- package/build/src/subchannel.d.ts +119 -0
- package/build/src/subchannel.js +353 -0
- package/build/src/subchannel.js.map +1 -0
- package/build/src/tls-helpers.d.ts +2 -0
- package/build/src/tls-helpers.js +34 -0
- package/build/src/tls-helpers.js.map +1 -0
- package/build/src/transport.d.ts +130 -0
- package/build/src/transport.js +640 -0
- package/build/src/transport.js.map +1 -0
- package/build/src/uri-parser.d.ts +12 -0
- package/build/src/uri-parser.js +110 -0
- package/build/src/uri-parser.js.map +1 -0
- package/package.json +85 -0
- package/proto/channelz.proto +564 -0
- package/src/admin.ts +45 -0
- package/src/backoff-timeout.ts +196 -0
- package/src/call-credentials.ts +226 -0
- package/src/call-interface.ts +173 -0
- package/src/call-number.ts +22 -0
- package/src/call.ts +200 -0
- package/src/channel-credentials.ts +267 -0
- package/src/channel-options.ts +119 -0
- package/src/channel.ts +174 -0
- package/src/channelz.ts +886 -0
- package/src/client-interceptors.ts +577 -0
- package/src/client.ts +715 -0
- package/src/compression-algorithms.ts +22 -0
- package/src/compression-filter.ts +315 -0
- package/src/connectivity-state.ts +24 -0
- package/src/constants.ts +66 -0
- package/src/control-plane-status.ts +43 -0
- package/src/deadline.ts +95 -0
- package/src/duration.ts +36 -0
- package/src/error.ts +37 -0
- package/src/events.ts +26 -0
- package/src/experimental.ts +48 -0
- package/src/filter-stack.ts +100 -0
- package/src/filter.ts +63 -0
- package/src/generated/channelz.ts +73 -0
- package/src/generated/google/protobuf/Any.ts +13 -0
- package/src/generated/google/protobuf/BoolValue.ts +10 -0
- package/src/generated/google/protobuf/BytesValue.ts +10 -0
- package/src/generated/google/protobuf/DoubleValue.ts +10 -0
- package/src/generated/google/protobuf/Duration.ts +13 -0
- package/src/generated/google/protobuf/FloatValue.ts +10 -0
- package/src/generated/google/protobuf/Int32Value.ts +10 -0
- package/src/generated/google/protobuf/Int64Value.ts +11 -0
- package/src/generated/google/protobuf/StringValue.ts +10 -0
- package/src/generated/google/protobuf/Timestamp.ts +13 -0
- package/src/generated/google/protobuf/UInt32Value.ts +10 -0
- package/src/generated/google/protobuf/UInt64Value.ts +11 -0
- package/src/generated/grpc/channelz/v1/Address.ts +89 -0
- package/src/generated/grpc/channelz/v1/Channel.ts +68 -0
- package/src/generated/grpc/channelz/v1/ChannelConnectivityState.ts +45 -0
- package/src/generated/grpc/channelz/v1/ChannelData.ts +76 -0
- package/src/generated/grpc/channelz/v1/ChannelRef.ts +31 -0
- package/src/generated/grpc/channelz/v1/ChannelTrace.ts +45 -0
- package/src/generated/grpc/channelz/v1/ChannelTraceEvent.ts +91 -0
- package/src/generated/grpc/channelz/v1/Channelz.ts +178 -0
- package/src/generated/grpc/channelz/v1/GetChannelRequest.ts +17 -0
- package/src/generated/grpc/channelz/v1/GetChannelResponse.ts +19 -0
- package/src/generated/grpc/channelz/v1/GetServerRequest.ts +17 -0
- package/src/generated/grpc/channelz/v1/GetServerResponse.ts +19 -0
- package/src/generated/grpc/channelz/v1/GetServerSocketsRequest.ts +39 -0
- package/src/generated/grpc/channelz/v1/GetServerSocketsResponse.ts +33 -0
- package/src/generated/grpc/channelz/v1/GetServersRequest.ts +37 -0
- package/src/generated/grpc/channelz/v1/GetServersResponse.ts +33 -0
- package/src/generated/grpc/channelz/v1/GetSocketRequest.ts +29 -0
- package/src/generated/grpc/channelz/v1/GetSocketResponse.ts +19 -0
- package/src/generated/grpc/channelz/v1/GetSubchannelRequest.ts +17 -0
- package/src/generated/grpc/channelz/v1/GetSubchannelResponse.ts +19 -0
- package/src/generated/grpc/channelz/v1/GetTopChannelsRequest.ts +37 -0
- package/src/generated/grpc/channelz/v1/GetTopChannelsResponse.ts +33 -0
- package/src/generated/grpc/channelz/v1/Security.ts +87 -0
- package/src/generated/grpc/channelz/v1/Server.ts +45 -0
- package/src/generated/grpc/channelz/v1/ServerData.ts +57 -0
- package/src/generated/grpc/channelz/v1/ServerRef.ts +31 -0
- package/src/generated/grpc/channelz/v1/Socket.ts +70 -0
- package/src/generated/grpc/channelz/v1/SocketData.ts +150 -0
- package/src/generated/grpc/channelz/v1/SocketOption.ts +47 -0
- package/src/generated/grpc/channelz/v1/SocketOptionLinger.ts +33 -0
- package/src/generated/grpc/channelz/v1/SocketOptionTcpInfo.ts +74 -0
- package/src/generated/grpc/channelz/v1/SocketOptionTimeout.ts +19 -0
- package/src/generated/grpc/channelz/v1/SocketRef.ts +31 -0
- package/src/generated/grpc/channelz/v1/Subchannel.ts +70 -0
- package/src/generated/grpc/channelz/v1/SubchannelRef.ts +31 -0
- package/src/http_proxy.ts +311 -0
- package/src/index.ts +284 -0
- package/src/internal-channel.ts +832 -0
- package/src/load-balancer-child-handler.ts +169 -0
- package/src/load-balancer-outlier-detection.ts +882 -0
- package/src/load-balancer-pick-first.ts +487 -0
- package/src/load-balancer-round-robin.ts +249 -0
- package/src/load-balancer.ts +230 -0
- package/src/load-balancing-call.ts +351 -0
- package/src/logging.ts +123 -0
- package/src/make-client.ts +238 -0
- package/src/max-message-size-filter.ts +88 -0
- package/src/metadata.ts +298 -0
- package/src/object-stream.ts +66 -0
- package/src/picker.ts +146 -0
- package/src/resolver-dns.ts +412 -0
- package/src/resolver-ip.ts +120 -0
- package/src/resolver-uds.ts +63 -0
- package/src/resolver.ts +180 -0
- package/src/resolving-call.ts +331 -0
- package/src/resolving-load-balancer.ts +403 -0
- package/src/retrying-call.ts +821 -0
- package/src/server-call.ts +1033 -0
- package/src/server-credentials.ts +108 -0
- package/src/server.ts +1300 -0
- package/src/service-config.ts +542 -0
- package/src/status-builder.ts +80 -0
- package/src/stream-decoder.ts +105 -0
- package/src/subchannel-address.ts +88 -0
- package/src/subchannel-call.ts +539 -0
- package/src/subchannel-interface.ts +97 -0
- package/src/subchannel-pool.ts +176 -0
- package/src/subchannel.ts +482 -0
- package/src/tls-helpers.ts +35 -0
- package/src/transport.ts +824 -0
- package/src/uri-parser.ts +114 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2019 gRPC authors.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
LoadBalancer,
|
|
20
|
+
ChannelControlHelper,
|
|
21
|
+
LoadBalancingConfig,
|
|
22
|
+
registerDefaultLoadBalancerType,
|
|
23
|
+
registerLoadBalancerType,
|
|
24
|
+
} from './load-balancer';
|
|
25
|
+
import { ConnectivityState } from './connectivity-state';
|
|
26
|
+
import {
|
|
27
|
+
QueuePicker,
|
|
28
|
+
Picker,
|
|
29
|
+
PickArgs,
|
|
30
|
+
CompletePickResult,
|
|
31
|
+
PickResultType,
|
|
32
|
+
UnavailablePicker,
|
|
33
|
+
} from './picker';
|
|
34
|
+
import { SubchannelAddress } from './subchannel-address';
|
|
35
|
+
import * as logging from './logging';
|
|
36
|
+
import { LogVerbosity } from './constants';
|
|
37
|
+
import {
|
|
38
|
+
SubchannelInterface,
|
|
39
|
+
ConnectivityStateListener,
|
|
40
|
+
} from './subchannel-interface';
|
|
41
|
+
|
|
42
|
+
const TRACER_NAME = 'pick_first';
|
|
43
|
+
|
|
44
|
+
function trace(text: string): void {
|
|
45
|
+
logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const TYPE_NAME = 'pick_first';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Delay after starting a connection on a subchannel before starting a
|
|
52
|
+
* connection on the next subchannel in the list, for Happy Eyeballs algorithm.
|
|
53
|
+
*/
|
|
54
|
+
const CONNECTION_DELAY_INTERVAL_MS = 250;
|
|
55
|
+
|
|
56
|
+
export class PickFirstLoadBalancingConfig implements LoadBalancingConfig {
|
|
57
|
+
constructor(private readonly shuffleAddressList: boolean) {}
|
|
58
|
+
|
|
59
|
+
getLoadBalancerName(): string {
|
|
60
|
+
return TYPE_NAME;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
toJsonObject(): object {
|
|
64
|
+
return {
|
|
65
|
+
[TYPE_NAME]: {
|
|
66
|
+
shuffleAddressList: this.shuffleAddressList,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getShuffleAddressList() {
|
|
72
|
+
return this.shuffleAddressList;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
static createFromJson(obj: any) {
|
|
77
|
+
if (
|
|
78
|
+
'shuffleAddressList' in obj &&
|
|
79
|
+
!(typeof obj.shuffleAddressList === 'boolean')
|
|
80
|
+
) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
'pick_first config field shuffleAddressList must be a boolean if provided'
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return new PickFirstLoadBalancingConfig(obj.shuffleAddressList === true);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Picker for a `PickFirstLoadBalancer` in the READY state. Always returns the
|
|
91
|
+
* picked subchannel.
|
|
92
|
+
*/
|
|
93
|
+
class PickFirstPicker implements Picker {
|
|
94
|
+
constructor(private subchannel: SubchannelInterface) {}
|
|
95
|
+
|
|
96
|
+
pick(pickArgs: PickArgs): CompletePickResult {
|
|
97
|
+
return {
|
|
98
|
+
pickResultType: PickResultType.COMPLETE,
|
|
99
|
+
subchannel: this.subchannel,
|
|
100
|
+
status: null,
|
|
101
|
+
onCallStarted: null,
|
|
102
|
+
onCallEnded: null,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface SubchannelChild {
|
|
108
|
+
subchannel: SubchannelInterface;
|
|
109
|
+
hasReportedTransientFailure: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Return a new array with the elements of the input array in a random order
|
|
114
|
+
* @param list The input array
|
|
115
|
+
* @returns A shuffled array of the elements of list
|
|
116
|
+
*/
|
|
117
|
+
export function shuffled<T>(list: T[]): T[] {
|
|
118
|
+
const result = list.slice();
|
|
119
|
+
for (let i = result.length - 1; i > 1; i--) {
|
|
120
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
121
|
+
const temp = result[i];
|
|
122
|
+
result[i] = result[j];
|
|
123
|
+
result[j] = temp;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export class PickFirstLoadBalancer implements LoadBalancer {
|
|
129
|
+
/**
|
|
130
|
+
* The list of subchannels this load balancer is currently attempting to
|
|
131
|
+
* connect to.
|
|
132
|
+
*/
|
|
133
|
+
private children: SubchannelChild[] = [];
|
|
134
|
+
/**
|
|
135
|
+
* The current connectivity state of the load balancer.
|
|
136
|
+
*/
|
|
137
|
+
private currentState: ConnectivityState = ConnectivityState.IDLE;
|
|
138
|
+
/**
|
|
139
|
+
* The index within the `subchannels` array of the subchannel with the most
|
|
140
|
+
* recently started connection attempt.
|
|
141
|
+
*/
|
|
142
|
+
private currentSubchannelIndex = 0;
|
|
143
|
+
/**
|
|
144
|
+
* The currently picked subchannel used for making calls. Populated if
|
|
145
|
+
* and only if the load balancer's current state is READY. In that case,
|
|
146
|
+
* the subchannel's current state is also READY.
|
|
147
|
+
*/
|
|
148
|
+
private currentPick: SubchannelInterface | null = null;
|
|
149
|
+
/**
|
|
150
|
+
* Listener callback attached to each subchannel in the `subchannels` list
|
|
151
|
+
* while establishing a connection.
|
|
152
|
+
*/
|
|
153
|
+
private subchannelStateListener: ConnectivityStateListener = (
|
|
154
|
+
subchannel,
|
|
155
|
+
previousState,
|
|
156
|
+
newState,
|
|
157
|
+
keepaliveTime,
|
|
158
|
+
errorMessage
|
|
159
|
+
) => {
|
|
160
|
+
this.onSubchannelStateUpdate(subchannel, previousState, newState, errorMessage);
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Timer reference for the timer tracking when to start
|
|
164
|
+
*/
|
|
165
|
+
private connectionDelayTimeout: NodeJS.Timeout;
|
|
166
|
+
|
|
167
|
+
private triedAllSubchannels = false;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The LB policy enters sticky TRANSIENT_FAILURE mode when all
|
|
171
|
+
* subchannels have failed to connect at least once, and it stays in that
|
|
172
|
+
* mode until a connection attempt is successful. While in sticky TF mode,
|
|
173
|
+
* the LB policy continuously attempts to connect to all of its subchannels.
|
|
174
|
+
*/
|
|
175
|
+
private stickyTransientFailureMode = false;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Indicates whether we called channelControlHelper.requestReresolution since
|
|
179
|
+
* the last call to updateAddressList
|
|
180
|
+
*/
|
|
181
|
+
private requestedResolutionSinceLastUpdate = false;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The most recent error reported by any subchannel as it transitioned to
|
|
185
|
+
* TRANSIENT_FAILURE.
|
|
186
|
+
*/
|
|
187
|
+
private lastError: string | null = null;
|
|
188
|
+
|
|
189
|
+
private latestAddressList: SubchannelAddress[] | null = null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Load balancer that attempts to connect to each backend in the address list
|
|
193
|
+
* in order, and picks the first one that connects, using it for every
|
|
194
|
+
* request.
|
|
195
|
+
* @param channelControlHelper `ChannelControlHelper` instance provided by
|
|
196
|
+
* this load balancer's owner.
|
|
197
|
+
*/
|
|
198
|
+
constructor(private readonly channelControlHelper: ChannelControlHelper) {
|
|
199
|
+
this.connectionDelayTimeout = setTimeout(() => {}, 0);
|
|
200
|
+
clearTimeout(this.connectionDelayTimeout);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private allChildrenHaveReportedTF(): boolean {
|
|
204
|
+
return this.children.every(child => child.hasReportedTransientFailure);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private calculateAndReportNewState() {
|
|
208
|
+
if (this.currentPick) {
|
|
209
|
+
this.updateState(
|
|
210
|
+
ConnectivityState.READY,
|
|
211
|
+
new PickFirstPicker(this.currentPick)
|
|
212
|
+
);
|
|
213
|
+
} else if (this.children.length === 0) {
|
|
214
|
+
this.updateState(ConnectivityState.IDLE, new QueuePicker(this));
|
|
215
|
+
} else {
|
|
216
|
+
if (this.stickyTransientFailureMode) {
|
|
217
|
+
this.updateState(
|
|
218
|
+
ConnectivityState.TRANSIENT_FAILURE,
|
|
219
|
+
new UnavailablePicker({details: `No connection established. Last error: ${this.lastError}`})
|
|
220
|
+
);
|
|
221
|
+
} else {
|
|
222
|
+
this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private requestReresolution() {
|
|
228
|
+
this.requestedResolutionSinceLastUpdate = true;
|
|
229
|
+
this.channelControlHelper.requestReresolution();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private maybeEnterStickyTransientFailureMode() {
|
|
233
|
+
if (!this.allChildrenHaveReportedTF()) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (!this.requestedResolutionSinceLastUpdate) {
|
|
237
|
+
/* Each time we get an update we reset each subchannel's
|
|
238
|
+
* hasReportedTransientFailure flag, so the next time we get to this
|
|
239
|
+
* point after that, each subchannel has reported TRANSIENT_FAILURE
|
|
240
|
+
* at least once since then. That is the trigger for requesting
|
|
241
|
+
* reresolution, whether or not the LB policy is already in sticky TF
|
|
242
|
+
* mode. */
|
|
243
|
+
this.requestReresolution();
|
|
244
|
+
}
|
|
245
|
+
if (this.stickyTransientFailureMode) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.stickyTransientFailureMode = true;
|
|
249
|
+
for (const { subchannel } of this.children) {
|
|
250
|
+
subchannel.startConnecting();
|
|
251
|
+
}
|
|
252
|
+
this.calculateAndReportNewState();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private removeCurrentPick() {
|
|
256
|
+
if (this.currentPick !== null) {
|
|
257
|
+
/* Unref can cause a state change, which can cause a change in the value
|
|
258
|
+
* of this.currentPick, so we hold a local reference to make sure that
|
|
259
|
+
* does not impact this function. */
|
|
260
|
+
const currentPick = this.currentPick;
|
|
261
|
+
this.currentPick = null;
|
|
262
|
+
currentPick.unref();
|
|
263
|
+
currentPick.removeConnectivityStateListener(this.subchannelStateListener);
|
|
264
|
+
this.channelControlHelper.removeChannelzChild(
|
|
265
|
+
currentPick.getChannelzRef()
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private onSubchannelStateUpdate(
|
|
271
|
+
subchannel: SubchannelInterface,
|
|
272
|
+
previousState: ConnectivityState,
|
|
273
|
+
newState: ConnectivityState,
|
|
274
|
+
errorMessage?: string
|
|
275
|
+
) {
|
|
276
|
+
if (this.currentPick?.realSubchannelEquals(subchannel)) {
|
|
277
|
+
if (newState !== ConnectivityState.READY) {
|
|
278
|
+
this.removeCurrentPick();
|
|
279
|
+
this.calculateAndReportNewState();
|
|
280
|
+
this.requestReresolution();
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
for (const [index, child] of this.children.entries()) {
|
|
285
|
+
if (subchannel.realSubchannelEquals(child.subchannel)) {
|
|
286
|
+
if (newState === ConnectivityState.READY) {
|
|
287
|
+
this.pickSubchannel(child.subchannel);
|
|
288
|
+
}
|
|
289
|
+
if (newState === ConnectivityState.TRANSIENT_FAILURE) {
|
|
290
|
+
child.hasReportedTransientFailure = true;
|
|
291
|
+
if (errorMessage) {
|
|
292
|
+
this.lastError = errorMessage;
|
|
293
|
+
}
|
|
294
|
+
this.maybeEnterStickyTransientFailureMode();
|
|
295
|
+
if (index === this.currentSubchannelIndex) {
|
|
296
|
+
this.startNextSubchannelConnecting(index + 1);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
child.subchannel.startConnecting();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private startNextSubchannelConnecting(startIndex: number) {
|
|
306
|
+
clearTimeout(this.connectionDelayTimeout);
|
|
307
|
+
if (this.triedAllSubchannels) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
for (const [index, child] of this.children.entries()) {
|
|
311
|
+
if (index >= startIndex) {
|
|
312
|
+
const subchannelState = child.subchannel.getConnectivityState();
|
|
313
|
+
if (
|
|
314
|
+
subchannelState === ConnectivityState.IDLE ||
|
|
315
|
+
subchannelState === ConnectivityState.CONNECTING
|
|
316
|
+
) {
|
|
317
|
+
this.startConnecting(index);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
this.triedAllSubchannels = true;
|
|
323
|
+
this.maybeEnterStickyTransientFailureMode();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Have a single subchannel in the `subchannels` list start connecting.
|
|
328
|
+
* @param subchannelIndex The index into the `subchannels` list.
|
|
329
|
+
*/
|
|
330
|
+
private startConnecting(subchannelIndex: number) {
|
|
331
|
+
clearTimeout(this.connectionDelayTimeout);
|
|
332
|
+
this.currentSubchannelIndex = subchannelIndex;
|
|
333
|
+
if (
|
|
334
|
+
this.children[subchannelIndex].subchannel.getConnectivityState() ===
|
|
335
|
+
ConnectivityState.IDLE
|
|
336
|
+
) {
|
|
337
|
+
trace(
|
|
338
|
+
'Start connecting to subchannel with address ' +
|
|
339
|
+
this.children[subchannelIndex].subchannel.getAddress()
|
|
340
|
+
);
|
|
341
|
+
process.nextTick(() => {
|
|
342
|
+
this.children[subchannelIndex]?.subchannel.startConnecting();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
this.connectionDelayTimeout = setTimeout(() => {
|
|
346
|
+
this.startNextSubchannelConnecting(subchannelIndex + 1);
|
|
347
|
+
}, CONNECTION_DELAY_INTERVAL_MS).unref?.();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
private pickSubchannel(subchannel: SubchannelInterface) {
|
|
351
|
+
if (this.currentPick && subchannel.realSubchannelEquals(this.currentPick)) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
trace('Pick subchannel with address ' + subchannel.getAddress());
|
|
355
|
+
this.stickyTransientFailureMode = false;
|
|
356
|
+
if (this.currentPick !== null) {
|
|
357
|
+
this.currentPick.unref();
|
|
358
|
+
this.channelControlHelper.removeChannelzChild(
|
|
359
|
+
this.currentPick.getChannelzRef()
|
|
360
|
+
);
|
|
361
|
+
this.currentPick.removeConnectivityStateListener(
|
|
362
|
+
this.subchannelStateListener
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
this.currentPick = subchannel;
|
|
366
|
+
subchannel.ref();
|
|
367
|
+
this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef());
|
|
368
|
+
this.resetSubchannelList();
|
|
369
|
+
clearTimeout(this.connectionDelayTimeout);
|
|
370
|
+
this.calculateAndReportNewState();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
private updateState(newState: ConnectivityState, picker: Picker) {
|
|
374
|
+
trace(
|
|
375
|
+
ConnectivityState[this.currentState] +
|
|
376
|
+
' -> ' +
|
|
377
|
+
ConnectivityState[newState]
|
|
378
|
+
);
|
|
379
|
+
this.currentState = newState;
|
|
380
|
+
this.channelControlHelper.updateState(newState, picker);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private resetSubchannelList() {
|
|
384
|
+
for (const child of this.children) {
|
|
385
|
+
if (!(this.currentPick && child.subchannel.realSubchannelEquals(this.currentPick))) {
|
|
386
|
+
/* The connectivity state listener is the same whether the subchannel
|
|
387
|
+
* is in the list of children or it is the currentPick, so if it is in
|
|
388
|
+
* both, removing it here would cause problems. In particular, that
|
|
389
|
+
* always happens immediately after the subchannel is picked. */
|
|
390
|
+
child.subchannel.removeConnectivityStateListener(
|
|
391
|
+
this.subchannelStateListener
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
/* Refs are counted independently for the children list and the
|
|
395
|
+
* currentPick, so we call unref whether or not the child is the
|
|
396
|
+
* currentPick. Channelz child references are also refcounted, so
|
|
397
|
+
* removeChannelzChild can be handled the same way. */
|
|
398
|
+
child.subchannel.unref();
|
|
399
|
+
this.channelControlHelper.removeChannelzChild(
|
|
400
|
+
child.subchannel.getChannelzRef()
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
this.currentSubchannelIndex = 0;
|
|
404
|
+
this.children = [];
|
|
405
|
+
this.triedAllSubchannels = false;
|
|
406
|
+
this.requestedResolutionSinceLastUpdate = false;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
private connectToAddressList(addressList: SubchannelAddress[]) {
|
|
410
|
+
const newChildrenList = addressList.map(address => ({
|
|
411
|
+
subchannel: this.channelControlHelper.createSubchannel(address, {}),
|
|
412
|
+
hasReportedTransientFailure: false,
|
|
413
|
+
}));
|
|
414
|
+
/* Ref each subchannel before resetting the list, to ensure that
|
|
415
|
+
* subchannels shared between the list don't drop to 0 refs during the
|
|
416
|
+
* transition. */
|
|
417
|
+
for (const { subchannel } of newChildrenList) {
|
|
418
|
+
subchannel.ref();
|
|
419
|
+
this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef());
|
|
420
|
+
}
|
|
421
|
+
this.resetSubchannelList();
|
|
422
|
+
this.children = newChildrenList;
|
|
423
|
+
for (const { subchannel } of this.children) {
|
|
424
|
+
subchannel.addConnectivityStateListener(this.subchannelStateListener);
|
|
425
|
+
if (subchannel.getConnectivityState() === ConnectivityState.READY) {
|
|
426
|
+
this.pickSubchannel(subchannel);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
for (const child of this.children) {
|
|
431
|
+
if (
|
|
432
|
+
child.subchannel.getConnectivityState() ===
|
|
433
|
+
ConnectivityState.TRANSIENT_FAILURE
|
|
434
|
+
) {
|
|
435
|
+
child.hasReportedTransientFailure = true;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
this.startNextSubchannelConnecting(0);
|
|
439
|
+
this.calculateAndReportNewState();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
updateAddressList(
|
|
443
|
+
addressList: SubchannelAddress[],
|
|
444
|
+
lbConfig: LoadBalancingConfig
|
|
445
|
+
): void {
|
|
446
|
+
if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
/* Previously, an update would be discarded if it was identical to the
|
|
450
|
+
* previous update, to minimize churn. Now the DNS resolver is
|
|
451
|
+
* rate-limited, so that is less of a concern. */
|
|
452
|
+
if (lbConfig.getShuffleAddressList()) {
|
|
453
|
+
addressList = shuffled(addressList);
|
|
454
|
+
}
|
|
455
|
+
this.latestAddressList = addressList;
|
|
456
|
+
this.connectToAddressList(addressList);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
exitIdle() {
|
|
460
|
+
if (this.currentState === ConnectivityState.IDLE && this.latestAddressList) {
|
|
461
|
+
this.connectToAddressList(this.latestAddressList);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
resetBackoff() {
|
|
466
|
+
/* The pick first load balancer does not have a connection backoff, so this
|
|
467
|
+
* does nothing */
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
destroy() {
|
|
471
|
+
this.resetSubchannelList();
|
|
472
|
+
this.removeCurrentPick();
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
getTypeName(): string {
|
|
476
|
+
return TYPE_NAME;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export function setup(): void {
|
|
481
|
+
registerLoadBalancerType(
|
|
482
|
+
TYPE_NAME,
|
|
483
|
+
PickFirstLoadBalancer,
|
|
484
|
+
PickFirstLoadBalancingConfig
|
|
485
|
+
);
|
|
486
|
+
registerDefaultLoadBalancerType(TYPE_NAME);
|
|
487
|
+
}
|