* * Copyright 2017 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *
MethodConfig defines the configuration recommended by the service providers for a particular method. Deprecated: Users should not use this struct. Service config should be received through name resolver, as specified here https://github.com/grpc/grpc/blob/master/doc/service_config.md
WaitForReady indicates whether RPCs sent to this method should wait until the connection is ready by default (!failfast). The value specified via the gRPC client API will override the value set here.
Timeout is the default timeout for RPCs sent to this method. The actual deadline used will be the minimum of the value specified here and the value set by the application via the gRPC client API. If either one is not set, then the other will be used. If neither is set, then the RPC has no deadline.
MaxReqSize is the maximum allowed payload size for an individual request in a stream (client->server) in bytes. The size which is measured is the serialized payload after per-message compression (but before stream compression) in bytes. The actual value used is the minimum of the value specified here and the value set by the application via the gRPC client API. If either one is not set, then the other will be used. If neither is set, then the built-in default is used.
MaxRespSize is the maximum allowed payload size for an individual response in a stream (server->client) in bytes.
RetryPolicy configures retry options for the method.
ServiceConfig is provided by the service provider and contains parameters for how clients that connect to the service should behave. Deprecated: Users should not use this struct. Service config should be received through name resolver, as specified here https://github.com/grpc/grpc/blob/master/doc/service_config.md
LB is the load balancer the service providers recommends. The balancer specified via grpc.WithBalancerName will override this. This is deprecated; lbConfigs is preferred. If lbConfig and LB are both present, lbConfig will be used.
Methods contains a map for the methods in this service. If there is an exact match for a method (i.e. /service/method) in the map, use the corresponding MethodConfig. If there's no exact match, look for the default config for the service (/service/) and use the corresponding MethodConfig if it exists. Otherwise, the method has no MethodConfig to use.
If a retryThrottlingPolicy is provided, gRPC will automatically throttle retry attempts and hedged RPCs when the client’s ratio of failures to successes exceeds a threshold. For each server name, the gRPC client will maintain a token_count which is initially set to maxTokens, and can take values between 0 and maxTokens. Every outgoing RPC (regardless of service or method invoked) will change token_count as follows: - Every failed RPC will decrement the token_count by 1. - Every successful RPC will increment the token_count by tokenRatio. If token_count is less than or equal to maxTokens / 2, then RPCs will not be retried and hedged RPCs will not be sent.
healthCheckConfig must be set as one of the requirement to enable LB channel health check.
rawJSONString stores service config json string that get parsed into this service config struct.
retryPolicy defines the go-native version of the retry policy defined by the service config here: https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config
MaxAttempts is the maximum number of attempts, including the original RPC. This field is required and must be two or greater.
Exponential backoff parameters. The initial retry attempt will occur at random(0, initialBackoff). In general, the nth attempt will occur at random(0, min(initialBackoff*backoffMultiplier**(n-1), maxBackoff)). These fields are required and must be greater than zero.
The set of status codes which may be retried. Status codes are specified as strings, e.g., "UNAVAILABLE". This field is required and must be non-empty. Note: a set is used to store this for easy lookup.
retryThrottlingPolicy defines the go-native version of the retry throttling policy defined by the service config here: https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config
The number of tokens starts at maxTokens. The token_count will always be between 0 and maxTokens. This field is required and must be greater than zero.
The amount of tokens to add on each successful RPC. Typically this will be some number between 0 and 1, e.g., 0.1. This field is required and must be greater than zero. Up to 3 decimal places are supported.
equalServiceConfig compares two configs. The rawJSONString field is ignored, because they may diff in white spaces. If any of them is NOT *ServiceConfig, return false.
Using reflect.DeepEqual instead of cmp.Equal because many balancer configs are unexported, and cmp.Equal cannot compare unexported fields from unexported structs.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.