v2.31.0-dev21 b59533b

container.go RawHistoryFolder

1// Package in defines input ports (interfaces) for use cases.
2// These interfaces define the contract between driving adapters (HTTP, CLI)
3// and the business logic (use cases).
4package in
5
6import (
7	"context"
8
9	"github.com/bnema/gordon/internal/domain"
10)
11
12// ContainerService defines the contract for container management operations.
13type ContainerService interface {
14	// Deploy creates and starts a container for the given route.
15	Deploy(ctx context.Context, route domain.Route) (*domain.Container, error)
16
17	// Stop stops a running container.
18	Stop(ctx context.Context, containerID string) error
19
20	// Remove removes a container, optionally forcing removal.
21	Remove(ctx context.Context, containerID string, force bool) error
22
23	// ReconcileRemovedRoute removes active route runtime containers after the
24	// route has been removed from configuration, preserving stateful resources.
25	ReconcileRemovedRoute(ctx context.Context, domain string) (*domain.CleanupReport, error)
26
27	// Get retrieves a container by domain name.
28	Get(ctx context.Context, domain string) (*domain.Container, bool)
29
30	// Restart restarts a running container for the given domain.
31	// If withAttachments is true, also restarts attachment containers.
32	Restart(ctx context.Context, domain string, withAttachments bool) error
33
34	// List returns all managed containers.
35	List(ctx context.Context) map[string]*domain.Container
36
37	// ListRoutesWithDetails returns routes with network and attachment info.
38	ListRoutesWithDetails(ctx context.Context) []domain.RouteInfo
39
40	// ListAttachments returns attachments for a domain.
41	ListAttachments(ctx context.Context, domain string) []domain.Attachment
42
43	// ListOrphanedAttachments returns running attachment containers no longer configured.
44	ListOrphanedAttachments(ctx context.Context) ([]domain.CleanupAttachment, error)
45
46	// CleanupOrphanedAttachments optionally stops/removes orphaned attachment containers.
47	// When owner is non-empty, cleanup is scoped to that attachment owner.
48	CleanupOrphanedAttachments(ctx context.Context, owner string, stop bool) (*domain.CleanupReport, error)
49
50	// ListNetworks returns Gordon-managed networks.
51	ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error)
52
53	// HealthCheck performs health checks on all containers.
54	HealthCheck(ctx context.Context) map[string]bool
55
56	// SyncContainers synchronizes containers with configured routes.
57	SyncContainers(ctx context.Context) error
58
59	// UpdateAttachments updates the attachment configuration in the container service.
60	// This is called after a config reload to propagate attachment changes without restart.
61	UpdateAttachments(attachments map[string][]string)
62
63	// AutoStart starts containers for the provided routes that aren't running.
64	AutoStart(ctx context.Context, routes []domain.Route) error
65
66	// Shutdown gracefully shuts down all managed containers.
67	Shutdown(ctx context.Context) error
68}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close