Skip to main content

Module resolving

Module resolving 

Source
Expand description

Directory-resolving REST transport.

DirectoryResolvingClient is a thin, self-healing wrapper around a generated <Trait>RestClient. Instead of binding to a single static base URL at construction time, it resolves the provider’s endpoint from the service directory on every call and rebuilds the underlying client only when the resolved endpoint changes.

This is what makes the consumer side tolerant of eventual readiness and runtime churn:

  • Not ready yet — the provider hasn’t registered → resolution yields None → calls fail with TransportError::Unresolved (a transient error that maps to service_unavailable), never a panic.
  • Provider moved / pod replaced — the directory returns a new endpoint → the wrapper rebuilds the client against it on the next call.
  • Provider vanished — all instances evicted → resolution yields None again → Unresolved; the wrapper recovers automatically once a live instance reappears.

The Arc<dyn Trait> registered in the ClientHub is the long-lived resolving wrapper, so the hub entry is wired once and never replaced; all churn handling lives inside this transport.

Structs§

DirectoryResolvingClient
Self-healing REST transport that resolves its endpoint from the directory.
ResolveError
Directory-lookup failure (the directory backend itself could not answer — e.g. the gRPC directory is unreachable), as opposed to a successful lookup that found no live instance (Ok(None)). Keeping the two distinct lets callers and observability tell a not-ready provider apart from a directory outage.

Traits§

EndpointResolver
Resolves a logical gear name to a live base endpoint URI.