Documentation
¶
Overview ¶
Package client resolves invocation targets through the service registry and runs invocations over the control channel. It is the shared machinery under the Admin API's Invoke and any other fleet-internal consumer of invocations (e.g. the stats prometheus collector).
Index ¶
Constants ¶
const PerNodeTimeout = 10 * time.Second
PerNodeTimeout bounds a single peer invocation so one slow or offline node never stalls a fleet-wide fan-out.
Variables ¶
This section is empty.
Functions ¶
func ControlClientAt ¶
func ControlClientAt(address string) (controlpb.ControlClient, error)
ControlClientAt returns a Control client for a peer control endpoint address, pooling the underlying connection.
func Route ¶
Route groups the endpoints into the calls an invocation makes, one call per group. A shared invocation needs one instance per service, so the instances of a service share a group. Any other invocation gets a group per instance. A node that does not advertise the invocation as shared gets its own group, as before shared invocations existed.
Types ¶
type Endpoint ¶
type Endpoint struct {
Node string
Addr string
Target string
Err string
Service string
Draining bool
}
Endpoint is one resolved invocation target: the node id to report, the control address to dial, and the target the control channel routes on. Err set means the target could not be resolved. Service, Draining and Shared come from the node's registry entry and route the shared invocations.
func EndpointFor ¶
EndpointFor builds the endpoint dialing a node's control channel, routing by its id.
func Pick ¶
Pick selects the endpoint of a group that gets the call: the first one that can take it now, with instances in rotation before draining ones. It moves on only before the call is sent, because a sent call can have run already. If no endpoint can take the call, the first one gets it and reports the failure.
func Resolve ¶
Resolve maps a selector to its control endpoints. An instance is one service process running on a specific node, identified by its node id "host:port/service"; the fleet is every instance of every service in the registry. A node id targets one instance, a service name every live one, a partial id ("host:port" or a bare host) every instance at that address or on that machine, and "*" every live instance in the fleet. It returns the resolved service name when the selector was one.
type NodeResult ¶
NodeResult is the outcome of one peer invocation.