Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDatabaseError ¶
func CheckDatabaseError(err error)
CheckDatabaseError inspects a GORM error for SQLite corruption or a closed database connection. Only call this in error branches — it's a no-op for nil or unrecognised errors.
func HeartbeatStatus ¶
HeartbeatStatus returns the response message for a plugin heartbeat. Returns "re-register" if the plugin needs to re-send its full registration (host/port was cleared), or "ok" for normal operation.
func InitDatabase ¶
func InitDatabase(ops DatabaseOps)
InitDatabase configures the database watchdog with the necessary operations.
Types ¶
type DatabaseOps ¶
type DatabaseOps struct {
GetDB func() *gorm.DB
Reinit func() error
RestoreFromBackup func() error
}
DatabaseOps provides the database operations needed by the corruption watchdog.
type PluginWatchdog ¶
type PluginWatchdog struct {
// contains filtered or unexported fields
}
PluginWatchdog periodically scans for plugins whose containers are running but have no host/port registration in the kernel. These plugins are alive but unreachable via the kernel proxy. Recovery happens via the heartbeat re-register signal: when a disconnected plugin sends its next heartbeat, the kernel responds with "re-register" instead of "ok", prompting the plugin SDK to re-send its full registration.
func NewPluginWatchdog ¶
func NewPluginWatchdog(rt runtime.ContainerRuntime, interval time.Duration, getDB func() *gorm.DB) *PluginWatchdog
NewPluginWatchdog creates a plugin watchdog with the given check interval.
func (*PluginWatchdog) Start ¶
func (pw *PluginWatchdog) Start(ctx context.Context)
Start runs the plugin watchdog loop until the context is cancelled.