watchdog

package
v0.0.0-...-9285160 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 10 Imported by: 0

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

func HeartbeatStatus(plugin *models.Plugin) string

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.

Jump to

Keyboard shortcuts

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