Commit graph

4 commits

Author SHA1 Message Date
Nicolas De Loof
619ad27cd3 refactor(compose): use a single event processor that discards events
The quiet display, pkg/compose and three test files each defined an api.EventProcessor doing nothing. Provide it once as internal/progress.Noop.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-29 11:59:43 +01:00
Nicolas De Loof
019c47f109 refactor(compose): build progress events with internal/progress
pkg/compose carried its own copy of the event constructors that internal/progress already provides. Use the shared ones and move the generic waiting, healthy, exited and skipped events there too.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-29 11:59:43 +01:00
Nicolas De Loof
4f6ed1f893 refactor(provider): move the provider plugin execution to internal/provider
Running a provider plugin (finding its binary, executing it, serving the
JSON messages it sends, applying the variables and endpoints it publishes,
streaming it an image) needs from the engine the Docker API, the event bus,
the Docker CLI that locates the plugin, the preparation of the environment
of a shelled-out command, and the lock that guards the project model every
concurrent provider run mutates.

It now lives in internal/provider behind a Backend interface that
composeService implements in pkg/compose/plugins.go, next to runPlugin, which
stays as a one-line forwarder so none of its callers (up, down, stop, pull)
changes. The relay it deploys goes through internal/relay, whose Backend the
new one extends. The public types and constants of the protocol (JsonMessage,
ProviderMetadata, the *Type message constants...) stay exported from
pkg/compose as aliases of the new package's.

The tests of the plugin protocol move with the code, assertions unchanged;
those of the provider image phase and of the relay link network removal
stay in pkg/compose. The forwarders to the relay that only the plugin code
used are dropped.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 09:10:05 +02:00
Nicolas De Loof
89ff984452 refactor(relay): move the provider relay management to internal/relay
The relay container and the relay link networks that stand in for a
provider service need three things from the engine: the Docker API, the
event bus and whether Docker Desktop is the engine.

They now live in internal/relay behind a Backend interface that
composeService implements in pkg/compose/relay.go, which keeps the names
the lifecycle code calls (ensureServiceRelay, isRelayContainer,
checkRelayTarget...) as one-line forwarders, so none of its callers change.
The one down-specific piece, turning the relay link networks into down
operations gated on the shared limiter, stays in pkg/compose together with
its tests; the other relay tests move with the code, assertions unchanged.

The progress events and the container name the package needs come from two
small shared packages, internal/progress and internal/naming, which the
following moves reuse. pkg/compose keeps its own copies until the shared
kernel is extracted.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 09:10:05 +02:00