resolver

package
v1.8.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManualResolver

func NewManualResolver(schemeName string, serviceName string, endpointAddrs []string) error

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 UpdateManualResolver(schemeName string, serviceName string, endpointAddrs []string) error

func UpdateManualResolverInstance added in v1.8.15

func UpdateManualResolverInstance(r *manual.Resolver, endpointAddrs []string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL