package serviceconfig
Import Path
google.golang.org/grpc/internal/serviceconfig (on go.dev)
Dependency Relation
imports 10 packages, and imported by 2 packages
Involved Source Files
duration.go
Package serviceconfig contains utility functions to parse service config.
Package-Level Type Names (total 4)
BalancerConfig wraps the name and config associated with one load balancing
policy. It corresponds to a single entry of the loadBalancingConfig field
from ServiceConfig.
It implements the json.Unmarshaler interface.
https://github.com/grpc/grpc-proto/blob/54713b1e8bc6ed2d4f25fb4dff527842150b91b2/grpc/service_config/service_config.proto#L247
Config externalserviceconfig.LoadBalancingConfig
Name string
MarshalJSON implements the json.Marshaler interface.
It marshals the balancer and config into a length-1 slice
([]map[string]config).
UnmarshalJSON implements the json.Unmarshaler interface.
ServiceConfig contains a list of loadBalancingConfigs, each with a name and
config. This method iterates through that list in order, and stops at the
first policy that is supported.
- If the config for the first supported policy is invalid, the whole service
config is invalid.
- If the list doesn't contain any supported policy, the whole service config
is invalid.
*BalancerConfig : encoding/json.Marshaler
*BalancerConfig : encoding/json.Unmarshaler
*BalancerConfig : github.com/goccy/go-json.Marshaler
*BalancerConfig : github.com/goccy/go-json.Unmarshaler
Duration defines JSON marshal and unmarshal methods to conform to the
protobuf JSON spec defined [here].
MarshalJSON converts from d to a JSON string output.
( Duration) String() string
UnmarshalJSON unmarshals b as a duration JSON string into d.
Duration : encoding/json.Marshaler
*Duration : encoding/json.Unmarshaler
Duration : expvar.Var
Duration : fmt.Stringer
Duration : github.com/goccy/go-json.Marshaler
*Duration : github.com/goccy/go-json.Unmarshaler
MethodConfig defines the configuration recommended by the service providers for a
particular method.
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.
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.
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.
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
BackoffMultiplier float64
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.
MaxAttempts is the maximum number of attempts, including the original RPC.
This field is required and must be two or greater.
MaxBackoff time.Duration
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.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux 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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |