Documentation
¶
Index ¶
- func NewManualResolver(schemeName string, serviceName string, endpointAddrs []string) error
- func NewManualResolverInstance(schemeName string, serviceName string, endpointAddrs []string) (r *manual.Resolver, normalizedScheme string, normalizedService string, ...)
- func UpdateManualResolver(schemeName string, serviceName string, endpointAddrs []string) error
- func UpdateManualResolverInstance(r *manual.Resolver, endpointAddrs []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewManualResolver ¶
FIX: NewManualResolver now performs an upsert instead of always creating a new resolver. On re-dial (e.g., after client.Close() + client.Dial()), the scheme+service pair already exists in the resolver map from the first dial. The original code rejected this with "Resolver already registered" — but this is a legitimate reconnect scenario.
Now: if a resolver already exists for the scheme+service, we update its state with the new addresses. If it doesn't exist, we create and register a new one.
func NewManualResolverInstance ¶ added in v1.8.15
func NewManualResolverInstance(schemeName string, serviceName string, endpointAddrs []string) (r *manual.Resolver, normalizedScheme string, normalizedService string, err error)
NewManualResolverInstance creates a NEW *manual.Resolver bound to a SINGLE caller (a single grpc.ClientConn), WITHOUT storing it in the process-global schemeMap. It is the per-connection counterpart of NewManualResolver: the caller keeps the returned resolver on its own struct and passes it into its own Dial via grpc.WithResolvers(...), then drives it with UpdateManualResolverInstance. This guarantees the grpc-go manual.Resolver contract ("every instance may only ever be used with a single grpc.ClientConn") structurally, so one caller's endpoint refresh can never overwrite another caller's connection (the shared-resolver orphaning bug). The existing global NewManualResolver/UpdateManualResolver are left intact for other callers.
Returns the resolver instance plus the normalized scheme and service (the caller builds its dial target as "<scheme>:///<service>"). Validation mirrors NewManualResolver exactly (same normalizers, same error shapes).
func UpdateManualResolver ¶ added in v1.0.8
func UpdateManualResolverInstance ¶ added in v1.8.15
UpdateManualResolverInstance pushes a fresh address set into a caller-owned *manual.Resolver (obtained from NewManualResolverInstance). It is the per-connection counterpart of UpdateManualResolver, but targets the passed instance directly instead of a global-map lookup, so the update always lands on the caller's OWN connection. Nil-guards match the global path's "resolver is nil" failure shape (no panic).
Types ¶
This section is empty.