serviceconfig
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package serviceconfig contains utility functions to parse service config.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeBalancerConfig¶
type BalancerConfig struct {NamestringConfigexternalserviceconfig.LoadBalancingConfig}BalancerConfig wraps the name and config associated with one load balancingpolicy. It corresponds to a single entry of the loadBalancingConfig fieldfrom ServiceConfig.
It implements the json.Unmarshaler interface.
func (*BalancerConfig)MarshalJSON¶added inv1.38.0
func (bc *BalancerConfig) MarshalJSON() ([]byte,error)
MarshalJSON implements the json.Marshaler interface.
It marshals the balancer and config into a length-1 slice([]map[string]config).
func (*BalancerConfig)UnmarshalJSON¶
func (bc *BalancerConfig) UnmarshalJSON(b []byte)error
UnmarshalJSON implements the json.Unmarshaler interface.
ServiceConfig contains a list of loadBalancingConfigs, each with a name andconfig. This method iterates through that list in order, and stops at thefirst policy that is supported.
- If the config for the first supported policy is invalid, the whole serviceconfig is invalid.
- If the list doesn't contain any supported policy, the whole service configis invalid.
typeDuration¶added inv1.56.0
Duration defines JSON marshal and unmarshal methods to conform to theprotobuf JSON spec definedhere.
func (Duration)MarshalJSON¶added inv1.56.0
MarshalJSON converts from d to a JSON string output.
func (*Duration)UnmarshalJSON¶added inv1.56.0
UnmarshalJSON unmarshals b as a duration JSON string into d.
typeMethodConfig¶added inv1.34.0
type MethodConfig struct {// 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.WaitForReady *bool// 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.Timeout *time.Duration// 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.MaxReqSize *int// MaxRespSize is the maximum allowed payload size for an individual response in a// stream (server->client) in bytes.MaxRespSize *int// RetryPolicy configures retry options for the method.RetryPolicy *RetryPolicy}MethodConfig defines the configuration recommended by the service providers for aparticular method.
typeRetryPolicy¶added inv1.34.0
type RetryPolicy struct {// MaxAttempts is the maximum number of attempts, including the original RPC.//// This field is required and must be two or greater.MaxAttemptsint// 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.InitialBackofftime.DurationMaxBackofftime.DurationBackoffMultiplierfloat64// 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.RetryableStatusCodes map[codes.Code]bool}RetryPolicy defines the go-native version of the retry policy defined by theservice config here:https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config