Package-Level Type Names (total 13, none are exported)
/* sort exporteds by: | */
ClientStreamgrpc.ClientStream
CloseSend closes the send direction of the stream. It closes the stream
when non-nil error is met. It is also not safe to call CloseSend
concurrently with SendMsg.
Context returns the context for this stream.
It should not be called until after Header or RecvMsg has returned. Once
called, subsequent client-side retries are disabled.
Header returns the header metadata received from the server if there
is any. It blocks if the metadata is not ready to read.
(*T) Recv() (*lbpb.LoadBalanceResponse, error)
RecvMsg blocks until it receives a message into m or the stream is
done. It returns io.EOF when the stream completes successfully. On
any other error, the stream is aborted and the error contains the RPC
status.
It is safe to have a goroutine calling SendMsg and another goroutine
calling RecvMsg on the same stream at the same time, but it is not
safe to call RecvMsg on the same stream in different goroutines.
(*T) Send(m *lbpb.LoadBalanceRequest) error
SendMsg is generally called by generated code. On error, SendMsg aborts
the stream. If the error was generated by the client, the status is
returned directly; otherwise, io.EOF is returned and the status of
the stream may be discovered using RecvMsg.
SendMsg blocks until:
- There is sufficient flow control to schedule m with the transport, or
- The stream is done, or
- The stream breaks.
SendMsg does not wait until the message is received by the server. An
untimely stream closure may result in lost messages. To ensure delivery,
users should ensure the RPC completed successfully using RecvMsg.
It is safe to have a goroutine calling SendMsg and another goroutine
calling RecvMsg on the same stream at the same time, but it is not safe
to call SendMsg on the same stream in different goroutines. It is also
not safe to call CloseSend concurrently with SendMsg.
Trailer returns the trailer metadata from the server, if there is any.
It must only be called after stream.CloseAndRecv has returned, or
stream.Recv has returned a non-nil error (including io.EOF).
*T : google.golang.org/grpc/balancer/grpclb/grpc_lb_v1.LoadBalancer_BalanceLoadClient
T : google.golang.org/grpc.ClientStream
T : google.golang.org/grpc.Stream
Backend addresses. It's kept so the addresses are available when
switching between round_robin and pickfirst.
All backends addresses, with metadata set to nil. This list contains all
backend addresses in the same order and with the same duplicates as in
serverlist. When generating picker, a SubConn slice with the same order
but with only READY SCs will be gerenated.
backoff for calling remote balancer.
cc*lbCacheClientConn
The ClientConn to talk to the remote balancer.
Support client side load reporting. Each picker gets a reference to this,
and will update its content.
doneChchan struct{}fallbackTimeouttime.Duration
The full server list including drops, used to check if the newly received
serverList contains anything new. Each generate picker will also have
reference to this list to do the first layer pick.
grpclbBackendCreds is the creds bundle to be used for addresses that are
returned by grpclb server. If it's nil, don't set anything when creating
SubConns.
grpclbClientConnCreds is the creds bundle to be used to connect to grpclb
servers. If it's nil, use the TransportCredentials from BuildOptions
instead.
inFallbackbool
manualResolver is used in the remote LB ClientConn inside grpclb. When
resolved address updates are received by grpclb, filtered updates will be
send to remote LB ClientConn through this resolver.
// guards everything following.
optbalancer.BuildOptionspickerbalancer.Picker
Support fallback to resolved backend addresses if there's no response
from remote balancer within fallbackTimeout.
resolvedBackendAddrs is resolvedAddrs minus remote balancers. It's set
when resolved address updates are received, and read in the goroutine
handling fallback.
// Used to filter READY SubConns.
serverListReceivedbool
Roundrobin functionalities.
// Used to new/remove SubConn.
targetstringusePickFirstbool(*T) Close()(*T) ResolverError(error)(*T) UpdateClientConnState(ccs balancer.ClientConnState) error(*T) UpdateSubConnState(sc balancer.SubConn, scs balancer.SubConnState)
aggregateSubConnStats calculate the aggregated state of SubConns in
lb.SubConns. These SubConns are subconns in use (when switching between
fallback and grpclb). lb.scState contains states for all SubConns, including
those in cache (SubConns are cached for 10 seconds after remove).
The aggregated state is:
- If at least one SubConn in Ready, the aggregated state is Ready;
- Else if at least one SubConn in Connecting, the aggregated state is Connecting;
- Else the aggregated state is TransientFailure.
fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use
resolved backends (backends received from resolver, not from remote balancer)
if no connection to remote balancers was successful.
(*T) handleServiceConfig(gc *grpclbServiceConfig)(*T) newRemoteBalancerCCWrapper()
processServerList updates balancer's internal state, create/remove SubConns
and regenerates picker using the received serverList.
refreshSubConns creates/removes SubConns with backendAddrs, and refreshes
balancer state and picker.
Caller must hold lb.mu.
regeneratePicker takes a snapshot of the balancer, and generates a picker from
it. The picker
- always returns ErrTransientFailure if the balancer is in TransientFailure,
- does two layer roundrobin pick otherwise.
Caller must hold lb.mu.
updateStateAndPicker re-calculate the aggregated state, and regenerate picker
if overall state is changed.
If forceRegeneratePicker is true, picker will be regenerated.
*T : google.golang.org/grpc/balancer.Balancer
lbManualResolver is used by the ClientConn inside grpclb. It's a manual
resolver with a special ResolveNow() function.
When ResolveNow() is called, it calls ResolveNow() on the parent ClientConn,
so when grpclb client lose contact with remote balancers, the parent
ClientConn's resolver will re-resolve.
ccbbalancer.ClientConnccrresolver.ClientConnschemestring(*T) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error)
Close is a noop for Resolver.
ResolveNow calls resolveNow on the parent ClientConn.
(*T) Scheme() string
UpdateState calls cc.UpdateState.
*T : google.golang.org/grpc/resolver.Builder
*T : google.golang.org/grpc/resolver.Resolver
rrPicker does roundrobin on subConns. It's typically used when there's no
response from remote balancer, and grpclb falls back to the resolved
backends.
It guaranteed that len(subConns) > 0.
musync.Mutex
// The subConns that were READY when taking the snapshot.
subConnsNextint(*T) Pick(balancer.PickInfo) (balancer.PickResult, error)
*T : google.golang.org/grpc/balancer.Picker
func newRRPicker(readySCs []balancer.SubConn) *rrPicker
newLBBuilderWithFallbackTimeout creates a grpclb builder with the given
fallbackTimeout. If no response is received from the remote balancer within
fallbackTimeout, the backend addresses from the resolved address list will be
used.
Only call this function when a non-default fallback timeout is needed.
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.