Skip to main content

Module adapters

Module adapters 

Source
Expand description

The adapters port: the production pieces a use case builds for itself partway through.

§Why a port for construction

Most ports are handed to a use case whole: a ControlPlane gets its transport, clock and entropy when it’s built. Two pieces can’t be, because what they’re built for isn’t known until later. A sandbox learns its VM’s endpoint from the launch reply, and only then can it build the HTTP backend its session talks through, and ensure_image builds its STS and S3 client on first use, for the plane’s region. Building either inline would put reqwest and the credential chain inside the use case, so the use case asks an Adapters for them instead.

SystemAdapters (in microvms-edges) is the production implementation. A test passes one that hands out fakes, or that refuses, so a session a sandbox builds can’t dial a real endpoint by accident.

Traits§

Adapters
The production pieces a use case builds once it knows what they’re for.