Skip to main content

Module discovery

Module discovery 

Source
Expand description

Consumer-side discovery wiring for eventual readiness.

Bridges the service DirectoryClient into the contract layer’s EndpointResolver, and carries the ConsumerRegistrations emitted by #[toolkit::consumes] that the runtime’s proxy-wiring phase replays at startup.

Unconditional: consuming another gear over a discovered REST transport is the normal case, and #[toolkit::consumes] emits its registration unconditionally too. Putting this behind a feature only created a way to build a gear whose declared dependencies were silently never wired.

Structs§

ConsumerRegistration
A consumer→provider contract wiring, registered by #[toolkit::consumes] via inventory::submit! and replayed by the runtime’s proxy-wiring phase.
DirectoryEndpointResolver
Adapts the service DirectoryClient into the contract-layer EndpointResolver consumed by DirectoryResolvingClient.
NullEndpointResolver
An EndpointResolver that never resolves any gear (Ok(None) for every lookup). Used by the proxy-wiring phase when no DirectoryClient is present in the ClientHub: co-located (local) consumers still short-circuit and wire successfully, while remote consumers register as unresolved readiness gates (so /readyz correctly stays 503) rather than being silently skipped.
ResolveError
Re-export so the #[toolkit::consumes]-generated wire fn can name the resolver type as toolkit::discovery::EndpointResolver without the consuming gear crate needing a direct toolkit-contract dependency. 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.
StaticEndpointResolver
An EndpointResolver that always resolves to a single, fixed endpoint — the ADR-0004 static-endpoint override escape hatch for local development and integration testing. It bypasses the service directory: a consumer configured with gears.<owner>.config.consumer_wiring.<dep> = "http://host:port" wires a resolving client whose endpoint is this constant. Not for production use.

Enums§

WireOutcome
Outcome of a ConsumerRegistration::wire call: whether the dependency was satisfied by a co-located compile-time impl (no directory dependency) or by a directory-resolving REST client that still needs endpoint resolution.

Traits§

EndpointResolver
Re-export so the #[toolkit::consumes]-generated wire fn can name the resolver type as toolkit::discovery::EndpointResolver without the consuming gear crate needing a direct toolkit-contract dependency. Resolves a logical gear name to a live base endpoint URI.

Type Aliases§

WireFn
The wiring function pointer emitted by #[toolkit::consumes]. Registers the client into the ClientHub, given the endpoint resolver and the process’s platform-plane credential source (threaded onto a directory-resolving remote client). Aliased to keep the fn-pointer type readable.