Documentation
¶
Overview ¶
Package doctor implements the "bubblefish doctor" health check subsystem. It tests whether the daemon, WAL, destinations, and disk are healthy without modifying any persistent state.
Reference: Tech Spec Section 13.1, Phase 0D Behavioral Contract items 11–13.
Index ¶
Constants ¶
const DefaultMinDiskFreeBytes uint64 = 100 * 1024 * 1024
DefaultMinDiskFreeBytes is the minimum acceptable free disk space on the WAL partition. Matches the WAL watchdog default of 100 MiB.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DestinationResult ¶
type DestinationResult struct {
// Name is the destination's configured name.
Name string `json:"name"`
// Reachable is true if Ping() succeeded.
Reachable bool `json:"reachable"`
// Error is the Ping() error message, or "" on success.
Error string `json:"error,omitempty"`
}
DestinationResult is the health outcome for a single destination.
type Pinger ¶
Pinger is the subset of destination.DestinationWriter required for doctor checks. It matches the interface exactly so destinations can be passed directly without adaptation.
INVARIANT: Close() MUST be called after Ping() to prevent connection leaks. Reference: Phase 0D Behavioral Contract item 12 (CR-7).
type Result ¶
type Result struct {
// DaemonRunning is always true when Check is called from within the daemon.
DaemonRunning bool `json:"daemon_running"`
// WALWritable is true if a probe file could be written and deleted in walDir.
WALWritable bool `json:"wal_writable"`
// DiskFreeBytes is the available disk space on the WAL partition in bytes.
DiskFreeBytes uint64 `json:"disk_free_bytes"`
// DiskSpaceOK is true if DiskFreeBytes >= 100 MiB.
DiskSpaceOK bool `json:"disk_space_ok"`
// Destinations holds the reachability result for each destination.
Destinations []DestinationResult `json:"destinations"`
// AllHealthy is true when all individual checks pass.
AllHealthy bool `json:"all_healthy"`
}
Result is the aggregated doctor health check outcome.
func Check ¶
Check runs all doctor health checks and returns a Result. minDiskBytes is the minimum free disk threshold; pass 0 to use the default (100 MiB).
For each destination: Ping() is called, then Close() is called regardless of Ping outcome. This prevents connection leaks (CR-7).
Reference: Tech Spec Section 13.1, Phase 0D Behavioral Contract items 11–13.