Documentation
¶
Index ¶
- func InitBuiltinTemplates(store *storage.Store) error
- type Manager
- func (m *Manager) AllocateModulePort(ctx context.Context) (int, error)
- func (m *Manager) AllocateModulePortExcluding(ctx context.Context, exclude map[int]bool) (int, error)
- func (m *Manager) CreateAndStartModule(ctx context.Context, moduleID string, startImmediately bool) error
- func (m *Manager) DeleteModule(ctx context.Context, moduleID string) error
- func (m *Manager) ForgetModule(ctx context.Context, moduleID string) error
- func (m *Manager) GetModuleStatus(ctx context.Context, moduleID string) (storage.ModuleStatus, error)
- func (m *Manager) GetUsedModulePorts(ctx context.Context) ([]int, error)
- func (m *Manager) HandleServerEvent(ctx context.Context, event events.Event)
- func (m *Manager) IsRunning() bool
- func (m *Manager) ReconcileModule(ctx context.Context, moduleID string) (ReconcileOutcome, error)
- func (m *Manager) RecreateModule(ctx context.Context, moduleID string) error
- func (m *Manager) RestartModule(ctx context.Context, moduleID string) error
- func (m *Manager) SetLogStreamer(streamer *logger.LogStreamer)
- func (m *Manager) Start() error
- func (m *Manager) StartModule(ctx context.Context, moduleID string) error
- func (m *Manager) Stop() error
- func (m *Manager) StopModule(ctx context.Context, moduleID string) error
- type ModuleObservation
- type ReconcileOutcome
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitBuiltinTemplates ¶
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 ¶
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 ¶
DeleteModule stops and removes a module and its container
func (*Manager) ForgetModule ¶ added in v1.0.40
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 ¶
GetUsedModulePorts returns all ports currently in use by modules
func (*Manager) HandleServerEvent ¶
Module subsystem subscription to the central event bus
func (*Manager) ReconcileModule ¶ added in v1.0.40
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 ¶
RecreateModule recreates a module container
func (*Manager) RestartModule ¶
RestartModule restarts a module
func (*Manager) SetLogStreamer ¶
func (m *Manager) SetLogStreamer(streamer *logger.LogStreamer)
SetLogStreamer sets the log streamer for module containers
func (*Manager) StartModule ¶
StartModule starts an existing module container
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" )