module

package
v1.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBuiltinTemplates

func InitBuiltinTemplates(store *storage.Store) error

InitBuiltinTemplates creates/updates built-in module templates Only includes templates with real, working Docker images

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles the lifecycle of modules

func NewManager

func NewManager(store *storage.Store, dockerCli *docker.Client, sender *command.Sender, cfg *config.Config, proxyManager *proxy.Manager, log *logger.Logger) *Manager

NewManager creates a new module manager

func NewManagerWithPool

func NewManagerWithPool(store *storage.Store, dockerCli *docker.Client, pool *docker.ClientPool, sender *command.Sender, cfg *config.Config, proxyManager *proxy.Manager, log *logger.Logger) *Manager

NewManagerWithPool creates a new module manager with a multi-node ClientPool. If pool is nil and dockerCli is non-nil, a single-node pool wrapping dockerCli is created.

func (*Manager) AllocateModulePort

func (m *Manager) AllocateModulePort(ctx context.Context) (int, error)

AllocateModulePort finds an available port for a module

func (*Manager) AllocateModulePortExcluding

func (m *Manager) AllocateModulePortExcluding(ctx context.Context, exclude map[int]bool) (int, error)

AllocateModulePortExcluding finds an available port, excluding any ports in the exclude map

func (*Manager) CreateAndStartModule

func (m *Manager) CreateAndStartModule(ctx context.Context, moduleID string, startImmediately bool) error

CreateAndStartModule creates a container and optionally starts the module

func (*Manager) DeleteModule

func (m *Manager) DeleteModule(ctx context.Context, moduleID string) error

DeleteModule stops and removes a module and its container

func (*Manager) ForgetModule added in v1.0.40

func (m *Manager) ForgetModule(ctx context.Context, moduleID string) error

ForgetModule drops the panel record and API token without stopping or removing the container. Parent keep_data uses this so sidecar volumes are not purged by RemoveContainer (which always sets RemoveVolumes).

func (*Manager) GetModuleStatus

func (m *Manager) GetModuleStatus(ctx context.Context, moduleID string) (storage.ModuleStatus, error)

GetModuleStatus returns current status from Docker

func (*Manager) GetUsedModulePorts

func (m *Manager) GetUsedModulePorts(ctx context.Context) ([]int, error)

GetUsedModulePorts returns all ports currently in use by modules

func (*Manager) HandleServerEvent

func (m *Manager) HandleServerEvent(ctx context.Context, event events.Event)

Module subsystem subscription to the central event bus

func (*Manager) IsRunning

func (m *Manager) IsRunning() bool

IsRunning returns whether the manager is running

func (*Manager) ReconcileModule added in v1.0.40

func (m *Manager) ReconcileModule(ctx context.Context, moduleID string) (ReconcileOutcome, error)

ReconcileModule converges one module record with the container the daemon reports. It adopts a drifted container id or status, records a container that disappeared as stopped, and recreates a missing container only when the module and its parent server are both meant to be running.

A node that cannot be reached leaves the record untouched: an unreachable daemon is not evidence that the container is gone. A missing container is restored without RemoveVolumes so sidecar data is not purged on reconnect.

func (*Manager) RecreateModule

func (m *Manager) RecreateModule(ctx context.Context, moduleID string) error

RecreateModule recreates a module container

func (*Manager) RestartModule

func (m *Manager) RestartModule(ctx context.Context, moduleID string) error

RestartModule restarts a module

func (*Manager) SetLogStreamer

func (m *Manager) SetLogStreamer(streamer *logger.LogStreamer)

SetLogStreamer sets the log streamer for module containers

func (*Manager) Start

func (m *Manager) Start() error

Start initializes the module manager

func (*Manager) StartModule

func (m *Manager) StartModule(ctx context.Context, moduleID string) error

StartModule starts an existing module container

func (*Manager) Stop

func (m *Manager) Stop() error

Stop gracefully stops all managed modules

func (*Manager) StopModule

func (m *Manager) StopModule(ctx context.Context, moduleID string) error

StopModule stops a running module

type ModuleObservation added in v1.0.40

type ModuleObservation struct {
	// Exists is false when no container could be resolved for the module.
	Exists bool
	// ContainerID is the daemon's id for the container, which may differ from
	// the recorded one after an external recreate.
	ContainerID string
	// Running is true when the container's state is running.
	Running bool
}

ModuleObservation is what the daemon reported about a module's container.

type ReconcileOutcome added in v1.0.40

type ReconcileOutcome string

ReconcileOutcome says what a module convergence pass did. It is returned rather than only logged so the reconciler and its tests can assert on it.

const (
	// ReconcileInSync means the recorded module state already matched the
	// container.
	ReconcileInSync ReconcileOutcome = "in_sync"
	// ReconcileAdopted means the container id or the status was corrected from
	// what the daemon reported.
	ReconcileAdopted ReconcileOutcome = "adopted"
	// ReconcileRecreated means a missing container was recreated for a running
	// module whose parent server is running.
	ReconcileRecreated ReconcileOutcome = "recreated"
	// ReconcileStopped means the container is gone and the module is recorded
	// as stopped instead of claiming it runs.
	ReconcileStopped ReconcileOutcome = "stopped"
	// ReconcileSkipped means there was nothing safe to do: the module is gone,
	// its node cannot be reached, or its parent is not running.
	ReconcileSkipped ReconcileOutcome = "skipped"
	// ReconcileWaiting means convergence is blocked on a declared dependency,
	// a host port reservation, a parent server that is not yet running, or
	// another precondition that may clear later.
	ReconcileWaiting ReconcileOutcome = "waiting"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL